@ndustrial/contxt-sdk
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -0,1 +1,7 @@ | ||
## [v1.2.2](http://github.com/ndustrialio/contxt-sdk-js/tree/v1.2.2) (2019-06-03) | ||
**Fixed** | ||
- v1.2.1 was published without the changes introduced in 1.1.0. Republishing to re-add this code. | ||
## [v1.2.1](http://github.com/ndustrialio/contxt-sdk-js/tree/v1.2.1) (2019-05-30) | ||
@@ -2,0 +8,0 @@ |
@@ -17,2 +17,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
/** | ||
* @alias BrowserBus | ||
* | ||
* @param {Object} sdk An instance of the SDK so the module can communicate with other modules | ||
@@ -19,0 +21,0 @@ * @param {Object} request An instance of the request module tied to this module's audience. |
@@ -11,3 +11,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
*/ | ||
var WebSocketConnection = function WebSocketConnection(webSocket, organizationId) { | ||
var WebSocketConnection = | ||
/** | ||
* @alias BrowserWebSocketConnection | ||
*/ | ||
function WebSocketConnection(webSocket, organizationId) { | ||
_classCallCheck(this, WebSocketConnection); | ||
@@ -14,0 +18,0 @@ |
@@ -27,7 +27,7 @@ export default { | ||
clientId: '8qY2xJob1JAxhmVhIDLCNnGriTM9bct8', | ||
host: 'http://localhost:3000' | ||
host: 'https://contxt.api.ndustrial.io' | ||
}, | ||
staging: { | ||
clientId: '8qY2xJob1JAxhmVhIDLCNnGriTM9bct8', | ||
host: 'http://localhost:3000' | ||
host: 'https://contxt-staging.api.ndustrial.io' | ||
} | ||
@@ -34,0 +34,0 @@ }, |
@@ -23,2 +23,26 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
/** | ||
* @typedef {Object} ContxtApplicationGrouping | ||
* @property {number} applicationId | ||
* @property {ContxtApplicationModule[]} applicationModules | ||
* @property {string} id | ||
* @property {number} index The position of the grouping within the list of all | ||
* groupings of a the parent application | ||
* @property {string} label | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtApplicationModule | ||
* @property {string} applicationGroupingId | ||
* @property {string} [externalLink] A URI pointing to an external application | ||
* @property {string} [iconUrl] A URI pointing to an icon/image representing the | ||
* application module | ||
* @property {string} id | ||
* @property {number} index The position of the module within the list of all | ||
* modules of a the parent application grouping | ||
* @property {string} label | ||
* @property {string} slug String that corresponds with a front-end package | ||
* name (e.g. the `@ndustrial/nsight-example` example application) | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtOrganizationFeaturedApplication | ||
@@ -183,2 +207,30 @@ * @property {number} applicationId | ||
/** | ||
* Gets the application groupings (and application modules) of an application | ||
* that are available to the currently authenticated user. | ||
* | ||
* API Endpoint: '/applications/:applicationId/groupings' | ||
* Method: GET | ||
* | ||
* @param {number} applicationId | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtApplicationGrouping[]} | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.applications | ||
* .getGroupings(31) | ||
* .then((applicationGroupings) => console.log(applicationGroupings)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'getGroupings', | ||
value: function getGroupings(applicationId) { | ||
return this._request.get(this._baseUrl + '/applications/' + applicationId + '/groupings').then(function (groupings) { | ||
return toCamelCase(groupings); | ||
}); | ||
} | ||
/** | ||
* Removes an application from the current user's list of favorited applications | ||
@@ -185,0 +237,0 @@ * |
@@ -51,3 +51,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
* contxtSdk.coordinator.permissions | ||
* .getByOrganizationId('36b8421a-cc4a-4204-b839-1397374fb16b') | ||
* .getAllByOrganizationId('36b8421a-cc4a-4204-b839-1397374fb16b') | ||
* .then((usersPermissions) => console.log(usersPermissions)) | ||
@@ -59,4 +59,4 @@ * .catch((err) => console.log(err)); | ||
_createClass(Permissions, [{ | ||
key: 'getByOrganizationId', | ||
value: function getByOrganizationId(organizationId) { | ||
key: 'getAllByOrganizationId', | ||
value: function getAllByOrganizationId(organizationId) { | ||
if (!organizationId) { | ||
@@ -72,2 +72,38 @@ return Promise.reject(new Error('An organization ID is required for getting users permissions for an organization')); | ||
/** | ||
* Gets a single user's permissions within an organization | ||
* | ||
* API Endpoint: '/organizations/:organizationId/users/:userId/permissions' | ||
* Method: GET | ||
* | ||
* @param {string} organizationId The ID of the organization | ||
* @param {string} userId The ID of the user | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtUserPermissions} A single user's permissions | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.permissions | ||
* .getOneByOrganizationId('36b8421a-cc4a-4204-b839-1397374fb16b', 'auth0|12345') | ||
* .then((usersPermissions) => console.log(usersPermissions)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'getOneByOrganizationId', | ||
value: function getOneByOrganizationId(organizationId, userId) { | ||
if (!organizationId) { | ||
return Promise.reject(new Error("An organization ID is required for getting a user's permissions for an organization")); | ||
} | ||
if (!userId) { | ||
return Promise.reject(new Error("A user ID is required for getting a user's permissions for an organization")); | ||
} | ||
return this._request.get(this._baseUrl + '/organizations/' + organizationId + '/users/' + userId + '/permissions').then(function (userPermissions) { | ||
return toCamelCase(userPermissions); | ||
}); | ||
} | ||
/** | ||
* Gets a map of permission scopes to which the user has access | ||
@@ -74,0 +110,0 @@ * |
@@ -21,2 +21,11 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
/** | ||
* @typedef {Object} ContxtUserApplication | ||
* @property {string} applicationId | ||
* @property {string} createdAt ISO 8601 Extended Format date/time string | ||
* @property {string} id | ||
* @property {string} userId | ||
* @property {string} updatedAt ISO 8601 Extended Format date/time string | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtUserRole | ||
@@ -32,2 +41,12 @@ * @property {string} createdAt ISO 8601 Extended Format date/time string | ||
/** | ||
* @typedef {Object} ContxtUserStack | ||
* @property {string} accessType Access Type of the user for this stack with options "reader", "collaborator", "owner" | ||
* @property {string} createdAt ISO 8601 Extended Format date/time string | ||
* @property {string} id | ||
* @property {string} userId | ||
* @property {string} stackId | ||
* @property {string} updatedAt ISO 8601 Extended Format date/time string | ||
*/ | ||
/** | ||
* Module that provides access to contxt users | ||
@@ -105,6 +124,42 @@ * | ||
/** | ||
* Adds a application to a user | ||
* | ||
* API Endpoint: '/users/:userId/applications/:applicationId' | ||
* Method: GET | ||
* | ||
* @param {string} userId The ID of the user | ||
* @param {string} applicationId The ID of the application | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtUserApplication} The newly created user application | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.users | ||
* .addApplication('36b8421a-cc4a-4204-b839-1397374fb16b', '007ca9ee-ece7-4931-9d11-9b4fd97d4d58') | ||
* .then((userApplication) => console.log(userApplication)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'addApplication', | ||
value: function addApplication(userId, applicationId) { | ||
if (!userId) { | ||
return Promise.reject(new Error('A user ID is required for adding a application to a user')); | ||
} | ||
if (!applicationId) { | ||
return Promise.reject(new Error('An application ID is required for adding a application to a user')); | ||
} | ||
return this._request.post(this._baseUrl + '/users/' + userId + '/applications/' + applicationId).then(function (response) { | ||
return toCamelCase(response); | ||
}); | ||
} | ||
/** | ||
* Adds a role to a user | ||
* | ||
* API Endpoint: '/users/:userId/roles/:roleId' | ||
* Method: GET | ||
* Method: POST | ||
* | ||
@@ -142,2 +197,45 @@ * @param {string} userId The ID of the user | ||
/** | ||
* Adds a stack to a user | ||
* | ||
* API Endpoint: '/users/:userId/stacks/:stackId' | ||
* Method: POST | ||
* | ||
* @param {string} userId The ID of the user | ||
* @param {string} stackId The ID of the stack | ||
* @param {'reader' | 'collaborator' | 'owner'} accessType The level of access for the user | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtUserStack} The newly created user stack | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.users | ||
* .addStack('36b8421a-cc4a-4204-b839-1397374fb16b', '007ca9ee-ece7-4931-9d11-9b4fd97d4d58', 'collaborator') | ||
* .then((userStack) => console.log(userStack)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'addStack', | ||
value: function addStack(userId, stackId, accessType) { | ||
if (!userId) { | ||
return Promise.reject(new Error('A user ID is required for adding a stack to a user')); | ||
} | ||
if (!stackId) { | ||
return Promise.reject(new Error('A stack ID is required for adding a stack to a user')); | ||
} | ||
if (['reader', 'collaborator', 'owner'].indexOf(accessType) === -1) { | ||
return Promise.reject(new Error('An access type of "reader", "collaborator", or "owner" is required for adding a stack to a user')); | ||
} | ||
return this._request.post(this._baseUrl + '/users/' + userId + '/stacks/' + stackId, { | ||
access_type: accessType | ||
}).then(function (response) { | ||
return toCamelCase(response); | ||
}); | ||
} | ||
/** | ||
* Gets information about a contxt user | ||
@@ -297,2 +395,35 @@ * | ||
/** | ||
* Removes a application from a user | ||
* | ||
* API Endpoint: '/users/:userId/applications/:applicationId' | ||
* Method: DELETE | ||
* | ||
* @param {string} userId The ID of the user | ||
* @param {string} applicationId The ID of the application | ||
* | ||
* @returns {Promise} | ||
* @fulfill {undefined} | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.users | ||
* .removeApplication('36b8421a-cc4a-4204-b839-1397374fb16b', '007ca9ee-ece7-4931-9d11-9b4fd97d4d58') | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'removeApplication', | ||
value: function removeApplication(userId, applicationId) { | ||
if (!userId) { | ||
return Promise.reject(new Error('A user ID is required for removing a application from a user')); | ||
} | ||
if (!applicationId) { | ||
return Promise.reject(new Error('An application ID is required for removing a application from a user')); | ||
} | ||
return this._request.delete(this._baseUrl + '/users/' + userId + '/applications/' + applicationId); | ||
} | ||
/** | ||
* Removes a role from a user | ||
@@ -329,2 +460,35 @@ * | ||
} | ||
/** | ||
* Removes a stack from a user | ||
* | ||
* API Endpoint: '/users/:userId/stacks/:stackId' | ||
* Method: DELETE | ||
* | ||
* @param {string} userId The ID of the user | ||
* @param {string} stackId The ID of the stack | ||
* | ||
* @returns {Promise} | ||
* @fulfill {undefined} | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.users | ||
* .removeStack('36b8421a-cc4a-4204-b839-1397374fb16b', '007ca9ee-ece7-4931-9d11-9b4fd97d4d58') | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'removeStack', | ||
value: function removeStack(userId, stackId) { | ||
if (!userId) { | ||
return Promise.reject(new Error('A user ID is required for removing a stack from a user')); | ||
} | ||
if (!stackId) { | ||
return Promise.reject(new Error('A stack ID is required for removing a stack from a user')); | ||
} | ||
return this._request.delete(this._baseUrl + '/users/' + userId + '/stacks/' + stackId); | ||
} | ||
}]); | ||
@@ -331,0 +495,0 @@ |
@@ -163,3 +163,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
if (err) { | ||
reject(err); | ||
return reject(err); | ||
} | ||
@@ -166,0 +166,0 @@ |
@@ -26,2 +26,4 @@ 'use strict'; | ||
/** | ||
* @alias BrowserBus | ||
* | ||
* @param {Object} sdk An instance of the SDK so the module can communicate with other modules | ||
@@ -28,0 +30,0 @@ * @param {Object} request An instance of the request module tied to this module's audience. |
@@ -17,3 +17,7 @@ 'use strict'; | ||
*/ | ||
var WebSocketConnection = function WebSocketConnection(webSocket, organizationId) { | ||
var WebSocketConnection = | ||
/** | ||
* @alias BrowserWebSocketConnection | ||
*/ | ||
function WebSocketConnection(webSocket, organizationId) { | ||
_classCallCheck(this, WebSocketConnection); | ||
@@ -20,0 +24,0 @@ |
@@ -32,7 +32,7 @@ 'use strict'; | ||
clientId: '8qY2xJob1JAxhmVhIDLCNnGriTM9bct8', | ||
host: 'http://localhost:3000' | ||
host: 'https://contxt.api.ndustrial.io' | ||
}, | ||
staging: { | ||
clientId: '8qY2xJob1JAxhmVhIDLCNnGriTM9bct8', | ||
host: 'http://localhost:3000' | ||
host: 'https://contxt-staging.api.ndustrial.io' | ||
} | ||
@@ -39,0 +39,0 @@ }, |
@@ -29,2 +29,26 @@ 'use strict'; | ||
/** | ||
* @typedef {Object} ContxtApplicationGrouping | ||
* @property {number} applicationId | ||
* @property {ContxtApplicationModule[]} applicationModules | ||
* @property {string} id | ||
* @property {number} index The position of the grouping within the list of all | ||
* groupings of a the parent application | ||
* @property {string} label | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtApplicationModule | ||
* @property {string} applicationGroupingId | ||
* @property {string} [externalLink] A URI pointing to an external application | ||
* @property {string} [iconUrl] A URI pointing to an icon/image representing the | ||
* application module | ||
* @property {string} id | ||
* @property {number} index The position of the module within the list of all | ||
* modules of a the parent application grouping | ||
* @property {string} label | ||
* @property {string} slug String that corresponds with a front-end package | ||
* name (e.g. the `@ndustrial/nsight-example` example application) | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtOrganizationFeaturedApplication | ||
@@ -188,2 +212,30 @@ * @property {number} applicationId | ||
/** | ||
* Gets the application groupings (and application modules) of an application | ||
* that are available to the currently authenticated user. | ||
* | ||
* API Endpoint: '/applications/:applicationId/groupings' | ||
* Method: GET | ||
* | ||
* @param {number} applicationId | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtApplicationGrouping[]} | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.applications | ||
* .getGroupings(31) | ||
* .then((applicationGroupings) => console.log(applicationGroupings)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'getGroupings', | ||
value: function getGroupings(applicationId) { | ||
return this._request.get(this._baseUrl + '/applications/' + applicationId + '/groupings').then(function (groupings) { | ||
return (0, _objects.toCamelCase)(groupings); | ||
}); | ||
} | ||
/** | ||
* Removes an application from the current user's list of favorited applications | ||
@@ -190,0 +242,0 @@ * |
@@ -56,3 +56,3 @@ 'use strict'; | ||
* contxtSdk.coordinator.permissions | ||
* .getByOrganizationId('36b8421a-cc4a-4204-b839-1397374fb16b') | ||
* .getAllByOrganizationId('36b8421a-cc4a-4204-b839-1397374fb16b') | ||
* .then((usersPermissions) => console.log(usersPermissions)) | ||
@@ -64,4 +64,4 @@ * .catch((err) => console.log(err)); | ||
_createClass(Permissions, [{ | ||
key: 'getByOrganizationId', | ||
value: function getByOrganizationId(organizationId) { | ||
key: 'getAllByOrganizationId', | ||
value: function getAllByOrganizationId(organizationId) { | ||
if (!organizationId) { | ||
@@ -77,2 +77,38 @@ return Promise.reject(new Error('An organization ID is required for getting users permissions for an organization')); | ||
/** | ||
* Gets a single user's permissions within an organization | ||
* | ||
* API Endpoint: '/organizations/:organizationId/users/:userId/permissions' | ||
* Method: GET | ||
* | ||
* @param {string} organizationId The ID of the organization | ||
* @param {string} userId The ID of the user | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtUserPermissions} A single user's permissions | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.permissions | ||
* .getOneByOrganizationId('36b8421a-cc4a-4204-b839-1397374fb16b', 'auth0|12345') | ||
* .then((usersPermissions) => console.log(usersPermissions)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'getOneByOrganizationId', | ||
value: function getOneByOrganizationId(organizationId, userId) { | ||
if (!organizationId) { | ||
return Promise.reject(new Error("An organization ID is required for getting a user's permissions for an organization")); | ||
} | ||
if (!userId) { | ||
return Promise.reject(new Error("A user ID is required for getting a user's permissions for an organization")); | ||
} | ||
return this._request.get(this._baseUrl + '/organizations/' + organizationId + '/users/' + userId + '/permissions').then(function (userPermissions) { | ||
return (0, _objects.toCamelCase)(userPermissions); | ||
}); | ||
} | ||
/** | ||
* Gets a map of permission scopes to which the user has access | ||
@@ -79,0 +115,0 @@ * |
@@ -27,2 +27,11 @@ 'use strict'; | ||
/** | ||
* @typedef {Object} ContxtUserApplication | ||
* @property {string} applicationId | ||
* @property {string} createdAt ISO 8601 Extended Format date/time string | ||
* @property {string} id | ||
* @property {string} userId | ||
* @property {string} updatedAt ISO 8601 Extended Format date/time string | ||
*/ | ||
/** | ||
* @typedef {Object} ContxtUserRole | ||
@@ -38,2 +47,12 @@ * @property {string} createdAt ISO 8601 Extended Format date/time string | ||
/** | ||
* @typedef {Object} ContxtUserStack | ||
* @property {string} accessType Access Type of the user for this stack with options "reader", "collaborator", "owner" | ||
* @property {string} createdAt ISO 8601 Extended Format date/time string | ||
* @property {string} id | ||
* @property {string} userId | ||
* @property {string} stackId | ||
* @property {string} updatedAt ISO 8601 Extended Format date/time string | ||
*/ | ||
/** | ||
* Module that provides access to contxt users | ||
@@ -110,6 +129,42 @@ * | ||
/** | ||
* Adds a application to a user | ||
* | ||
* API Endpoint: '/users/:userId/applications/:applicationId' | ||
* Method: GET | ||
* | ||
* @param {string} userId The ID of the user | ||
* @param {string} applicationId The ID of the application | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtUserApplication} The newly created user application | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.users | ||
* .addApplication('36b8421a-cc4a-4204-b839-1397374fb16b', '007ca9ee-ece7-4931-9d11-9b4fd97d4d58') | ||
* .then((userApplication) => console.log(userApplication)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'addApplication', | ||
value: function addApplication(userId, applicationId) { | ||
if (!userId) { | ||
return Promise.reject(new Error('A user ID is required for adding a application to a user')); | ||
} | ||
if (!applicationId) { | ||
return Promise.reject(new Error('An application ID is required for adding a application to a user')); | ||
} | ||
return this._request.post(this._baseUrl + '/users/' + userId + '/applications/' + applicationId).then(function (response) { | ||
return (0, _objects.toCamelCase)(response); | ||
}); | ||
} | ||
/** | ||
* Adds a role to a user | ||
* | ||
* API Endpoint: '/users/:userId/roles/:roleId' | ||
* Method: GET | ||
* Method: POST | ||
* | ||
@@ -147,2 +202,45 @@ * @param {string} userId The ID of the user | ||
/** | ||
* Adds a stack to a user | ||
* | ||
* API Endpoint: '/users/:userId/stacks/:stackId' | ||
* Method: POST | ||
* | ||
* @param {string} userId The ID of the user | ||
* @param {string} stackId The ID of the stack | ||
* @param {'reader' | 'collaborator' | 'owner'} accessType The level of access for the user | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtUserStack} The newly created user stack | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.users | ||
* .addStack('36b8421a-cc4a-4204-b839-1397374fb16b', '007ca9ee-ece7-4931-9d11-9b4fd97d4d58', 'collaborator') | ||
* .then((userStack) => console.log(userStack)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'addStack', | ||
value: function addStack(userId, stackId, accessType) { | ||
if (!userId) { | ||
return Promise.reject(new Error('A user ID is required for adding a stack to a user')); | ||
} | ||
if (!stackId) { | ||
return Promise.reject(new Error('A stack ID is required for adding a stack to a user')); | ||
} | ||
if (['reader', 'collaborator', 'owner'].indexOf(accessType) === -1) { | ||
return Promise.reject(new Error('An access type of "reader", "collaborator", or "owner" is required for adding a stack to a user')); | ||
} | ||
return this._request.post(this._baseUrl + '/users/' + userId + '/stacks/' + stackId, { | ||
access_type: accessType | ||
}).then(function (response) { | ||
return (0, _objects.toCamelCase)(response); | ||
}); | ||
} | ||
/** | ||
* Gets information about a contxt user | ||
@@ -302,2 +400,35 @@ * | ||
/** | ||
* Removes a application from a user | ||
* | ||
* API Endpoint: '/users/:userId/applications/:applicationId' | ||
* Method: DELETE | ||
* | ||
* @param {string} userId The ID of the user | ||
* @param {string} applicationId The ID of the application | ||
* | ||
* @returns {Promise} | ||
* @fulfill {undefined} | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.users | ||
* .removeApplication('36b8421a-cc4a-4204-b839-1397374fb16b', '007ca9ee-ece7-4931-9d11-9b4fd97d4d58') | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'removeApplication', | ||
value: function removeApplication(userId, applicationId) { | ||
if (!userId) { | ||
return Promise.reject(new Error('A user ID is required for removing a application from a user')); | ||
} | ||
if (!applicationId) { | ||
return Promise.reject(new Error('An application ID is required for removing a application from a user')); | ||
} | ||
return this._request.delete(this._baseUrl + '/users/' + userId + '/applications/' + applicationId); | ||
} | ||
/** | ||
* Removes a role from a user | ||
@@ -334,2 +465,35 @@ * | ||
} | ||
/** | ||
* Removes a stack from a user | ||
* | ||
* API Endpoint: '/users/:userId/stacks/:stackId' | ||
* Method: DELETE | ||
* | ||
* @param {string} userId The ID of the user | ||
* @param {string} stackId The ID of the stack | ||
* | ||
* @returns {Promise} | ||
* @fulfill {undefined} | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator.users | ||
* .removeStack('36b8421a-cc4a-4204-b839-1397374fb16b', '007ca9ee-ece7-4931-9d11-9b4fd97d4d58') | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
}, { | ||
key: 'removeStack', | ||
value: function removeStack(userId, stackId) { | ||
if (!userId) { | ||
return Promise.reject(new Error('A user ID is required for removing a stack from a user')); | ||
} | ||
if (!stackId) { | ||
return Promise.reject(new Error('A stack ID is required for removing a stack from a user')); | ||
} | ||
return this._request.delete(this._baseUrl + '/users/' + userId + '/stacks/' + stackId); | ||
} | ||
}]); | ||
@@ -336,0 +500,0 @@ |
@@ -179,3 +179,3 @@ 'use strict'; | ||
if (err) { | ||
reject(err); | ||
return reject(err); | ||
} | ||
@@ -182,0 +182,0 @@ |
{ | ||
"name": "@ndustrial/contxt-sdk", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
2354381
384
37875