particle-api-js 11.1.7 → 12.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 +90 -10
- package/dist/particle.min.js +1 -1
- package/dist/particle.min.js.map +1 -1
- package/fs.d.ts +2 -0
- package/lib/fs.d.ts +2 -0
- package/lib/fs.js +3 -0
- package/lib/package.json +109 -0
- package/lib/src/Agent.d.ts +38 -0
- package/lib/src/Agent.d.ts.map +1 -0
- package/lib/src/Agent.js +228 -0
- package/lib/src/Agent.js.map +1 -0
- package/lib/src/Client.d.ts +80 -0
- package/lib/src/Client.d.ts.map +1 -0
- package/lib/src/Client.js +104 -0
- package/lib/src/Client.js.map +1 -0
- package/lib/src/Defaults.d.ts +6 -0
- package/lib/src/Defaults.d.ts.map +1 -0
- package/lib/src/Defaults.js +12 -0
- package/lib/src/Defaults.js.map +1 -0
- package/lib/src/EventStream.d.ts +29 -0
- package/lib/src/EventStream.d.ts.map +1 -0
- package/lib/src/EventStream.js +270 -0
- package/lib/src/EventStream.js.map +1 -0
- package/lib/src/Library.d.ts +33 -0
- package/lib/src/Library.d.ts.map +1 -0
- package/lib/src/Library.js +19 -0
- package/lib/src/Library.js.map +1 -0
- package/{src/Particle.js → lib/src/Particle.d.ts} +790 -1666
- package/lib/src/Particle.d.ts.map +1 -0
- package/lib/src/Particle.js +2794 -0
- package/lib/src/Particle.js.map +1 -0
- package/lib/src/types/common.d.ts +71 -0
- package/lib/src/types/common.d.ts.map +1 -0
- package/lib/src/types/common.js +3 -0
- package/lib/src/types/common.js.map +1 -0
- package/lib/src/types/index.d.ts +4 -0
- package/lib/src/types/index.d.ts.map +1 -0
- package/lib/src/types/index.js +20 -0
- package/lib/src/types/index.js.map +1 -0
- package/lib/src/types/requests.d.ts +667 -0
- package/lib/src/types/requests.d.ts.map +1 -0
- package/lib/src/types/requests.js +3 -0
- package/lib/src/types/requests.js.map +1 -0
- package/lib/src/types/responses.d.ts +472 -0
- package/lib/src/types/responses.d.ts.map +1 -0
- package/lib/src/types/responses.js +3 -0
- package/lib/src/types/responses.js.map +1 -0
- package/package.json +34 -14
- package/scripts/postprocess-docs.js +306 -0
- package/typedoc.json +20 -0
- package/.circleci/config.yml +0 -104
- package/.nvmrc +0 -1
- package/CHANGELOG.md +0 -404
- package/EventStream-e2e-browser.html +0 -39
- package/EventStream-e2e-node.js +0 -34
- package/RELEASE.md +0 -12
- package/bower.json +0 -30
- package/docs/api.md +0 -2594
- package/eslint.config.mjs +0 -7
- package/examples/login/login.html +0 -17
- package/karma.conf.js +0 -80
- package/src/Agent.js +0 -397
- package/src/Client.js +0 -171
- package/src/Defaults.js +0 -8
- package/src/EventStream.js +0 -269
- package/src/Library.js +0 -33
- package/test/Agent.integration.js +0 -23
- package/test/Agent.spec.js +0 -488
- package/test/Client.spec.js +0 -216
- package/test/Defaults.spec.js +0 -30
- package/test/EventStream.feature +0 -65
- package/test/EventStream.spec.js +0 -263
- package/test/FakeAgent.js +0 -27
- package/test/Library.spec.js +0 -40
- package/test/Particle.integration.js +0 -38
- package/test/Particle.spec.js +0 -3198
- package/test/fixtures/index.js +0 -15
- package/test/fixtures/libraries.json +0 -33
- package/test/fixtures/library.json +0 -31
- package/test/fixtures/libraryVersions.json +0 -211
- package/test/out.tmp +0 -0
- package/test/support/FixtureHttpServer.js +0 -28
- package/test/test-setup.js +0 -17
- package/tsconfig.json +0 -17
- package/webpack.config.js +0 -46
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const Client = require('./Client');
|
|
6
|
-
|
|
1
|
+
import EventStream = require('./EventStream');
|
|
2
|
+
import Agent = require('./Agent');
|
|
3
|
+
import Client = require('./Client');
|
|
4
|
+
import type { JSONResponse, RequestResponse, AgentRequestOptions, GetHeadOptions, MutateOptions, ToolContext, ProjectContext, LoginOptions, SendOtpOptions, LoginAsClientOwnerOptions, EnableMfaOptions, ConfirmMfaOptions, DisableMfaOptions, ResetPasswordOptions, ChangeUsernameOptions, ChangeUserPasswordOptions, DeleteUserOptions, TrackingIdentityOptions, DeleteAccessTokenOptions, DeleteCurrentAccessTokenOptions, DeleteActiveAccessTokensOptions, GetDeviceOptions, ClaimDeviceOptions, RemoveDeviceOptions, RemoveDeviceOwnerOptions, UpdateDeviceOptions, RenameDeviceOptions, SignalDeviceOptions, FlashDeviceOptions, CallFunctionOptions, GetVariableOptions, UnprotectDeviceOptions, DownloadManufacturingBackupOptions, CompileCodeOptions, DownloadFirmwareBinaryOptions, ProvisionDeviceOptions, GetEventStreamOptions, ListProductFirmwareOptions, UploadProductFirmwareOptions, GetProductFirmwareOptions, UpdateProductFirmwareOptions, ReleaseFirmwareOptions, DownloadProductFirmwareOptions, AddDeviceToProductOptions, ListWebhooksOptions, DeleteWebhookOptions, ListIntegrationsOptions, CreateIntegrationOptions, EditIntegrationOptions, DeleteIntegrationOptions, ListSIMsOptions, CheckSIMOptions, ActivateSIMOptions, DeactivateSIMOptions, ReactivateSIMOptions, UpdateSIMOptions, RemoveSIMOptions, GetSIMDataUsageOptions, GetFleetDataUsageOptions, ListProductsOptions, GetProductOptions, GetProductConfigurationOptions, GetProductConfigurationSchemaOptions, GetProductDeviceConfigurationOptions, GetProductDeviceConfigurationSchemaOptions, SetProductConfigurationOptions, SetProductDeviceConfigurationOptions, GetProductLocationsOptions, GetProductDeviceLocationsOptions, ListMeshNetworksOptions, CreateMeshNetworkOptions, GetMeshNetworkOptions, UpdateMeshNetworkOptions, RemoveMeshNetworkOptions, ListMeshNetworkDevicesOptions, RemoveMeshNetworkDeviceOptions, ListOAuthClientsOptions, UpdateOAuthClientOptions, DeleteOAuthClientOptions, ListLibrariesOptions, GetLibraryOptions, GetLibraryVersionsOptions, ContributeLibraryOptions, PublishLibraryOptions, DeleteLibraryOptions, ListBuildTargetsOptions, ListDeviceOsVersionsOptions, GetDeviceOsVersionOptions, GetClaimCodeOptions, LookupSerialNumberOptions, DownloadFileOptions, ListTeamMembersOptions, InviteTeamMemberOptions, RemoveTeamMemberOptions, CreateCustomerOptions, ExecuteLogicOptions, ListLogicFunctionsOptions, GetLogicFunctionOptions, DeleteLogicFunctionOptions, ListLogicRunsOptions, GetLogicRunOptions, GetLogicRunLogsOptions, ListLedgersOptions, CreateLedgerOptions, GetLedgerOptions, UpdateLedgerOptions, ArchiveLedgerOptions, ListLedgerInstancesOptions, GetLedgerInstanceOptions, SetLedgerInstanceOptions, DeleteLedgerInstanceOptions, ListLedgerInstanceVersionsOptions, GetLedgerInstanceVersionOptions, ListEnvVarsOptions, UpdateEnvVarsOptions, SetEnvVarOptions, DeleteEnvVarOptions, RenderEnvVarsOptions, ReviewEnvVarsRolloutOptions, StartEnvVarsRolloutOptions, OKResponse, LoginResponse, EnableMfaResponse, ConfirmMfaResponse, CreateCustomerResponse, TrackingIdentityResponse, UserInfo, DeviceInfo, ClaimResponse, ClaimCodeResponse, DeviceVariableResponse, FunctionCallResponse, CompileResponse, ProductFirmwareInfo, WebhookInfo, CreateWebhookResponse, IntegrationInfo, SimInfo, SimDataUsage, ProductInfo, TeamMember, SerialNumberResponse, BuildTargetsResponse, LibraryInfo, OAuthClientInfo, NetworkInfo, ProductConfigurationResponse, LocationListResponse, DeviceLocationInfo, ExecuteLogicResponse, LogicFunction, LogicRun, LogicRunLog, LedgerDefinition, LedgerInstance, LedgerInstanceListResponse, LedgerVersionListResponse, DeviceOsVersion, EnvVarsResponse, EnvVarsRenderResponse, EnvVarsRolloutResponse, EnvVarsRolloutStartResponse } from './types';
|
|
7
5
|
/**
|
|
8
6
|
* Particle Cloud API wrapper.
|
|
9
7
|
*
|
|
@@ -13,12 +11,20 @@ const Client = require('./Client');
|
|
|
13
11
|
* Most Particle methods take a single unnamed argument object documented as
|
|
14
12
|
* `options` with key/value pairs for each option.
|
|
15
13
|
*
|
|
16
|
-
* @typedef {import('./Agent').RequestResponse} RequestResponse
|
|
17
|
-
* @typedef {import('./Agent').RequestError} RequestError
|
|
18
14
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
declare class Particle {
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
clientId: string;
|
|
18
|
+
clientSecret: string;
|
|
19
|
+
tokenDuration: number;
|
|
20
|
+
auth: string | undefined;
|
|
21
|
+
context: {
|
|
22
|
+
tool?: ToolContext;
|
|
23
|
+
project?: ProjectContext;
|
|
24
|
+
};
|
|
25
|
+
agent: Agent;
|
|
26
|
+
_defaultAuth?: string;
|
|
27
|
+
/**
|
|
22
28
|
* Contructor for the Cloud API wrapper.
|
|
23
29
|
*
|
|
24
30
|
* Create a new Particle object and call methods below on it.
|
|
@@ -30,62 +36,28 @@ class Particle {
|
|
|
30
36
|
* @param {number} [options.tokenDuration]
|
|
31
37
|
* @param {string} [options.auth] The access token. If not specified here, will have to be added to every request
|
|
32
38
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.agent = new Agent(this.baseUrl);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
_isValidContext(name, context){
|
|
46
|
-
return (name === 'tool' || name === 'project') && context !== undefined;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
39
|
+
constructor(options?: {
|
|
40
|
+
baseUrl?: string;
|
|
41
|
+
clientId?: string;
|
|
42
|
+
clientSecret?: string;
|
|
43
|
+
tokenDuration?: number;
|
|
44
|
+
auth?: string;
|
|
45
|
+
});
|
|
46
|
+
private _isValidContext;
|
|
47
|
+
/**
|
|
50
48
|
* @typedef {Object} ToolContext
|
|
51
49
|
* @property {string} name
|
|
52
50
|
* @property {string | number} [version]
|
|
53
51
|
* @property {Omit<ToolContext, 'components'>[]} [components]
|
|
54
52
|
*/
|
|
55
|
-
|
|
56
|
-
/**
|
|
53
|
+
/**
|
|
57
54
|
* @typedef {Record<string, string | number>} ProjectContext
|
|
58
55
|
* @property {string} name
|
|
59
56
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* Project- x-particle-project
|
|
65
|
-
* @param {'tool' | 'project'} name
|
|
66
|
-
* @param {ToolContext | ProjectContext | undefined} context
|
|
67
|
-
*/
|
|
68
|
-
setContext(name, context){
|
|
69
|
-
if (context !== undefined){
|
|
70
|
-
if (this._isValidContext(name, context)){
|
|
71
|
-
this.context[name] = context;
|
|
72
|
-
} else {
|
|
73
|
-
throw Error('unknown context name or undefined context: ' + name);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Builds the final context from the context parameter and the context items in the api.
|
|
80
|
-
* @param {Object} context The invocation context, this takes precedence over the local context.
|
|
81
|
-
* @returns {Object} The context to use.
|
|
82
|
-
* @private
|
|
83
|
-
*/
|
|
84
|
-
_buildContext(context){
|
|
85
|
-
return Object.assign(this.context, context);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
57
|
+
/** @internal */
|
|
58
|
+
setContext(name: 'tool' | 'project', context: ToolContext | ProjectContext | undefined): void;
|
|
59
|
+
private _buildContext;
|
|
60
|
+
/**
|
|
89
61
|
* Login to Particle Cloud using an existing Particle acccount.
|
|
90
62
|
* @param {Object} options Options for this API call
|
|
91
63
|
* @param {String} options.username Username for the Particle account
|
|
@@ -93,68 +65,29 @@ class Particle {
|
|
|
93
65
|
* @param {Number} options.tokenDuration How long the access token should last in seconds
|
|
94
66
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
95
67
|
* @param {Number} [options.context] Request context
|
|
96
|
-
* @returns {Promise} A promise
|
|
68
|
+
* @returns {Promise<JSONResponse<LoginResponse>>} A promise that resolves with the response data
|
|
97
69
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return this.request({
|
|
101
|
-
uri: '/oauth/token',
|
|
102
|
-
method: 'post',
|
|
103
|
-
headers,
|
|
104
|
-
form: {
|
|
105
|
-
username,
|
|
106
|
-
password,
|
|
107
|
-
grant_type: 'password',
|
|
108
|
-
// @ts-ignore
|
|
109
|
-
client_id: this.clientId,
|
|
110
|
-
// @ts-ignore
|
|
111
|
-
client_secret: this.clientSecret,
|
|
112
|
-
expires_in: tokenDuration
|
|
113
|
-
},
|
|
114
|
-
context
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
70
|
+
login({ username, password, tokenDuration, headers, context }: LoginOptions): Promise<JSONResponse<LoginResponse>>;
|
|
71
|
+
/**
|
|
119
72
|
* If login failed with an 'mfa_required' error, this must be called with a valid OTP code to login
|
|
120
73
|
* @param {Object} options Options for this API call
|
|
121
74
|
* @param {String} options.mfaToken Given as 'mfa_token' in the error body of `.login()`.
|
|
122
75
|
* @param {String} options.otp Current one-time-password generated from the authentication application
|
|
123
76
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
124
77
|
* @param {Number} [options.context] Request context
|
|
125
|
-
* @returns {Promise} A promise
|
|
78
|
+
* @returns {Promise<JSONResponse<LoginResponse>>} A promise that resolves with the response data
|
|
126
79
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
uri: '/oauth/token',
|
|
130
|
-
method: 'post',
|
|
131
|
-
headers,
|
|
132
|
-
form: {
|
|
133
|
-
grant_type: 'urn:custom:mfa-otp',
|
|
134
|
-
mfa_token: mfaToken,
|
|
135
|
-
otp,
|
|
136
|
-
// @ts-ignore
|
|
137
|
-
client_id: this.clientId,
|
|
138
|
-
// @ts-ignore
|
|
139
|
-
client_secret: this.clientSecret
|
|
140
|
-
},
|
|
141
|
-
context
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
80
|
+
sendOtp({ mfaToken, otp, headers, context }: SendOtpOptions): Promise<JSONResponse<LoginResponse>>;
|
|
81
|
+
/**
|
|
146
82
|
* Enable MFA on the currently logged in user
|
|
147
83
|
* @param {Object} options Options for this API call
|
|
148
84
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
149
85
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
150
86
|
* @param {Object} [options.context] Request context
|
|
151
|
-
* @returns {Promise} A promise
|
|
87
|
+
* @returns {Promise<JSONResponse<EnableMfaResponse>>} A promise that resolves with the response data
|
|
152
88
|
*/
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
89
|
+
enableMfa({ auth, headers, context }: EnableMfaOptions): Promise<JSONResponse<EnableMfaResponse>>;
|
|
90
|
+
/**
|
|
158
91
|
* Confirm MFA for the user. This must be called with current TOTP code, determined from the results of enableMfa(). You will be prompted to enter an OTP code every time you login after enrollment is confirmed.
|
|
159
92
|
* @param {Object} options Options for this API call
|
|
160
93
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
@@ -163,44 +96,20 @@ class Particle {
|
|
|
163
96
|
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
|
|
164
97
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
165
98
|
* @param {Object} [options.context] Request context
|
|
166
|
-
* @returns {Promise} A promise
|
|
99
|
+
* @returns {Promise<JSONResponse<ConfirmMfaResponse>>} A promise that resolves with the response data
|
|
167
100
|
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if (invalidateTokens) {
|
|
172
|
-
data.invalidate_tokens = true;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return this.post({
|
|
176
|
-
uri: '/v1/user/mfa-enable',
|
|
177
|
-
auth,
|
|
178
|
-
headers,
|
|
179
|
-
data,
|
|
180
|
-
context
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
101
|
+
confirmMfa({ mfaToken, otp, invalidateTokens, auth, headers, context }: ConfirmMfaOptions): Promise<JSONResponse<ConfirmMfaResponse>>;
|
|
102
|
+
/**
|
|
185
103
|
* Disable MFA for the user.
|
|
186
104
|
* @param {Object} options Options for this API call
|
|
187
105
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
188
106
|
* @param {Object} options.currentPassword User's current password
|
|
189
107
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
190
108
|
* @param {Object} [options.context] Request context
|
|
191
|
-
* @returns {Promise} A promise
|
|
109
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
192
110
|
*/
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
uri: '/v1/user/mfa-disable',
|
|
196
|
-
auth,
|
|
197
|
-
headers,
|
|
198
|
-
data: { current_password: currentPassword },
|
|
199
|
-
context
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
111
|
+
disableMfa({ currentPassword, auth, headers, context }: DisableMfaOptions): Promise<JSONResponse<OKResponse>>;
|
|
112
|
+
/**
|
|
204
113
|
* Create Customer for Product.
|
|
205
114
|
* @param {Object} options Options for this API call
|
|
206
115
|
* @param {String} options.email Username for the Particle account
|
|
@@ -208,50 +117,18 @@ class Particle {
|
|
|
208
117
|
* @param {String} options.product Create the customer in this product ID or slug
|
|
209
118
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
210
119
|
* @param {Object} [options.context] Request context
|
|
211
|
-
* @returns {Promise} A promise
|
|
120
|
+
* @returns {Promise<JSONResponse<CreateCustomerResponse>>} A promise that resolves with the response data
|
|
212
121
|
*/
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
uri: `/v1/products/${product}/customers`,
|
|
216
|
-
method: 'post',
|
|
217
|
-
headers,
|
|
218
|
-
form: {
|
|
219
|
-
email,
|
|
220
|
-
password,
|
|
221
|
-
grant_type: 'client_credentials',
|
|
222
|
-
// @ts-ignore
|
|
223
|
-
client_id: this.clientId,
|
|
224
|
-
// @ts-ignore
|
|
225
|
-
client_secret: this.clientSecret
|
|
226
|
-
},
|
|
227
|
-
context
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
122
|
+
createCustomer({ email, password, product, headers, context }: CreateCustomerOptions): Promise<JSONResponse<CreateCustomerResponse>>;
|
|
123
|
+
/**
|
|
232
124
|
* Login to Particle Cloud using an OAuth client.
|
|
233
125
|
* @param {Object} options Options for this API call
|
|
234
126
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
235
127
|
* @param {Object} [options.context] Request context
|
|
236
|
-
* @returns {Promise} A promise
|
|
128
|
+
* @returns {Promise<JSONResponse<LoginResponse>>} A promise that resolves with the response data
|
|
237
129
|
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
uri: '/oauth/token',
|
|
241
|
-
method: 'post',
|
|
242
|
-
headers,
|
|
243
|
-
form: {
|
|
244
|
-
grant_type: 'client_credentials',
|
|
245
|
-
// @ts-ignore
|
|
246
|
-
client_id: this.clientId,
|
|
247
|
-
// @ts-ignore
|
|
248
|
-
client_secret: this.clientSecret
|
|
249
|
-
},
|
|
250
|
-
context
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
130
|
+
loginAsClientOwner({ headers, context }?: LoginAsClientOwnerOptions): Promise<JSONResponse<LoginResponse>>;
|
|
131
|
+
/**
|
|
255
132
|
* Create a user account for the Particle Cloud
|
|
256
133
|
* @param {Object} options Options for this API call
|
|
257
134
|
* @param {String} options.username Email of the new user
|
|
@@ -260,126 +137,66 @@ class Particle {
|
|
|
260
137
|
* @param {Object} [options.utm] Object that contains info about the campaign that lead to this user creation
|
|
261
138
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
262
139
|
* @param {Object} [options.context] Request context
|
|
263
|
-
* @returns {Promise} A promise
|
|
264
|
-
*/
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Verify new user account via verification email
|
|
281
|
-
* @param {Object} options Options for this API call
|
|
282
|
-
* @param {String} options.token The string token sent in the verification email
|
|
283
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
284
|
-
* @param {Object} [options.context] Request context
|
|
285
|
-
* @returns {Promise} A promise
|
|
286
|
-
*/
|
|
287
|
-
verifyUser({ token, headers, context }){
|
|
288
|
-
return this.post({
|
|
289
|
-
uri: '/v1/user/verify',
|
|
290
|
-
headers,
|
|
291
|
-
data: { token },
|
|
292
|
-
context
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
140
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
141
|
+
*/
|
|
142
|
+
createUser({ username, password, accountInfo, utm, headers, context }: {
|
|
143
|
+
username: string;
|
|
144
|
+
password: string;
|
|
145
|
+
accountInfo?: Record<string, string | number | boolean>;
|
|
146
|
+
utm?: Record<string, string>;
|
|
147
|
+
headers?: Record<string, string>;
|
|
148
|
+
context?: {
|
|
149
|
+
tool?: ToolContext;
|
|
150
|
+
project?: ProjectContext;
|
|
151
|
+
};
|
|
152
|
+
}): Promise<JSONResponse<OKResponse>>;
|
|
153
|
+
/**
|
|
297
154
|
* Send reset password email for a Particle Cloud user account
|
|
298
155
|
* @param {Object} options Options for this API call
|
|
299
156
|
* @param {String} options.username Email of the user
|
|
300
157
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
301
158
|
* @param {Object} [options.context] Request context
|
|
302
|
-
* @returns {Promise} A promise
|
|
159
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
303
160
|
*/
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
uri: '/v1/user/password-reset',
|
|
307
|
-
headers,
|
|
308
|
-
data: { username },
|
|
309
|
-
context
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
161
|
+
resetPassword({ username, headers, context }: ResetPasswordOptions): Promise<JSONResponse<OKResponse>>;
|
|
162
|
+
/**
|
|
314
163
|
* Revoke an access token
|
|
315
164
|
* @param {Object} options Options for this API call
|
|
316
165
|
* @param {String} options.token Access token you wish to revoke
|
|
317
166
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
318
167
|
* @param {Object} [options.context] Request context
|
|
319
|
-
* @returns {Promise} A promise
|
|
168
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
320
169
|
*/
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
uri: `/v1/access_tokens/${token}`,
|
|
324
|
-
headers,
|
|
325
|
-
context
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/**
|
|
170
|
+
deleteAccessToken({ token, headers, context }: DeleteAccessTokenOptions): Promise<JSONResponse<OKResponse>>;
|
|
171
|
+
/**
|
|
330
172
|
* Revoke the current session access token
|
|
331
173
|
* @param {Object} options Options for this API call
|
|
332
174
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
333
175
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
334
176
|
* @param {Object} [options.context] Request context
|
|
335
|
-
* @returns {Promise} A promise
|
|
177
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
336
178
|
*/
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
uri: '/v1/access_tokens/current',
|
|
340
|
-
auth,
|
|
341
|
-
headers,
|
|
342
|
-
context
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/**
|
|
179
|
+
deleteCurrentAccessToken({ auth, headers, context }: DeleteCurrentAccessTokenOptions): Promise<JSONResponse<OKResponse>>;
|
|
180
|
+
/**
|
|
347
181
|
* Revoke all active access tokens
|
|
348
182
|
* @param {Object} options Options for this API call
|
|
349
183
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
350
184
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
351
185
|
* @param {Object} [options.context] Request context
|
|
352
|
-
* @returns {Promise} A promise
|
|
186
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
353
187
|
*/
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
uri: '/v1/access_tokens',
|
|
357
|
-
auth,
|
|
358
|
-
headers,
|
|
359
|
-
context
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
188
|
+
deleteActiveAccessTokens({ auth, headers, context }: DeleteActiveAccessTokensOptions): Promise<JSONResponse<OKResponse>>;
|
|
189
|
+
/**
|
|
364
190
|
* Delete the current user
|
|
365
191
|
* @param {Object} options Options for this API call
|
|
366
192
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
367
193
|
* @param {String} options.password Password
|
|
368
194
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
369
195
|
* @param {Object} [options.context] Request context
|
|
370
|
-
* @returns {Promise} A promise
|
|
196
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
371
197
|
*/
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
uri: '/v1/user',
|
|
375
|
-
data: { password },
|
|
376
|
-
auth,
|
|
377
|
-
headers,
|
|
378
|
-
context
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
198
|
+
deleteUser({ auth, password, headers, context }: DeleteUserOptions): Promise<JSONResponse<OKResponse>>;
|
|
199
|
+
/**
|
|
383
200
|
* Retrieves the information that is used to identify the current login for tracking.
|
|
384
201
|
* @param {Object} [options] Options for this API call
|
|
385
202
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
@@ -387,19 +204,10 @@ class Particle {
|
|
|
387
204
|
* retrieve only the unique tracking ID for the current login.
|
|
388
205
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
389
206
|
* @param {Object} [options.context] Request context
|
|
390
|
-
* @returns {Promise<
|
|
391
|
-
*/
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
uri: '/v1/user/identify',
|
|
395
|
-
auth,
|
|
396
|
-
headers,
|
|
397
|
-
query: (full ? undefined : { tracking: 1 }),
|
|
398
|
-
context
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
/**
|
|
207
|
+
* @returns {Promise<JSONResponse<TrackingIdentityResponse>>} A promise that resolves with the response data
|
|
208
|
+
*/
|
|
209
|
+
trackingIdentity({ full, auth, headers, context }?: TrackingIdentityOptions): Promise<JSONResponse<TrackingIdentityResponse>>;
|
|
210
|
+
/**
|
|
403
211
|
* List devices claimed to the account or product
|
|
404
212
|
* @param {Object} options Options for this API call
|
|
405
213
|
* @param {String} [options.deviceId] (Product only) Filter results to devices with this ID (partial matching)
|
|
@@ -413,30 +221,25 @@ class Particle {
|
|
|
413
221
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
414
222
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
415
223
|
* @param {Object} [options.context] Request context
|
|
416
|
-
* @returns {Promise} A promise
|
|
417
|
-
*/
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
return this.get({ uri, auth, headers, query, context });
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/**
|
|
224
|
+
* @returns {Promise<JSONResponse<DeviceInfo[]>>} A promise that resolves with the response data
|
|
225
|
+
*/
|
|
226
|
+
listDevices({ deviceId, deviceName, groups, sortAttr, sortDir, page, perPage, product, auth, headers, context }: {
|
|
227
|
+
deviceId?: string;
|
|
228
|
+
deviceName?: string;
|
|
229
|
+
groups?: string[];
|
|
230
|
+
sortAttr?: string;
|
|
231
|
+
sortDir?: string;
|
|
232
|
+
page?: number;
|
|
233
|
+
perPage?: number;
|
|
234
|
+
product?: string | number;
|
|
235
|
+
auth?: string;
|
|
236
|
+
headers?: Record<string, string>;
|
|
237
|
+
context?: {
|
|
238
|
+
tool?: ToolContext;
|
|
239
|
+
project?: ProjectContext;
|
|
240
|
+
};
|
|
241
|
+
}): Promise<JSONResponse<DeviceInfo[]>>;
|
|
242
|
+
/**
|
|
440
243
|
* Get detailed informationa about a device
|
|
441
244
|
* @param {Object} options Options for this API call
|
|
442
245
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -444,14 +247,10 @@ class Particle {
|
|
|
444
247
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
445
248
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
446
249
|
* @param {Object} [options.context] Request context
|
|
447
|
-
* @returns {Promise} A promise
|
|
250
|
+
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
448
251
|
*/
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
return this.get({ uri, auth, headers, context });
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
/**
|
|
252
|
+
getDevice({ deviceId, product, auth, headers, context }: GetDeviceOptions): Promise<JSONResponse<DeviceInfo>>;
|
|
253
|
+
/**
|
|
455
254
|
* Claim a device to the account. The device must be online and unclaimed.
|
|
456
255
|
* @param {Object} options Options for this API call
|
|
457
256
|
* @param {String} options.deviceId Device ID
|
|
@@ -459,22 +258,10 @@ class Particle {
|
|
|
459
258
|
* @param {boolean} options.requestTransfer True to request the device be transfered from another user
|
|
460
259
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
461
260
|
* @param {Object} [options.context] Request context
|
|
462
|
-
* @returns {Promise} A promise
|
|
261
|
+
* @returns {Promise<JSONResponse<ClaimResponse>>} A promise that resolves with the response data
|
|
463
262
|
*/
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
uri: '/v1/devices',
|
|
467
|
-
auth,
|
|
468
|
-
headers,
|
|
469
|
-
data: {
|
|
470
|
-
id: deviceId,
|
|
471
|
-
request_transfer: !!requestTransfer
|
|
472
|
-
},
|
|
473
|
-
context
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
/**
|
|
263
|
+
claimDevice({ deviceId, requestTransfer, auth, headers, context }: ClaimDeviceOptions): Promise<JSONResponse<ClaimResponse>>;
|
|
264
|
+
/**
|
|
478
265
|
* Add a device to a product or move device out of quarantine.
|
|
479
266
|
* @param {Object} options Options for this API call
|
|
480
267
|
* @param {String} options.deviceId Device ID
|
|
@@ -484,29 +271,10 @@ class Particle {
|
|
|
484
271
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
485
272
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
486
273
|
* @param {Object} [options.context] Request context
|
|
487
|
-
* @returns {Promise} A promise
|
|
274
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
488
275
|
*/
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
if (file){
|
|
493
|
-
files = { file };
|
|
494
|
-
} else if (deviceId){
|
|
495
|
-
data = { id: deviceId };
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
return this.request({
|
|
499
|
-
uri: `/v1/products/${product}/devices`,
|
|
500
|
-
method: 'post',
|
|
501
|
-
headers,
|
|
502
|
-
data,
|
|
503
|
-
files,
|
|
504
|
-
auth,
|
|
505
|
-
context
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
/**
|
|
276
|
+
addDeviceToProduct({ deviceId, product, file, auth, headers, context }: AddDeviceToProductOptions): Promise<JSONResponse<OKResponse>>;
|
|
277
|
+
/**
|
|
510
278
|
* Unclaim / Remove a device from your account or product, or deny quarantine
|
|
511
279
|
* @param {Object} options Options for this API call
|
|
512
280
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -515,15 +283,10 @@ class Particle {
|
|
|
515
283
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
516
284
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
517
285
|
* @param {Object} [options.context] Request context
|
|
518
|
-
* @returns {Promise} A promise
|
|
286
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
519
287
|
*/
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
const data = product ? { deny } : undefined;
|
|
523
|
-
return this.delete({ uri, data, auth, headers, context });
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
/**
|
|
288
|
+
removeDevice({ deviceId, deny, product, auth, headers, context }: RemoveDeviceOptions): Promise<JSONResponse<OKResponse>>;
|
|
289
|
+
/**
|
|
527
290
|
* Unclaim a product device its the owner, but keep it in the product
|
|
528
291
|
* @param {Object} options Options for this API call
|
|
529
292
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -531,14 +294,10 @@ class Particle {
|
|
|
531
294
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
532
295
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
533
296
|
* @param {Object} [options.context] Request context
|
|
534
|
-
* @returns {Promise} A promise
|
|
297
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
535
298
|
*/
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
return this.delete({ uri, auth, headers, context });
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
/**
|
|
299
|
+
removeDeviceOwner({ deviceId, product, auth, headers, context }: RemoveDeviceOwnerOptions): Promise<JSONResponse<OKResponse>>;
|
|
300
|
+
/**
|
|
542
301
|
* Rename a device
|
|
543
302
|
* @param {Object} options Options for this API call
|
|
544
303
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -547,13 +306,10 @@ class Particle {
|
|
|
547
306
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
548
307
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
549
308
|
* @param {Object} [options.context] Request context
|
|
550
|
-
* @returns {Promise} A promise
|
|
309
|
+
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
551
310
|
*/
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
/**
|
|
311
|
+
renameDevice({ deviceId, name, product, auth, headers, context }: RenameDeviceOptions): Promise<JSONResponse<DeviceInfo>>;
|
|
312
|
+
/**
|
|
557
313
|
* Instruct the device to turn on/off the LED in a rainbow pattern
|
|
558
314
|
* @param {Object} options Options for this API call
|
|
559
315
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -562,13 +318,10 @@ class Particle {
|
|
|
562
318
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
563
319
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
564
320
|
* @param {Object} [options.context] Request context
|
|
565
|
-
* @returns {Promise} A promise
|
|
321
|
+
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
566
322
|
*/
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/**
|
|
323
|
+
signalDevice({ deviceId, signal, product, auth, headers, context }: SignalDeviceOptions): Promise<JSONResponse<DeviceInfo>>;
|
|
324
|
+
/**
|
|
572
325
|
* Store some notes about device
|
|
573
326
|
* @param {Object} options Options for this API call
|
|
574
327
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -577,13 +330,20 @@ class Particle {
|
|
|
577
330
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
578
331
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
579
332
|
* @param {Object} [options.context] Request context
|
|
580
|
-
* @returns {Promise} A promise
|
|
581
|
-
*/
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
333
|
+
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
334
|
+
*/
|
|
335
|
+
setDeviceNotes({ deviceId, notes, product, auth, headers, context }: {
|
|
336
|
+
deviceId: string;
|
|
337
|
+
notes: string;
|
|
338
|
+
product?: string | number;
|
|
339
|
+
auth?: string;
|
|
340
|
+
headers?: Record<string, string>;
|
|
341
|
+
context?: {
|
|
342
|
+
tool?: ToolContext;
|
|
343
|
+
project?: ProjectContext;
|
|
344
|
+
};
|
|
345
|
+
}): Promise<JSONResponse<DeviceInfo>>;
|
|
346
|
+
/**
|
|
587
347
|
* Mark device as being used in development of a product so it opts out of automatic firmware updates
|
|
588
348
|
* @param {Object} options Options for this API call
|
|
589
349
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -592,13 +352,20 @@ class Particle {
|
|
|
592
352
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
593
353
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
594
354
|
* @param {Object} [options.context] Request context
|
|
595
|
-
* @returns {Promise} A promise
|
|
596
|
-
*/
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
355
|
+
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
356
|
+
*/
|
|
357
|
+
markAsDevelopmentDevice({ deviceId, development, product, auth, headers, context }: {
|
|
358
|
+
deviceId: string;
|
|
359
|
+
development?: boolean;
|
|
360
|
+
product: string | number;
|
|
361
|
+
auth?: string;
|
|
362
|
+
headers?: Record<string, string>;
|
|
363
|
+
context?: {
|
|
364
|
+
tool?: ToolContext;
|
|
365
|
+
project?: ProjectContext;
|
|
366
|
+
};
|
|
367
|
+
}): Promise<JSONResponse<DeviceInfo>>;
|
|
368
|
+
/**
|
|
602
369
|
* Mark device as being used in development of a product, so it opts out of automatic firmware updates
|
|
603
370
|
* @param {Object} options Options for this API call
|
|
604
371
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -608,13 +375,21 @@ class Particle {
|
|
|
608
375
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
609
376
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
610
377
|
* @param {Object} [options.context] Request context
|
|
611
|
-
* @returns {Promise} A promise
|
|
612
|
-
*/
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
378
|
+
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
379
|
+
*/
|
|
380
|
+
lockDeviceProductFirmware({ deviceId, desiredFirmwareVersion, flash, product, auth, headers, context }: {
|
|
381
|
+
deviceId: string;
|
|
382
|
+
desiredFirmwareVersion: number;
|
|
383
|
+
flash?: boolean;
|
|
384
|
+
product: string | number;
|
|
385
|
+
auth?: string;
|
|
386
|
+
headers?: Record<string, string>;
|
|
387
|
+
context?: {
|
|
388
|
+
tool?: ToolContext;
|
|
389
|
+
project?: ProjectContext;
|
|
390
|
+
};
|
|
391
|
+
}): Promise<JSONResponse<DeviceInfo>>;
|
|
392
|
+
/**
|
|
618
393
|
* Mark device as receiving automatic firmware updates
|
|
619
394
|
* @param {Object} options Options for this API call
|
|
620
395
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -622,13 +397,19 @@ class Particle {
|
|
|
622
397
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
623
398
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
624
399
|
* @param {Object} [options.context] Request context
|
|
625
|
-
* @returns {Promise} A promise
|
|
400
|
+
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
626
401
|
*/
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
402
|
+
unlockDeviceProductFirmware({ deviceId, product, auth, headers, context }: {
|
|
403
|
+
deviceId: string;
|
|
404
|
+
product: string | number;
|
|
405
|
+
auth?: string;
|
|
406
|
+
headers?: Record<string, string>;
|
|
407
|
+
context?: {
|
|
408
|
+
tool?: ToolContext;
|
|
409
|
+
project?: ProjectContext;
|
|
410
|
+
};
|
|
411
|
+
}): Promise<JSONResponse<DeviceInfo>>;
|
|
412
|
+
/**
|
|
632
413
|
* Update multiple device attributes at the same time
|
|
633
414
|
* @param {Object} options Options for this API call
|
|
634
415
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -643,23 +424,10 @@ class Particle {
|
|
|
643
424
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
644
425
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
645
426
|
* @param {Object} [options.context] Request context
|
|
646
|
-
* @returns {Promise} A promise
|
|
427
|
+
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
647
428
|
*/
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
if (signal !== undefined){
|
|
651
|
-
signalValue = signal ? '1' : '0';
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
const uri = this.deviceUri({ deviceId, product });
|
|
655
|
-
const data = product ?
|
|
656
|
-
{ name, signal: signalValue, notes, development, desired_firmware_version: desiredFirmwareVersion, flash } :
|
|
657
|
-
{ name, signal: signalValue, notes };
|
|
658
|
-
|
|
659
|
-
return this.put({ uri, auth, headers, data, context });
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
/**
|
|
429
|
+
updateDevice({ deviceId, name, signal, notes, development, desiredFirmwareVersion, flash, product, auth, headers, context }: UpdateDeviceOptions): Promise<JSONResponse<DeviceInfo>>;
|
|
430
|
+
/**
|
|
663
431
|
* Disable device protection.
|
|
664
432
|
*
|
|
665
433
|
* @param {Object} options Options for this API call.
|
|
@@ -675,46 +443,20 @@ class Particle {
|
|
|
675
443
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor.
|
|
676
444
|
* @param {Object} [options.headers] Key/value pairs to send as headers.
|
|
677
445
|
* @param {Object} [options.context] Request context.
|
|
678
|
-
* @returns {Promise} A promise
|
|
446
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
679
447
|
*/
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
if (deviceNonce !== undefined) {
|
|
683
|
-
data.device_nonce = deviceNonce;
|
|
684
|
-
}
|
|
685
|
-
if (serverNonce !== undefined) {
|
|
686
|
-
data.server_nonce = serverNonce;
|
|
687
|
-
}
|
|
688
|
-
if (deviceSignature !== undefined) {
|
|
689
|
-
data.device_signature = deviceSignature;
|
|
690
|
-
}
|
|
691
|
-
if (devicePublicKeyFingerprint !== undefined) {
|
|
692
|
-
data.device_public_key_fingerprint = devicePublicKeyFingerprint;
|
|
693
|
-
}
|
|
694
|
-
const uri = this.deviceUri({ deviceId, product, org }) + '/unprotect';
|
|
695
|
-
return this.put({ uri, data, auth, headers, context });
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
/**
|
|
448
|
+
unprotectDevice({ deviceId, org, product, action, serverNonce, deviceNonce, deviceSignature, devicePublicKeyFingerprint, auth, headers, context }: UnprotectDeviceOptions): Promise<JSONResponse<OKResponse>>;
|
|
449
|
+
/**
|
|
699
450
|
* Provision a new device for products that allow self-provisioning
|
|
700
451
|
* @param {Object} options Options for this API call
|
|
701
452
|
* @param {String} options.productId Product ID where to create this device
|
|
702
453
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
703
454
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
704
455
|
* @param {Object} [options.context] Request context
|
|
705
|
-
* @returns {Promise} A promise
|
|
456
|
+
* @returns {Promise<JSONResponse<DeviceInfo>>} A promise that resolves with the response data
|
|
706
457
|
*/
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
uri: '/v1/devices',
|
|
710
|
-
auth,
|
|
711
|
-
headers,
|
|
712
|
-
data: { product_id: productId },
|
|
713
|
-
context
|
|
714
|
-
});
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
/**
|
|
458
|
+
provisionDevice({ productId, auth, headers, context }: ProvisionDeviceOptions): Promise<JSONResponse<DeviceInfo>>;
|
|
459
|
+
/**
|
|
718
460
|
* Generate a claim code to use in the device claiming process.
|
|
719
461
|
* To generate a claim code for a product, the access token MUST belong to a
|
|
720
462
|
* customer of the product.
|
|
@@ -724,23 +466,10 @@ class Particle {
|
|
|
724
466
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
725
467
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
726
468
|
* @param {Object} [options.context] Request context
|
|
727
|
-
* @returns {Promise} A promise
|
|
469
|
+
* @returns {Promise<JSONResponse<ClaimCodeResponse>>} A promise that resolves with the response data
|
|
728
470
|
*/
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
return this.post({ uri, auth, headers, data: { iccid }, context });
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
validatePromoCode({ promoCode, auth, headers, context }){
|
|
735
|
-
return this.get({
|
|
736
|
-
uri: `/v1/promo_code/${promoCode}`,
|
|
737
|
-
auth,
|
|
738
|
-
headers,
|
|
739
|
-
context
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
/**
|
|
471
|
+
getClaimCode({ iccid, product, auth, headers, context }: GetClaimCodeOptions): Promise<JSONResponse<ClaimCodeResponse>>;
|
|
472
|
+
/**
|
|
744
473
|
* Get the value of a device variable
|
|
745
474
|
* @param {Object} options Options for this API call
|
|
746
475
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -749,17 +478,10 @@ class Particle {
|
|
|
749
478
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
750
479
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
751
480
|
* @param {Object} [options.context] Request context
|
|
752
|
-
* @returns {Promise} A promise
|
|
481
|
+
* @returns {Promise<JSONResponse<DeviceVariableResponse>>} A promise that resolves with the response data
|
|
753
482
|
*/
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
`/v1/products/${product}/devices/${deviceId}/${name}` :
|
|
757
|
-
`/v1/devices/${deviceId}/${name}`;
|
|
758
|
-
|
|
759
|
-
return this.get({ uri, auth, headers, context });
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
/**
|
|
483
|
+
getVariable({ deviceId, name, product, auth, headers, context }: GetVariableOptions): Promise<JSONResponse<DeviceVariableResponse>>;
|
|
484
|
+
/**
|
|
763
485
|
* Compile and flash application firmware to a device. Pass a pre-compiled binary to flash it directly to the device.
|
|
764
486
|
* @param {Object} options Options for this API call
|
|
765
487
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -769,48 +491,10 @@ class Particle {
|
|
|
769
491
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
770
492
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
771
493
|
* @param {Object} [options.context] Request context
|
|
772
|
-
* @returns {Promise} A promise
|
|
773
|
-
*/
|
|
774
|
-
flashDevice({ deviceId, product, files, targetVersion, auth, headers, context }){
|
|
775
|
-
const uri = this.deviceUri({ deviceId, product });
|
|
776
|
-
const form = {};
|
|
777
|
-
|
|
778
|
-
if (targetVersion){
|
|
779
|
-
form.build_target_version = targetVersion;
|
|
780
|
-
} else {
|
|
781
|
-
form.latest = 'true';
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
return this.request({ uri, method: 'put', auth, headers, files, form, context });
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
* DEPRECATED: Flash the Tinker application to a device. Instead compile and flash the Tinker source code.
|
|
789
|
-
* @param {Object} options Options for this API call
|
|
790
|
-
* @param {String} options.deviceId Device ID or Name
|
|
791
|
-
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
792
|
-
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
793
|
-
* @param {Object} [options.context] Request context
|
|
794
|
-
* @returns {Promise} A promise
|
|
494
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
795
495
|
*/
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
/* @ts-ignore */
|
|
799
|
-
if (console && console.warning){
|
|
800
|
-
// @ts-ignore
|
|
801
|
-
console.warning('Particle.flashTinker is deprecated');
|
|
802
|
-
}
|
|
803
|
-
/* eslint-enable no-console */
|
|
804
|
-
return this.put({
|
|
805
|
-
uri: `/v1/devices/${deviceId}`,
|
|
806
|
-
headers,
|
|
807
|
-
data: { app: 'tinker' },
|
|
808
|
-
auth,
|
|
809
|
-
context
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
/**
|
|
496
|
+
flashDevice({ deviceId, product, files, targetVersion, auth, headers, context }: FlashDeviceOptions): Promise<JSONResponse<OKResponse>>;
|
|
497
|
+
/**
|
|
814
498
|
* Compile firmware using the Particle Cloud
|
|
815
499
|
* @param {Object} options Options for this API call
|
|
816
500
|
* @param {Object} options.files Object containing files to be compiled. Keys should be the filenames, including relative path, and the values should be a path or Buffer of the file contents in Node, or a File or Blob in the browser.
|
|
@@ -819,49 +503,20 @@ class Particle {
|
|
|
819
503
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
820
504
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
821
505
|
* @param {Object} [options.context] Request context
|
|
822
|
-
* @returns {Promise} A promise
|
|
506
|
+
* @returns {Promise<JSONResponse<CompileResponse>>} A promise that resolves with the response data
|
|
823
507
|
*/
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
if (targetVersion){
|
|
828
|
-
form.build_target_version = targetVersion;
|
|
829
|
-
} else {
|
|
830
|
-
form.latest = 'true';
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
return this.request({
|
|
834
|
-
uri: '/v1/binaries',
|
|
835
|
-
method: 'post',
|
|
836
|
-
auth,
|
|
837
|
-
headers,
|
|
838
|
-
files,
|
|
839
|
-
form,
|
|
840
|
-
context
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
/**
|
|
508
|
+
compileCode({ files, platformId, targetVersion, auth, headers, context }: CompileCodeOptions): Promise<JSONResponse<CompileResponse>>;
|
|
509
|
+
/**
|
|
845
510
|
* Download a firmware binary
|
|
846
511
|
* @param {Object} options Options for this API call
|
|
847
512
|
* @param {String} options.binaryId Binary ID received from a successful compile call
|
|
848
513
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
849
514
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
850
515
|
* @param {Object} [options.context] Request context
|
|
851
|
-
* @returns {Promise<
|
|
852
|
-
*/
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
uri: `/v1/binaries/${binaryId}`,
|
|
856
|
-
method: 'get',
|
|
857
|
-
auth,
|
|
858
|
-
headers,
|
|
859
|
-
context,
|
|
860
|
-
isBuffer: true
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
/**
|
|
516
|
+
* @returns {Promise<Buffer | ArrayBuffer>} A promise that resolves with the binary data
|
|
517
|
+
*/
|
|
518
|
+
downloadFirmwareBinary({ binaryId, auth, headers, context }: DownloadFirmwareBinaryOptions): Promise<Buffer | ArrayBuffer>;
|
|
519
|
+
/**
|
|
865
520
|
* Send a new device public key to the Particle Cloud
|
|
866
521
|
* @param {Object} options Options for this API call
|
|
867
522
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -870,25 +525,20 @@ class Particle {
|
|
|
870
525
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
871
526
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
872
527
|
* @param {Object} [options.context] Request context
|
|
873
|
-
* @returns {Promise} A promise
|
|
874
|
-
*/
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
context
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
/**
|
|
528
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
529
|
+
*/
|
|
530
|
+
sendPublicKey({ deviceId, key, algorithm, auth, headers, context }: {
|
|
531
|
+
deviceId: string;
|
|
532
|
+
key: string | Buffer;
|
|
533
|
+
algorithm?: string;
|
|
534
|
+
auth?: string;
|
|
535
|
+
headers?: Record<string, string>;
|
|
536
|
+
context?: {
|
|
537
|
+
tool?: ToolContext;
|
|
538
|
+
project?: ProjectContext;
|
|
539
|
+
};
|
|
540
|
+
}): Promise<JSONResponse<OKResponse>>;
|
|
541
|
+
/**
|
|
892
542
|
* Call a device function
|
|
893
543
|
* @param {Object} options Options for this API call
|
|
894
544
|
* @param {String} options.deviceId Device ID or Name
|
|
@@ -898,16 +548,10 @@ class Particle {
|
|
|
898
548
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
899
549
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
900
550
|
* @param {Object} [options.context] Request context
|
|
901
|
-
* @returns {Promise} A promise
|
|
551
|
+
* @returns {Promise<JSONResponse<FunctionCallResponse>>} A promise that resolves with the response data
|
|
902
552
|
*/
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
`/v1/products/${product}/devices/${deviceId}/${name}` :
|
|
906
|
-
`/v1/devices/${deviceId}/${name}`;
|
|
907
|
-
return this.post({ uri, auth, headers, data: { args: argument }, context });
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
/**
|
|
553
|
+
callFunction({ deviceId, name, argument, product, auth, headers, context }: CallFunctionOptions): Promise<JSONResponse<FunctionCallResponse>>;
|
|
554
|
+
/**
|
|
911
555
|
* Get a stream of events
|
|
912
556
|
* @param {Object} options Options for this API call
|
|
913
557
|
* @param {String} [options.deviceId] Device ID or Name, or `mine` to indicate only your devices.
|
|
@@ -915,37 +559,11 @@ class Particle {
|
|
|
915
559
|
* @param {String} [options.org] Organization Slug
|
|
916
560
|
* @param {String} [options.product] Events for this product ID or slug
|
|
917
561
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
918
|
-
* @returns {Promise}
|
|
562
|
+
* @returns {Promise<EventStream>} A promise that resolves with the response data
|
|
919
563
|
* emit 'event' events.
|
|
920
564
|
*/
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
if (org){
|
|
924
|
-
uri += `orgs/${org}/`;
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
if (product){
|
|
928
|
-
uri += `products/${product}/`;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
if (deviceId){
|
|
932
|
-
uri += 'devices/';
|
|
933
|
-
if (!(deviceId.toLowerCase() === 'mine')){
|
|
934
|
-
uri += `${deviceId}/`;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
uri += 'events';
|
|
939
|
-
|
|
940
|
-
if (name){
|
|
941
|
-
uri += `/${encodeURIComponent(name)}`;
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
auth = this._getActiveAuthToken(auth);
|
|
945
|
-
return new EventStream(`${this.baseUrl}${uri}`, auth).connect();
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
/**
|
|
565
|
+
getEventStream({ deviceId, name, org, product, auth }: GetEventStreamOptions): Promise<EventStream>;
|
|
566
|
+
/**
|
|
949
567
|
* Publish a event to the Particle Cloud
|
|
950
568
|
* @param {Object} options Options for this API call
|
|
951
569
|
* @param {String} options.name Event name
|
|
@@ -955,15 +573,21 @@ class Particle {
|
|
|
955
573
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
956
574
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
957
575
|
* @param {Object} [options.context] Request context
|
|
958
|
-
* @returns {Promise} A promise
|
|
959
|
-
*/
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
576
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
577
|
+
*/
|
|
578
|
+
publishEvent({ name, data, isPrivate, product, auth, headers, context }: {
|
|
579
|
+
name: string;
|
|
580
|
+
data?: string;
|
|
581
|
+
isPrivate?: boolean;
|
|
582
|
+
product?: string | number;
|
|
583
|
+
auth?: string;
|
|
584
|
+
headers?: Record<string, string>;
|
|
585
|
+
context?: {
|
|
586
|
+
tool?: ToolContext;
|
|
587
|
+
project?: ProjectContext;
|
|
588
|
+
};
|
|
589
|
+
}): Promise<JSONResponse<OKResponse>>;
|
|
590
|
+
/**
|
|
967
591
|
* @typedef {Object} Hook
|
|
968
592
|
* @property {String} [method=POST] Type of web request triggered by the Webhook (GET, POST, PUT, or DELETE)
|
|
969
593
|
* @property {Object} [auth] Auth data like `{ user: 'me', pass: '1234' }` for basic auth or `{ bearer: 'token' }` to send with the Webhook request
|
|
@@ -976,8 +600,7 @@ class Particle {
|
|
|
976
600
|
* @property {Object} [responseEvent] The Webhook response event name that your devices can subscribe to
|
|
977
601
|
* @property {Object} [errorResponseEvent] The Webhook error response event name that your devices can subscribe to
|
|
978
602
|
*/
|
|
979
|
-
|
|
980
|
-
/**
|
|
603
|
+
/**
|
|
981
604
|
* Create a webhook
|
|
982
605
|
* @param {Object} options Options for this API call
|
|
983
606
|
* @param {String} options.event The name of the Particle event that should trigger the Webhook
|
|
@@ -990,33 +613,35 @@ class Particle {
|
|
|
990
613
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
991
614
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
992
615
|
* @param {Object} [options.context] Request context
|
|
993
|
-
* @returns {Promise} A promise
|
|
994
|
-
*/
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
616
|
+
* @returns {Promise<JSONResponse<CreateWebhookResponse>>} A promise that resolves with the response data
|
|
617
|
+
*/
|
|
618
|
+
createWebhook({ event, url, device, rejectUnauthorized, noDefaults, hook, product, auth, headers, context }: {
|
|
619
|
+
event: string;
|
|
620
|
+
url: string;
|
|
621
|
+
device?: string;
|
|
622
|
+
rejectUnauthorized?: boolean;
|
|
623
|
+
noDefaults?: boolean;
|
|
624
|
+
hook?: {
|
|
625
|
+
method?: string;
|
|
626
|
+
auth?: Record<string, string>;
|
|
627
|
+
headers?: Record<string, string>;
|
|
628
|
+
query?: Record<string, string>;
|
|
629
|
+
json?: object;
|
|
630
|
+
form?: object;
|
|
631
|
+
body?: string;
|
|
632
|
+
responseTemplate?: string;
|
|
633
|
+
responseEvent?: string;
|
|
634
|
+
errorResponseEvent?: string;
|
|
635
|
+
};
|
|
636
|
+
product?: string | number;
|
|
637
|
+
auth?: string;
|
|
638
|
+
headers?: Record<string, string>;
|
|
639
|
+
context?: {
|
|
640
|
+
tool?: ToolContext;
|
|
641
|
+
project?: ProjectContext;
|
|
642
|
+
};
|
|
643
|
+
}): Promise<JSONResponse<CreateWebhookResponse>>;
|
|
644
|
+
/**
|
|
1020
645
|
* Delete a webhook
|
|
1021
646
|
* @param {Object} options Options for this API call
|
|
1022
647
|
* @param {String} options.hookId Webhook ID
|
|
@@ -1024,28 +649,20 @@ class Particle {
|
|
|
1024
649
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1025
650
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1026
651
|
* @param {Object} [options.context] Request context
|
|
1027
|
-
* @returns {Promise} A promise
|
|
652
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1028
653
|
*/
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
return this.delete({ uri, auth, headers, context });
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
/**
|
|
654
|
+
deleteWebhook({ hookId, product, auth, headers, context }: DeleteWebhookOptions): Promise<JSONResponse<OKResponse>>;
|
|
655
|
+
/**
|
|
1035
656
|
* List all webhooks owned by the account or product
|
|
1036
657
|
* @param {Object} options Options for this API call
|
|
1037
658
|
* @param {String} [options.product] Webhooks for this product ID or slug
|
|
1038
659
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1039
660
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1040
661
|
* @param {Object} [options.context] Request context
|
|
1041
|
-
* @returns {Promise} A promise
|
|
662
|
+
* @returns {Promise<JSONResponse<WebhookInfo[]>>} A promise that resolves with the response data
|
|
1042
663
|
*/
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
return this.get({ uri, auth, headers, context });
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
/**
|
|
664
|
+
listWebhooks({ product, auth, headers, context }: ListWebhooksOptions): Promise<JSONResponse<WebhookInfo[]>>;
|
|
665
|
+
/**
|
|
1049
666
|
* Create an integration to send events to an external service
|
|
1050
667
|
*
|
|
1051
668
|
* See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-
|
|
@@ -1058,15 +675,10 @@ class Particle {
|
|
|
1058
675
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1059
676
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1060
677
|
* @param {Object} [options.context] Request context
|
|
1061
|
-
* @returns {Promise} A promise
|
|
678
|
+
* @returns {Promise<JSONResponse<IntegrationInfo>>} A promise that resolves with the response data
|
|
1062
679
|
*/
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
const data = Object.assign({ event, deviceid: deviceId }, settings);
|
|
1066
|
-
return this.post({ uri, data, auth, headers, context });
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
/**
|
|
680
|
+
createIntegration({ event, settings, deviceId, product, auth, headers, context }: CreateIntegrationOptions): Promise<JSONResponse<IntegrationInfo>>;
|
|
681
|
+
/**
|
|
1070
682
|
* Edit an integration to send events to an external service
|
|
1071
683
|
*
|
|
1072
684
|
* See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-
|
|
@@ -1080,15 +692,10 @@ class Particle {
|
|
|
1080
692
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1081
693
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1082
694
|
* @param {Object} [options.context] Request context
|
|
1083
|
-
* @returns {Promise} A promise
|
|
695
|
+
* @returns {Promise<JSONResponse<IntegrationInfo>>} A promise that resolves with the response data
|
|
1084
696
|
*/
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
const data = Object.assign({ event, deviceid: deviceId }, settings);
|
|
1088
|
-
return this.put({ uri, auth, headers, data, context });
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
/**
|
|
697
|
+
editIntegration({ integrationId, event, settings, deviceId, product, auth, headers, context }: EditIntegrationOptions): Promise<JSONResponse<IntegrationInfo>>;
|
|
698
|
+
/**
|
|
1092
699
|
* Delete an integration to send events to an external service
|
|
1093
700
|
*
|
|
1094
701
|
* @param {Object} options Options for this API call
|
|
@@ -1097,54 +704,54 @@ class Particle {
|
|
|
1097
704
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1098
705
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1099
706
|
* @param {Object} [options.context] Request context
|
|
1100
|
-
* @returns {Promise} A promise
|
|
707
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1101
708
|
*/
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
return this.delete({ uri, auth, headers, context });
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
/**
|
|
709
|
+
deleteIntegration({ integrationId, product, auth, headers, context }: DeleteIntegrationOptions): Promise<JSONResponse<OKResponse>>;
|
|
710
|
+
/**
|
|
1108
711
|
* List all integrations owned by the account or product
|
|
1109
712
|
* @param {Object} options Options for this API call
|
|
1110
713
|
* @param {String} [options.product] Integrations for this product ID or slug
|
|
1111
714
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1112
715
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1113
716
|
* @param {Object} [options.context] Request context
|
|
1114
|
-
* @returns {Promise} A promise
|
|
717
|
+
* @returns {Promise<JSONResponse<IntegrationInfo[]>>} A promise that resolves with the response data
|
|
1115
718
|
*/
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
return this.get({ uri, auth, headers, context });
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
/**
|
|
719
|
+
listIntegrations({ product, auth, headers, context }: ListIntegrationsOptions): Promise<JSONResponse<IntegrationInfo[]>>;
|
|
720
|
+
/**
|
|
1122
721
|
* Get details about the current user
|
|
1123
722
|
* @param {Object} options Options for this API call
|
|
1124
723
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1125
724
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1126
725
|
* @param {Object} [options.context] Request context
|
|
1127
|
-
* @returns {Promise} A promise
|
|
726
|
+
* @returns {Promise<JSONResponse<UserInfo>>} A promise that resolves with the response data
|
|
1128
727
|
*/
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
728
|
+
getUserInfo({ auth, headers, context }: {
|
|
729
|
+
auth?: string;
|
|
730
|
+
headers?: Record<string, string>;
|
|
731
|
+
context?: {
|
|
732
|
+
tool?: ToolContext;
|
|
733
|
+
project?: ProjectContext;
|
|
734
|
+
};
|
|
735
|
+
}): Promise<JSONResponse<UserInfo>>;
|
|
736
|
+
/**
|
|
1134
737
|
* Set details on the current user
|
|
1135
738
|
* @param {Object} options Options for this API call
|
|
1136
739
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1137
740
|
* @param {String} options.accountInfo Set user's extended info fields (name, business account, company name, etc)
|
|
1138
741
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1139
742
|
* @param {Object} [options.context] Request context
|
|
1140
|
-
* @returns {Promise} A promise
|
|
1141
|
-
*/
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
743
|
+
* @returns {Promise<JSONResponse<UserInfo>>} A promise that resolves with the response data
|
|
744
|
+
*/
|
|
745
|
+
setUserInfo({ accountInfo, auth, headers, context }: {
|
|
746
|
+
accountInfo?: Record<string, string | number | boolean>;
|
|
747
|
+
auth?: string;
|
|
748
|
+
headers?: Record<string, string>;
|
|
749
|
+
context?: {
|
|
750
|
+
tool?: ToolContext;
|
|
751
|
+
project?: ProjectContext;
|
|
752
|
+
};
|
|
753
|
+
}): Promise<JSONResponse<UserInfo>>;
|
|
754
|
+
/**
|
|
1148
755
|
* Change username (i.e, email)
|
|
1149
756
|
* @param {Object} options Options for this API call
|
|
1150
757
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
@@ -1153,19 +760,10 @@ class Particle {
|
|
|
1153
760
|
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
|
|
1154
761
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1155
762
|
* @param {Object} [options.context] Request context
|
|
1156
|
-
* @returns {Promise} A promise
|
|
763
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1157
764
|
*/
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
if (invalidateTokens) {
|
|
1162
|
-
data.invalidate_tokens = true;
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
return this.put({ uri: '/v1/user', auth, headers, data, context });
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
/**
|
|
765
|
+
changeUsername({ currentPassword, username, invalidateTokens, auth, headers, context }: ChangeUsernameOptions): Promise<JSONResponse<OKResponse>>;
|
|
766
|
+
/**
|
|
1169
767
|
* Change user's password
|
|
1170
768
|
* @param {Object} options Options for this API call
|
|
1171
769
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
@@ -1174,19 +772,10 @@ class Particle {
|
|
|
1174
772
|
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
|
|
1175
773
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1176
774
|
* @param {Object} [options.context] Request context
|
|
1177
|
-
* @returns {Promise} A promise
|
|
775
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1178
776
|
*/
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
if (invalidateTokens) {
|
|
1183
|
-
data.invalidate_tokens = true;
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
return this.put({ uri: '/v1/user', auth, headers, data, context });
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
/**
|
|
777
|
+
changeUserPassword({ currentPassword, password, invalidateTokens, auth, headers, context }: ChangeUserPasswordOptions): Promise<JSONResponse<OKResponse>>;
|
|
778
|
+
/**
|
|
1190
779
|
* List SIM cards owned by a user or product
|
|
1191
780
|
* @param {Object} options Options for this API call
|
|
1192
781
|
* @param {String} [options.iccid] (Product only) Filter to SIM cards matching this ICCID
|
|
@@ -1198,15 +787,10 @@ class Particle {
|
|
|
1198
787
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1199
788
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1200
789
|
* @param {Object} [options.context] Request context
|
|
1201
|
-
* @returns {Promise} A promise
|
|
790
|
+
* @returns {Promise<JSONResponse<SimInfo[]>>} A promise that resolves with the response data
|
|
1202
791
|
*/
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
const query = product ? { iccid, deviceId, deviceName, page, per_page: perPage } : undefined;
|
|
1206
|
-
return this.get({ uri, auth, headers, query, context });
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
/**
|
|
792
|
+
listSIMs({ iccid, deviceId, deviceName, page, perPage, product, auth, headers, context }: ListSIMsOptions): Promise<JSONResponse<SimInfo[]>>;
|
|
793
|
+
/**
|
|
1210
794
|
* Get data usage for one SIM card for the current billing period
|
|
1211
795
|
* @param {Object} options Options for this API call
|
|
1212
796
|
* @param {String} options.iccid ICCID of the SIM card
|
|
@@ -1214,48 +798,30 @@ class Particle {
|
|
|
1214
798
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1215
799
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1216
800
|
* @param {Object} [options.context] Request context
|
|
1217
|
-
* @returns {Promise} A promise
|
|
801
|
+
* @returns {Promise<JSONResponse<SimDataUsage>>} A promise that resolves with the response data
|
|
1218
802
|
*/
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
`/v1/products/${product}/sims/${iccid}/data_usage` :
|
|
1222
|
-
`/v1/sims/${iccid}/data_usage`;
|
|
1223
|
-
|
|
1224
|
-
return this.get({ uri, auth, headers, context });
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
/**
|
|
803
|
+
getSIMDataUsage({ iccid, product, auth, headers, context }: GetSIMDataUsageOptions): Promise<JSONResponse<SimDataUsage>>;
|
|
804
|
+
/**
|
|
1228
805
|
* Get data usage for all SIM cards in a product the current billing period
|
|
1229
806
|
* @param {Object} options Options for this API call
|
|
1230
807
|
* @param {String} options.product SIM cards for this product ID or slug
|
|
1231
808
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1232
809
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1233
810
|
* @param {Object} [options.context] Request context
|
|
1234
|
-
* @returns {Promise} A promise
|
|
811
|
+
* @returns {Promise<JSONResponse<SimDataUsage>>} A promise that resolves with the response data
|
|
1235
812
|
*/
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
uri: `/v1/products/${product}/sims/data_usage`,
|
|
1239
|
-
auth,
|
|
1240
|
-
headers,
|
|
1241
|
-
context
|
|
1242
|
-
});
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
/**
|
|
813
|
+
getFleetDataUsage({ product, auth, headers, context }: GetFleetDataUsageOptions): Promise<JSONResponse<SimDataUsage>>;
|
|
814
|
+
/**
|
|
1246
815
|
* Check SIM status
|
|
1247
816
|
* @param {Object} options Options for this API call
|
|
1248
817
|
* @param {String} options.iccid ICCID of the SIM card
|
|
1249
818
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1250
819
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1251
820
|
* @param {Object} [options.context] Request context
|
|
1252
|
-
* @returns {Promise} A promise
|
|
821
|
+
* @returns {Promise<JSONResponse<SimInfo>>} A promise that resolves with the response data
|
|
1253
822
|
*/
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
/**
|
|
823
|
+
checkSIM({ iccid, auth, headers, context }: CheckSIMOptions): Promise<JSONResponse<SimInfo>>;
|
|
824
|
+
/**
|
|
1259
825
|
* Activate and add SIM cards to an account or product
|
|
1260
826
|
* @param {Object} options Options for this API call
|
|
1261
827
|
* @param {String} options.iccid ICCID of the SIM card
|
|
@@ -1266,21 +832,10 @@ class Particle {
|
|
|
1266
832
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1267
833
|
* @param {Object} [options.context] Request context
|
|
1268
834
|
* @param {any} [options.promoCode]
|
|
1269
|
-
* @returns {Promise} A promise
|
|
835
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1270
836
|
*/
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
iccids = iccids || [iccid];
|
|
1274
|
-
const uri = product ? `/v1/products/${product}/sims` : `/v1/sims/${iccid}`;
|
|
1275
|
-
const data = product ?
|
|
1276
|
-
{ sims: iccids, country } :
|
|
1277
|
-
{ country, promoCode, action: 'activate' };
|
|
1278
|
-
const method = product ? 'post' : 'put';
|
|
1279
|
-
|
|
1280
|
-
return this.request({ uri, method, headers, data, auth, context });
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
/**
|
|
837
|
+
activateSIM({ iccid, iccids, country, promoCode, product, auth, headers, context }: ActivateSIMOptions): Promise<JSONResponse<OKResponse>>;
|
|
838
|
+
/**
|
|
1284
839
|
* Deactivate a SIM card so it doesn't incur data usage in future months.
|
|
1285
840
|
* @param {Object} options Options for this API call
|
|
1286
841
|
* @param {String} options.iccid ICCID of the SIM card
|
|
@@ -1288,15 +843,10 @@ class Particle {
|
|
|
1288
843
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1289
844
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1290
845
|
* @param {Object} [options.context] Request context
|
|
1291
|
-
* @returns {Promise} A promise
|
|
846
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1292
847
|
*/
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
const data = { action: 'deactivate' };
|
|
1296
|
-
return this.put({ uri, auth, headers, data, context });
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
/**
|
|
848
|
+
deactivateSIM({ iccid, product, auth, headers, context }: DeactivateSIMOptions): Promise<JSONResponse<OKResponse>>;
|
|
849
|
+
/**
|
|
1300
850
|
* Reactivate a SIM card the was deactivated or unpause a SIM card that was automatically paused
|
|
1301
851
|
* @param {Object} options Options for this API call
|
|
1302
852
|
* @param {String} options.iccid ICCID of the SIM card
|
|
@@ -1305,15 +855,10 @@ class Particle {
|
|
|
1305
855
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1306
856
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1307
857
|
* @param {Object} [options.context] Request context
|
|
1308
|
-
* @returns {Promise} A promise
|
|
858
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1309
859
|
*/
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
const data = { mb_limit: mbLimit, action: 'reactivate' };
|
|
1313
|
-
return this.put({ uri, auth, headers, data, context });
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
/**
|
|
860
|
+
reactivateSIM({ iccid, mbLimit, product, auth, headers, context }: ReactivateSIMOptions): Promise<JSONResponse<OKResponse>>;
|
|
861
|
+
/**
|
|
1317
862
|
* Update SIM card data limit
|
|
1318
863
|
* @param {Object} options Options for this API call
|
|
1319
864
|
* @param {String} options.iccid ICCID of the SIM card
|
|
@@ -1322,15 +867,10 @@ class Particle {
|
|
|
1322
867
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1323
868
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1324
869
|
* @param {Object} [options.context] Request context
|
|
1325
|
-
* @returns {Promise} A promise
|
|
870
|
+
* @returns {Promise<JSONResponse<SimInfo>>} A promise that resolves with the response data
|
|
1326
871
|
*/
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
const data = { mb_limit: mbLimit };
|
|
1330
|
-
return this.put({ uri, auth, headers, data, context });
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
872
|
+
updateSIM({ iccid, mbLimit, product, auth, headers, context }: UpdateSIMOptions): Promise<JSONResponse<SimInfo>>;
|
|
873
|
+
/**
|
|
1334
874
|
* Remove a SIM card from an account so it can be activated by a different account
|
|
1335
875
|
* @param {Object} options Options for this API call
|
|
1336
876
|
* @param {String} options.iccid ICCID of the SIM card
|
|
@@ -1338,28 +878,20 @@ class Particle {
|
|
|
1338
878
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1339
879
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1340
880
|
* @param {Object} [options.context] Request context
|
|
1341
|
-
* @returns {Promise} A promise
|
|
881
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1342
882
|
*/
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
return this.delete({ uri, auth, headers, context });
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
/**
|
|
883
|
+
removeSIM({ iccid, product, auth, headers, context }: RemoveSIMOptions): Promise<JSONResponse<OKResponse>>;
|
|
884
|
+
/**
|
|
1349
885
|
* List valid build targets to be used for compiling
|
|
1350
886
|
* @param {Object} options Options for this API call
|
|
1351
887
|
* @param {Boolean} [options.onlyFeatured=false] Only list featured build targets
|
|
1352
888
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1353
889
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1354
890
|
* @param {Object} [options.context] Request context
|
|
1355
|
-
* @returns {Promise} A promise
|
|
891
|
+
* @returns {Promise<JSONResponse<BuildTargetsResponse>>} A promise that resolves with the response data
|
|
1356
892
|
*/
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
return this.get({ uri: '/v1/build_targets', auth, headers, query, context });
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
/**
|
|
893
|
+
listBuildTargets({ onlyFeatured, auth, headers, context }: ListBuildTargetsOptions): Promise<JSONResponse<BuildTargetsResponse>>;
|
|
894
|
+
/**
|
|
1363
895
|
* List firmware libraries
|
|
1364
896
|
* @param {Object} options Options for this API call
|
|
1365
897
|
* @param {Number} options.page Page index (default, first page)
|
|
@@ -1383,30 +915,11 @@ class Particle {
|
|
|
1383
915
|
* @param {Object} [options.context] Request context
|
|
1384
916
|
* @returns {Promise} A promise
|
|
1385
917
|
*/
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
query: {
|
|
1392
|
-
page,
|
|
1393
|
-
filter,
|
|
1394
|
-
limit,
|
|
1395
|
-
sort,
|
|
1396
|
-
architectures: this._asList(architectures),
|
|
1397
|
-
category,
|
|
1398
|
-
scope,
|
|
1399
|
-
excludeScopes: this._asList(excludeScopes)
|
|
1400
|
-
},
|
|
1401
|
-
context
|
|
1402
|
-
});
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
_asList(value){
|
|
1406
|
-
return (Array.isArray(value) ? value.join(',') : value);
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
/**
|
|
918
|
+
listLibraries({ page, limit, filter, sort, architectures, category, scope, excludeScopes, auth, headers, context }: ListLibrariesOptions): Promise<JSONResponse<{
|
|
919
|
+
data: LibraryInfo[];
|
|
920
|
+
}>>;
|
|
921
|
+
private _asList;
|
|
922
|
+
/**
|
|
1410
923
|
* Get firmware library details
|
|
1411
924
|
* @param {Object} options Options for this API call
|
|
1412
925
|
* @param {String} options.name Name of the library to fetch
|
|
@@ -1416,17 +929,10 @@ class Particle {
|
|
|
1416
929
|
* @param {Object} [options.context] Request context
|
|
1417
930
|
* @returns {Promise} A promise
|
|
1418
931
|
*/
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
headers,
|
|
1424
|
-
query: { version },
|
|
1425
|
-
context
|
|
1426
|
-
});
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
/**
|
|
932
|
+
getLibrary({ name, version, auth, headers, context }: GetLibraryOptions): Promise<JSONResponse<{
|
|
933
|
+
data: LibraryInfo;
|
|
934
|
+
}>>;
|
|
935
|
+
/**
|
|
1430
936
|
* Firmware library details for each version
|
|
1431
937
|
* @param {Object} options Options for this API call
|
|
1432
938
|
* @param {String} options.name Name of the library to fetch
|
|
@@ -1437,17 +943,10 @@ class Particle {
|
|
|
1437
943
|
* @param {Object} [options.context] Request context
|
|
1438
944
|
* @returns {Promise} A promise
|
|
1439
945
|
*/
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
headers,
|
|
1445
|
-
query: { page, limit },
|
|
1446
|
-
context
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
/**
|
|
946
|
+
getLibraryVersions({ name, page, limit, auth, headers, context }: GetLibraryVersionsOptions): Promise<JSONResponse<{
|
|
947
|
+
data: LibraryInfo[];
|
|
948
|
+
}>>;
|
|
949
|
+
/**
|
|
1451
950
|
* Contribute a new library version from a compressed archive
|
|
1452
951
|
* @param {Object} options Options for this API call
|
|
1453
952
|
* @param {String | Buffer} options.archive Compressed archive file containing the library sources
|
|
@@ -1457,22 +956,10 @@ class Particle {
|
|
|
1457
956
|
* @param {Object} [options.context] Request context
|
|
1458
957
|
* @returns {Promise} A promise
|
|
1459
958
|
*/
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
return this.request({
|
|
1466
|
-
uri: '/v1/libraries',
|
|
1467
|
-
method: 'post',
|
|
1468
|
-
auth,
|
|
1469
|
-
headers,
|
|
1470
|
-
files,
|
|
1471
|
-
context
|
|
1472
|
-
});
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
/**
|
|
959
|
+
contributeLibrary({ archive, auth, headers, context }: ContributeLibraryOptions): Promise<JSONResponse<{
|
|
960
|
+
data: LibraryInfo;
|
|
961
|
+
}>>;
|
|
962
|
+
/**
|
|
1476
963
|
* Publish the latest version of a library to the public
|
|
1477
964
|
* @param {Object} options Options for this API call
|
|
1478
965
|
* @param {String} options.name Name of the library to publish
|
|
@@ -1481,18 +968,10 @@ class Particle {
|
|
|
1481
968
|
* @param {Object} [options.context] Request context
|
|
1482
969
|
* @returns {Promise} A promise
|
|
1483
970
|
*/
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
auth,
|
|
1489
|
-
headers,
|
|
1490
|
-
data: { visibility: 'public' },
|
|
1491
|
-
context
|
|
1492
|
-
});
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
/**
|
|
971
|
+
publishLibrary({ name, auth, headers, context }: PublishLibraryOptions): Promise<JSONResponse<{
|
|
972
|
+
data: LibraryInfo;
|
|
973
|
+
}>>;
|
|
974
|
+
/**
|
|
1496
975
|
* Delete one version of a library or an entire private library
|
|
1497
976
|
* @param {Object} options Options for this API call
|
|
1498
977
|
* @param {String} options.name Name of the library to remove
|
|
@@ -1500,31 +979,19 @@ class Particle {
|
|
|
1500
979
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1501
980
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1502
981
|
* @param {Object} [options.context] Request context
|
|
1503
|
-
* @returns {Promise} A promise
|
|
982
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1504
983
|
*/
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
uri: `/v1/libraries/${name}`,
|
|
1508
|
-
auth,
|
|
1509
|
-
headers,
|
|
1510
|
-
data: { force },
|
|
1511
|
-
context
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
/**
|
|
984
|
+
deleteLibrary({ name, force, auth, headers, context }: DeleteLibraryOptions): Promise<JSONResponse<OKResponse>>;
|
|
985
|
+
/**
|
|
1516
986
|
* Download an external file that may not be on the API
|
|
1517
987
|
* @param {Object} options Options for this API call
|
|
1518
988
|
* @param {String} options.uri URL of the file.
|
|
1519
989
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1520
990
|
* @param {Object} [options.context] Request context
|
|
1521
|
-
* @returns {Promise}
|
|
991
|
+
* @returns {Promise<Buffer | ArrayBuffer>} A promise that resolves with the binary data
|
|
1522
992
|
*/
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
/**
|
|
993
|
+
downloadFile({ uri, headers, context }: DownloadFileOptions): Promise<Buffer | ArrayBuffer>;
|
|
994
|
+
/**
|
|
1528
995
|
* List OAuth client created by the account
|
|
1529
996
|
* @param {Object} options Options for this API call
|
|
1530
997
|
* @param {String} [options.product] List clients for this product ID or slug
|
|
@@ -1533,12 +1000,10 @@ class Particle {
|
|
|
1533
1000
|
* @param {Object} [options.context] Request context
|
|
1534
1001
|
* @returns {Promise} A promise
|
|
1535
1002
|
*/
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
/**
|
|
1003
|
+
listOAuthClients({ product, auth, headers, context }: ListOAuthClientsOptions): Promise<JSONResponse<{
|
|
1004
|
+
clients: OAuthClientInfo[];
|
|
1005
|
+
}>>;
|
|
1006
|
+
/**
|
|
1542
1007
|
* Create an OAuth client
|
|
1543
1008
|
* @param {Object} options Options for this API call
|
|
1544
1009
|
* @param {String} options.name Name of the OAuth client
|
|
@@ -1549,15 +1014,22 @@ class Particle {
|
|
|
1549
1014
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1550
1015
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1551
1016
|
* @param {Object} [options.context] Request context
|
|
1552
|
-
* @returns {Promise} A promise
|
|
1553
|
-
*/
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1017
|
+
* @returns {Promise<JSONResponse<OAuthClientInfo>>} A promise that resolves with the response data
|
|
1018
|
+
*/
|
|
1019
|
+
createOAuthClient({ name, type, redirect_uri, scope, product, auth, headers, context }: {
|
|
1020
|
+
name: string;
|
|
1021
|
+
type: string;
|
|
1022
|
+
redirect_uri?: string;
|
|
1023
|
+
scope?: Record<string, string>;
|
|
1024
|
+
product?: string | number;
|
|
1025
|
+
auth?: string;
|
|
1026
|
+
headers?: Record<string, string>;
|
|
1027
|
+
context?: {
|
|
1028
|
+
tool?: ToolContext;
|
|
1029
|
+
project?: ProjectContext;
|
|
1030
|
+
};
|
|
1031
|
+
}): Promise<JSONResponse<OAuthClientInfo>>;
|
|
1032
|
+
/**
|
|
1561
1033
|
* Update an OAuth client
|
|
1562
1034
|
* @param {Object} options Options for this API call
|
|
1563
1035
|
* @param {String} options.clientId The OAuth client to update
|
|
@@ -1567,15 +1039,10 @@ class Particle {
|
|
|
1567
1039
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1568
1040
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1569
1041
|
* @param {Object} [options.context] Request context
|
|
1570
|
-
* @returns {Promise} A promise
|
|
1042
|
+
* @returns {Promise<JSONResponse<OAuthClientInfo>>} A promise that resolves with the response data
|
|
1571
1043
|
*/
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
const data = { name, scope };
|
|
1575
|
-
return this.put({ uri, data, auth, headers, context });
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
/**
|
|
1044
|
+
updateOAuthClient({ clientId, name, scope, product, auth, headers, context }: UpdateOAuthClientOptions): Promise<JSONResponse<OAuthClientInfo>>;
|
|
1045
|
+
/**
|
|
1579
1046
|
* Delete an OAuth client
|
|
1580
1047
|
* @param {Object} options Options for this API call
|
|
1581
1048
|
* @param {String} options.clientId The OAuth client to update
|
|
@@ -1583,14 +1050,10 @@ class Particle {
|
|
|
1583
1050
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1584
1051
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1585
1052
|
* @param {Object} [options.context] Request context
|
|
1586
|
-
* @returns {Promise} A promise
|
|
1053
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1587
1054
|
*/
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
return this.delete({ uri, auth, headers, context });
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
/**
|
|
1055
|
+
deleteOAuthClient({ clientId, product, auth, headers, context }: DeleteOAuthClientOptions): Promise<JSONResponse<OKResponse>>;
|
|
1056
|
+
/**
|
|
1594
1057
|
* List products the account has access to
|
|
1595
1058
|
* @param {Object} options Options for this API call
|
|
1596
1059
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
@@ -1598,11 +1061,10 @@ class Particle {
|
|
|
1598
1061
|
* @param {Object} [options.context] Request context
|
|
1599
1062
|
* @returns {Promise} A promise
|
|
1600
1063
|
*/
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
/**
|
|
1064
|
+
listProducts({ auth, headers, context }: ListProductsOptions): Promise<JSONResponse<{
|
|
1065
|
+
products: ProductInfo[];
|
|
1066
|
+
}>>;
|
|
1067
|
+
/**
|
|
1606
1068
|
* Get detailed information about a product
|
|
1607
1069
|
* @param {Object} options Options for this API call
|
|
1608
1070
|
* @param {String} options.product Product ID or slug
|
|
@@ -1611,24 +1073,20 @@ class Particle {
|
|
|
1611
1073
|
* @param {Object} [options.context] Request context
|
|
1612
1074
|
* @returns {Promise} A promise
|
|
1613
1075
|
*/
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
/**
|
|
1076
|
+
getProduct({ product, auth, headers, context }: GetProductOptions): Promise<JSONResponse<{
|
|
1077
|
+
product: ProductInfo;
|
|
1078
|
+
}>>;
|
|
1079
|
+
/**
|
|
1619
1080
|
* List product firmware versions
|
|
1620
1081
|
* @param {Object} options Options for this API call
|
|
1621
1082
|
* @param {String} options.product Firmware for this product ID or slug
|
|
1622
1083
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1623
1084
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1624
1085
|
* @param {Object} [options.context] Request context
|
|
1625
|
-
* @returns {Promise} A promise
|
|
1086
|
+
* @returns {Promise<JSONResponse<ProductFirmwareInfo[]>>} A promise that resolves with the response data
|
|
1626
1087
|
*/
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
/**
|
|
1088
|
+
listProductFirmware({ product, auth, headers, context }: ListProductFirmwareOptions): Promise<JSONResponse<ProductFirmwareInfo[]>>;
|
|
1089
|
+
/**
|
|
1632
1090
|
* List product firmware versions
|
|
1633
1091
|
* @param {Object} options Options for this API call
|
|
1634
1092
|
* @param {Object} options.file Path or Buffer of the new firmware file
|
|
@@ -1640,27 +1098,10 @@ class Particle {
|
|
|
1640
1098
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1641
1099
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1642
1100
|
* @param {Object} [options.context] Request context
|
|
1643
|
-
* @returns {Promise} A promise
|
|
1101
|
+
* @returns {Promise<JSONResponse<ProductFirmwareInfo>>} A promise that resolves with the response data
|
|
1644
1102
|
*/
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
uri: `/v1/products/${product}/firmware`,
|
|
1648
|
-
method: 'post',
|
|
1649
|
-
auth,
|
|
1650
|
-
headers,
|
|
1651
|
-
form: {
|
|
1652
|
-
version,
|
|
1653
|
-
title,
|
|
1654
|
-
description
|
|
1655
|
-
},
|
|
1656
|
-
files: {
|
|
1657
|
-
'firmware.bin': file
|
|
1658
|
-
},
|
|
1659
|
-
context
|
|
1660
|
-
});
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
/**
|
|
1103
|
+
uploadProductFirmware({ file, version, title, description, product, auth, headers, context }: UploadProductFirmwareOptions): Promise<JSONResponse<ProductFirmwareInfo>>;
|
|
1104
|
+
/**
|
|
1664
1105
|
* Get information about a product firmware version
|
|
1665
1106
|
* @param {Object} options Options for this API call
|
|
1666
1107
|
* @param {Number} options.version Version number of firmware
|
|
@@ -1668,18 +1109,10 @@ class Particle {
|
|
|
1668
1109
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1669
1110
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1670
1111
|
* @param {Object} [options.context] Request context
|
|
1671
|
-
* @returns {Promise} A promise
|
|
1112
|
+
* @returns {Promise<JSONResponse<ProductFirmwareInfo>>} A promise that resolves with the response data
|
|
1672
1113
|
*/
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
uri: `/v1/products/${product}/firmware/${version}`,
|
|
1676
|
-
auth,
|
|
1677
|
-
headers,
|
|
1678
|
-
context
|
|
1679
|
-
});
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
/**
|
|
1114
|
+
getProductFirmware({ version, product, auth, headers, context }: GetProductFirmwareOptions): Promise<JSONResponse<ProductFirmwareInfo>>;
|
|
1115
|
+
/**
|
|
1683
1116
|
* Update information for a product firmware version
|
|
1684
1117
|
* @param {Object} options Options for this API call
|
|
1685
1118
|
* @param {Number} options.version Version number of new firmware
|
|
@@ -1689,14 +1122,10 @@ class Particle {
|
|
|
1689
1122
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1690
1123
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1691
1124
|
* @param {Object} [options.context] Request context
|
|
1692
|
-
* @returns {Promise} A promise
|
|
1125
|
+
* @returns {Promise<JSONResponse<ProductFirmwareInfo>>} A promise that resolves with the response data
|
|
1693
1126
|
*/
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
return this.put({ uri, auth, headers, data: { title, description }, context });
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
/**
|
|
1127
|
+
updateProductFirmware({ version, title, description, product, auth, headers, context }: UpdateProductFirmwareOptions): Promise<JSONResponse<ProductFirmwareInfo>>;
|
|
1128
|
+
/**
|
|
1700
1129
|
* Download a product firmware binary
|
|
1701
1130
|
* @param {Object} options Options for this API call
|
|
1702
1131
|
* @param {Number} options.version Version number of new firmware
|
|
@@ -1704,40 +1133,20 @@ class Particle {
|
|
|
1704
1133
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1705
1134
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1706
1135
|
* @param {Object} [options.context] Request context
|
|
1707
|
-
* @returns {Promise<
|
|
1708
|
-
*/
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
uri: `/v1/products/${product}/firmware/${version}/binary`,
|
|
1712
|
-
method: 'get',
|
|
1713
|
-
auth,
|
|
1714
|
-
headers,
|
|
1715
|
-
context,
|
|
1716
|
-
isBuffer: true
|
|
1717
|
-
});
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
/**
|
|
1136
|
+
* @returns {Promise<Buffer | ArrayBuffer>} A promise that resolves with the binary data
|
|
1137
|
+
*/
|
|
1138
|
+
downloadProductFirmware({ version, product, auth, headers, context }: DownloadProductFirmwareOptions): Promise<Buffer | ArrayBuffer>;
|
|
1139
|
+
/**
|
|
1721
1140
|
* Download a tachyon manufacturing backup files
|
|
1722
1141
|
* @param {Object} options Options for this API call
|
|
1723
1142
|
* @param {Number} options.deviceId Device ID
|
|
1724
1143
|
* @param {String} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1725
1144
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1726
1145
|
* @param {Object} [options.context] Request context
|
|
1727
|
-
|
|
1146
|
+
* @returns {Promise<Buffer | ArrayBuffer>} A promise that resolves with the binary data
|
|
1728
1147
|
*/
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
uri:`/v1/devices/${deviceId}/backup_files`,
|
|
1732
|
-
method: 'put',
|
|
1733
|
-
auth,
|
|
1734
|
-
headers,
|
|
1735
|
-
context,
|
|
1736
|
-
isBuffer: true
|
|
1737
|
-
});
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
/**
|
|
1148
|
+
downloadManufacturingBackup({ deviceId, auth, headers, context }: DownloadManufacturingBackupOptions): Promise<Buffer | ArrayBuffer>;
|
|
1149
|
+
/**
|
|
1741
1150
|
* Release a product firmware version as the default version
|
|
1742
1151
|
* @param {Object} options Options for this API call
|
|
1743
1152
|
* @param {Number} options.version Version number of new firmware
|
|
@@ -1745,32 +1154,20 @@ class Particle {
|
|
|
1745
1154
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1746
1155
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1747
1156
|
* @param {Object} [options.context] Request context
|
|
1748
|
-
* @returns {Promise} A promise
|
|
1157
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1749
1158
|
*/
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
return this.put({ uri, auth, headers, data: { version }, context });
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
|
-
/**
|
|
1159
|
+
releaseProductFirmware({ version, product, product_default, groups, intelligent, auth, headers, context }: ReleaseFirmwareOptions): Promise<JSONResponse<OKResponse>>;
|
|
1160
|
+
/**
|
|
1756
1161
|
* List product team members
|
|
1757
1162
|
* @param {Object} options Options for this API call
|
|
1758
1163
|
* @param {String} options.product Team for this product ID or slug
|
|
1759
1164
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1760
1165
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1761
1166
|
* @param {Object} [options.context] Request context
|
|
1762
|
-
* @returns {Promise} A promise
|
|
1167
|
+
* @returns {Promise<JSONResponse<TeamMember[]>>} A promise that resolves with the response data
|
|
1763
1168
|
*/
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
uri: `/v1/products/${product}/team`,
|
|
1767
|
-
auth,
|
|
1768
|
-
headers,
|
|
1769
|
-
context
|
|
1770
|
-
});
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
/**
|
|
1169
|
+
listTeamMembers({ product, auth, headers, context }: ListTeamMembersOptions): Promise<JSONResponse<TeamMember[]>>;
|
|
1170
|
+
/**
|
|
1774
1171
|
* Invite Particle user to a product team
|
|
1775
1172
|
* @param {Object} options Options for this API call
|
|
1776
1173
|
* @param {String} options.username Username for the Particle account
|
|
@@ -1778,19 +1175,10 @@ class Particle {
|
|
|
1778
1175
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1779
1176
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1780
1177
|
* @param {Object} [options.context] Request context
|
|
1781
|
-
* @returns {Promise} A promise
|
|
1178
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1782
1179
|
*/
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
uri: `/v1/products/${product}/team`,
|
|
1786
|
-
auth,
|
|
1787
|
-
headers,
|
|
1788
|
-
data: { username },
|
|
1789
|
-
context
|
|
1790
|
-
});
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
/**
|
|
1180
|
+
inviteTeamMember({ username, product, auth, headers, context }: InviteTeamMemberOptions): Promise<JSONResponse<OKResponse>>;
|
|
1181
|
+
/**
|
|
1794
1182
|
* Remove Particle user to a product team
|
|
1795
1183
|
* @param {Object} options Options for this API call
|
|
1796
1184
|
* @param {String} options.username Username for the Particle account
|
|
@@ -1798,36 +1186,20 @@ class Particle {
|
|
|
1798
1186
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1799
1187
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1800
1188
|
* @param {Object} [options.context] Request context
|
|
1801
|
-
* @returns {Promise} A promise
|
|
1189
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1802
1190
|
*/
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
uri: `/v1/products/${product}/team/${username}`,
|
|
1806
|
-
auth,
|
|
1807
|
-
headers,
|
|
1808
|
-
context
|
|
1809
|
-
});
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
/**
|
|
1191
|
+
removeTeamMember({ username, product, auth, headers, context }: RemoveTeamMemberOptions): Promise<JSONResponse<OKResponse>>;
|
|
1192
|
+
/**
|
|
1813
1193
|
* Fetch details about a serial number
|
|
1814
1194
|
* @param {Object} options Options for this API call
|
|
1815
1195
|
* @param {String} options.serialNumber The serial number printed on the barcode of the device packaging
|
|
1816
1196
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1817
1197
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1818
1198
|
* @param {Object} [options.context] Request context
|
|
1819
|
-
* @returns {Promise} A promise
|
|
1199
|
+
* @returns {Promise<JSONResponse<SerialNumberResponse>>} A promise that resolves with the response data
|
|
1820
1200
|
*/
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
uri: `/v1/serial_numbers/${serialNumber}`,
|
|
1824
|
-
auth,
|
|
1825
|
-
headers,
|
|
1826
|
-
context
|
|
1827
|
-
});
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
/**
|
|
1201
|
+
lookupSerialNumber({ serialNumber, auth, headers, context }: LookupSerialNumberOptions): Promise<JSONResponse<SerialNumberResponse>>;
|
|
1202
|
+
/**
|
|
1831
1203
|
* Create a mesh network
|
|
1832
1204
|
* @param {Object} options Options for this API call
|
|
1833
1205
|
* @param {String} options.name Network name
|
|
@@ -1836,32 +1208,20 @@ class Particle {
|
|
|
1836
1208
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1837
1209
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1838
1210
|
* @param {Object} [options.context] Request context
|
|
1839
|
-
* @returns {Promise<
|
|
1211
|
+
* @returns {Promise<JSONResponse<NetworkInfo>>} A promise that resolves with the response data
|
|
1840
1212
|
*/
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
uri: '/v1/networks',
|
|
1844
|
-
auth,
|
|
1845
|
-
headers,
|
|
1846
|
-
data: { name, device_id: deviceId, iccid },
|
|
1847
|
-
context
|
|
1848
|
-
});
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
/**
|
|
1213
|
+
createMeshNetwork({ name, deviceId, iccid, auth, headers, context }: CreateMeshNetworkOptions): Promise<JSONResponse<NetworkInfo>>;
|
|
1214
|
+
/**
|
|
1852
1215
|
* Remove a mesh network.
|
|
1853
1216
|
* @param {Object} options Options for this API call
|
|
1854
1217
|
* @param {String} options.networkId Network ID or name
|
|
1855
1218
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1856
1219
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1857
1220
|
* @param {Object} [options.context] Request context
|
|
1858
|
-
* @returns {Promise<
|
|
1221
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1859
1222
|
*/
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
/**
|
|
1223
|
+
removeMeshNetwork({ networkId, auth, headers, context }: RemoveMeshNetworkOptions): Promise<JSONResponse<OKResponse>>;
|
|
1224
|
+
/**
|
|
1865
1225
|
* List all mesh networks
|
|
1866
1226
|
* @param {Object} options Options for this API call
|
|
1867
1227
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
@@ -1869,27 +1229,20 @@ class Particle {
|
|
|
1869
1229
|
* @param {Number} [options.perPage] Records per page
|
|
1870
1230
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1871
1231
|
* @param {Object} [options.context] Request context
|
|
1872
|
-
* @returns {Promise<
|
|
1232
|
+
* @returns {Promise<JSONResponse<NetworkInfo[]>>} A promise that resolves with the response data
|
|
1873
1233
|
*/
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
return this.get({ uri: '/v1/networks', auth, headers, query, context });
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
|
-
/**
|
|
1234
|
+
listMeshNetworks({ page, perPage, auth, headers, context }: ListMeshNetworksOptions): Promise<JSONResponse<NetworkInfo[]>>;
|
|
1235
|
+
/**
|
|
1880
1236
|
* Get information about a mesh network.
|
|
1881
1237
|
* @param {Object} options Options for this API call
|
|
1882
1238
|
* @param {String} options.networkId Network ID or name
|
|
1883
1239
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1884
1240
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1885
1241
|
* @param {Object} [options.context] Request context
|
|
1886
|
-
* @returns {Promise<
|
|
1242
|
+
* @returns {Promise<JSONResponse<NetworkInfo>>} A promise that resolves with the response data
|
|
1887
1243
|
*/
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
/**
|
|
1244
|
+
getMeshNetwork({ networkId, auth, headers, context }: GetMeshNetworkOptions): Promise<JSONResponse<NetworkInfo>>;
|
|
1245
|
+
/**
|
|
1893
1246
|
* Modify a mesh network.
|
|
1894
1247
|
* @param {Object} options Options for this API call
|
|
1895
1248
|
* @param {String} options.networkId Network ID or name
|
|
@@ -1898,19 +1251,10 @@ class Particle {
|
|
|
1898
1251
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1899
1252
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1900
1253
|
* @param {Object} [options.context] Request context
|
|
1901
|
-
* @returns {Promise<
|
|
1254
|
+
* @returns {Promise<JSONResponse<NetworkInfo>>} A promise that resolves with the response data
|
|
1902
1255
|
*/
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
uri: `/v1/networks/${networkId}`,
|
|
1906
|
-
auth,
|
|
1907
|
-
headers,
|
|
1908
|
-
data: { action, device_id: deviceId },
|
|
1909
|
-
context
|
|
1910
|
-
});
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
/**
|
|
1256
|
+
updateMeshNetwork({ networkId, action, deviceId, auth, headers, context }: UpdateMeshNetworkOptions): Promise<JSONResponse<NetworkInfo>>;
|
|
1257
|
+
/**
|
|
1914
1258
|
* Add a device to a mesh network.
|
|
1915
1259
|
* @param {Object} options Options for this API call
|
|
1916
1260
|
* @param {String} options.networkId Network ID or name
|
|
@@ -1918,20 +1262,19 @@ class Particle {
|
|
|
1918
1262
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1919
1263
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1920
1264
|
* @param {Object} [options.context] Request context
|
|
1921
|
-
* @returns {Promise<
|
|
1922
|
-
*/
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
/**
|
|
1265
|
+
* @returns {Promise<JSONResponse<NetworkInfo>>} A promise that resolves with the response data
|
|
1266
|
+
*/
|
|
1267
|
+
addMeshNetworkDevice({ networkId, deviceId, auth, headers, context }: {
|
|
1268
|
+
networkId: string;
|
|
1269
|
+
deviceId: string;
|
|
1270
|
+
auth?: string;
|
|
1271
|
+
headers?: Record<string, string>;
|
|
1272
|
+
context?: {
|
|
1273
|
+
tool?: ToolContext;
|
|
1274
|
+
project?: ProjectContext;
|
|
1275
|
+
};
|
|
1276
|
+
}): Promise<JSONResponse<NetworkInfo>>;
|
|
1277
|
+
/**
|
|
1935
1278
|
* Remove a device from a mesh network.
|
|
1936
1279
|
* @param {Object} options Options for this API call
|
|
1937
1280
|
* @param {String} [options.networkId] Network ID or name
|
|
@@ -1939,27 +1282,10 @@ class Particle {
|
|
|
1939
1282
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1940
1283
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1941
1284
|
* @param {Object} [options.context] Request context
|
|
1942
|
-
* @returns {Promise<
|
|
1943
|
-
*/
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
return this.delete({
|
|
1947
|
-
uri: `/v1/devices/${deviceId}/network`,
|
|
1948
|
-
auth,
|
|
1949
|
-
headers, context
|
|
1950
|
-
});
|
|
1951
|
-
}
|
|
1952
|
-
return this.updateMeshNetwork({
|
|
1953
|
-
action: 'remove-device',
|
|
1954
|
-
networkId,
|
|
1955
|
-
deviceId,
|
|
1956
|
-
auth,
|
|
1957
|
-
headers,
|
|
1958
|
-
context
|
|
1959
|
-
});
|
|
1960
|
-
}
|
|
1961
|
-
|
|
1962
|
-
/**
|
|
1285
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1286
|
+
*/
|
|
1287
|
+
removeMeshNetworkDevice({ networkId, deviceId, auth, headers, context }: RemoveMeshNetworkDeviceOptions): Promise<JSONResponse<OKResponse>>;
|
|
1288
|
+
/**
|
|
1963
1289
|
* List all devices of a mesh network.
|
|
1964
1290
|
* @param {Object} options Options for this API call
|
|
1965
1291
|
* @param {String} options.networkId Network ID or name
|
|
@@ -1969,57 +1295,30 @@ class Particle {
|
|
|
1969
1295
|
* @param {Number} [options.perPage] Records per page
|
|
1970
1296
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1971
1297
|
* @param {Object} [options.context] Request context
|
|
1972
|
-
* @returns {Promise<
|
|
1973
|
-
*/
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
return this.get({
|
|
1977
|
-
uri: `/v1/networks/${networkId}/devices`,
|
|
1978
|
-
auth,
|
|
1979
|
-
headers,
|
|
1980
|
-
query,
|
|
1981
|
-
context
|
|
1982
|
-
});
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
/**
|
|
1298
|
+
* @returns {Promise<JSONResponse<DeviceInfo[]>>} A promise that resolves with the response data
|
|
1299
|
+
*/
|
|
1300
|
+
listMeshNetworkDevices({ networkId, role, page, perPage, auth, headers, context }: ListMeshNetworkDevicesOptions): Promise<JSONResponse<DeviceInfo[]>>;
|
|
1301
|
+
/**
|
|
1986
1302
|
* Get product configuration
|
|
1987
1303
|
* @param {Object} options Options for this API call
|
|
1988
1304
|
* @param {String} options.product Config for this product ID or slug
|
|
1989
1305
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1990
1306
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1991
1307
|
* @param {Object} [options.context] Request context
|
|
1992
|
-
* @returns {Promise} A promise
|
|
1308
|
+
* @returns {Promise<JSONResponse<ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
1993
1309
|
*/
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
uri: `/v1/products/${product}/config`,
|
|
1997
|
-
auth,
|
|
1998
|
-
headers,
|
|
1999
|
-
context
|
|
2000
|
-
});
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
/**
|
|
1310
|
+
getProductConfiguration({ auth, product, headers, context }: GetProductConfigurationOptions): Promise<JSONResponse<ProductConfigurationResponse>>;
|
|
1311
|
+
/**
|
|
2004
1312
|
* Get product configuration schema
|
|
2005
1313
|
* @param {Object} options Options for this API call
|
|
2006
1314
|
* @param {String} options.product Config for this product ID or slug
|
|
2007
1315
|
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
2008
1316
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2009
1317
|
* @param {Object} [options.context] Request context
|
|
2010
|
-
* @returns {Promise} A promise
|
|
1318
|
+
* @returns {Promise<JSONResponse<object>>} A promise that resolves with the response data
|
|
2011
1319
|
*/
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
return this.get({
|
|
2015
|
-
uri: `/v1/products/${product}/config`,
|
|
2016
|
-
auth,
|
|
2017
|
-
headers,
|
|
2018
|
-
context
|
|
2019
|
-
});
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
/**
|
|
1320
|
+
getProductConfigurationSchema({ auth, product, headers, context }: GetProductConfigurationSchemaOptions): Promise<JSONResponse<object>>;
|
|
1321
|
+
/**
|
|
2023
1322
|
* Get product device's configuration
|
|
2024
1323
|
* @param {Object} options Options for this API call
|
|
2025
1324
|
* @param {String} options.product Config for this product ID or slug
|
|
@@ -2027,18 +1326,10 @@ class Particle {
|
|
|
2027
1326
|
* @param {String} options.deviceId Device ID to access
|
|
2028
1327
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2029
1328
|
* @param {Object} [options.context] Request context
|
|
2030
|
-
* @returns {Promise} A promise
|
|
1329
|
+
* @returns {Promise<JSONResponse<ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
2031
1330
|
*/
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
uri: `/v1/products/${product}/config/${deviceId}`,
|
|
2035
|
-
auth,
|
|
2036
|
-
headers,
|
|
2037
|
-
context
|
|
2038
|
-
});
|
|
2039
|
-
}
|
|
2040
|
-
|
|
2041
|
-
/**
|
|
1331
|
+
getProductDeviceConfiguration({ auth, product, deviceId, headers, context }: GetProductDeviceConfigurationOptions): Promise<JSONResponse<ProductConfigurationResponse>>;
|
|
1332
|
+
/**
|
|
2042
1333
|
* Get product device's configuration schema
|
|
2043
1334
|
* @param {Object} options Options for this API call
|
|
2044
1335
|
* @param {String} options.product Config for this product ID or slug
|
|
@@ -2046,19 +1337,10 @@ class Particle {
|
|
|
2046
1337
|
* @param {String} options.deviceId Device ID to access
|
|
2047
1338
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2048
1339
|
* @param {Object} [options.context] Request context
|
|
2049
|
-
* @returns {Promise} A promise
|
|
1340
|
+
* @returns {Promise<JSONResponse<object>>} A promise that resolves with the response data
|
|
2050
1341
|
*/
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
return this.get({
|
|
2054
|
-
uri: `/v1/products/${product}/config/${deviceId}`,
|
|
2055
|
-
auth,
|
|
2056
|
-
headers,
|
|
2057
|
-
context
|
|
2058
|
-
});
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
/**
|
|
1342
|
+
getProductDeviceConfigurationSchema({ auth, product, deviceId, headers, context }: GetProductDeviceConfigurationSchemaOptions): Promise<JSONResponse<object>>;
|
|
1343
|
+
/**
|
|
2062
1344
|
* Set product configuration
|
|
2063
1345
|
* @param {Object} options Options for this API call
|
|
2064
1346
|
* @param {String} options.product Config for this product ID or slug
|
|
@@ -2066,19 +1348,10 @@ class Particle {
|
|
|
2066
1348
|
* @param {Object} options.config Product configuration to update
|
|
2067
1349
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2068
1350
|
* @param {Object} [options.context] Request context
|
|
2069
|
-
* @returns {Promise} A promise
|
|
1351
|
+
* @returns {Promise<JSONResponse<ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
2070
1352
|
*/
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
uri: `/v1/products/${product}/config`,
|
|
2074
|
-
auth,
|
|
2075
|
-
data: config,
|
|
2076
|
-
headers,
|
|
2077
|
-
context
|
|
2078
|
-
});
|
|
2079
|
-
}
|
|
2080
|
-
|
|
2081
|
-
/**
|
|
1353
|
+
setProductConfiguration({ auth, product, config, headers, context }: SetProductConfigurationOptions): Promise<JSONResponse<ProductConfigurationResponse>>;
|
|
1354
|
+
/**
|
|
2082
1355
|
* Set product configuration for a specific device within the product
|
|
2083
1356
|
* @param {Object} options Options for this API call
|
|
2084
1357
|
* @param {String} options.product Config for this product ID or slug
|
|
@@ -2087,19 +1360,10 @@ class Particle {
|
|
|
2087
1360
|
* @param {String} options.deviceId Device ID to access
|
|
2088
1361
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2089
1362
|
* @param {Object} [options.context] Request context
|
|
2090
|
-
* @returns {Promise} A promise
|
|
1363
|
+
* @returns {Promise<JSONResponse<ProductConfigurationResponse>>} A promise that resolves with the response data
|
|
2091
1364
|
*/
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
uri: `/v1/products/${product}/config/${deviceId}`,
|
|
2095
|
-
data: config,
|
|
2096
|
-
auth,
|
|
2097
|
-
headers,
|
|
2098
|
-
context
|
|
2099
|
-
});
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
/**
|
|
1365
|
+
setProductDeviceConfiguration({ auth, product, deviceId, config, headers, context }: SetProductDeviceConfigurationOptions): Promise<JSONResponse<ProductConfigurationResponse>>;
|
|
1366
|
+
/**
|
|
2103
1367
|
* Query location for devices within a product
|
|
2104
1368
|
* @param {Object} options Options for this API call
|
|
2105
1369
|
* @param {String} options.product Locations for this product ID or slug
|
|
@@ -2114,28 +1378,10 @@ class Particle {
|
|
|
2114
1378
|
* @param {String} options.perPage Number of results per page. Defaults to 20. Maximum of 100
|
|
2115
1379
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2116
1380
|
* @param {Object} [options.context] Request context
|
|
2117
|
-
* @returns {Promise} A promise
|
|
1381
|
+
* @returns {Promise<JSONResponse<LocationListResponse>>} A promise that resolves with the response data
|
|
2118
1382
|
*/
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
uri: `/v1/products/${product}/locations`,
|
|
2122
|
-
query: {
|
|
2123
|
-
date_range: dateRange,
|
|
2124
|
-
rect_bl: rectBl,
|
|
2125
|
-
rect_tr: rectTr,
|
|
2126
|
-
device_id: deviceId,
|
|
2127
|
-
device_name: deviceName,
|
|
2128
|
-
groups,
|
|
2129
|
-
page,
|
|
2130
|
-
per_page: perPage
|
|
2131
|
-
},
|
|
2132
|
-
auth,
|
|
2133
|
-
headers,
|
|
2134
|
-
context
|
|
2135
|
-
});
|
|
2136
|
-
}
|
|
2137
|
-
|
|
2138
|
-
/**
|
|
1383
|
+
getProductLocations({ auth, product, dateRange, rectBl, rectTr, deviceId, deviceName, groups, page, perPage, headers, context }: GetProductLocationsOptions): Promise<JSONResponse<LocationListResponse>>;
|
|
1384
|
+
/**
|
|
2139
1385
|
* Query location for one device within a product
|
|
2140
1386
|
* @param {Object} options Options for this API call
|
|
2141
1387
|
* @param {String} options.product Locations for this product ID or slug
|
|
@@ -2148,23 +1394,10 @@ class Particle {
|
|
|
2148
1394
|
* @param {Object} [options.context] Request context
|
|
2149
1395
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2150
1396
|
* @param {Object} [options.context] Request context
|
|
2151
|
-
* @returns {Promise} A promise
|
|
1397
|
+
* @returns {Promise<JSONResponse<DeviceLocationInfo>>} A promise that resolves with the response data
|
|
2152
1398
|
*/
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
uri: `/v1/products/${product}/locations/${deviceId}`,
|
|
2156
|
-
query: {
|
|
2157
|
-
date_range: dateRange,
|
|
2158
|
-
rect_bl: rectBl,
|
|
2159
|
-
rect_tr: rectTr
|
|
2160
|
-
},
|
|
2161
|
-
auth,
|
|
2162
|
-
headers,
|
|
2163
|
-
context
|
|
2164
|
-
});
|
|
2165
|
-
}
|
|
2166
|
-
|
|
2167
|
-
/**
|
|
1399
|
+
getProductDeviceLocations({ auth, product, dateRange, rectBl, rectTr, deviceId, headers, context }: GetProductDeviceLocationsOptions): Promise<JSONResponse<DeviceLocationInfo>>;
|
|
1400
|
+
/**
|
|
2168
1401
|
* Executes the provided logic function once and returns the result. No logs, runs, etc are saved
|
|
2169
1402
|
*
|
|
2170
1403
|
* NOTE: Any external interactions such as Particle.publish will actually occur when the logic is executed.
|
|
@@ -2176,19 +1409,10 @@ class Particle {
|
|
|
2176
1409
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2177
1410
|
* @param {Object} [options.context] Request context
|
|
2178
1411
|
*
|
|
2179
|
-
* @returns {Promise<
|
|
1412
|
+
* @returns {Promise<JSONResponse<ExecuteLogicResponse>>} A promise that resolves with the response data
|
|
2180
1413
|
*/
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
uri: this._namespacedPath(org, 'logic/execute'),
|
|
2184
|
-
auth,
|
|
2185
|
-
data: logic,
|
|
2186
|
-
headers,
|
|
2187
|
-
context
|
|
2188
|
-
});
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
/**
|
|
1414
|
+
executeLogic({ auth, org, logic, headers, context }: ExecuteLogicOptions): Promise<JSONResponse<ExecuteLogicResponse>>;
|
|
1415
|
+
/**
|
|
2192
1416
|
* Creates a new logic function in the specified organization or sandbox using the provided function data.
|
|
2193
1417
|
*
|
|
2194
1418
|
* When you create a logic function with Event logic triggers, events will immediately
|
|
@@ -2206,17 +1430,29 @@ class Particle {
|
|
|
2206
1430
|
*
|
|
2207
1431
|
* @returns {Promise<RequestResponse>} A promise that resolves to the created logic function data.
|
|
2208
1432
|
*/
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
1433
|
+
createLogicFunction({ auth, org, logicFunction, headers, context }: {
|
|
1434
|
+
auth?: string;
|
|
1435
|
+
org?: string;
|
|
1436
|
+
logicFunction: {
|
|
1437
|
+
name: string;
|
|
1438
|
+
description?: string;
|
|
1439
|
+
enabled?: boolean;
|
|
1440
|
+
source: {
|
|
1441
|
+
type: 'JavaScript';
|
|
1442
|
+
code: string;
|
|
1443
|
+
};
|
|
1444
|
+
logic_triggers?: object[];
|
|
1445
|
+
api_username?: string;
|
|
1446
|
+
};
|
|
1447
|
+
headers?: Record<string, string>;
|
|
1448
|
+
context?: {
|
|
1449
|
+
tool?: ToolContext;
|
|
1450
|
+
project?: ProjectContext;
|
|
1451
|
+
};
|
|
1452
|
+
}): Promise<JSONResponse<{
|
|
1453
|
+
logic_function: LogicFunction;
|
|
1454
|
+
}>>;
|
|
1455
|
+
/**
|
|
2220
1456
|
* Get a logic function in the specified organization or sandbox by logic function ID.
|
|
2221
1457
|
*
|
|
2222
1458
|
* @param {Object} options The options for the logic function.
|
|
@@ -2228,16 +1464,10 @@ class Particle {
|
|
|
2228
1464
|
*
|
|
2229
1465
|
* @returns {Promise<RequestResponse>} A promise that resolves to the specified logic function data.
|
|
2230
1466
|
*/
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
headers,
|
|
2236
|
-
context
|
|
2237
|
-
});
|
|
2238
|
-
}
|
|
2239
|
-
|
|
2240
|
-
/**
|
|
1467
|
+
getLogicFunction({ auth, org, logicFunctionId, headers, context }: GetLogicFunctionOptions): Promise<JSONResponse<{
|
|
1468
|
+
logic_function: LogicFunction;
|
|
1469
|
+
}>>;
|
|
1470
|
+
/**
|
|
2241
1471
|
* Updates an existing logic function in the specified organization or sandbox using the provided function data.
|
|
2242
1472
|
*
|
|
2243
1473
|
* If you include an id on a logic trigger, it will update the logic trigger in place.
|
|
@@ -2252,17 +1482,29 @@ class Particle {
|
|
|
2252
1482
|
*
|
|
2253
1483
|
* @returns {Promise<RequestResponse>} A promise that resolves to the updated logic function data.
|
|
2254
1484
|
*/
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
1485
|
+
updateLogicFunction({ auth, org, logicFunctionId, logicFunction, headers, context }: {
|
|
1486
|
+
auth?: string;
|
|
1487
|
+
org?: string;
|
|
1488
|
+
logicFunctionId: string;
|
|
1489
|
+
logicFunction: {
|
|
1490
|
+
name?: string;
|
|
1491
|
+
description?: string;
|
|
1492
|
+
enabled?: boolean;
|
|
1493
|
+
source?: {
|
|
1494
|
+
type: 'JavaScript';
|
|
1495
|
+
code: string;
|
|
1496
|
+
};
|
|
1497
|
+
logic_triggers?: object[];
|
|
1498
|
+
};
|
|
1499
|
+
headers?: Record<string, string>;
|
|
1500
|
+
context?: {
|
|
1501
|
+
tool?: ToolContext;
|
|
1502
|
+
project?: ProjectContext;
|
|
1503
|
+
};
|
|
1504
|
+
}): Promise<JSONResponse<{
|
|
1505
|
+
logic_function: LogicFunction;
|
|
1506
|
+
}>>;
|
|
1507
|
+
/**
|
|
2266
1508
|
* Deletes a logic function in the specified organization or sandbox by logic function ID.
|
|
2267
1509
|
*
|
|
2268
1510
|
* @param {Object} options The options for deleting the logic function.
|
|
@@ -2272,18 +1514,10 @@ class Particle {
|
|
|
2272
1514
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2273
1515
|
* @param {Object} [options.context] Request context.
|
|
2274
1516
|
*
|
|
2275
|
-
* @returns {Promise<
|
|
2276
|
-
*/
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
uri: this._namespacedPath(org, `logic/functions/${logicFunctionId}`),
|
|
2280
|
-
auth,
|
|
2281
|
-
headers,
|
|
2282
|
-
context
|
|
2283
|
-
});
|
|
2284
|
-
}
|
|
2285
|
-
|
|
2286
|
-
/**
|
|
1517
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1518
|
+
*/
|
|
1519
|
+
deleteLogicFunction({ auth, org, logicFunctionId, headers, context }: DeleteLogicFunctionOptions): Promise<JSONResponse<OKResponse>>;
|
|
1520
|
+
/**
|
|
2287
1521
|
* Lists all logic functions in the specified organization or sandbox.
|
|
2288
1522
|
*
|
|
2289
1523
|
* @param {Object} options The options for listing logic functions.
|
|
@@ -2295,19 +1529,10 @@ class Particle {
|
|
|
2295
1529
|
*
|
|
2296
1530
|
* @returns {Promise<RequestResponse>} A promise that resolves to an array of logic functions data.
|
|
2297
1531
|
*/
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
today_stats: todayStats
|
|
2303
|
-
},
|
|
2304
|
-
auth,
|
|
2305
|
-
headers,
|
|
2306
|
-
context
|
|
2307
|
-
});
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2310
|
-
/**
|
|
1532
|
+
listLogicFunctions({ auth, org, todayStats, headers, context }: ListLogicFunctionsOptions): Promise<JSONResponse<{
|
|
1533
|
+
logic_functions: LogicFunction[];
|
|
1534
|
+
}>>;
|
|
1535
|
+
/**
|
|
2311
1536
|
* Lists all logic runs for the specified logic function in the specified organization or sandbox.
|
|
2312
1537
|
*
|
|
2313
1538
|
* @param {Object} options The options for the request.
|
|
@@ -2319,16 +1544,10 @@ class Particle {
|
|
|
2319
1544
|
*
|
|
2320
1545
|
* @returns {Promise<RequestResponse>} A promise that resolves to an array of logic run data.
|
|
2321
1546
|
*/
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
headers,
|
|
2327
|
-
context
|
|
2328
|
-
});
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
/**
|
|
1547
|
+
listLogicRuns({ auth, org, logicFunctionId, headers, context }: ListLogicRunsOptions): Promise<JSONResponse<{
|
|
1548
|
+
logic_runs: LogicRun[];
|
|
1549
|
+
}>>;
|
|
1550
|
+
/**
|
|
2332
1551
|
* Retrieves a logic run by its ID for the specified logic function in the specified organization or sandbox.
|
|
2333
1552
|
*
|
|
2334
1553
|
* @param {Object} options The options for the request.
|
|
@@ -2341,16 +1560,10 @@ class Particle {
|
|
|
2341
1560
|
*
|
|
2342
1561
|
* @returns {Promise<RequestResponse>} A promise that resolves to an array of logic run data for the specified logic run ID.
|
|
2343
1562
|
*/
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
headers,
|
|
2349
|
-
context
|
|
2350
|
-
});
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
|
-
/**
|
|
1563
|
+
getLogicRun({ auth, org, logicFunctionId, logicRunId, headers, context }: GetLogicRunOptions): Promise<JSONResponse<{
|
|
1564
|
+
logic_run: LogicRun;
|
|
1565
|
+
}>>;
|
|
1566
|
+
/**
|
|
2354
1567
|
* Retrieves the logs for a logic run by its ID for the specified logic function in the specified organization or sandbox.
|
|
2355
1568
|
*
|
|
2356
1569
|
* @param {Object} options The options for the request.
|
|
@@ -2363,16 +1576,10 @@ class Particle {
|
|
|
2363
1576
|
*
|
|
2364
1577
|
* @returns {Promise<RequestResponse>} A promise that resolves to the logs for the specified logic run ID.
|
|
2365
1578
|
*/
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
headers,
|
|
2371
|
-
context
|
|
2372
|
-
});
|
|
2373
|
-
}
|
|
2374
|
-
|
|
2375
|
-
/**
|
|
1579
|
+
getLogicRunLogs({ auth, org, logicFunctionId, logicRunId, headers, context }: GetLogicRunLogsOptions): Promise<JSONResponse<{
|
|
1580
|
+
logs: LogicRunLog[];
|
|
1581
|
+
}>>;
|
|
1582
|
+
/**
|
|
2376
1583
|
* Creates a new ledger definition in the specified organization or sandbox.
|
|
2377
1584
|
*
|
|
2378
1585
|
* @param {Object} options The options for creating the ledger definition.
|
|
@@ -2382,19 +1589,10 @@ class Particle {
|
|
|
2382
1589
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2383
1590
|
* @param {Object} [options.context] Request context
|
|
2384
1591
|
*
|
|
2385
|
-
* @returns {Promise<
|
|
2386
|
-
*/
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
uri: this._namespacedPath(org, 'ledgers'),
|
|
2390
|
-
auth,
|
|
2391
|
-
data: { ledger },
|
|
2392
|
-
headers,
|
|
2393
|
-
context
|
|
2394
|
-
});
|
|
2395
|
-
}
|
|
2396
|
-
|
|
2397
|
-
/**
|
|
1592
|
+
* @returns {Promise<JSONResponse<LedgerDefinition>>} A promise that resolves with the response data
|
|
1593
|
+
*/
|
|
1594
|
+
createLedger({ auth, org, ledger, headers, context }: CreateLedgerOptions): Promise<JSONResponse<LedgerDefinition>>;
|
|
1595
|
+
/**
|
|
2398
1596
|
* Get a ledger definition in the specified organization or sandbox by ledger name.
|
|
2399
1597
|
*
|
|
2400
1598
|
* @param {Object} options The options for the ledger definition.
|
|
@@ -2404,18 +1602,10 @@ class Particle {
|
|
|
2404
1602
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2405
1603
|
* @param {Object} [options.context] Request context
|
|
2406
1604
|
*
|
|
2407
|
-
* @returns {Promise<
|
|
2408
|
-
*/
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
uri: this._namespacedPath(org, `ledgers/${ledgerName}`),
|
|
2412
|
-
auth,
|
|
2413
|
-
headers,
|
|
2414
|
-
context
|
|
2415
|
-
});
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
|
-
/**
|
|
1605
|
+
* @returns {Promise<JSONResponse<LedgerDefinition>>} A promise that resolves with the response data
|
|
1606
|
+
*/
|
|
1607
|
+
getLedger({ auth, org, ledgerName, headers, context }: GetLedgerOptions): Promise<JSONResponse<LedgerDefinition>>;
|
|
1608
|
+
/**
|
|
2419
1609
|
* Updates an existing ledger definition in the specified organization or sandbox.
|
|
2420
1610
|
*
|
|
2421
1611
|
* @param {Object} options The options for updating the ledger definition.
|
|
@@ -2426,19 +1616,10 @@ class Particle {
|
|
|
2426
1616
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2427
1617
|
* @param {Object} [options.context] Request context.
|
|
2428
1618
|
*
|
|
2429
|
-
* @returns {Promise<
|
|
2430
|
-
*/
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
uri: this._namespacedPath(org, `ledgers/${ledgerName}`),
|
|
2434
|
-
auth,
|
|
2435
|
-
data: { ledger },
|
|
2436
|
-
headers,
|
|
2437
|
-
context
|
|
2438
|
-
});
|
|
2439
|
-
}
|
|
2440
|
-
|
|
2441
|
-
/**
|
|
1619
|
+
* @returns {Promise<JSONResponse<LedgerDefinition>>} A promise that resolves with the response data
|
|
1620
|
+
*/
|
|
1621
|
+
updateLedger({ auth, org, ledgerName, ledger, headers, context }: UpdateLedgerOptions): Promise<JSONResponse<LedgerDefinition>>;
|
|
1622
|
+
/**
|
|
2442
1623
|
* Archives a ledger definition in the specified organization or sandbox by ledger name.
|
|
2443
1624
|
*
|
|
2444
1625
|
* @param {Object} options The options for archiving the ledger definition.
|
|
@@ -2448,22 +1629,13 @@ class Particle {
|
|
|
2448
1629
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2449
1630
|
* @param {Object} [options.context] Request context.
|
|
2450
1631
|
*
|
|
2451
|
-
* @returns {Promise<
|
|
2452
|
-
*/
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
uri: this._namespacedPath(org, `ledgers/${ledgerName}`),
|
|
2456
|
-
auth,
|
|
2457
|
-
headers,
|
|
2458
|
-
context
|
|
2459
|
-
});
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
|
-
/**
|
|
1632
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1633
|
+
*/
|
|
1634
|
+
archiveLedger({ auth, org, ledgerName, headers, context }: ArchiveLedgerOptions): Promise<JSONResponse<OKResponse>>;
|
|
1635
|
+
/**
|
|
2463
1636
|
* @typedef {"Owner" | "Product" | "Device"} Scope
|
|
2464
1637
|
*/
|
|
2465
|
-
|
|
2466
|
-
/**
|
|
1638
|
+
/**
|
|
2467
1639
|
* Lists all ledger definitions in the specified organization or sandbox.
|
|
2468
1640
|
*
|
|
2469
1641
|
* @param {Object} options The options for listing ledger definitions.
|
|
@@ -2478,22 +1650,10 @@ class Particle {
|
|
|
2478
1650
|
*
|
|
2479
1651
|
* @returns {Promise<RequestResponse>} A promise that resolves to an array of ledger definition data.
|
|
2480
1652
|
*/
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
scope,
|
|
2486
|
-
page,
|
|
2487
|
-
per_page: perPage,
|
|
2488
|
-
archived
|
|
2489
|
-
},
|
|
2490
|
-
auth,
|
|
2491
|
-
headers,
|
|
2492
|
-
context
|
|
2493
|
-
});
|
|
2494
|
-
}
|
|
2495
|
-
|
|
2496
|
-
/**
|
|
1653
|
+
listLedgers({ auth, org, scope, page, perPage, archived, headers, context }: ListLedgersOptions): Promise<JSONResponse<{
|
|
1654
|
+
ledger_definitions: LedgerDefinition[];
|
|
1655
|
+
}>>;
|
|
1656
|
+
/**
|
|
2497
1657
|
* Get ledger instance data.
|
|
2498
1658
|
*
|
|
2499
1659
|
* @param {Object} options The options for the ledger instance.
|
|
@@ -2504,22 +1664,13 @@ class Particle {
|
|
|
2504
1664
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2505
1665
|
* @param {Object} [options.context] Request context
|
|
2506
1666
|
*
|
|
2507
|
-
* @returns {Promise<
|
|
2508
|
-
*/
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
uri: this._namespacedPath(org, `ledgers/${ledgerName}/instances/${scopeValue}`),
|
|
2512
|
-
auth,
|
|
2513
|
-
headers,
|
|
2514
|
-
context
|
|
2515
|
-
});
|
|
2516
|
-
}
|
|
2517
|
-
|
|
2518
|
-
/**
|
|
1667
|
+
* @returns {Promise<JSONResponse<LedgerInstance>>} A promise that resolves with the response data
|
|
1668
|
+
*/
|
|
1669
|
+
getLedgerInstance({ auth, org, ledgerName, scopeValue, headers, context }: GetLedgerInstanceOptions): Promise<JSONResponse<LedgerInstance>>;
|
|
1670
|
+
/**
|
|
2519
1671
|
* @typedef {"Replace" | "Merge"} SetMode
|
|
2520
1672
|
*/
|
|
2521
|
-
|
|
2522
|
-
/**
|
|
1673
|
+
/**
|
|
2523
1674
|
* Set ledger instance data.
|
|
2524
1675
|
*
|
|
2525
1676
|
* @param {Object} options The options for updating the ledger instance.
|
|
@@ -2532,22 +1683,10 @@ class Particle {
|
|
|
2532
1683
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2533
1684
|
* @param {Object} [options.context] Request context.
|
|
2534
1685
|
*
|
|
2535
|
-
* @returns {Promise<
|
|
2536
|
-
*/
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
uri: this._namespacedPath(org, `ledgers/${ledgerName}/instances/${scopeValue}`),
|
|
2540
|
-
query: {
|
|
2541
|
-
set_mode: setMode
|
|
2542
|
-
},
|
|
2543
|
-
auth,
|
|
2544
|
-
data: { instance },
|
|
2545
|
-
headers,
|
|
2546
|
-
context
|
|
2547
|
-
});
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
|
-
/**
|
|
1686
|
+
* @returns {Promise<JSONResponse<LedgerInstance>>} A promise that resolves with the response data
|
|
1687
|
+
*/
|
|
1688
|
+
setLedgerInstance({ auth, org, ledgerName, scopeValue, instance, setMode, headers, context }: SetLedgerInstanceOptions): Promise<JSONResponse<LedgerInstance>>;
|
|
1689
|
+
/**
|
|
2551
1690
|
* Delete a ledger instance in the specified organization or sandbox by ledger name.
|
|
2552
1691
|
*
|
|
2553
1692
|
* @param {Object} options The options for archiving the ledger instance.
|
|
@@ -2558,18 +1697,10 @@ class Particle {
|
|
|
2558
1697
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2559
1698
|
* @param {Object} [options.context] Request context.
|
|
2560
1699
|
*
|
|
2561
|
-
* @returns {Promise<
|
|
2562
|
-
*/
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
uri: this._namespacedPath(org, `ledgers/${ledgerName}/instances/${scopeValue}`),
|
|
2566
|
-
auth,
|
|
2567
|
-
headers,
|
|
2568
|
-
context
|
|
2569
|
-
});
|
|
2570
|
-
}
|
|
2571
|
-
|
|
2572
|
-
/**
|
|
1700
|
+
* @returns {Promise<JSONResponse<OKResponse>>} A promise that resolves with the response data
|
|
1701
|
+
*/
|
|
1702
|
+
deleteLedgerInstance({ auth, org, ledgerName, scopeValue, headers, context }: DeleteLedgerInstanceOptions): Promise<JSONResponse<OKResponse>>;
|
|
1703
|
+
/**
|
|
2573
1704
|
* Lists ledger instances in the specified organization or sandbox.
|
|
2574
1705
|
*
|
|
2575
1706
|
* @param {Object} options The options for listing ledger instances.
|
|
@@ -2581,22 +1712,10 @@ class Particle {
|
|
|
2581
1712
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2582
1713
|
* @param {Object} [options.context] Request context.
|
|
2583
1714
|
*
|
|
2584
|
-
* @returns {Promise<
|
|
2585
|
-
*/
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
uri: this._namespacedPath(org, `ledgers/${ledgerName}/instances`),
|
|
2589
|
-
query: {
|
|
2590
|
-
page,
|
|
2591
|
-
per_page: perPage
|
|
2592
|
-
},
|
|
2593
|
-
auth,
|
|
2594
|
-
headers,
|
|
2595
|
-
context
|
|
2596
|
-
});
|
|
2597
|
-
}
|
|
2598
|
-
|
|
2599
|
-
/**
|
|
1715
|
+
* @returns {Promise<JSONResponse<LedgerInstanceListResponse>>} A promise that resolves with the response data
|
|
1716
|
+
*/
|
|
1717
|
+
listLedgerInstances({ auth, org, ledgerName, page, perPage, headers, context }: ListLedgerInstancesOptions): Promise<JSONResponse<LedgerInstanceListResponse>>;
|
|
1718
|
+
/**
|
|
2600
1719
|
* List ledger instance versions
|
|
2601
1720
|
*
|
|
2602
1721
|
* @param {Object} options The options for the ledger instance.
|
|
@@ -2609,22 +1728,10 @@ class Particle {
|
|
|
2609
1728
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2610
1729
|
* @param {Object} [options.context] Request context
|
|
2611
1730
|
*
|
|
2612
|
-
* @returns {Promise<
|
|
2613
|
-
*/
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
uri: this._namespacedPath(org, `ledgers/${ledgerName}/instances/${scopeValue}/versions`),
|
|
2617
|
-
query: {
|
|
2618
|
-
replaced_before: replacedBefore,
|
|
2619
|
-
replaced_after: replacedAfter
|
|
2620
|
-
},
|
|
2621
|
-
auth,
|
|
2622
|
-
headers,
|
|
2623
|
-
context
|
|
2624
|
-
});
|
|
2625
|
-
}
|
|
2626
|
-
|
|
2627
|
-
/**
|
|
1731
|
+
* @returns {Promise<JSONResponse<LedgerVersionListResponse>>} A promise that resolves with the response data
|
|
1732
|
+
*/
|
|
1733
|
+
listLedgerInstanceVersions({ auth, org, ledgerName, scopeValue, replacedBefore, replacedAfter, headers, context }: ListLedgerInstanceVersionsOptions): Promise<JSONResponse<LedgerVersionListResponse>>;
|
|
1734
|
+
/**
|
|
2628
1735
|
* Get specific ledger instance version
|
|
2629
1736
|
*
|
|
2630
1737
|
* @param {Object} options The options for the ledger instance.
|
|
@@ -2636,18 +1743,10 @@ class Particle {
|
|
|
2636
1743
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2637
1744
|
* @param {Object} [options.context] Request context
|
|
2638
1745
|
*
|
|
2639
|
-
* @returns {Promise<
|
|
2640
|
-
*/
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
uri: this._namespacedPath(org, `ledgers/${ledgerName}/instances/${scopeValue}/versions/${version}`),
|
|
2644
|
-
auth,
|
|
2645
|
-
headers,
|
|
2646
|
-
context
|
|
2647
|
-
});
|
|
2648
|
-
}
|
|
2649
|
-
|
|
2650
|
-
/**
|
|
1746
|
+
* @returns {Promise<JSONResponse<LedgerInstance>>} A promise that resolves with the response data
|
|
1747
|
+
*/
|
|
1748
|
+
getLedgerInstanceVersion({ auth, org, ledgerName, scopeValue, version, headers, context }: GetLedgerInstanceVersionOptions): Promise<JSONResponse<LedgerInstance>>;
|
|
1749
|
+
/**
|
|
2651
1750
|
* List Device OS versions
|
|
2652
1751
|
*
|
|
2653
1752
|
* @param {Object} options Options for this API call
|
|
@@ -2659,26 +1758,10 @@ class Particle {
|
|
|
2659
1758
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2660
1759
|
* @param {Object} [options.context] Request context
|
|
2661
1760
|
*
|
|
2662
|
-
* @returns {Promise<
|
|
2663
|
-
*/
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
platform_id: platformId,
|
|
2667
|
-
internal_version: internalVersion,
|
|
2668
|
-
page,
|
|
2669
|
-
per_page: perPage
|
|
2670
|
-
};
|
|
2671
|
-
|
|
2672
|
-
return this.get({
|
|
2673
|
-
uri: '/v1/device-os/versions',
|
|
2674
|
-
query,
|
|
2675
|
-
auth,
|
|
2676
|
-
headers,
|
|
2677
|
-
context
|
|
2678
|
-
});
|
|
2679
|
-
}
|
|
2680
|
-
|
|
2681
|
-
/**
|
|
1761
|
+
* @returns {Promise<JSONResponse<DeviceOsVersion[]>>} A promise that resolves with the response data
|
|
1762
|
+
*/
|
|
1763
|
+
listDeviceOsVersions({ platformId, internalVersion, page, perPage, auth, headers, context }: ListDeviceOsVersionsOptions): Promise<JSONResponse<DeviceOsVersion[]>>;
|
|
1764
|
+
/**
|
|
2682
1765
|
* Get a specific Device OS version
|
|
2683
1766
|
*
|
|
2684
1767
|
* @param {Object} options Options for this API call
|
|
@@ -2688,71 +1771,135 @@ class Particle {
|
|
|
2688
1771
|
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2689
1772
|
* @param {Object} [options.context] Request context
|
|
2690
1773
|
*
|
|
2691
|
-
* @returns {Promise<
|
|
2692
|
-
*/
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
1774
|
+
* @returns {Promise<JSONResponse<DeviceOsVersion>>} A promise that resolves with the response data
|
|
1775
|
+
*/
|
|
1776
|
+
getDeviceOsVersion({ version, platformId, auth, headers, context }: GetDeviceOsVersionOptions): Promise<JSONResponse<DeviceOsVersion>>;
|
|
1777
|
+
/**
|
|
1778
|
+
* List environment variables for the given scope.
|
|
1779
|
+
*
|
|
1780
|
+
* @param {Object} options Options for this API call
|
|
1781
|
+
* @param {string} [options.product] Product ID or slug.
|
|
1782
|
+
* @param {string} [options.org] Organization ID or slug.
|
|
1783
|
+
* @param {string} [options.deviceId] Device ID.
|
|
1784
|
+
* @param {boolean} [options.sandbox] Set to `true` to target the user sandbox scope.
|
|
1785
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1786
|
+
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1787
|
+
* @param {Object} [options.context] Request context
|
|
1788
|
+
*
|
|
1789
|
+
* @returns {Promise<JSONResponse<EnvVarsResponse>>} A promise that resolves with the env vars data
|
|
1790
|
+
*/
|
|
1791
|
+
listEnvVars({ product, org, deviceId, sandbox, auth, headers, context }: ListEnvVarsOptions): Promise<JSONResponse<EnvVarsResponse>>;
|
|
1792
|
+
/**
|
|
1793
|
+
* Bulk update environment variables with set/unset operations.
|
|
1794
|
+
*
|
|
1795
|
+
* @param {Object} options Options for this API call
|
|
1796
|
+
* @param {Array} options.ops Array of operations. Each op: `{ op: "Set", key: "KEY", value: "val" }` or `{ op: "Unset", key: "KEY" }`. Max 50.
|
|
1797
|
+
* @param {string} [options.product] Product ID or slug.
|
|
1798
|
+
* @param {string} [options.org] Organization ID or slug.
|
|
1799
|
+
* @param {string} [options.deviceId] Device ID.
|
|
1800
|
+
* @param {boolean} [options.sandbox] Set to `true` to target the user sandbox scope.
|
|
1801
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1802
|
+
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1803
|
+
* @param {Object} [options.context] Request context
|
|
1804
|
+
*
|
|
1805
|
+
* @returns {Promise<JSONResponse<EnvVarsResponse>>} A promise that resolves with the updated env vars data
|
|
1806
|
+
*/
|
|
1807
|
+
updateEnvVars({ ops, product, org, deviceId, sandbox, auth, headers, context }: UpdateEnvVarsOptions): Promise<JSONResponse<EnvVarsResponse>>;
|
|
1808
|
+
/**
|
|
1809
|
+
* Set a single environment variable.
|
|
1810
|
+
*
|
|
1811
|
+
* @param {Object} options Options for this API call
|
|
1812
|
+
* @param {string} options.key Environment variable name.
|
|
1813
|
+
* @param {string} options.value Environment variable value.
|
|
1814
|
+
* @param {string} [options.product] Product ID or slug.
|
|
1815
|
+
* @param {string} [options.org] Organization ID or slug.
|
|
1816
|
+
* @param {string} [options.deviceId] Device ID.
|
|
1817
|
+
* @param {boolean} [options.sandbox] Set to `true` to target the user sandbox scope.
|
|
1818
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1819
|
+
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1820
|
+
* @param {Object} [options.context] Request context
|
|
1821
|
+
*
|
|
1822
|
+
* @returns {Promise<JSONResponse<EnvVarsResponse>>} A promise that resolves with the updated env vars data
|
|
1823
|
+
*/
|
|
1824
|
+
setEnvVar({ key, value, product, org, deviceId, sandbox, auth, headers, context }: SetEnvVarOptions): Promise<JSONResponse<EnvVarsResponse>>;
|
|
1825
|
+
/**
|
|
1826
|
+
* Delete a single environment variable.
|
|
1827
|
+
*
|
|
1828
|
+
* @param {Object} options Options for this API call
|
|
1829
|
+
* @param {string} options.key Environment variable name to delete.
|
|
1830
|
+
* @param {string} [options.product] Product ID or slug.
|
|
1831
|
+
* @param {string} [options.org] Organization ID or slug.
|
|
1832
|
+
* @param {string} [options.deviceId] Device ID.
|
|
1833
|
+
* @param {boolean} [options.sandbox] Set to `true` to target the user sandbox scope.
|
|
1834
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1835
|
+
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1836
|
+
* @param {Object} [options.context] Request context
|
|
1837
|
+
*
|
|
1838
|
+
* @returns {Promise<JSONResponse<EnvVarsResponse>>} A promise that resolves with the updated env vars data
|
|
1839
|
+
*/
|
|
1840
|
+
deleteEnvVar({ key, product, org, deviceId, sandbox, auth, headers, context }: DeleteEnvVarOptions): Promise<JSONResponse<EnvVarsResponse>>;
|
|
1841
|
+
/**
|
|
1842
|
+
* Get the rendered (flattened) environment variables for the given scope.
|
|
1843
|
+
*
|
|
1844
|
+
* @param {Object} options Options for this API call
|
|
1845
|
+
* @param {string} [options.product] Product ID or slug.
|
|
1846
|
+
* @param {string} [options.org] Organization ID or slug.
|
|
1847
|
+
* @param {string} [options.deviceId] Device ID.
|
|
1848
|
+
* @param {boolean} [options.sandbox] Set to `true` to target the user sandbox scope.
|
|
1849
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1850
|
+
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1851
|
+
* @param {Object} [options.context] Request context
|
|
1852
|
+
*
|
|
1853
|
+
* @returns {Promise<JSONResponse<EnvVarsRenderResponse>>} A promise that resolves with the rendered env vars
|
|
1854
|
+
*/
|
|
1855
|
+
renderEnvVars({ product, org, deviceId, sandbox, auth, headers, context }: RenderEnvVarsOptions): Promise<JSONResponse<EnvVarsRenderResponse>>;
|
|
1856
|
+
/**
|
|
1857
|
+
* Review the pending environment variables rollout changes.
|
|
1858
|
+
*
|
|
1859
|
+
* @param {Object} options Options for this API call
|
|
1860
|
+
* @param {string} [options.product] Product ID or slug.
|
|
1861
|
+
* @param {string} [options.org] Organization ID or slug.
|
|
1862
|
+
* @param {string} [options.deviceId] Device ID.
|
|
1863
|
+
* @param {boolean} [options.sandbox] Set to `true` to target the user sandbox scope.
|
|
1864
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1865
|
+
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1866
|
+
* @param {Object} [options.context] Request context
|
|
1867
|
+
*
|
|
1868
|
+
* @returns {Promise<JSONResponse<EnvVarsRolloutResponse>>} A promise that resolves with the rollout diff
|
|
1869
|
+
*/
|
|
1870
|
+
reviewEnvVarsRollout({ product, org, deviceId, sandbox, auth, headers, context }: ReviewEnvVarsRolloutOptions): Promise<JSONResponse<EnvVarsRolloutResponse>>;
|
|
1871
|
+
/**
|
|
1872
|
+
* Start rolling out environment variables to devices.
|
|
1873
|
+
*
|
|
1874
|
+
* @param {Object} options Options for this API call
|
|
1875
|
+
* @param {string} options.when When to apply: `"Immediate"` or `"Connect"`.
|
|
1876
|
+
* @param {string} [options.product] Product ID or slug.
|
|
1877
|
+
* @param {string} [options.org] Organization ID or slug.
|
|
1878
|
+
* @param {string} [options.deviceId] Device ID.
|
|
1879
|
+
* @param {boolean} [options.sandbox] Set to `true` to target the user sandbox scope.
|
|
1880
|
+
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
|
|
1881
|
+
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1882
|
+
* @param {Object} [options.context] Request context
|
|
1883
|
+
*
|
|
1884
|
+
* @returns {Promise<JSONResponse<EnvVarsRolloutStartResponse>>} A promise that resolves with success status
|
|
1885
|
+
*/
|
|
1886
|
+
startEnvVarsRollout({ when, product, org, deviceId, sandbox, auth, headers, context }: StartEnvVarsRolloutOptions): Promise<JSONResponse<EnvVarsRolloutStartResponse>>;
|
|
1887
|
+
/**
|
|
2705
1888
|
* Set default auth token that will be used in each method if `auth` is not provided
|
|
2706
1889
|
* @param {string} auth The access token
|
|
2707
1890
|
* @throws {Error} When not auth string is provided
|
|
2708
1891
|
*/
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
* @returns {String|undefined} a Particle auth token or undefined
|
|
2721
|
-
*/
|
|
2722
|
-
_getActiveAuthToken(auth) {
|
|
2723
|
-
return auth || this._defaultAuth;
|
|
2724
|
-
}
|
|
2725
|
-
/**
|
|
2726
|
-
* API URI to access a device
|
|
2727
|
-
* @param {Object} options Options for this API call
|
|
2728
|
-
* @param {String} options.deviceId Device ID to access
|
|
2729
|
-
* @param {String} [options.product] Device only in this product ID or slug
|
|
2730
|
-
* @param {String} [options.org] Device only in this organization ID or slug
|
|
2731
|
-
* @private
|
|
2732
|
-
* @returns {string} URI
|
|
2733
|
-
*/
|
|
2734
|
-
deviceUri({ deviceId, product, org }){
|
|
2735
|
-
if (org) {
|
|
2736
|
-
return `/v1/orgs/${org}/devices/${deviceId}`;
|
|
2737
|
-
}
|
|
2738
|
-
if (product) {
|
|
2739
|
-
return `/v1/products/${product}/devices/${deviceId}`;
|
|
2740
|
-
}
|
|
2741
|
-
return `/v1/devices/${deviceId}`;
|
|
2742
|
-
}
|
|
2743
|
-
|
|
2744
|
-
/**
|
|
2745
|
-
* Helper for building API paths that support sandbox and org prefixes based on org presence
|
|
2746
|
-
* @param {string | undefined} org slug or ID
|
|
2747
|
-
* @param {string} path will be appended to the end of the org/sandbox prefix
|
|
2748
|
-
* @returns {string} the full combined path
|
|
2749
|
-
* @private
|
|
2750
|
-
*/
|
|
2751
|
-
_namespacedPath(org, path) {
|
|
2752
|
-
return org ? `/v1/orgs/${org}/${path}` : `/v1/${path}`;
|
|
2753
|
-
}
|
|
2754
|
-
|
|
2755
|
-
/**
|
|
1892
|
+
setDefaultAuth(auth: string): void;
|
|
1893
|
+
private _getActiveAuthToken;
|
|
1894
|
+
/** @internal */
|
|
1895
|
+
deviceUri({ deviceId, product, org }: {
|
|
1896
|
+
deviceId: string;
|
|
1897
|
+
product?: string | number;
|
|
1898
|
+
org?: string;
|
|
1899
|
+
}): string;
|
|
1900
|
+
private _namespacedPath;
|
|
1901
|
+
private _envVarUri;
|
|
1902
|
+
/**
|
|
2756
1903
|
* Make a GET request
|
|
2757
1904
|
* @param {object} params
|
|
2758
1905
|
* @param {string} params.uri The URI to request
|
|
@@ -2760,15 +1907,10 @@ class Particle {
|
|
|
2760
1907
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2761
1908
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
2762
1909
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
2763
|
-
* @returns {Promise<
|
|
2764
|
-
*/
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
auth = this._getActiveAuthToken(auth);
|
|
2768
|
-
return this.agent.get({ uri, auth, headers, query, context });
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
|
-
/**
|
|
1910
|
+
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
1911
|
+
*/
|
|
1912
|
+
get<T = object>({ uri, auth, headers, query, context }: GetHeadOptions): Promise<JSONResponse<T>>;
|
|
1913
|
+
/**
|
|
2772
1914
|
* Make a HEAD request
|
|
2773
1915
|
* @param {object} params
|
|
2774
1916
|
* @param {string} params.uri The URI to request
|
|
@@ -2776,15 +1918,10 @@ class Particle {
|
|
|
2776
1918
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2777
1919
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
2778
1920
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
2779
|
-
* @returns {Promise<
|
|
2780
|
-
*/
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
auth = this._getActiveAuthToken(auth);
|
|
2784
|
-
return this.agent.head({ uri, auth, headers, query, context });
|
|
2785
|
-
}
|
|
2786
|
-
|
|
2787
|
-
/**
|
|
1921
|
+
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
1922
|
+
*/
|
|
1923
|
+
head<T = object>({ uri, auth, headers, query, context }: GetHeadOptions): Promise<JSONResponse<T>>;
|
|
1924
|
+
/**
|
|
2788
1925
|
* Make a POST request
|
|
2789
1926
|
* @param {object} params
|
|
2790
1927
|
* @param {string} params.uri The URI to request
|
|
@@ -2792,15 +1929,10 @@ class Particle {
|
|
|
2792
1929
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2793
1930
|
* @param {object} [params.data] Object to send as JSON data in the body.
|
|
2794
1931
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
2795
|
-
* @returns {Promise<
|
|
2796
|
-
*/
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
auth = this._getActiveAuthToken(auth);
|
|
2800
|
-
return this.agent.post({ uri, auth, headers, data, context });
|
|
2801
|
-
}
|
|
2802
|
-
|
|
2803
|
-
/**
|
|
1932
|
+
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
1933
|
+
*/
|
|
1934
|
+
post<T = object>({ uri, auth, headers, data, context }: MutateOptions): Promise<JSONResponse<T>>;
|
|
1935
|
+
/**
|
|
2804
1936
|
* Make a PUT request
|
|
2805
1937
|
* @param {object} params
|
|
2806
1938
|
* @param {string} params.uri The URI to request
|
|
@@ -2809,15 +1941,21 @@ class Particle {
|
|
|
2809
1941
|
* @param {object} [params.data] Object to send as JSON data in the body.
|
|
2810
1942
|
* @param {object} [params.query] Key/Value pairs of query params or a correctly formatted string
|
|
2811
1943
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
2812
|
-
* @returns {Promise<
|
|
2813
|
-
*/
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
1944
|
+
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
1945
|
+
*/
|
|
1946
|
+
put<T = object>({ uri, auth, headers, data, query, context }: MutateOptions): Promise<JSONResponse<T>>;
|
|
1947
|
+
/**
|
|
1948
|
+
* Make a PATCH request
|
|
1949
|
+
* @param {object} params
|
|
1950
|
+
* @param {string} params.uri The URI to request
|
|
1951
|
+
* @param {string} [params.auth] Authorization token to use
|
|
1952
|
+
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
1953
|
+
* @param {object} [params.data] Object to send as JSON data in the body.
|
|
1954
|
+
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
1955
|
+
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
1956
|
+
*/
|
|
1957
|
+
patch<T = object>({ uri, auth, headers, data, context }: MutateOptions): Promise<JSONResponse<T>>;
|
|
1958
|
+
/**
|
|
2821
1959
|
* Make a DELETE request
|
|
2822
1960
|
* @param {object} params
|
|
2823
1961
|
* @param {string} params.uri The URI to request
|
|
@@ -2825,15 +1963,10 @@ class Particle {
|
|
|
2825
1963
|
* @param {object} [params.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
|
|
2826
1964
|
* @param {object} [params.data] Object to send as JSON data in the body.
|
|
2827
1965
|
* @param {object} [params.context] The invocation context, describing the tool and project
|
|
2828
|
-
* @returns {Promise<
|
|
1966
|
+
* @returns {Promise<JSONResponse<T>>} A promise that resolves with the response data
|
|
2829
1967
|
*/
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
auth = this._getActiveAuthToken(auth);
|
|
2833
|
-
return this.agent.delete({ uri, auth, headers, data, context });
|
|
2834
|
-
}
|
|
2835
|
-
|
|
2836
|
-
/**
|
|
1968
|
+
delete<T = object>({ uri, auth, headers, data, context }: MutateOptions): Promise<JSONResponse<T>>;
|
|
1969
|
+
/**
|
|
2837
1970
|
*
|
|
2838
1971
|
* @param {Object} args An obj with all the possible request configurations
|
|
2839
1972
|
* @param {String} args.uri The URI to request
|
|
@@ -2846,24 +1979,15 @@ class Particle {
|
|
|
2846
1979
|
* @param {Object} [args.files] Array of file names and file content
|
|
2847
1980
|
* @param {Object} [args.context] The invocation context, describing the tool and project.
|
|
2848
1981
|
* @param {boolean} [args.isBuffer] Indicate if the response should be treated as Buffer instead of JSON
|
|
2849
|
-
* @returns {Promise<RequestResponse
|
|
2850
|
-
*/
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
// @ts-ignore
|
|
2859
|
-
return new Client(Object.assign({ api: this }, options));
|
|
2860
|
-
}
|
|
2861
|
-
|
|
2862
|
-
// Internal method used to target Particle's APIs other than the default
|
|
2863
|
-
setBaseUrl(baseUrl){
|
|
2864
|
-
this.baseUrl = baseUrl;
|
|
2865
|
-
this.agent.setBaseUrl(baseUrl);
|
|
2866
|
-
}
|
|
1982
|
+
* @returns {Promise<RequestResponse>} A promise that resolves with the response data
|
|
1983
|
+
*/
|
|
1984
|
+
request(args: AgentRequestOptions): Promise<RequestResponse>;
|
|
1985
|
+
/** @internal */
|
|
1986
|
+
client(options?: {
|
|
1987
|
+
auth?: string;
|
|
1988
|
+
}): Client;
|
|
1989
|
+
/** @internal */
|
|
1990
|
+
setBaseUrl(baseUrl: string): void;
|
|
2867
1991
|
}
|
|
2868
|
-
|
|
2869
|
-
|
|
1992
|
+
export = Particle;
|
|
1993
|
+
//# sourceMappingURL=Particle.d.ts.map
|