diff --git a/src/uploader.ts b/src/uploader.ts new file mode 100644 index 0000000..a587038 --- /dev/null +++ b/src/uploader.ts @@ -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 {} \ No newline at end of file diff --git a/src/watcher.ts b/src/watcher.ts index 4824607..24f37c5 100644 --- a/src/watcher.ts +++ b/src/watcher.ts @@ -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