How to upload a file downloadable on wix - remarkable
npm
About
Client library for File Sharing Server based on .
Usage
Errors
Server errors are mapped to error object:
can be one of , , . holds explanation of the error that was sent by server.
Enums
For Enum fields you can import Enum constants or use strings that match constant name.
Constants:
Strings:
Longs
Big integers are represented as https://github.com/dcodeIO/long.js longs. Example is file size in bytes.
Root Folder Id
Root folder is a special folder. It is not physicaly stored anywhere. Root folder's parent is root folder itself. Each instance of file sharing can have different root folder id. Root folder id is provided in response.
App Settings
App settings entity contains all settings for site's or group's File Sharing TPA.
Updates existing or default app settings. Only keys present in json are updated ().
Get default or existing settings:
Library Items
Main domain entity is Library Item. Library Item can be either Folder or File.
Library Item Entity
Folder creation
Creates new folder if it doesn't exist with same name.
Query library items
When no filters specified all files sorted by its ID is returned until the limit is reached.
Query folder library items
Get library items for given folders. Defaults to root folder when filter is unspecified.
Response is identical to .
Get Library items by id
If it is not found it is ommited from response.
Get Folder Tree
is optional. When given only tree from given folder will be returned.
Upload file
File upload consits of 3 phases:
- start upload by getting upload url
- upload to upload url
- callback with upload response
You can initiate multiple file uploads with single request:
You should not care what is in . Just map it to when performing upload.
Example of upload from browser:
Complete upload by providing :
Complete upload responds with newly created library items. You can complete upload of multiple files with single request.
Downloading
Same endpoint can be used to download:
- single file: by probiding single id
- multiple files: by providing multiple file ids
- folder: by providing folder id
When is invoked with single file id it would return url that would download that file. Browser will start file download because url respons with header .
View file
Returns url that responds with a file and
View folder
View folder increments folder view counts
Favorite file or folder
Marks file or folder as favorite
Rename file or folder
is optinal. Specifying zero UUID or undefined yields same behavior.
Move file or folder
To move file or folder just specify its id and new parent. When is null Root is assumed.
Delete file or folder
Deletes file or folder
Identity Profile
is an object that contains member information
Share file or folder
Currently share is implemented as url shortener without any file/folder context. It is responsible to prepend correct site domain to given path
Roles and Permissions
Authorized actions
Provides actions that are available to user per item. Some actions like means that this action is available in the context of provided libraryItemId.
Currently supported rejection reasons
Assign permissions
Remove permissions
List roles with permission
When array is empty then role has no file sharing permission assigned.
To fetch roles that have specific permission assigned use filter.
To fetch all roles omit filter (null or empty array).
List roles for current user
Lists current roles assigned to requesting user
Role Entity
Report item
Requires of reporting application. Response contains flag, indicating if user request was throttled
Don't forget to check if action is available in api.
-