Skip to content

Commit

Permalink
initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
pan261 committed Dec 18, 2021
1 parent 2828da6 commit ec2efda
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions src/uploader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const axios = require('axios');

const upload = (projectID: string, folderID: string, fileName: string, credentials: any) => {
axios({
method: 'POST',
url: `https://developer.api.autodesk.com/data/v1/projects/${projectID}/storage`,
headers: {
'Content-Type': "application/vnd.api+json",
'Accept': "application/vnd.api+json",
Authorization: `Bearer ${credentials.access_token}`
},
data: {
"jsonapi": { "version": "1.0" },
"data": {
"type": "objects",
"attributes": {
"name": fileName
},
"relationships": {
"target": {
"data": { "type": "folders", "id": folderID }
}
}
}
}
}).then((res: any) => {
console.log(res);
})
}

export {}
2 changes: 1 addition & 1 deletion src/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const axios = require('axios');
*
* Watches given folder id in the project, logs any files changed since
* `interval` ms ago
* @param {string} projectId the project id
* @param {string} projectID the project id
* @param {string} folderId the folder id
* @param {Object} credentials credentials for the call
* @param {Integer} interval number of ms used to filter the date
Expand Down

0 comments on commit ec2efda

Please sign in to comment.