@ndustrial/contxt-sdk
Advanced tools
Comparing version 0.0.43 to 0.0.44
@@ -0,1 +1,7 @@ | ||
## [v0.0.44](http://github.com/ndustrialio/contxt-sdk-js/tree/v0.0.44) (2019-03-19) | ||
**Added** | ||
- Added `Coordinator#getAllApplications` for getting a list of all applications | ||
## [v0.0.43](http://github.com/ndustrialio/contxt-sdk-js/tree/v0.0.43) (2019-03-13) | ||
@@ -2,0 +8,0 @@ |
@@ -10,2 +10,3 @@ <a name="Coordinator"></a> | ||
* [new Coordinator(sdk, request)](#new_Coordinator_new) | ||
* [.getAllApplications()](#Coordinator+getAllApplications) ⇒ <code>Promise</code> | ||
* [.getAllOrganizations()](#Coordinator+getAllOrganizations) ⇒ <code>Promise</code> | ||
@@ -25,2 +26,20 @@ * [.getOrganizationById(organizationId)](#Coordinator+getOrganizationById) ⇒ <code>Promise</code> | ||
<a name="Coordinator+getAllApplications"></a> | ||
### contxtSdk.coordinator.getAllApplications() ⇒ <code>Promise</code> | ||
Gets information about all contxt applications | ||
API Endpoint: '/applications' | ||
Method: GET | ||
**Kind**: instance method of [<code>Coordinator</code>](#Coordinator) | ||
**Fulfill**: <code>ContxtApplication[]</code> Information about all contxt applications | ||
**Reject**: <code>Error</code> | ||
**Example** | ||
```js | ||
contxtSdk.coordinator | ||
.getAllApplications() | ||
.then((apps) => console.log(apps)) | ||
.catch((err) => console.log(err)); | ||
``` | ||
<a name="Coordinator+getAllOrganizations"></a> | ||
@@ -27,0 +46,0 @@ |
<a name="Files"></a> | ||
## Files | ||
Module that provides access to information about Files | ||
Module that provides access to information about Files. | ||
More information about the best way to use this module is available at: | ||
https://contxt.readme.io/reference#files-overview | ||
@@ -38,3 +40,3 @@ **Kind**: global class | ||
**Kind**: instance method of [<code>Files</code>](#Files) | ||
**Fulfill**: [<code>File</code>](./Typedefs.md#File) | ||
**Fulfill**: [<code>FileWithUploadInformation</code>](./Typedefs.md#FileWithUploadInformation) | ||
**Rejects**: <code>Error</code> | ||
@@ -41,0 +43,0 @@ |
@@ -75,3 +75,5 @@ ## Classes | ||
<dt><a href="./Files.md">Files</a></dt> | ||
<dd><p>Module that provides access to information about Files</p> | ||
<dd><p>Module that provides access to information about Files. | ||
More information about the best way to use this module is available at: | ||
<a href="https://contxt.readme.io/reference#files-overview">https://contxt.readme.io/reference#files-overview</a></p> | ||
</dd> | ||
@@ -140,2 +142,4 @@ <dt><a href="./Iot.md">Iot</a></dt> | ||
</dd> | ||
<dt><a href="./Typedefs.md#ContxtApplication">ContxtApplication</a> : <code>Object</code></dt> | ||
<dd></dd> | ||
<dt><a href="./Typedefs.md#ContxtOrganization">ContxtOrganization</a> : <code>Object</code></dt> | ||
@@ -142,0 +146,0 @@ <dd></dd> |
@@ -221,2 +221,22 @@ <a name="Asset"></a> | ||
<a name="ContxtApplication"></a> | ||
## ContxtApplication : <code>Object</code> | ||
**Kind**: global typedef | ||
**Properties** | ||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
| clientId | <code>string</code> | | | ||
| clientSecret | <code>string</code> | | | ||
| createdAt | <code>string</code> | ISO 8601 Extended Format date/time string | | ||
| currentVersionId | <code>string</code> | | | ||
| description | <code>string</code> | | | ||
| iconUrl | <code>string</code> | | | ||
| id | <code>number</code> | | | ||
| name | <code>string</code> | | | ||
| serviceId | <code>number</code> | | | ||
| type | <code>string</code> | | | ||
| updatedAt | <code>string</code> | ISO 8601 Extended Format date/time string | | ||
<a name="ContxtOrganization"></a> | ||
@@ -592,4 +612,15 @@ | ||
| --- | --- | --- | | ||
| expiresAt | <code>string</code> | ISO 8601 Extended Format date/time | | ||
| temporaryUrl | <code>string</code> | A temporary URL that can be used to download the file | | ||
| createdAt | <code>string</code> | ISO 8601 Extended Format date/time string | | ||
| contentType | <code>string</code> | The MIME type of the file | | ||
| description | <code>string</code> | | | ||
| downloadInfo | <code>Object</code> | | | ||
| downloadInfo.attachmentUrl | <code>string</code> | A URL that can be used to download the file from the external storage | | ||
| downloadInfo.expiresAt | <code>string</code> | ISO 8601 Extended Format date/time indicating when the attachement and inline URLs expire | | ||
| downloadInfo.inlineUrl | <code>string</code> | A URL that can be used for embedding the file into a page | | ||
| filename | <code>string</code> | | | ||
| id | <code>string</code> | UUID of the file | | ||
| organizationId | <code>string</code> | UUID of the organization to which the file belongs | | ||
| ownerId | <code>string</code> | The ID of the user who owns the file | | ||
| status | <code>string</code> | The status of the File, e.g. "ACTIVE" | | ||
| updatedAt | <code>string</code> | ISO 8601 Extended Format date/time string | | ||
@@ -596,0 +627,0 @@ <a name="FileWithUploadInformation"></a> |
{ | ||
"name": "@ndustrial/contxt-sdk", | ||
"version": "0.0.43", | ||
"version": "0.0.44", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -27,2 +27,17 @@ import EdgeNodes from './edgeNodes'; | ||
/** | ||
* @typedef {Object} ContxtApplication | ||
* @property {string} clientId | ||
* @property {string} clientSecret | ||
* @property {string} createdAt ISO 8601 Extended Format date/time string | ||
* @property {string} currentVersionId | ||
* @property {string} description | ||
* @property {string} iconUrl | ||
* @property {number} id | ||
* @property {string} name | ||
* @property {number} serviceId | ||
* @property {string} type | ||
* @property {string} updatedAt ISO 8601 Extended Format date/time string | ||
*/ | ||
/** | ||
* Module that provides access to information about Contxt | ||
@@ -48,2 +63,24 @@ * | ||
/** | ||
* Gets information about all contxt applications | ||
* | ||
* API Endpoint: '/applications' | ||
* Method: GET | ||
* | ||
* @returns {Promise} | ||
* @fulfill {ContxtApplication[]} Information about all contxt applications | ||
* @reject {Error} | ||
* | ||
* @example | ||
* contxtSdk.coordinator | ||
* .getAllApplications() | ||
* .then((apps) => console.log(apps)) | ||
* .catch((err) => console.log(err)); | ||
*/ | ||
getAllApplications() { | ||
return this._request | ||
.get(`${this._baseUrl}/applications`) | ||
.then((apps) => apps.map((app) => toCamelCase(app))); | ||
} | ||
/** | ||
* Gets information about all contxt organizations | ||
@@ -50,0 +87,0 @@ * |
@@ -54,2 +54,57 @@ import Coordinator from './index'; | ||
describe('getAllApplications', function() { | ||
let expectedApplications; | ||
let applicationsFromServer; | ||
let promise; | ||
let request; | ||
let toCamelCase; | ||
beforeEach(function() { | ||
const numberOfApplications = faker.random.number({ | ||
min: 1, | ||
max: 10 | ||
}); | ||
expectedApplications = fixture.buildList( | ||
'contxtApplication', | ||
numberOfApplications | ||
); | ||
applicationsFromServer = expectedApplications.map((app) => | ||
fixture.build('contxtApplication', app, { fromServer: true }) | ||
); | ||
request = { | ||
...baseRequest, | ||
get: this.sandbox.stub().resolves(applicationsFromServer) | ||
}; | ||
toCamelCase = this.sandbox | ||
.stub(objectUtils, 'toCamelCase') | ||
.callsFake((app) => | ||
expectedApplications.find(({ id }) => id === app.id) | ||
); | ||
const coordinator = new Coordinator(baseSdk, request); | ||
coordinator._baseUrl = expectedHost; | ||
promise = coordinator.getAllApplications(); | ||
}); | ||
it('gets the list of applications from the server', function() { | ||
expect(request.get).to.be.calledWith(`${expectedHost}/applications`); | ||
}); | ||
it('formats the list of applications', function() { | ||
return promise.then(() => { | ||
expect(toCamelCase).to.have.callCount(applicationsFromServer.length); | ||
applicationsFromServer.forEach((app) => { | ||
expect(toCamelCase).to.be.calledWith(app); | ||
}); | ||
}); | ||
}); | ||
it('returns a fulfilled promise with the applications', function() { | ||
return expect(promise).to.be.fulfilled.and.to.eventually.deep.equal( | ||
expectedApplications | ||
); | ||
}); | ||
}); | ||
describe('getAllOrganizations', function() { | ||
@@ -56,0 +111,0 @@ let expectedOrganizations; |
@@ -52,4 +52,15 @@ import axios from 'axios'; | ||
* @typedef {Object} FileToDownload | ||
* @property {string} expiresAt ISO 8601 Extended Format date/time | ||
* @property {string} temporaryUrl A temporary URL that can be used to download the file | ||
* @property {string} createdAt ISO 8601 Extended Format date/time string | ||
* @property {string} contentType The MIME type of the file | ||
* @property {string} description | ||
* @property {Object} downloadInfo | ||
* @property {string} downloadInfo.attachmentUrl A URL that can be used to download the file from the external storage | ||
* @property {string} downloadInfo.expiresAt ISO 8601 Extended Format date/time indicating when the attachement and inline URLs expire | ||
* @property {string} downloadInfo.inlineUrl A URL that can be used for embedding the file into a page | ||
* @property {string} filename | ||
* @property {string} id UUID of the file | ||
* @property {string} organizationId UUID of the organization to which the file belongs | ||
* @property {string} ownerId The ID of the user who owns the file | ||
* @property {string} status The status of the File, e.g. "ACTIVE" | ||
* @property {string} updatedAt ISO 8601 Extended Format date/time string | ||
*/ | ||
@@ -75,3 +86,5 @@ | ||
/** | ||
* Module that provides access to information about Files | ||
* Module that provides access to information about Files. | ||
* More information about the best way to use this module is available at: | ||
* https://contxt.readme.io/reference#files-overview | ||
* | ||
@@ -107,3 +120,3 @@ * @typicalname contxtSdk.files | ||
* @returns {Promise} | ||
* @fulfill {File} | ||
* @fulfill {FileWithUploadInformation} | ||
* @rejects {Error} | ||
@@ -110,0 +123,0 @@ * |
@@ -13,2 +13,3 @@ 'use strict'; | ||
require('./channel'); | ||
require('./contxtApplication'); | ||
require('./contxtOrganization'); | ||
@@ -15,0 +16,0 @@ require('./contxtUser'); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
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
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
2599972
247
33985
3