Important
This repo is for the older Presentator v2 and it is no longer maintained.
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.
npm install presentator-client --save
ES6-style import:
import PresentatorClient from 'presentator-client'
<script src="/path/to/dist/client.min.js"></script>
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...
});
var client = new PresentatorClient(baseUrl = '', token = '', axiosConfig = {});
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. |
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. |
# build and minify for production
npm run build
# run unit tests
npm test