Skip to content
This repository was archived by the owner on Jan 28, 2024. It is now read-only.
presentatorPublic archive

About

Presentator v2 REST API JS client

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

27 Commits

Folders and files

Repository files navigation

Presentator v2 REST API JS client

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.

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('test@example.com', '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

About

Presentator v2 REST API JS client

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages