@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.
- package/README.md +290 -250
- package/cobalt.js +11 -1
- package/docs.md +35 -0
- 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
|
-
<!--
|
|
25
|
-
<script src="https://cdn.jsdelivr.net/npm/@cobaltio/cobalt-js"></script>
|
|
26
|
-
<!--
|
|
27
|
-
<script src="https://cdn.jsdelivr.net/npm/@cobaltio/cobalt-js@
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
</
|
|
81
|
-
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Cobalt
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
|
221
|
-
|
|
|
222
|
-
|
|
|
223
|
-
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
|
236
|
-
|
|
|
237
|
-
|
|
238
|
-
<
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
|
249
|
-
|
|
|
250
|
-
|
|
|
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.<Boolean></code>
|
|
99
|
+
* [.disconnect(slug)](#Cobalt+disconnect) ⇒ <code>Promise.<void></code>
|
|
100
|
+
* [.config(slug, configId, [fields])](#Cobalt+config) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
101
|
+
* [.updateConfig(slug, configId, payload)](#Cobalt+updateConfig) ⇒ [<code>Promise.<Config></code>](#Config)
|
|
102
|
+
* [.deleteConfig(slug, configId)](#Cobalt+deleteConfig) ⇒ <code>Promise.<unknown></code>
|
|
103
|
+
* Additional Methods:
|
|
104
|
+
* [.getApp(slug)](#Cobalt+getApp) ⇒ [<code>Promise.<Application></code>](#Application)
|
|
105
|
+
* [.getConfig(slug, configId)](#Cobalt+getConfig) ⇒ [<code>Promise.<Config></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.<Application></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.<Application></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.<Boolean></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.<Boolean></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.<string, (string\|number\|boolean)></code> | <code>{}</code> | The key value pairs of auth data. |
|
|
144
|
+
|
|
145
|
+
<a name="Cobalt+disconnect"></a>
|
|
146
|
+
|
|
147
|
+
### cobalt.disconnect(slug) ⇒ <code>Promise.<void></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.<Config></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.<Config></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.<Config></code>](#Config)
|
|
173
|
+
Returns the specified config.
|
|
174
|
+
|
|
175
|
+
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
176
|
+
**Returns**: [<code>Promise.<Config></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.<Config></code>](#Config)
|
|
186
|
+
Update the specified config.
|
|
187
|
+
|
|
188
|
+
**Kind**: instance method of [<code>Cobalt</code>](#Cobalt)
|
|
189
|
+
**Returns**: [<code>Promise.<Config></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.<unknown></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>"oauth2"</code> \| <code>"keybased"</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.<Label></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.<string, DynamicField></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.<string, (string\|number\|boolean)></code> | A map of application data slots and their values. |
|
|
276
|
+
| workflows | [<code>Array.<Workflow></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.<string, (string\|number\|boolean)></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.<Application></code>](#Application)
|
|
38
42
|
* [.connect(slug, [payload])](#Cobalt+connect) ⇒ <code>Promise.<Boolean></code>
|
|
39
43
|
* [.disconnect(slug)](#Cobalt+disconnect) ⇒ <code>Promise.<void></code>
|
|
40
44
|
* [.config(slug, configId, [fields])](#Cobalt+config) ⇒ [<code>Promise.<Config></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.<Application></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.<Application></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.<Boolean></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>"oauth2"</code> \| <code>"keybased"</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.
|
|
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
|
+
}
|