@cobaltio/cobalt-js 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -37
- package/cobalt.js +24 -24
- package/cobalt.min.js +1 -1
- package/docs.md +37 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,11 +59,11 @@ cobalt.token = "COBALT_SESSION_TOKEN";
|
|
|
59
59
|
## Typedefs
|
|
60
60
|
|
|
61
61
|
<dl>
|
|
62
|
-
<dt><a href="#
|
|
62
|
+
<dt><a href="#Config">Config</a> : <code>object</code></dt>
|
|
63
63
|
<dd><p>The configuration data for an application.</p>
|
|
64
64
|
</dd>
|
|
65
|
-
<dt><a href="#
|
|
66
|
-
<dd><p>An
|
|
65
|
+
<dt><a href="#SavedConfig">SavedConfig</a> : <code>Object</code></dt>
|
|
66
|
+
<dd><p>An saved config.</p>
|
|
67
67
|
</dd>
|
|
68
68
|
<dt><a href="#Workflow">Workflow</a> : <code>Object</code></dt>
|
|
69
69
|
<dd><p>The workflow.</p>
|
|
@@ -90,11 +90,11 @@ Cobalt Frontend SDK
|
|
|
90
90
|
* [.authCustom(applicationId, payload)](#Cobalt+authCustom) ⇒ <code>Promise.<unknown></code>
|
|
91
91
|
* [.checkAuth(application)](#Cobalt+checkAuth) ⇒ <code>Promise.<Boolean></code>
|
|
92
92
|
* [.removeAuth(application, [applicationId])](#Cobalt+removeAuth) ⇒ <code>Promise.<void></code>
|
|
93
|
-
* [.
|
|
94
|
-
* [.
|
|
95
|
-
* [.
|
|
96
|
-
* [.
|
|
97
|
-
* [.
|
|
93
|
+
* [.getConfig(application)](#Cobalt+getConfig) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
94
|
+
* [.saveConfig(applicationId, payload)](#Cobalt+saveConfig) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
95
|
+
* [.getSavedConfig(applicationId, configId)](#Cobalt+getSavedConfig) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
96
|
+
* [.updateSavedConfig(applicationId, configId, payload)](#Cobalt+updateSavedConfig) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
97
|
+
* [.deleteSavedConfig(applicationId, configId)](#Cobalt+deleteSavedConfig) ⇒ <code>Promise.<unknown></code>
|
|
98
98
|
|
|
99
99
|
<a name="new_Cobalt_new"></a>
|
|
100
100
|
|
|
@@ -170,73 +170,73 @@ Unauthorize the specified application and remove any associated data from Cobalt
|
|
|
170
170
|
| application | <code>String</code> | The application type. |
|
|
171
171
|
| [applicationId] | <code>String</code> | The application ID in case of custom applications. |
|
|
172
172
|
|
|
173
|
-
<a name="Cobalt+
|
|
173
|
+
<a name="Cobalt+getConfig"></a>
|
|
174
174
|
|
|
175
|
-
### cobalt.
|
|
175
|
+
### cobalt.getConfig(application) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
176
176
|
Returns the configuration data for the specified application.
|
|
177
177
|
|
|
178
178
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
179
|
-
**Returns**: [<code>Promise.<
|
|
179
|
+
**Returns**: [<code>Promise.<Config></code>](#Config) - The specified application's configuration data.
|
|
180
180
|
|
|
181
181
|
| Param | Type | Description |
|
|
182
182
|
| --- | --- | --- |
|
|
183
183
|
| application | <code>String</code> | The application ID. |
|
|
184
184
|
|
|
185
|
-
<a name="Cobalt+
|
|
185
|
+
<a name="Cobalt+saveConfig"></a>
|
|
186
186
|
|
|
187
|
-
### cobalt.
|
|
188
|
-
|
|
187
|
+
### cobalt.saveConfig(applicationId, payload) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
188
|
+
Save the specified config.
|
|
189
189
|
|
|
190
190
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
191
|
-
**Returns**: [<code>Promise.<
|
|
191
|
+
**Returns**: [<code>Promise.<SavedConfig></code>](#SavedConfig) - The specified saved config.
|
|
192
192
|
|
|
193
193
|
| Param | Type | Description |
|
|
194
194
|
| --- | --- | --- |
|
|
195
195
|
| applicationId | <code>String</code> | The application ID. |
|
|
196
|
-
| payload | [<code>
|
|
196
|
+
| payload | [<code>SavedConfig</code>](#SavedConfig) | The config payload. |
|
|
197
197
|
|
|
198
|
-
<a name="Cobalt+
|
|
198
|
+
<a name="Cobalt+getSavedConfig"></a>
|
|
199
199
|
|
|
200
|
-
### cobalt.
|
|
201
|
-
Returns the specified
|
|
200
|
+
### cobalt.getSavedConfig(applicationId, configId) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
201
|
+
Returns the specified saved config.
|
|
202
202
|
|
|
203
203
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
204
|
-
**Returns**: [<code>Promise.<
|
|
204
|
+
**Returns**: [<code>Promise.<SavedConfig></code>](#SavedConfig) - The specified saved config.
|
|
205
205
|
|
|
206
206
|
| Param | Type | Description |
|
|
207
207
|
| --- | --- | --- |
|
|
208
208
|
| applicationId | <code>String</code> | The application ID. |
|
|
209
|
-
|
|
|
209
|
+
| configId | <code>String</code> | The config ID of the saved config. |
|
|
210
210
|
|
|
211
|
-
<a name="Cobalt+
|
|
211
|
+
<a name="Cobalt+updateSavedConfig"></a>
|
|
212
212
|
|
|
213
|
-
### cobalt.
|
|
214
|
-
Update the specified
|
|
213
|
+
### cobalt.updateSavedConfig(applicationId, configId, payload) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
214
|
+
Update the specified saved config.
|
|
215
215
|
|
|
216
216
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
217
|
-
**Returns**: [<code>Promise.<
|
|
217
|
+
**Returns**: [<code>Promise.<SavedConfig></code>](#SavedConfig) - The specified saved config.
|
|
218
218
|
|
|
219
219
|
| Param | Type | Description |
|
|
220
220
|
| --- | --- | --- |
|
|
221
221
|
| applicationId | <code>String</code> | The application ID. |
|
|
222
|
-
|
|
|
223
|
-
| payload | [<code>
|
|
222
|
+
| configId | <code>String</code> | The config ID of the saved config. |
|
|
223
|
+
| payload | [<code>SavedConfig</code>](#SavedConfig) | The update payload. |
|
|
224
224
|
|
|
225
|
-
<a name="Cobalt+
|
|
225
|
+
<a name="Cobalt+deleteSavedConfig"></a>
|
|
226
226
|
|
|
227
|
-
### cobalt.
|
|
228
|
-
Delete the specified
|
|
227
|
+
### cobalt.deleteSavedConfig(applicationId, configId) ⇒ <code>Promise.<unknown></code>
|
|
228
|
+
Delete the specified saved config.
|
|
229
229
|
|
|
230
230
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
231
231
|
|
|
232
232
|
| Param | Type | Description |
|
|
233
233
|
| --- | --- | --- |
|
|
234
234
|
| applicationId | <code>String</code> | The application ID. |
|
|
235
|
-
|
|
|
235
|
+
| configId | <code>String</code> | The config ID of the saved config. |
|
|
236
236
|
|
|
237
|
-
<a name="
|
|
237
|
+
<a name="Config"></a>
|
|
238
238
|
|
|
239
|
-
##
|
|
239
|
+
## Config : <code>object</code>
|
|
240
240
|
The configuration data for an application.
|
|
241
241
|
|
|
242
242
|
**Kind**: global typedef
|
|
@@ -247,17 +247,17 @@ The configuration data for an application.
|
|
|
247
247
|
| application_data_slots | <code>Array.<DataSlot></code> | Array of application data slots. |
|
|
248
248
|
| workflows | [<code>Array.<Workflow></code>](#Workflow) | Array of workflows. |
|
|
249
249
|
|
|
250
|
-
<a name="
|
|
250
|
+
<a name="SavedConfig"></a>
|
|
251
251
|
|
|
252
|
-
##
|
|
253
|
-
An
|
|
252
|
+
## SavedConfig : <code>Object</code>
|
|
253
|
+
An saved config.
|
|
254
254
|
|
|
255
255
|
**Kind**: global typedef
|
|
256
256
|
**Properties**
|
|
257
257
|
|
|
258
258
|
| Name | Type | Description |
|
|
259
259
|
| --- | --- | --- |
|
|
260
|
-
| [
|
|
260
|
+
| [config_id] | <code>String</code> | Unique ID for the saved config. |
|
|
261
261
|
| application_data_slots | <code>Object.<string, (string\|number\|boolean)></code> | A map of application data slots and their values. |
|
|
262
262
|
| workflows | [<code>Array.<Workflow></code>](#Workflow) | Whether the workflow is enabled. |
|
|
263
263
|
|
package/cobalt.js
CHANGED
|
@@ -181,7 +181,7 @@ class Cobalt {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
|
-
* @typedef {object}
|
|
184
|
+
* @typedef {object} Config The configuration data for an application.
|
|
185
185
|
* @property {DataSlot[]} application_data_slots Array of application data slots.
|
|
186
186
|
* @property {Workflow[]} workflows Array of workflows.
|
|
187
187
|
*/
|
|
@@ -189,9 +189,9 @@ class Cobalt {
|
|
|
189
189
|
/**
|
|
190
190
|
* Returns the configuration data for the specified application.
|
|
191
191
|
* @param {String} application The application ID.
|
|
192
|
-
* @returns {Promise<
|
|
192
|
+
* @returns {Promise<Config>} The specified application's configuration data.
|
|
193
193
|
*/
|
|
194
|
-
async
|
|
194
|
+
async getConfig(application) {
|
|
195
195
|
const res = await fetch(`${this.baseUrl}/api/v1/application/${application}/config`, {
|
|
196
196
|
headers: {
|
|
197
197
|
authorization: `Bearer ${this.token}`,
|
|
@@ -206,8 +206,8 @@ class Cobalt {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
|
-
* @typedef {Object}
|
|
210
|
-
* @property {String} [
|
|
209
|
+
* @typedef {Object} SavedConfig An saved config.
|
|
210
|
+
* @property {String} [config_id] Unique ID for the saved config.
|
|
211
211
|
* @property {Object.<string, string | number | boolean>} application_data_slots A map of application data slots and their values.
|
|
212
212
|
* @property {Workflow[]} workflows Whether the workflow is enabled.
|
|
213
213
|
*/
|
|
@@ -220,12 +220,12 @@ class Cobalt {
|
|
|
220
220
|
*/
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
|
-
*
|
|
223
|
+
* Save the specified config.
|
|
224
224
|
* @param {String} applicationId The application ID.
|
|
225
|
-
* @param {
|
|
226
|
-
* @returns {Promise<
|
|
225
|
+
* @param {SavedConfig} payload The config payload.
|
|
226
|
+
* @returns {Promise<SavedConfig>} The specified saved config.
|
|
227
227
|
*/
|
|
228
|
-
async
|
|
228
|
+
async saveConfig(applicationId, payload = {}) {
|
|
229
229
|
const res = await fetch(`${this.baseUrl}/api/v1/application/${applicationId}/install`, {
|
|
230
230
|
method: "POST",
|
|
231
231
|
headers: {
|
|
@@ -243,13 +243,13 @@ class Cobalt {
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
/**
|
|
246
|
-
* Returns the specified
|
|
246
|
+
* Returns the specified saved config.
|
|
247
247
|
* @param {String} applicationId The application ID.
|
|
248
|
-
* @param {String}
|
|
249
|
-
* @returns {Promise<
|
|
248
|
+
* @param {String} configId The config ID of the saved config.
|
|
249
|
+
* @returns {Promise<SavedConfig>} The specified saved config.
|
|
250
250
|
*/
|
|
251
|
-
async
|
|
252
|
-
const res = await fetch(`${this.baseUrl}/api/v1/application/${applicationId}/installation/${
|
|
251
|
+
async getSavedConfig(applicationId, configId) {
|
|
252
|
+
const res = await fetch(`${this.baseUrl}/api/v1/application/${applicationId}/installation/${configId}`, {
|
|
253
253
|
headers: {
|
|
254
254
|
authorization: `Bearer ${this.token}`,
|
|
255
255
|
},
|
|
@@ -263,14 +263,14 @@ class Cobalt {
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
|
-
* Update the specified
|
|
266
|
+
* Update the specified saved config.
|
|
267
267
|
* @param {String} applicationId The application ID.
|
|
268
|
-
* @param {String}
|
|
269
|
-
* @param {
|
|
270
|
-
* @returns {Promise<
|
|
268
|
+
* @param {String} configId The config ID of the saved config.
|
|
269
|
+
* @param {SavedConfig} payload The update payload.
|
|
270
|
+
* @returns {Promise<SavedConfig>} The specified saved config.
|
|
271
271
|
*/
|
|
272
|
-
async
|
|
273
|
-
const res = await fetch(`${this.baseUrl}/api/v1/application/${applicationId}/installation/${
|
|
272
|
+
async updateSavedConfig(applicationId, configId, payload = {}) {
|
|
273
|
+
const res = await fetch(`${this.baseUrl}/api/v1/application/${applicationId}/installation/${configId}`, {
|
|
274
274
|
method: "PUT",
|
|
275
275
|
headers: {
|
|
276
276
|
authorization: `Bearer ${this.token}`,
|
|
@@ -287,13 +287,13 @@ class Cobalt {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/**
|
|
290
|
-
* Delete the specified
|
|
290
|
+
* Delete the specified saved config.
|
|
291
291
|
* @param {String} applicationId The application ID.
|
|
292
|
-
* @param {String}
|
|
292
|
+
* @param {String} configId The config ID of the saved config.
|
|
293
293
|
* @returns {Promise<unknown>}
|
|
294
294
|
*/
|
|
295
|
-
async
|
|
296
|
-
const res = await fetch(`${this.baseUrl}/api/v1/application/${applicationId}/installation/${
|
|
295
|
+
async deleteSavedConfig(applicationId, configId) {
|
|
296
|
+
const res = await fetch(`${this.baseUrl}/api/v1/application/${applicationId}/installation/${configId}`, {
|
|
297
297
|
method: "DELETE",
|
|
298
298
|
headers: {
|
|
299
299
|
authorization: `Bearer ${this.token}`,
|
package/cobalt.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class Cobalt{constructor(options){this.baseUrl=options?.baseUrl||"https://api.gocobalt.io";this.token=options?.token}get token(){return this.sessionToken}set token(token){return this.sessionToken=typeof token==="string"?token:""}async getOAuthUrl(application){const res=await fetch(`${this.baseUrl}/api/v1/${application}/integrate`,{headers:{authorization:`Bearer ${this.token}`}});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}const data=await res.json();return data?.auth_url}async oauth(application){return new Promise((resolve,reject)=>{this.getOAuthUrl(application).then(oauthUrl=>{const connectWindow=window.open(oauthUrl);const interval=setInterval(()=>{this.checkAuth(application).then(connected=>{if(connected===true){connectWindow?.close();clearInterval(interval);resolve(true)}else{if(connectWindow?.closed){clearInterval(interval);resolve(false)}}}).catch(e=>{console.error(e);clearInterval(interval);reject(e)})},3e3)}).catch(reject)})}async auth(application,payload){const res=await fetch(`${this.baseUrl}/api/v1/${application}/save`,{method:"POST",headers:{authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify({...payload})});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}const data=await res.json();return data}async authCustom(applicationId,payload){const res=await fetch(`${this.baseUrl}/api/v1/custom/${applicationId}/save`,{method:"POST",headers:{authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify({...payload})});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}const data=await res.json();return data}async checkAuth(application){const res=await fetch(`${this.baseUrl}/api/v1/linked-acc/integration/auth?integration_type=${application}`,{headers:{authorization:`Bearer ${this.token}`}});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}const data=await res.json();return!!data?.status}async removeAuth(application,applicationId){const res=await fetch(`${this.baseUrl}/api/v1/linked-acc/integration/${application}?app_id=${applicationId}`,{method:"DELETE",headers:{authorization:`Bearer ${this.token}`}});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}}async
|
|
1
|
+
class Cobalt{constructor(options){this.baseUrl=options?.baseUrl||"https://api.gocobalt.io";this.token=options?.token}get token(){return this.sessionToken}set token(token){return this.sessionToken=typeof token==="string"?token:""}async getOAuthUrl(application){const res=await fetch(`${this.baseUrl}/api/v1/${application}/integrate`,{headers:{authorization:`Bearer ${this.token}`}});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}const data=await res.json();return data?.auth_url}async oauth(application){return new Promise((resolve,reject)=>{this.getOAuthUrl(application).then(oauthUrl=>{const connectWindow=window.open(oauthUrl);const interval=setInterval(()=>{this.checkAuth(application).then(connected=>{if(connected===true){connectWindow?.close();clearInterval(interval);resolve(true)}else{if(connectWindow?.closed){clearInterval(interval);resolve(false)}}}).catch(e=>{console.error(e);clearInterval(interval);reject(e)})},3e3)}).catch(reject)})}async auth(application,payload){const res=await fetch(`${this.baseUrl}/api/v1/${application}/save`,{method:"POST",headers:{authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify({...payload})});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}const data=await res.json();return data}async authCustom(applicationId,payload){const res=await fetch(`${this.baseUrl}/api/v1/custom/${applicationId}/save`,{method:"POST",headers:{authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify({...payload})});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}const data=await res.json();return data}async checkAuth(application){const res=await fetch(`${this.baseUrl}/api/v1/linked-acc/integration/auth?integration_type=${application}`,{headers:{authorization:`Bearer ${this.token}`}});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}const data=await res.json();return!!data?.status}async removeAuth(application,applicationId){const res=await fetch(`${this.baseUrl}/api/v1/linked-acc/integration/${application}?app_id=${applicationId}`,{method:"DELETE",headers:{authorization:`Bearer ${this.token}`}});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}}async getConfig(application){const res=await fetch(`${this.baseUrl}/api/v1/application/${application}/config`,{headers:{authorization:`Bearer ${this.token}`}});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}return await res.json()}async saveConfig(applicationId,payload={}){const res=await fetch(`${this.baseUrl}/api/v1/application/${applicationId}/install`,{method:"POST",headers:{authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(payload)});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}return await res.json()}async getSavedConfig(applicationId,configId){const res=await fetch(`${this.baseUrl}/api/v1/application/${applicationId}/installation/${configId}`,{headers:{authorization:`Bearer ${this.token}`}});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}return await res.json()}async updateSavedConfig(applicationId,configId,payload={}){const res=await fetch(`${this.baseUrl}/api/v1/application/${applicationId}/installation/${configId}`,{method:"PUT",headers:{authorization:`Bearer ${this.token}`,"content-type":"application/json"},body:JSON.stringify(payload)});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}return await res.json()}async deleteSavedConfig(applicationId,configId){const res=await fetch(`${this.baseUrl}/api/v1/application/${applicationId}/installation/${configId}`,{method:"DELETE",headers:{authorization:`Bearer ${this.token}`}});if(res.status>=400&&res.status<600){throw new Error(res.statusText)}return await res.json()}}module.exports=Cobalt;
|
package/docs.md
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
## Typedefs
|
|
10
10
|
|
|
11
11
|
<dl>
|
|
12
|
-
<dt><a href="#
|
|
12
|
+
<dt><a href="#Config">Config</a> : <code>object</code></dt>
|
|
13
13
|
<dd><p>The configuration data for an application.</p>
|
|
14
14
|
</dd>
|
|
15
|
-
<dt><a href="#
|
|
16
|
-
<dd><p>An
|
|
15
|
+
<dt><a href="#SavedConfig">SavedConfig</a> : <code>Object</code></dt>
|
|
16
|
+
<dd><p>An saved config.</p>
|
|
17
17
|
</dd>
|
|
18
18
|
<dt><a href="#Workflow">Workflow</a> : <code>Object</code></dt>
|
|
19
19
|
<dd><p>The workflow.</p>
|
|
@@ -40,11 +40,11 @@ Cobalt Frontend SDK
|
|
|
40
40
|
* [.authCustom(applicationId, payload)](#Cobalt+authCustom) ⇒ <code>Promise.<unknown></code>
|
|
41
41
|
* [.checkAuth(application)](#Cobalt+checkAuth) ⇒ <code>Promise.<Boolean></code>
|
|
42
42
|
* [.removeAuth(application, [applicationId])](#Cobalt+removeAuth) ⇒ <code>Promise.<void></code>
|
|
43
|
-
* [.
|
|
44
|
-
* [.
|
|
45
|
-
* [.
|
|
46
|
-
* [.
|
|
47
|
-
* [.
|
|
43
|
+
* [.getConfig(application)](#Cobalt+getConfig) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
44
|
+
* [.saveConfig(applicationId, payload)](#Cobalt+saveConfig) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
45
|
+
* [.getSavedConfig(applicationId, configId)](#Cobalt+getSavedConfig) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
46
|
+
* [.updateSavedConfig(applicationId, configId, payload)](#Cobalt+updateSavedConfig) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
47
|
+
* [.deleteSavedConfig(applicationId, configId)](#Cobalt+deleteSavedConfig) ⇒ <code>Promise.<unknown></code>
|
|
48
48
|
|
|
49
49
|
<a name="new_Cobalt_new"></a>
|
|
50
50
|
|
|
@@ -120,73 +120,73 @@ Unauthorize the specified application and remove any associated data from Cobalt
|
|
|
120
120
|
| application | <code>String</code> | The application type. |
|
|
121
121
|
| [applicationId] | <code>String</code> | The application ID in case of custom applications. |
|
|
122
122
|
|
|
123
|
-
<a name="Cobalt+
|
|
123
|
+
<a name="Cobalt+getConfig"></a>
|
|
124
124
|
|
|
125
|
-
### cobalt.
|
|
125
|
+
### cobalt.getConfig(application) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
126
126
|
Returns the configuration data for the specified application.
|
|
127
127
|
|
|
128
128
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
129
|
-
**Returns**: [<code>Promise.<
|
|
129
|
+
**Returns**: [<code>Promise.<Config></code>](#Config) - The specified application's configuration data.
|
|
130
130
|
|
|
131
131
|
| Param | Type | Description |
|
|
132
132
|
| --- | --- | --- |
|
|
133
133
|
| application | <code>String</code> | The application ID. |
|
|
134
134
|
|
|
135
|
-
<a name="Cobalt+
|
|
135
|
+
<a name="Cobalt+saveConfig"></a>
|
|
136
136
|
|
|
137
|
-
### cobalt.
|
|
138
|
-
|
|
137
|
+
### cobalt.saveConfig(applicationId, payload) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
138
|
+
Save the specified config.
|
|
139
139
|
|
|
140
140
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
141
|
-
**Returns**: [<code>Promise.<
|
|
141
|
+
**Returns**: [<code>Promise.<SavedConfig></code>](#SavedConfig) - The specified saved config.
|
|
142
142
|
|
|
143
143
|
| Param | Type | Description |
|
|
144
144
|
| --- | --- | --- |
|
|
145
145
|
| applicationId | <code>String</code> | The application ID. |
|
|
146
|
-
| payload | [<code>
|
|
146
|
+
| payload | [<code>SavedConfig</code>](#SavedConfig) | The config payload. |
|
|
147
147
|
|
|
148
|
-
<a name="Cobalt+
|
|
148
|
+
<a name="Cobalt+getSavedConfig"></a>
|
|
149
149
|
|
|
150
|
-
### cobalt.
|
|
151
|
-
Returns the specified
|
|
150
|
+
### cobalt.getSavedConfig(applicationId, configId) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
151
|
+
Returns the specified saved config.
|
|
152
152
|
|
|
153
153
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
154
|
-
**Returns**: [<code>Promise.<
|
|
154
|
+
**Returns**: [<code>Promise.<SavedConfig></code>](#SavedConfig) - The specified saved config.
|
|
155
155
|
|
|
156
156
|
| Param | Type | Description |
|
|
157
157
|
| --- | --- | --- |
|
|
158
158
|
| applicationId | <code>String</code> | The application ID. |
|
|
159
|
-
|
|
|
159
|
+
| configId | <code>String</code> | The config ID of the saved config. |
|
|
160
160
|
|
|
161
|
-
<a name="Cobalt+
|
|
161
|
+
<a name="Cobalt+updateSavedConfig"></a>
|
|
162
162
|
|
|
163
|
-
### cobalt.
|
|
164
|
-
Update the specified
|
|
163
|
+
### cobalt.updateSavedConfig(applicationId, configId, payload) ⇒ [<code>Promise.<SavedConfig></code>](#SavedConfig)
|
|
164
|
+
Update the specified saved config.
|
|
165
165
|
|
|
166
166
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
167
|
-
**Returns**: [<code>Promise.<
|
|
167
|
+
**Returns**: [<code>Promise.<SavedConfig></code>](#SavedConfig) - The specified saved config.
|
|
168
168
|
|
|
169
169
|
| Param | Type | Description |
|
|
170
170
|
| --- | --- | --- |
|
|
171
171
|
| applicationId | <code>String</code> | The application ID. |
|
|
172
|
-
|
|
|
173
|
-
| payload | [<code>
|
|
172
|
+
| configId | <code>String</code> | The config ID of the saved config. |
|
|
173
|
+
| payload | [<code>SavedConfig</code>](#SavedConfig) | The update payload. |
|
|
174
174
|
|
|
175
|
-
<a name="Cobalt+
|
|
175
|
+
<a name="Cobalt+deleteSavedConfig"></a>
|
|
176
176
|
|
|
177
|
-
### cobalt.
|
|
178
|
-
Delete the specified
|
|
177
|
+
### cobalt.deleteSavedConfig(applicationId, configId) ⇒ <code>Promise.<unknown></code>
|
|
178
|
+
Delete the specified saved config.
|
|
179
179
|
|
|
180
180
|
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
181
181
|
|
|
182
182
|
| Param | Type | Description |
|
|
183
183
|
| --- | --- | --- |
|
|
184
184
|
| applicationId | <code>String</code> | The application ID. |
|
|
185
|
-
|
|
|
185
|
+
| configId | <code>String</code> | The config ID of the saved config. |
|
|
186
186
|
|
|
187
|
-
<a name="
|
|
187
|
+
<a name="Config"></a>
|
|
188
188
|
|
|
189
|
-
##
|
|
189
|
+
## Config : <code>object</code>
|
|
190
190
|
The configuration data for an application.
|
|
191
191
|
|
|
192
192
|
**Kind**: global typedef
|
|
@@ -197,17 +197,17 @@ The configuration data for an application.
|
|
|
197
197
|
| application_data_slots | <code>Array.<DataSlot></code> | Array of application data slots. |
|
|
198
198
|
| workflows | [<code>Array.<Workflow></code>](#Workflow) | Array of workflows. |
|
|
199
199
|
|
|
200
|
-
<a name="
|
|
200
|
+
<a name="SavedConfig"></a>
|
|
201
201
|
|
|
202
|
-
##
|
|
203
|
-
An
|
|
202
|
+
## SavedConfig : <code>Object</code>
|
|
203
|
+
An saved config.
|
|
204
204
|
|
|
205
205
|
**Kind**: global typedef
|
|
206
206
|
**Properties**
|
|
207
207
|
|
|
208
208
|
| Name | Type | Description |
|
|
209
209
|
| --- | --- | --- |
|
|
210
|
-
| [
|
|
210
|
+
| [config_id] | <code>String</code> | Unique ID for the saved config. |
|
|
211
211
|
| application_data_slots | <code>Object.<string, (string\|number\|boolean)></code> | A map of application data slots and their values. |
|
|
212
212
|
| workflows | [<code>Array.<Workflow></code>](#Workflow) | Whether the workflow is enabled. |
|
|
213
213
|
|