Created
November 27, 2016 14:58
-
-
Save leefsmp/fb843b4868d34e3d72ab71c9cd2a8d48 to your computer and use it in GitHub Desktop.
Forge DataManagement API: creating version attachment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////////////////////////////// | |
// Get Version relationship references | |
// | |
///////////////////////////////////////////////////////////////// | |
getVersionRelationshipsRefs ( | |
token, projectId, versionId, opts = {}) { | |
this._APIAuth.accessToken = token | |
return this._versionsAPI.getVersionRelationshipsRefs( | |
projectId, versionId, opts) | |
} | |
///////////////////////////////////////////////////////////////// | |
// Create Version relationship reference | |
// | |
///////////////////////////////////////////////////////////////// | |
createVersionRelationshipRef ( | |
token, projectId, targetVersionId, refVersionId) { | |
this._APIAuth.accessToken = token | |
const payload = this.createVersionRelationshipRefPayload( | |
refVersionId) | |
return this._versionsAPI.postVersionRelationshipsRef( | |
projectId, targetVersionId, JSON.stringify(payload)) | |
} | |
///////////////////////////////////////////////////////////////// | |
// Creates version relationship payload | |
// | |
///////////////////////////////////////////////////////////////// | |
createVersionRelationshipRefPayload (refVersionId) { | |
return { | |
jsonapi: { | |
version: '1.0' | |
}, | |
data: { | |
type: 'versions', | |
id: refVersionId, | |
meta: { | |
extension: { | |
type: 'auxiliary:autodesk.core:Attachment', | |
version: '1.0' | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment