@capturebridge/sdk 0.33.0 → 0.34.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/Plugin.js +30 -0
- package/README.md +2 -2
- package/Version.js +1 -1
- package/package.json +1 -1
package/Plugin.js
CHANGED
|
@@ -94,6 +94,14 @@ class Plugin {
|
|
|
94
94
|
return device ? new Device(device, this, this.baseUrl) : null
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Obtain the JSON schema for a plugin's configuration
|
|
99
|
+
* @method
|
|
100
|
+
* @async
|
|
101
|
+
* @see {@link https://local.capturebridge.net:9001/doc/#api-Plugin-GetPluginConfigSchema|GetPluginConfigSchema Endpoint (/plugin/:pluginId/config/schema)}
|
|
102
|
+
* @example
|
|
103
|
+
* let schema = await plugin.configSchema()
|
|
104
|
+
*/
|
|
97
105
|
async configSchema () {
|
|
98
106
|
if (!await this.supportsConfig()) {
|
|
99
107
|
throw new Error('Plugin does not support config')
|
|
@@ -102,6 +110,15 @@ class Plugin {
|
|
|
102
110
|
return await response.json()
|
|
103
111
|
}
|
|
104
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Obtain a plugin's configuration
|
|
115
|
+
* @method
|
|
116
|
+
* @async
|
|
117
|
+
* @see {@link https://local.capturebridge.net:9001/doc/#api-Plugin-GetPluginConfig|GetPluginConfig Endpoint (/plugin/:pluginId/config)}
|
|
118
|
+
* @returns {object} config - Plugin configuration object
|
|
119
|
+
* @example
|
|
120
|
+
* let config = await plugin.config()
|
|
121
|
+
*/
|
|
105
122
|
async config () {
|
|
106
123
|
if (!await this.supportsConfig()) {
|
|
107
124
|
throw new Error('Plugin does not support config')
|
|
@@ -110,6 +127,18 @@ class Plugin {
|
|
|
110
127
|
return await response.json()
|
|
111
128
|
}
|
|
112
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Update a plugin's configuration
|
|
132
|
+
* @method
|
|
133
|
+
* @async
|
|
134
|
+
* @see {@link https://local.capturebridge.net:9001/doc/#api-Plugin-SetPluginConfig|SetPluginConfig Endpoint (/plugin/:pluginId/config)}
|
|
135
|
+
* @param {object} config - Plugin configuration object
|
|
136
|
+
* @returns {object} The updated configuration
|
|
137
|
+
* @example
|
|
138
|
+
* let config = await plugin.config()
|
|
139
|
+
* config.knob = 1000
|
|
140
|
+
* config = await plugin.saveConfig(config)
|
|
141
|
+
*/
|
|
113
142
|
async saveConfig (config) {
|
|
114
143
|
if (!await this.supportsConfig()) {
|
|
115
144
|
throw new Error('Plugin does not support config')
|
|
@@ -124,6 +153,7 @@ class Plugin {
|
|
|
124
153
|
}
|
|
125
154
|
const url = `${this.baseUrl}/plugin/${this.id}/config`
|
|
126
155
|
const response = await fetch(url, options)
|
|
156
|
+
await checkResponse(response)
|
|
127
157
|
return await response.json()
|
|
128
158
|
}
|
|
129
159
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
# Capture Bridge JavaScript Client SDK
|
|
2
2
|
|
|
3
|
-
- [SDK Documentation for v0.
|
|
4
|
-
- [SDK CHANGELOG](https://docs.capturebridge.net/client/sdk/javascript/0.
|
|
3
|
+
- [SDK Documentation for v0.34.0](https://docs.capturebridge.net/client/sdk/javascript/0.34.0/index.html)
|
|
4
|
+
- [SDK CHANGELOG](https://docs.capturebridge.net/client/sdk/javascript/0.34.0/CHANGELOG.html)
|
package/Version.js
CHANGED