presentator-client
v2.7.1
Published
Presentator v2 API JavaScript Client
Downloads
3
Maintainers
Readme
Presentator v2 REST API JS client
Simple and compact (~7kb gzip) JavaScript client (browser and node.js) for the Presentator v2 REST API (based on axios HTTP client).
This repository is READ-ONLY. Report issues and send pull requests in the main Presentator repository.
Installing
Using npm
npm install presentator-client --save
ES6-style import:
import PresentatorClient from 'presentator-client'
Manual
<script src="/path/to/dist/client.min.js"></script>
Example
var client = new PresentatorClient('my_api_url');
client.Users.login('[email protected]', 'my-password').then(function (data) {
// success...
// see axios response schema - https://github.com/axios/axios#response-schema
}).catch(function (e) {
// error...
});
Usage
Creating new client instance
var client = new PresentatorClient(baseUrl = '', token = '', axiosConfig = {});
Instance methods
Each instance method returns the
PresentatorClient
instance to allow chaining.
| Method | Description |
|:-----------------------------------------------|:--------------------------------------------------------|
| client.setBaseUrl(url)
| Sets the http client base url address. |
| client.setToken(token = '')
| Sets or removes Authorization
request header. |
| client.setLanguage(lang = 'en-US')
| Sets or removes Accept-Language
request header. |
| client.enableAutoCancellation(enable = true)
| Enables or disables cancellation of duplicated requests |
| client.cancelRequest(cancelKey)
| Cancels single request by its cancellation token. |
API resources/services
Each resource call returns a
Promise
object. More detailed API docs related to the resources could be found here.
| Resource | Description |
|:--------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------|
| Previews | |
| client.Previews.authorize(slug, password = '', bodyParams = {}, queryParams = {})
| Generates a project preview token and authorizes access to a project link. |
| client.Previews.getOne(previewToken, queryParams = {})
| Returns summary of a project preview |
| client.Previews.getPrototype(previewToken, id, queryParams = {})
| Returns preview details for the specified project link prototype. |
| client.Previews.getAssets(previewToken, queryParams = {})
| Returns list with all project guideline sections and assets. |
| client.Previews.getScreenCommentsList(previewToken, page = 1, perPage = 20, queryParams = {})
| Returns list with all project preview screen comments. |
| client.Previews.createScreenComment(previewToken, bodyParams = {}, queryParams = {})
| Creates a new screen comment for a preview screen. |
| client.Previews.updateScreenComment(previewToken, id, bodyParams = {}, queryParams = {})
| Updates the status of a primary screen comment within the preview screens. |
| client.Previews.report(previewToken, details = '', bodyParams = {}, queryParams = {})
| Reports a project link for spam, malware or other abusive content. |
| Users | |
| client.Users.getAuthMethods(queryParams = {})
| Returns array list with all configured application auth methods and clients. |
| client.Users.getAuthClients(queryParams = {})
| (DEPRECATED) Returns array list with all configured application auth clients. |
| client.Users.authorizeAuthClient(client, code, bodyParams = {}, queryParams = {})
| Authorizes a user via auth client and generates new user authorization token. |
| client.Users.register(bodyParams = {}, queryParams = {})
| Registers a new user (aka. creates an inactive regular user). |
| client.Users.activate(activationToken, bodyParams = {}, queryParams = {})
| Activates an inactive User model associated with the provided activation token. |
| client.Users.login(email, password, bodyParams = {}, queryParams = {})
| Performs active User model authorization. |
| client.Users.requestPasswordReset(email, bodyParams = {}, queryParams = {})
| Sends a forgotten password email. |
| client.Users.confirmPasswordReset(passwordResetToken, password, passwordConfirm, bodyParams = {}, queryParams = {})
| Resets the password for a single user by a password reset token. |
| client.Users.refresh(bodyParams = {}, queryParams = {})
| Refreshes user authorization token. |
| client.Users.requestEmailChange(email, bodyParams = {}, queryParams = {})
| Sends a request to change the authorized user's email address. |
| client.Users.confirmEmailChange(emailChangeToken, bodyParams = {}, queryParams = {})
| Confirms authorized user's email address change. |
| client.Users.sendFeedback(message, bodyParams = {}, queryParams = {})
| Sends user's feedback for Presentator to support. |
| client.Users.getList(page = 1, perPage = 20, queryParams = {})
| Returns paginated users list (super users only). |
| client.Users.getOne(id, queryParams = {})
| Views single user. |
| client.Users.create(bodyParams = {}, queryParams = {})
| Creates a new user (super users only). |
| client.Users.update(id, bodyParams = {}, queryParams = {})
| Updates an existing user. |
| client.Users.delete(id, bodyParams = {}, queryParams = {})
| Deletes an existing user. |
| Projects | |
| client.Projects.getList(page = 1, perPage = 20, queryParams = {})
| Returns paginated projects list. |
| client.Projects.getOne(id, queryParams = {})
| Views single project. |
| client.Projects.create(bodyParams = {}, queryParams = {})
| Creates a new project and automatically assign the current authorized user as an administrator. |
| client.Projects.update(id, bodyParams = {}, queryParams = {})
| Updates an existing project. |
| client.Projects.delete(id, bodyParams = {}, queryParams = {})
| Deletes an existing project. |
| client.Projects.getCollaboratorsList(id, queryParams = {})
| Returns list with all project's collaborators (including guests). |
| client.Projects.searchUsers(id, searchTerm, queryParams = {})
| Searches for new project admins (project linked users). |
| client.Projects.getUsersList(id, queryParams = {})
| Returns list with all linked project users. |
| client.Projects.linkUser(id, userId, bodyParams = {}, queryParams = {})
| Links an active user to a project (aka. adding new project admin). |
| client.Projects.unlinkUser(id, userId, bodyParams = {}, queryParams = {})
| Unlinks an active user from a project (aka. removing existing project admin). |
| ProjectLinks | |
| client.ProjectLinks.getList(page = 1, perPage = 20, queryParams = {})
| Returns paginated project links list. |
| client.ProjectLinks.getOne(id, queryParams = {})
| Views single project link. |
| client.ProjectLinks.create(bodyParams = {}, queryParams = {})
| Creates a new project link. |
| client.ProjectLinks.update(id, bodyParams = {}, queryParams = {})
| Updates an existing project link. |
| client.ProjectLinks.delete(id, bodyParams = {}, queryParams = {})
| Deletes an existing project link. |
| client.ProjectLinks.share(id, bodyParams = {}, queryParams = {})
| Shares a project link with other users (including guests) by sending an email to them. |
| client.ProjectLinks.getAccessed(page = 1, perPage = 20, queryParams = {})
| Returns paginated list with accessed project links by the authorized user. |
| GuidelineSections | |
| client.GuidelineSections.getList(page = 1, perPage = 20, queryParams = {})
| Returns paginated guideline sections list. |
| client.GuidelineSections.getOne(id, queryParams = {})
| Views single guideline section. |
| client.GuidelineSections.create(bodyParams = {}, queryParams = {})
| Creates a new guideline section. |
| client.GuidelineSections.update(id, bodyParams = {}, queryParams = {})
| Updates an existing guideline section. |
| client.GuidelineSections.delete(id, bodyParams = {}, queryParams = {})
| Deletes an existing guideline section. |
| GuidelineAssets | |
| client.GuidelineAssets.getList(page = 1, perPage = 20, queryParams = {})
| Returns paginated guideline assets list. |
| client.GuidelineAssets.getOne(id, queryParams = {})
| Views single guideline asset. |
| client.GuidelineAssets.create(bodyParams = {}, queryParams = {})
| Creates a new guideline asset. |
| client.GuidelineAssets.update(id, bodyParams = {}, queryParams = {})
| Updates an existing guideline asset. |
| client.GuidelineAssets.delete(id, bodyParams = {}, queryParams = {})
| Deletes an existing guideline asset. |
| Prototypes | |
| client.Prototypes.getList(page = 1, perPage = 20, queryParams = {})
| Returns paginated prototypes list. |
| client.Prototypes.getOne(id, queryParams = {})
| Views single prototype. |
| client.Prototypes.create(bodyParams = {}, queryParams = {})
| Creates a new prototype. |
| client.Prototypes.update(id, bodyParams = {}, queryParams = {})
| Updates an existing prototype. |
| client.Prototypes.duplicate(id, bodyParams = {}, queryParams = {})
| Duplicates an existing prototype with its screens, hotspot templates and hotspots. |
| client.Prototypes.delete(id, bodyParams = {}, queryParams = {})
| Deletes an existing prototype. |
| Screens | |
| client.Screens.getList(page = 1, perPage = 20, queryParams = {})
| Returns paginated screens list. |
| client.Screens.getOne(id, queryParams = {})
| Views single screen. |
| client.Screens.create(bodyParams = {}, queryParams = {})
| Creates a new screen. |
| client.Screens.update(id, bodyParams = {}, queryParams = {})
| Updates an existing screen. |
| client.Screens.bulkUpdate(bodyParams = {}, queryParams = {})
| Bulk updates all screens within a single prototype. |
| client.Screens.delete(id, bodyParams = {}, queryParams = {})
| Deletes an existing screen. |
| Hotspots | |
| client.Hotspots.getList(page = 1, perPage = 20, queryParams = {})
| Returns paginated hotspots list. |
| client.Hotspots.getOne(id, queryParams = {})
| Views single hotspot. |
| client.Hotspots.create(bodyParams = {}, queryParams = {})
| Creates a new hotspot. |
| client.Hotspots.update(id, bodyParams = {}, queryParams = {})
| Updates an existing hotspot. |
| client.Hotspots.delete(id, bodyParams = {}, queryParams = {})
| Deletes an existing hotspot. |
| HotspotTemplates | |
| client.HotspotTemplates.getList(page = 1, perPage = 20, queryParams = {})
| Returns paginated hotspot templates list. |
| client.HotspotTemplates.getOne(id, queryParams = {})
| Views single hotspot template. |
| client.HotspotTemplates.create(bodyParams = {}, queryParams = {})
| Creates a new hotspot template. |
| client.HotspotTemplates.update(id, bodyParams = {}, queryParams = {})
| Updates an existing hotspot template. |
| client.HotspotTemplates.delete(id, bodyParams = {}, queryParams = {})
| Deletes an existing hotspot template. |
| client.HotspotTemplates.getScreensList(id, queryParams = {})
| Returns list with all linked hotspot screen models. |
| client.HotspotTemplates.linkScreen(id, screenId, bodyParams = {}, queryParams = {})
| Links a single screen to a hotspot template. |
| client.HotspotTemplates.unlinkScreen(id, screenId, bodyParams = {}, queryParams = {})
| Unlinks a single screen from a hotspot template. |
| ScreenComments | |
| client.ScreenComments.getList(page = 1, perPage = 20, queryParams = {})
| Returns paginated screen comments list. |
| client.ScreenComments.getOne(id, queryParams = {})
| Views single screen comment. |
| client.ScreenComments.create(bodyParams = {}, queryParams = {})
| Creates a new screen comment. |
| client.ScreenComments.update(id, bodyParams = {}, queryParams = {})
| Updates an existing screen comment. |
| client.ScreenComments.delete(id, bodyParams = {}, queryParams = {})
| Deletes an existing screen comment. |
| client.ScreenComments.getUnread(queryParams = {})
| Returns all unread screen comments for the authorized user (with eager loader metaData). |
| client.ScreenComments.read(id, bodyParams = {}, queryParams = {})
| Marks a single screen comment as read for the authorized user. |
Development
# build and minify for production
npm run build
# run unit tests
npm test