@cobaltio/cobalt-js 3.0.0 → 3.0.2

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.
Files changed (4) hide show
  1. package/README.md +290 -250
  2. package/cobalt.js +11 -1
  3. package/docs.md +35 -0
  4. package/package.json +34 -34
package/README.md CHANGED
@@ -1,250 +1,290 @@
1
- # cobalt.js
2
- Cobalt frontend SDK.
3
-
4
- ## Install
5
-
6
- #### npm
7
- ```bash
8
- npm install @cobaltio/cobalt-js
9
- ```
10
-
11
- #### yarn
12
- ```bash
13
- yarn add @cobaltio/cobalt-js
14
- ```
15
-
16
- ## Usage
17
-
18
- <!-- Check the SDK [documentation](docs.md) for detailed information. -->
19
-
20
- ### Include
21
-
22
- #### Browser
23
- ```html
24
- <!-- import the latest version -->
25
- <script src="https://cdn.jsdelivr.net/npm/@cobaltio/cobalt-js"></script>
26
- <!-- import a specific version -->
27
- <script src="https://cdn.jsdelivr.net/npm/@cobaltio/cobalt-js@2"></script>
28
- ```
29
-
30
- #### Node
31
- ```js
32
- // CommonJS
33
- const Cobalt = require("@cobaltio/cobalt-js");
34
- // ESM
35
- import Cobalt from "@cobaltio/cobalt-js";
36
- ```
37
-
38
- ### Initialize
39
- ```js
40
- // initialize with token
41
- const cobalt = new Cobalt({
42
- // the token you generate for linked accounts using the cobalt backend SDK
43
- token: "COBALT_SESSION_TOKEN",
44
- });
45
-
46
- // initialize without token
47
- const cobalt = new Cobalt();
48
- // the token you generate for linked accounts using the cobalt backend SDK
49
- cobalt.token = "COBALT_SESSION_TOKEN";
50
- ```
51
-
52
- ### SDK
53
-
54
- ## Classes
55
-
56
- <dl>
57
- <dt><a href="#Cobalt">Cobalt</a></dt>
58
- <dd><p>Cobalt Frontend SDK</p>
59
- </dd>
60
- </dl>
61
-
62
- ## Typedefs
63
-
64
- <dl>
65
- <dt><a href="#Label">Label</a> : <code>Object</code></dt>
66
- <dd><p>Field Mapping Label</p>
67
- </dd>
68
- <dt><a href="#DynamicField">DynamicField</a> : <code>Object</code></dt>
69
- <dd><p>Field Mapping Label</p>
70
- </dd>
71
- <dt><a href="#DynamicFields">DynamicFields</a> : <code>Object</code></dt>
72
- <dd><p>The dynamic fields payload.</p>
73
- </dd>
74
- <dt><a href="#Config">Config</a> : <code>Object</code></dt>
75
- <dd><p>The configuration data for an application.</p>
76
- </dd>
77
- <dt><a href="#Workflow">Workflow</a> : <code>Object</code></dt>
78
- <dd><p>The workflow.</p>
79
- </dd>
80
- </dl>
81
-
82
- <a name="Cobalt"></a>
83
-
84
- ## Cobalt
85
- Cobalt Frontend SDK
86
-
87
- **Kind**: global class
88
-
89
- * [Cobalt](#Cobalt)
90
- * [new Cobalt(options)](#new_Cobalt_new)
91
- * [.connect(slug, [payload])](#Cobalt+connect) ⇒ <code>Promise.&lt;Boolean&gt;</code>
92
- * [.disconnect(slug)](#Cobalt+disconnect) <code>Promise.&lt;void&gt;</code>
93
- * [.config(slug, configId, [fields])](#Cobalt+config) ⇒ [<code>Promise.&lt;Config&gt;</code>](#Config)
94
- * [.getConfig(slug, configId)](#Cobalt+getConfig) ⇒ [<code>Promise.&lt;Config&gt;</code>](#Config)
95
- * [.updateConfig(slug, configId, payload)](#Cobalt+updateConfig) ⇒ [<code>Promise.&lt;Config&gt;</code>](#Config)
96
- * [.deleteConfig(slug, configId)](#Cobalt+deleteConfig) ⇒ <code>Promise.&lt;unknown&gt;</code>
97
-
98
- <a name="new_Cobalt_new"></a>
99
-
100
- ### new Cobalt(options)
101
- Cobalt Frontend SDK
102
-
103
-
104
- | Param | Type | Default | Description |
105
- | --- | --- | --- | --- |
106
- | options | <code>Object</code> | | The options to configure the Cobalt SDK. |
107
- | [options.token] | <code>String</code> | | The session token. |
108
- | [options.baseUrl] | <code>String</code> | <code>https://api.gocobalt.io</code> | The base URL of the Cobalt API. |
109
-
110
- <a name="Cobalt+connect"></a>
111
-
112
- ### cobalt.connect(slug, [payload]) ⇒ <code>Promise.&lt;Boolean&gt;</code>
113
- Connect the specified application, optionally with the auth data that user provides.
114
-
115
- **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
116
- **Returns**: <code>Promise.&lt;Boolean&gt;</code> - Whether the connection was successful.
117
-
118
- | Param | Type | Default | Description |
119
- | --- | --- | --- | --- |
120
- | slug | <code>String</code> | | The application slug. |
121
- | [payload] | <code>Object.&lt;string, (string\|number\|boolean)&gt;</code> | <code>{}</code> | The key value pairs of auth data. |
122
-
123
- <a name="Cobalt+disconnect"></a>
124
-
125
- ### cobalt.disconnect(slug) <code>Promise.&lt;void&gt;</code>
126
- Disconnect the specified application and remove any associated data from Cobalt.
127
-
128
- **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
129
-
130
- | Param | Type | Description |
131
- | --- | --- | --- |
132
- | slug | <code>String</code> | The application slug. |
133
-
134
- <a name="Cobalt+config"></a>
135
-
136
- ### cobalt.config(slug, configId, [fields]) ⇒ [<code>Promise.&lt;Config&gt;</code>](#Config)
137
- Returns the specified config, or creates one if it doesn't exist.
138
-
139
- **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
140
- **Returns**: [<code>Promise.&lt;Config&gt;</code>](#Config) - The specified config.
141
-
142
- | Param | Type | Description |
143
- | --- | --- | --- |
144
- | slug | <code>String</code> | The application slug. |
145
- | configId | <code>String</code> | A unique ID for the config. |
146
- | [fields] | [<code>DynamicFields</code>](#DynamicFields) | The dynamic fields payload. |
147
-
148
- <a name="Cobalt+getConfig"></a>
149
-
150
- ### cobalt.getConfig(slug, configId) [<code>Promise.&lt;Config&gt;</code>](#Config)
151
- Returns the specified config.
152
-
153
- **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
154
- **Returns**: [<code>Promise.&lt;Config&gt;</code>](#Config) - The specified config.
155
-
156
- | Param | Type | Description |
157
- | --- | --- | --- |
158
- | slug | <code>String</code> | The application slug. |
159
- | configId | <code>String</code> | The unique ID of the config. |
160
-
161
- <a name="Cobalt+updateConfig"></a>
162
-
163
- ### cobalt.updateConfig(slug, configId, payload) ⇒ [<code>Promise.&lt;Config&gt;</code>](#Config)
164
- Update the specified config.
165
-
166
- **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
167
- **Returns**: [<code>Promise.&lt;Config&gt;</code>](#Config) - The specified config.
168
-
169
- | Param | Type | Description |
170
- | --- | --- | --- |
171
- | slug | <code>String</code> | The application slug. |
172
- | configId | <code>String</code> | The unique ID of the config. |
173
- | payload | [<code>Config</code>](#Config) | The update payload. |
174
-
175
- <a name="Cobalt+deleteConfig"></a>
176
-
177
- ### cobalt.deleteConfig(slug, configId) ⇒ <code>Promise.&lt;unknown&gt;</code>
178
- Delete the specified config.
179
-
180
- **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
181
-
182
- | Param | Type | Description |
183
- | --- | --- | --- |
184
- | slug | <code>String</code> | The application slug. |
185
- | configId | <code>String</code> | The unique ID of the config. |
186
-
187
- <a name="Label"></a>
188
-
189
- ## Label : <code>Object</code>
190
- Field Mapping Label
191
-
192
- **Kind**: global typedef
193
- **Properties**
194
-
195
- | Name | Type | Description |
196
- | --- | --- | --- |
197
- | name | <code>string</code> | The Label name. |
198
- | value | <code>string</code> \| <code>number</code> \| <code>boolean</code> | The Label value. |
199
-
200
- <a name="DynamicField"></a>
201
-
202
- ## DynamicField : <code>Object</code>
203
- Field Mapping Label
204
-
205
- **Kind**: global typedef
206
- **Properties**
207
-
208
- | Name | Type | Description |
209
- | --- | --- | --- |
210
- | fields | [<code>Array.&lt;Label&gt;</code>](#Label) | The Label name. |
211
-
212
- <a name="DynamicFields"></a>
213
-
214
- ## DynamicFields : <code>Object</code>
215
- The dynamic fields payload.
216
-
217
- **Kind**: global typedef
218
- **Properties**
219
-
220
- | Name | Type | Description |
221
- | --- | --- | --- |
222
- | map_fields_object | <code>Object.&lt;string, DynamicField&gt;</code> | desc. |
223
-
224
- <a name="Config"></a>
225
-
226
- ## Config : <code>Object</code>
227
- The configuration data for an application.
228
-
229
- **Kind**: global typedef
230
- **Properties**
231
-
232
- | Name | Type | Description |
233
- | --- | --- | --- |
234
- | [config_id] | <code>String</code> | Unique ID for the config. |
235
- | application_data_slots | <code>Object.&lt;string, (string\|number\|boolean)&gt;</code> | A map of application data slots and their values. |
236
- | workflows | [<code>Array.&lt;Workflow&gt;</code>](#Workflow) | Whether the workflow is enabled. |
237
-
238
- <a name="Workflow"></a>
239
-
240
- ## Workflow : <code>Object</code>
241
- The workflow.
242
-
243
- **Kind**: global typedef
244
- **Properties**
245
-
246
- | Name | Type | Description |
247
- | --- | --- | --- |
248
- | id | <code>String</code> | The ID of the workflow. |
249
- | enabled | <code>Boolean</code> | Whether the workflow is enabled. |
250
- | data_slots | <code>Object.&lt;string, (string\|number\|boolean)&gt;</code> | A map of workflow's data slots and their values. |
1
+ # cobalt.js
2
+ Cobalt frontend SDK.
3
+
4
+ ## Install
5
+
6
+ #### npm
7
+ ```bash
8
+ npm install @cobaltio/cobalt-js
9
+ ```
10
+
11
+ #### yarn
12
+ ```bash
13
+ yarn add @cobaltio/cobalt-js
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ <!-- Check the SDK [documentation](docs.md) for detailed information. -->
19
+
20
+ ### Include
21
+
22
+ #### Browser
23
+ ```html
24
+ <!-- use a specific version -->
25
+ <script src="https://cdn.jsdelivr.net/npm/@cobaltio/cobalt-js@3.0.1"></script>
26
+ <!-- use a version range instead of a specific version -->
27
+ <script src="https://cdn.jsdelivr.net/npm/@cobaltio/cobalt-js@3"></script>
28
+ <script src="https://cdn.jsdelivr.net/npm/@cobaltio/cobalt-js@3.0"></script>
29
+ <!-- omit the version completely to use the latest one -->
30
+ <!-- you should NOT use this in production -->
31
+ <script src="https://cdn.jsdelivr.net/npm/@cobaltio/cobalt-js"></script>
32
+ ```
33
+
34
+ #### Node
35
+ ```js
36
+ // CommonJS
37
+ const Cobalt = require("@cobaltio/cobalt-js");
38
+ // ESM
39
+ import Cobalt from "@cobaltio/cobalt-js";
40
+ ```
41
+
42
+ ### Initialize
43
+ ```js
44
+ // initialize with token
45
+ const cobalt = new Cobalt({
46
+ // the token you generate for linked accounts using the cobalt backend SDK
47
+ token: "COBALT_SESSION_TOKEN",
48
+ });
49
+
50
+ // initialize without token
51
+ const cobalt = new Cobalt();
52
+ // the token you generate for linked accounts using the cobalt backend SDK
53
+ cobalt.token = "COBALT_SESSION_TOKEN";
54
+ ```
55
+
56
+ ### SDK
57
+
58
+ ## Classes
59
+
60
+ <dl>
61
+ <dt><a href="#Cobalt">Cobalt</a></dt>
62
+ <dd><p>Cobalt Frontend SDK</p>
63
+ </dd>
64
+ </dl>
65
+
66
+ ## Typedefs
67
+
68
+ <dl>
69
+ <dt><a href="#Application">Application</a> : <code>Object</code></dt>
70
+ <dd><p>An application in Cobalt.</p>
71
+ </dd>
72
+ <dt><a href="#Label">Label</a> : <code>Object</code></dt>
73
+ <dd><p>Field Mapping Label</p>
74
+ </dd>
75
+ <dt><a href="#DynamicField">DynamicField</a> : <code>Object</code></dt>
76
+ <dd><p>Field Mapping Label</p>
77
+ </dd>
78
+ <dt><a href="#DynamicFields">DynamicFields</a> : <code>Object</code></dt>
79
+ <dd><p>The dynamic fields payload.</p>
80
+ </dd>
81
+ <dt><a href="#Config">Config</a> : <code>Object</code></dt>
82
+ <dd><p>The configuration data for an application.</p>
83
+ </dd>
84
+ <dt><a href="#Workflow">Workflow</a> : <code>Object</code></dt>
85
+ <dd><p>The workflow.</p>
86
+ </dd>
87
+ </dl>
88
+
89
+ <a name="Cobalt"></a>
90
+
91
+ ## Cobalt
92
+ Cobalt Frontend SDK
93
+
94
+ **Kind**: global class
95
+
96
+ * [Cobalt](#Cobalt)
97
+ * [new Cobalt(options)](#new_Cobalt_new)
98
+ * [.connect(slug, [payload])](#Cobalt+connect) ⇒ <code>Promise.&lt;Boolean&gt;</code>
99
+ * [.disconnect(slug)](#Cobalt+disconnect) ⇒ <code>Promise.&lt;void&gt;</code>
100
+ * [.config(slug, configId, [fields])](#Cobalt+config) ⇒ [<code>Promise.&lt;Config&gt;</code>](#Config)
101
+ * [.updateConfig(slug, configId, payload)](#Cobalt+updateConfig) [<code>Promise.&lt;Config&gt;</code>](#Config)
102
+ * [.deleteConfig(slug, configId)](#Cobalt+deleteConfig) ⇒ <code>Promise.&lt;unknown&gt;</code>
103
+ * Additional Methods:
104
+ * [.getApp(slug)](#Cobalt+getApp) [<code>Promise.&lt;Application&gt;</code>](#Application)
105
+ * [.getConfig(slug, configId)](#Cobalt+getConfig) [<code>Promise.&lt;Config&gt;</code>](#Config)
106
+
107
+ <a name="new_Cobalt_new"></a>
108
+
109
+ ### new Cobalt(options)
110
+ Cobalt Frontend SDK
111
+
112
+
113
+ | Param | Type | Default | Description |
114
+ | --- | --- | --- | --- |
115
+ | options | <code>Object</code> | | The options to configure the Cobalt SDK. |
116
+ | [options.token] | <code>String</code> | | The session token. |
117
+ | [options.baseUrl] | <code>String</code> | <code>https://api.gocobalt.io</code> | The base URL of the Cobalt API. |
118
+
119
+ <a name="Cobalt+getApp"></a>
120
+
121
+ ### cobalt.getApp(slug) [<code>Promise.&lt;Application&gt;</code>](#Application)
122
+ Returns the application details for the specified application, provided
123
+ the application is enabled in Cobalt.
124
+
125
+ **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
126
+ **Returns**: [<code>Promise.&lt;Application&gt;</code>](#Application) - The application details.
127
+
128
+ | Param | Type | Description |
129
+ | --- | --- | --- |
130
+ | slug | <code>String</code> | The application slug. |
131
+
132
+ <a name="Cobalt+connect"></a>
133
+
134
+ ### cobalt.connect(slug, [payload]) ⇒ <code>Promise.&lt;Boolean&gt;</code>
135
+ Connect the specified application, optionally with the auth data that user provides.
136
+
137
+ **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
138
+ **Returns**: <code>Promise.&lt;Boolean&gt;</code> - Whether the connection was successful.
139
+
140
+ | Param | Type | Default | Description |
141
+ | --- | --- | --- | --- |
142
+ | slug | <code>String</code> | | The application slug. |
143
+ | [payload] | <code>Object.&lt;string, (string\|number\|boolean)&gt;</code> | <code>{}</code> | The key value pairs of auth data. |
144
+
145
+ <a name="Cobalt+disconnect"></a>
146
+
147
+ ### cobalt.disconnect(slug) ⇒ <code>Promise.&lt;void&gt;</code>
148
+ Disconnect the specified application and remove any associated data from Cobalt.
149
+
150
+ **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
151
+
152
+ | Param | Type | Description |
153
+ | --- | --- | --- |
154
+ | slug | <code>String</code> | The application slug. |
155
+
156
+ <a name="Cobalt+config"></a>
157
+
158
+ ### cobalt.config(slug, configId, [fields]) ⇒ [<code>Promise.&lt;Config&gt;</code>](#Config)
159
+ Returns the specified config, or creates one if it doesn't exist.
160
+
161
+ **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
162
+ **Returns**: [<code>Promise.&lt;Config&gt;</code>](#Config) - The specified config.
163
+
164
+ | Param | Type | Description |
165
+ | --- | --- | --- |
166
+ | slug | <code>String</code> | The application slug. |
167
+ | configId | <code>String</code> | A unique ID for the config. |
168
+ | [fields] | [<code>DynamicFields</code>](#DynamicFields) | The dynamic fields payload. |
169
+
170
+ <a name="Cobalt+getConfig"></a>
171
+
172
+ ### cobalt.getConfig(slug, configId) [<code>Promise.&lt;Config&gt;</code>](#Config)
173
+ Returns the specified config.
174
+
175
+ **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
176
+ **Returns**: [<code>Promise.&lt;Config&gt;</code>](#Config) - The specified config.
177
+
178
+ | Param | Type | Description |
179
+ | --- | --- | --- |
180
+ | slug | <code>String</code> | The application slug. |
181
+ | configId | <code>String</code> | The unique ID of the config. |
182
+
183
+ <a name="Cobalt+updateConfig"></a>
184
+
185
+ ### cobalt.updateConfig(slug, configId, payload) ⇒ [<code>Promise.&lt;Config&gt;</code>](#Config)
186
+ Update the specified config.
187
+
188
+ **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
189
+ **Returns**: [<code>Promise.&lt;Config&gt;</code>](#Config) - The specified config.
190
+
191
+ | Param | Type | Description |
192
+ | --- | --- | --- |
193
+ | slug | <code>String</code> | The application slug. |
194
+ | configId | <code>String</code> | The unique ID of the config. |
195
+ | payload | [<code>Config</code>](#Config) | The update payload. |
196
+
197
+ <a name="Cobalt+deleteConfig"></a>
198
+
199
+ ### cobalt.deleteConfig(slug, configId) ⇒ <code>Promise.&lt;unknown&gt;</code>
200
+ Delete the specified config.
201
+
202
+ **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
203
+
204
+ | Param | Type | Description |
205
+ | --- | --- | --- |
206
+ | slug | <code>String</code> | The application slug. |
207
+ | configId | <code>String</code> | The unique ID of the config. |
208
+
209
+ <a name="Application"></a>
210
+
211
+ ## Application : <code>Object</code>
212
+ An application in Cobalt.
213
+
214
+ **Kind**: global typedef
215
+ **Properties**
216
+
217
+ | Name | Type | Description |
218
+ | --- | --- | --- |
219
+ | name | <code>String</code> | The application name. |
220
+ | description | <code>String</code> | The application description. |
221
+ | icon | <code>String</code> | The application icon. |
222
+ | type | <code>String</code> | The application slug for native apps. |
223
+ | [slug] | <code>String</code> | The application slug for custom apps. |
224
+ | auth_type | <code>&quot;oauth2&quot;</code> \| <code>&quot;keybased&quot;</code> | The type of auth used by application. |
225
+ | [connected] | <code>Boolean</code> | Whether the user has connected the application. |
226
+
227
+ <a name="Label"></a>
228
+
229
+ ## Label : <code>Object</code>
230
+ Field Mapping Label
231
+
232
+ **Kind**: global typedef
233
+ **Properties**
234
+
235
+ | Name | Type | Description |
236
+ | --- | --- | --- |
237
+ | name | <code>string</code> | The Label name. |
238
+ | value | <code>string</code> \| <code>number</code> \| <code>boolean</code> | The Label value. |
239
+
240
+ <a name="DynamicField"></a>
241
+
242
+ ## DynamicField : <code>Object</code>
243
+ Field Mapping Label
244
+
245
+ **Kind**: global typedef
246
+ **Properties**
247
+
248
+ | Name | Type | Description |
249
+ | --- | --- | --- |
250
+ | fields | [<code>Array.&lt;Label&gt;</code>](#Label) | The Label name. |
251
+
252
+ <a name="DynamicFields"></a>
253
+
254
+ ## DynamicFields : <code>Object</code>
255
+ The dynamic fields payload.
256
+
257
+ **Kind**: global typedef
258
+ **Properties**
259
+
260
+ | Name | Type | Description |
261
+ | --- | --- | --- |
262
+ | map_fields_object | <code>Object.&lt;string, DynamicField&gt;</code> | desc. |
263
+
264
+ <a name="Config"></a>
265
+
266
+ ## Config : <code>Object</code>
267
+ The configuration data for an application.
268
+
269
+ **Kind**: global typedef
270
+ **Properties**
271
+
272
+ | Name | Type | Description |
273
+ | --- | --- | --- |
274
+ | [config_id] | <code>String</code> | Unique ID for the config. |
275
+ | application_data_slots | <code>Object.&lt;string, (string\|number\|boolean)&gt;</code> | A map of application data slots and their values. |
276
+ | workflows | [<code>Array.&lt;Workflow&gt;</code>](#Workflow) | Whether the workflow is enabled. |
277
+
278
+ <a name="Workflow"></a>
279
+
280
+ ## Workflow : <code>Object</code>
281
+ The workflow.
282
+
283
+ **Kind**: global typedef
284
+ **Properties**
285
+
286
+ | Name | Type | Description |
287
+ | --- | --- | --- |
288
+ | id | <code>String</code> | The ID of the workflow. |
289
+ | enabled | <code>Boolean</code> | Whether the workflow is enabled. |
290
+ | data_slots | <code>Object.&lt;string, (string\|number\|boolean)&gt;</code> | A map of workflow's data slots and their values. |
package/cobalt.js CHANGED
@@ -21,10 +21,20 @@ class Cobalt {
21
21
  return this.sessionToken = typeof token === "string" ? token : "";
22
22
  };
23
23
 
24
+ /**
25
+ * @typedef {Object} Application An application in Cobalt.
26
+ * @property {String} name The application name.
27
+ * @property {String} description The application description.
28
+ * @property {String} icon The application icon.
29
+ * @property {String} type The application slug for native apps.
30
+ * @property {String} [slug] The application slug for custom apps.
31
+ * @property {"oauth2"|"keybased"} auth_type The type of auth used by application.
32
+ * @property {Boolean} [connected] Whether the user has connected the application.
33
+ */
34
+
24
35
  /**
25
36
  * Returns the application details for the specified application, provided
26
37
  * the application is enabled in Cobalt.
27
- * @private
28
38
  * @param {String} slug The application slug.
29
39
  * @returns {Promise<Application>} The application details.
30
40
  */
package/docs.md CHANGED
@@ -9,6 +9,9 @@
9
9
  ## Typedefs
10
10
 
11
11
  <dl>
12
+ <dt><a href="#Application">Application</a> : <code>Object</code></dt>
13
+ <dd><p>An application in Cobalt.</p>
14
+ </dd>
12
15
  <dt><a href="#Label">Label</a> : <code>Object</code></dt>
13
16
  <dd><p>Field Mapping Label</p>
14
17
  </dd>
@@ -35,6 +38,7 @@ Cobalt Frontend SDK
35
38
 
36
39
  * [Cobalt](#Cobalt)
37
40
  * [new Cobalt(options)](#new_Cobalt_new)
41
+ * [.getApp(slug)](#Cobalt+getApp) ⇒ [<code>Promise.&lt;Application&gt;</code>](#Application)
38
42
  * [.connect(slug, [payload])](#Cobalt+connect) ⇒ <code>Promise.&lt;Boolean&gt;</code>
39
43
  * [.disconnect(slug)](#Cobalt+disconnect) ⇒ <code>Promise.&lt;void&gt;</code>
40
44
  * [.config(slug, configId, [fields])](#Cobalt+config) ⇒ [<code>Promise.&lt;Config&gt;</code>](#Config)
@@ -54,6 +58,19 @@ Cobalt Frontend SDK
54
58
  | [options.token] | <code>String</code> | | The session token. |
55
59
  | [options.baseUrl] | <code>String</code> | <code>https://api.gocobalt.io</code> | The base URL of the Cobalt API. |
56
60
 
61
+ <a name="Cobalt+getApp"></a>
62
+
63
+ ### cobalt.getApp(slug) ⇒ [<code>Promise.&lt;Application&gt;</code>](#Application)
64
+ Returns the application details for the specified application, provided
65
+ the application is enabled in Cobalt.
66
+
67
+ **Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
68
+ **Returns**: [<code>Promise.&lt;Application&gt;</code>](#Application) - The application details.
69
+
70
+ | Param | Type | Description |
71
+ | --- | --- | --- |
72
+ | slug | <code>String</code> | The application slug. |
73
+
57
74
  <a name="Cobalt+connect"></a>
58
75
 
59
76
  ### cobalt.connect(slug, [payload]) ⇒ <code>Promise.&lt;Boolean&gt;</code>
@@ -131,6 +148,24 @@ Delete the specified config.
131
148
  | slug | <code>String</code> | The application slug. |
132
149
  | configId | <code>String</code> | The unique ID of the config. |
133
150
 
151
+ <a name="Application"></a>
152
+
153
+ ## Application : <code>Object</code>
154
+ An application in Cobalt.
155
+
156
+ **Kind**: global typedef
157
+ **Properties**
158
+
159
+ | Name | Type | Description |
160
+ | --- | --- | --- |
161
+ | name | <code>String</code> | The application name. |
162
+ | description | <code>String</code> | The application description. |
163
+ | icon | <code>String</code> | The application icon. |
164
+ | type | <code>String</code> | The application slug for native apps. |
165
+ | [slug] | <code>String</code> | The application slug for custom apps. |
166
+ | auth_type | <code>&quot;oauth2&quot;</code> \| <code>&quot;keybased&quot;</code> | The type of auth used by application. |
167
+ | [connected] | <code>Boolean</code> | Whether the user has connected the application. |
168
+
134
169
  <a name="Label"></a>
135
170
 
136
171
  ## Label : <code>Object</code>
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
- {
2
- "name": "@cobaltio/cobalt-js",
3
- "version": "3.0.0",
4
- "description": "Cobalt frontend SDK",
5
- "main": "./cobalt.js",
6
- "scripts": {
7
- "docgen": "jsdoc2md cobalt.js > docs.md",
8
- "test": "echo \"Warn: no test specified\""
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/Breakout-Embed/cobalt.js.git"
13
- },
14
- "publishConfig": {
15
- "access": "public",
16
- "registry": "https://registry.npmjs.org/"
17
- },
18
- "keywords": [
19
- "cobalt embed",
20
- "cobalt sdk",
21
- "frontend sdk",
22
- "sdk"
23
- ],
24
- "author": "Sankarsan Kampa",
25
- "license": "MIT",
26
- "bugs": {
27
- "url": "https://github.com/Breakout-Embed/cobalt-js/issues"
28
- },
29
- "homepage": "https://github.com/Breakout-Embed/cobalt-js#readme",
30
- "devDependencies": {
31
- "jsdoc": "^4.0.2",
32
- "jsdoc-to-markdown": "^8.0.0"
33
- }
34
- }
1
+ {
2
+ "name": "@cobaltio/cobalt-js",
3
+ "version": "3.0.2",
4
+ "description": "Cobalt frontend SDK",
5
+ "main": "./cobalt.js",
6
+ "scripts": {
7
+ "docgen": "jsdoc2md cobalt.js > docs.md",
8
+ "test": "echo \"Warn: no test specified\""
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/Breakout-Embed/cobalt.js.git"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public",
16
+ "registry": "https://registry.npmjs.org/"
17
+ },
18
+ "keywords": [
19
+ "cobalt embed",
20
+ "cobalt sdk",
21
+ "frontend sdk",
22
+ "sdk"
23
+ ],
24
+ "author": "Sankarsan Kampa",
25
+ "license": "MIT",
26
+ "bugs": {
27
+ "url": "https://github.com/Breakout-Embed/cobalt-js/issues"
28
+ },
29
+ "homepage": "https://github.com/Breakout-Embed/cobalt-js#readme",
30
+ "devDependencies": {
31
+ "jsdoc": "^4.0.2",
32
+ "jsdoc-to-markdown": "^8.0.0"
33
+ }
34
+ }