import EventStream = require('./EventStream');
import Agent = require('./Agent');
import Client = require('./Client');
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';
/**
* Particle Cloud API wrapper.
*
* See for examples
* of using the `Particle` class.
*
* Most Particle methods take a single unnamed argument object documented as
* `options` with key/value pairs for each option.
*
*/
declare class Particle {
baseUrl: string;
clientId: string;
clientSecret: string;
tokenDuration: number;
auth: string | undefined;
context: {
tool?: ToolContext;
project?: ProjectContext;
};
agent: Agent;
_defaultAuth?: string;
/**
* Contructor for the Cloud API wrapper.
*
* Create a new Particle object and call methods below on it.
*
* @param {Object} options Options for this API call Options to be used for all requests (see [Defaults](../src/Defaults.js))
* @param {string} [options.baseUrl]
* @param {string} [options.clientSecret]
* @param {string} [options.clientId]
* @param {number} [options.tokenDuration]
* @param {string} [options.auth] The access token. If not specified here, will have to be added to every request
*/
constructor(options?: {
baseUrl?: string;
clientId?: string;
clientSecret?: string;
tokenDuration?: number;
auth?: string;
});
private _isValidContext;
/**
* @typedef {Object} ToolContext
* @property {string} name
* @property {string | number} [version]
* @property {Omit[]} [components]
*/
/**
* @typedef {Record} ProjectContext
* @property {string} name
*/
/** @internal */
setContext(name: 'tool' | 'project', context: ToolContext | ProjectContext | undefined): void;
private _buildContext;
/**
* Login to Particle Cloud using an existing Particle acccount.
* @param {Object} options Options for this API call
* @param {String} options.username Username for the Particle account
* @param {String} options.password Password for the Particle account
* @param {Number} options.tokenDuration How long the access token should last in seconds
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Number} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
login({ username, password, tokenDuration, headers, context }: LoginOptions): Promise>;
/**
* If login failed with an 'mfa_required' error, this must be called with a valid OTP code to login
* @param {Object} options Options for this API call
* @param {String} options.mfaToken Given as 'mfa_token' in the error body of `.login()`.
* @param {String} options.otp Current one-time-password generated from the authentication application
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Number} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
sendOtp({ mfaToken, otp, headers, context }: SendOtpOptions): Promise>;
/**
* Enable MFA on the currently logged in user
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
enableMfa({ auth, headers, context }: EnableMfaOptions): Promise>;
/**
* 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.
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} options.mfaToken Token given from previous step to
* @param {Object} options.otp Current one-time-password generated from the authentication app
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
confirmMfa({ mfaToken, otp, invalidateTokens, auth, headers, context }: ConfirmMfaOptions): Promise>;
/**
* Disable MFA for the user.
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} options.currentPassword User's current password
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
disableMfa({ currentPassword, auth, headers, context }: DisableMfaOptions): Promise>;
/**
* Create Customer for Product.
* @param {Object} options Options for this API call
* @param {String} options.email Username for the Particle account
* @param {String} options.password Password for the Particle account
* @param {String} options.product Create the customer in this product ID or slug
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
createCustomer({ email, password, product, headers, context }: CreateCustomerOptions): Promise>;
/**
* Login to Particle Cloud using an OAuth client.
* @param {Object} options Options for this API call
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
loginAsClientOwner({ headers, context }?: LoginAsClientOwnerOptions): Promise>;
/**
* Create a user account for the Particle Cloud
* @param {Object} options Options for this API call
* @param {String} options.username Email of the new user
* @param {String} options.password Password
* @param {String} options.accountInfo Object that contains account information fields such as user real name, company name, business account flag etc
* @param {Object} [options.utm] Object that contains info about the campaign that lead to this user creation
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
createUser({ username, password, accountInfo, utm, headers, context }: {
username: string;
password: string;
accountInfo?: Record;
utm?: Record;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Send reset password email for a Particle Cloud user account
* @param {Object} options Options for this API call
* @param {String} options.username Email of the user
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
resetPassword({ username, headers, context }: ResetPasswordOptions): Promise>;
/**
* Revoke an access token
* @param {Object} options Options for this API call
* @param {String} options.token Access token you wish to revoke
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
deleteAccessToken({ token, headers, context }: DeleteAccessTokenOptions): Promise>;
/**
* Revoke the current session access token
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
deleteCurrentAccessToken({ auth, headers, context }: DeleteCurrentAccessTokenOptions): Promise>;
/**
* Revoke all active access tokens
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
deleteActiveAccessTokens({ auth, headers, context }: DeleteActiveAccessTokensOptions): Promise>;
/**
* Delete the current user
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {String} options.password Password
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
deleteUser({ auth, password, headers, context }: DeleteUserOptions): Promise>;
/**
* Retrieves the information that is used to identify the current login for tracking.
* @param {Object} [options] Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Boolean} [options.full] When true, retrieve all information for registering a user with the tracking API. When false,
* retrieve only the unique tracking ID for the current login.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
trackingIdentity({ full, auth, headers, context }?: TrackingIdentityOptions): Promise>;
/**
* List devices claimed to the account or product
* @param {Object} options Options for this API call
* @param {String} [options.deviceId] (Product only) Filter results to devices with this ID (partial matching)
* @param {String} [options.deviceName] (Product only) Filter results to devices with this name (partial matching)
* @param {Array.} [options.groups] (Product only) A list of full group names to filter results to devices belonging to these groups only.
* @param {String} [options.sortAttr] (Product only) The attribute by which to sort results. See API docs for options.
* @param {String} [options.sortDir] (Product only) The direction of sorting. See API docs for options.
* @param {Number} [options.page] (Product only) Current page of results
* @param {Number} [options.perPage] (Product only) Records per page
* @param {String} [options.product] List devices in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
listDevices({ deviceId, deviceName, groups, sortAttr, sortDir, page, perPage, product, auth, headers, context }: {
deviceId?: string;
deviceName?: string;
groups?: string[];
sortAttr?: string;
sortDir?: string;
page?: number;
perPage?: number;
product?: string | number;
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Get detailed informationa about a device
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {String} [options.product] Device in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getDevice({ deviceId, product, auth, headers, context }: GetDeviceOptions): Promise>;
/**
* Claim a device to the account. The device must be online and unclaimed.
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {boolean} options.requestTransfer True to request the device be transfered from another user
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
claimDevice({ deviceId, requestTransfer, auth, headers, context }: ClaimDeviceOptions): Promise>;
/**
* Add a device to a product or move device out of quarantine.
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID
* @param {Object} options.file A file that contains a single-column list of device IDs, device serial numbers, device IMEIs, or devie ICCIDs.
* Node: Either a path or Buffer. Browser: a File or Blob.
* @param {String} options.product Add to this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
addDeviceToProduct({ deviceId, product, file, auth, headers, context }: AddDeviceToProductOptions): Promise>;
/**
* Unclaim / Remove a device from your account or product, or deny quarantine
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {Boolean} [options.deny] (Product only) Deny this quarantined device, instead of removing an already approved device
* @param {String} options.product Remove from this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
removeDevice({ deviceId, deny, product, auth, headers, context }: RemoveDeviceOptions): Promise>;
/**
* Unclaim a product device its the owner, but keep it in the product
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {String} options.product Remove from this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
removeDeviceOwner({ deviceId, product, auth, headers, context }: RemoveDeviceOwnerOptions): Promise>;
/**
* Rename a device
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {String} options.name Desired Name
* @param {String} [options.product] Rename device in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
renameDevice({ deviceId, name, product, auth, headers, context }: RenameDeviceOptions): Promise>;
/**
* Instruct the device to turn on/off the LED in a rainbow pattern
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {Boolean} options.signal Signal on or off
* @param {String} [options.product] Device in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
signalDevice({ deviceId, signal, product, auth, headers, context }: SignalDeviceOptions): Promise>;
/**
* Store some notes about device
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {String} options.notes Your notes about this device
* @param {String} [options.product] Device in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
setDeviceNotes({ deviceId, notes, product, auth, headers, context }: {
deviceId: string;
notes: string;
product?: string | number;
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Mark device as being used in development of a product so it opts out of automatic firmware updates
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {Boolean} options.development Set to true to mark as development, false to return to product fleet
* @param {String} options.product Device in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
markAsDevelopmentDevice({ deviceId, development, product, auth, headers, context }: {
deviceId: string;
development?: boolean;
product: string | number;
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Mark device as being used in development of a product, so it opts out of automatic firmware updates
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {Number} options.desiredFirmwareVersion Lock the product device to run this firmware version.
* @param {Boolean} [options.flash] Immediately flash firmware indicated by desiredFirmwareVersion
* @param {String} options.product Device in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
lockDeviceProductFirmware({ deviceId, desiredFirmwareVersion, flash, product, auth, headers, context }: {
deviceId: string;
desiredFirmwareVersion: number;
flash?: boolean;
product: string | number;
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Mark device as receiving automatic firmware updates
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {String} options.product Device in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
unlockDeviceProductFirmware({ deviceId, product, auth, headers, context }: {
deviceId: string;
product: string | number;
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Update multiple device attributes at the same time
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {String} [options.name] Desired Name
* @param {Boolean} [options.signal] Signal device on or off
* @param {String} [options.notes] Your notes about this device
* @param {Boolean} [options.development] (Product only) Set to true to mark as development, false to return to product fleet
* @param {Number | null} [options.desiredFirmwareVersion] (Product only) Lock the product device to run this firmware version.
* Pass `null` to unlock firmware and go back to released firmware.
* @param {Boolean} [options.flash] (Product only) Immediately flash firmware indicated by desiredFirmwareVersion
* @param {String} [options.product] Device in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
updateDevice({ deviceId, name, signal, notes, development, desiredFirmwareVersion, flash, product, auth, headers, context }: UpdateDeviceOptions): Promise>;
/**
* Disable device protection.
*
* @param {Object} options Options for this API call.
* @param {String} options.deviceId Device ID or name.
* @param {String} options.action Request action: `prepare` or `confirm`.
* @param {String} [options.org] Organziation ID or slug.
* @param {String} [options.product] Product ID or slug.
* @param {String} [options.serverNonce] Base64-encoded server nonce. Mandatory if `action` is `confirm`,
* @param {String} [options.deviceNonce] Base64-encoded device nonce. Mandatory if `action` is `confirm`,
* @param {String} [options.deviceSignature] Base64-encoded device signature. Mandatory if `action` is `confirm`,
* @param {String} [options.devicePublicKeyFingerprint] Base64-encoded fingerprint of the device public key.
* Mandatory if `action` is `confirm`,
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor.
* @param {Object} [options.headers] Key/value pairs to send as headers.
* @param {Object} [options.context] Request context.
* @returns {Promise>} A promise that resolves with the response data
*/
unprotectDevice({ deviceId, org, product, action, serverNonce, deviceNonce, deviceSignature, devicePublicKeyFingerprint, auth, headers, context }: UnprotectDeviceOptions): Promise>;
/**
* Provision a new device for products that allow self-provisioning
* @param {Object} options Options for this API call
* @param {String} options.productId Product ID where to create this device
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
provisionDevice({ productId, auth, headers, context }: ProvisionDeviceOptions): Promise>;
/**
* Generate a claim code to use in the device claiming process.
* To generate a claim code for a product, the access token MUST belong to a
* customer of the product.
* @param {Object} options Options for this API call
* @param {String} [options.iccid] ICCID of the SIM card used in the Electron
* @param {String} [options.product] Device in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getClaimCode({ iccid, product, auth, headers, context }: GetClaimCodeOptions): Promise>;
/**
* Get the value of a device variable
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {String} options.name Variable name
* @param {String} [options.product] Device in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getVariable({ deviceId, name, product, auth, headers, context }: GetVariableOptions): Promise>;
/**
* Compile and flash application firmware to a device. Pass a pre-compiled binary to flash it directly to the device.
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {String} options.product Flash device in this product ID or slug
* @param {Object} options.files Object containing files to be compiled and flashed. 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.
* @param {String} [options.targetVersion=latest] System firmware version to compile against
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
flashDevice({ deviceId, product, files, targetVersion, auth, headers, context }: FlashDeviceOptions): Promise>;
/**
* Compile firmware using the Particle Cloud
* @param {Object} options Options for this API call
* @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.
* @param {Number} [options.platformId] Platform id number of the device you are compiling for. Common values are 0=Core, 6=Photon, 10=Electron.
* @param {String} [options.targetVersion=latest] System firmware version to compile against
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
compileCode({ files, platformId, targetVersion, auth, headers, context }: CompileCodeOptions): Promise>;
/**
* Download a firmware binary
* @param {Object} options Options for this API call
* @param {String} options.binaryId Binary ID received from a successful compile call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise that resolves with the binary data
*/
downloadFirmwareBinary({ binaryId, auth, headers, context }: DownloadFirmwareBinaryOptions): Promise;
/**
* Send a new device public key to the Particle Cloud
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {String | Buffer} options.key Public key contents
* @param {String} [options.algorithm=rsa] Algorithm used to generate the public key. Valid values are `rsa` or `ecc`.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
sendPublicKey({ deviceId, key, algorithm, auth, headers, context }: {
deviceId: string;
key: string | Buffer;
algorithm?: string;
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Call a device function
* @param {Object} options Options for this API call
* @param {String} options.deviceId Device ID or Name
* @param {String} options.name Function name
* @param {String} options.argument Function argument
* @param {String} [options.product] Device in this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
callFunction({ deviceId, name, argument, product, auth, headers, context }: CallFunctionOptions): Promise>;
/**
* Get a stream of events
* @param {Object} options Options for this API call
* @param {String} [options.deviceId] Device ID or Name, or `mine` to indicate only your devices.
* @param {String} [options.name] Event Name
* @param {String} [options.org] Organization Slug
* @param {String} [options.product] Events for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @returns {Promise} A promise that resolves with the response data
* emit 'event' events.
*/
getEventStream({ deviceId, name, org, product, auth }: GetEventStreamOptions): Promise;
/**
* Publish a event to the Particle Cloud
* @param {Object} options Options for this API call
* @param {String} options.name Event name
* @param {String} options.data Event data
* @param {Boolean} options.isPrivate Should the event be publicly available?
* @param {String} [options.product] Event for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
publishEvent({ name, data, isPrivate, product, auth, headers, context }: {
name: string;
data?: string;
isPrivate?: boolean;
product?: string | number;
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* @typedef {Object} Hook
* @property {String} [method=POST] Type of web request triggered by the Webhook (GET, POST, PUT, or DELETE)
* @property {Object} [auth] Auth data like `{ user: 'me', pass: '1234' }` for basic auth or `{ bearer: 'token' }` to send with the Webhook request
* @property {Object} [headers] Additional headers to add to the Webhook like `{ 'X-ONE': '1', X-TWO: '2' }`
* @property {Object} [query] Query params to add to the Webhook request like `{ foo: 'foo', bar: 'bar' }`
* @property {Object} [json] JSON data to send with the Webhook request - sets `Content-Type` to `application/json`
* @property {Object} [form] Form data to send with the Webhook request - sets `Content-Type` to `application/x-www-form-urlencoded`
* @property {String} [body] Custom body to send with the Webhook request
* @property {Object} [responseTemplate] Template to use to customize the Webhook response body
* @property {Object} [responseEvent] The Webhook response event name that your devices can subscribe to
* @property {Object} [errorResponseEvent] The Webhook error response event name that your devices can subscribe to
*/
/**
* Create a webhook
* @param {Object} options Options for this API call
* @param {String} options.event The name of the Particle event that should trigger the Webhook
* @param {String} options.url The web address that will be targeted when the Webhook is triggered
* @param {String} [options.device] Trigger Webhook only for this device ID or Name
* @param {Boolean} [options.rejectUnauthorized] Set to `false` to skip SSL certificate validation of the target URL
* @param {Boolean} [options.noDefaults] Don't include default event data in the webhook request
* @param {Hook} [options.hook] Webhook configuration settings
* @param {String} [options.product] Webhook for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
createWebhook({ event, url, device, rejectUnauthorized, noDefaults, hook, product, auth, headers, context }: {
event: string;
url: string;
device?: string;
rejectUnauthorized?: boolean;
noDefaults?: boolean;
hook?: {
method?: string;
auth?: Record;
headers?: Record;
query?: Record;
json?: object;
form?: object;
body?: string;
responseTemplate?: string;
responseEvent?: string;
errorResponseEvent?: string;
};
product?: string | number;
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Delete a webhook
* @param {Object} options Options for this API call
* @param {String} options.hookId Webhook ID
* @param {String} [options.product] Webhook for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
deleteWebhook({ hookId, product, auth, headers, context }: DeleteWebhookOptions): Promise>;
/**
* List all webhooks owned by the account or product
* @param {Object} options Options for this API call
* @param {String} [options.product] Webhooks for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
listWebhooks({ product, auth, headers, context }: ListWebhooksOptions): Promise>;
/**
* Create an integration to send events to an external service
*
* See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-
*
* @param {Object} options Options for this API call
* @param {String} options.event Event that triggers the integration
* @param {Object} options.settings Settings specific to that integration type
* @param {String} [options.deviceId] Trigger integration only for this device ID or Name
* @param {String} [options.product] Integration for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
createIntegration({ event, settings, deviceId, product, auth, headers, context }: CreateIntegrationOptions): Promise>;
/**
* Edit an integration to send events to an external service
*
* See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-
*
* @param {Object} options Options for this API call
* @param {String} options.integrationId The integration to edit
* @param {String} [options.event] Change the event that triggers the integration
* @param {Object} [options.settings] Change the settings specific to that integration type
* @param {String} [options.deviceId] Trigger integration only for this device ID or Name
* @param {String} [options.product] Integration for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
editIntegration({ integrationId, event, settings, deviceId, product, auth, headers, context }: EditIntegrationOptions): Promise>;
/**
* Delete an integration to send events to an external service
*
* @param {Object} options Options for this API call
* @param {String} options.integrationId The integration to remove
* @param {String} [options.product] Integration for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
deleteIntegration({ integrationId, product, auth, headers, context }: DeleteIntegrationOptions): Promise>;
/**
* List all integrations owned by the account or product
* @param {Object} options Options for this API call
* @param {String} [options.product] Integrations for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
listIntegrations({ product, auth, headers, context }: ListIntegrationsOptions): Promise>;
/**
* Get details about the current user
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getUserInfo({ auth, headers, context }: {
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Set details on the current user
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {String} options.accountInfo Set user's extended info fields (name, business account, company name, etc)
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
setUserInfo({ accountInfo, auth, headers, context }: {
accountInfo?: Record;
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Change username (i.e, email)
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {String} options.currentPassword Current password
* @param {String} options.username New email
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
changeUsername({ currentPassword, username, invalidateTokens, auth, headers, context }: ChangeUsernameOptions): Promise>;
/**
* Change user's password
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {String} options.currentPassword Current password
* @param {String} options.password New password
* @param {Boolean} options.invalidateTokens Should all tokens be invalidated
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
changeUserPassword({ currentPassword, password, invalidateTokens, auth, headers, context }: ChangeUserPasswordOptions): Promise>;
/**
* List SIM cards owned by a user or product
* @param {Object} options Options for this API call
* @param {String} [options.iccid] (Product only) Filter to SIM cards matching this ICCID
* @param {String} [options.deviceId] (Product only) Filter to SIM cards matching this device ID
* @param {String} [options.deviceName] (Product only) Filter to SIM cards matching this device name
* @param {Number} [options.page] (Product only) Current page of results
* @param {Number} [options.perPage] (Product only) Records per page
* @param {String} [options.product] SIM cards for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
listSIMs({ iccid, deviceId, deviceName, page, perPage, product, auth, headers, context }: ListSIMsOptions): Promise>;
/**
* Get data usage for one SIM card for the current billing period
* @param {Object} options Options for this API call
* @param {String} options.iccid ICCID of the SIM card
* @param {String} [options.product] SIM card for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getSIMDataUsage({ iccid, product, auth, headers, context }: GetSIMDataUsageOptions): Promise>;
/**
* Get data usage for all SIM cards in a product the current billing period
* @param {Object} options Options for this API call
* @param {String} options.product SIM cards for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getFleetDataUsage({ product, auth, headers, context }: GetFleetDataUsageOptions): Promise>;
/**
* Check SIM status
* @param {Object} options Options for this API call
* @param {String} options.iccid ICCID of the SIM card
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
checkSIM({ iccid, auth, headers, context }: CheckSIMOptions): Promise>;
/**
* Activate and add SIM cards to an account or product
* @param {Object} options Options for this API call
* @param {String} options.iccid ICCID of the SIM card
* @param {Array} options.iccids (Product only) ICCID of multiple SIM cards to import
* @param {String} options.country The ISO country code for the SIM cards
* @param {String} [options.product] SIM cards for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @param {any} [options.promoCode]
* @returns {Promise>} A promise that resolves with the response data
*/
activateSIM({ iccid, iccids, country, promoCode, product, auth, headers, context }: ActivateSIMOptions): Promise>;
/**
* Deactivate a SIM card so it doesn't incur data usage in future months.
* @param {Object} options Options for this API call
* @param {String} options.iccid ICCID of the SIM card
* @param {String} [options.product] SIM cards for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
deactivateSIM({ iccid, product, auth, headers, context }: DeactivateSIMOptions): Promise>;
/**
* Reactivate a SIM card the was deactivated or unpause a SIM card that was automatically paused
* @param {Object} options Options for this API call
* @param {String} options.iccid ICCID of the SIM card
* @param {Number} [options.mbLimit] New monthly data limit. Necessary if unpausing a SIM card
* @param {String} [options.product] SIM cards for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
reactivateSIM({ iccid, mbLimit, product, auth, headers, context }: ReactivateSIMOptions): Promise>;
/**
* Update SIM card data limit
* @param {Object} options Options for this API call
* @param {String} options.iccid ICCID of the SIM card
* @param {Array} options.mbLimit Data limit in megabyte for the SIM card
* @param {String} [options.product] SIM cards for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
updateSIM({ iccid, mbLimit, product, auth, headers, context }: UpdateSIMOptions): Promise>;
/**
* Remove a SIM card from an account so it can be activated by a different account
* @param {Object} options Options for this API call
* @param {String} options.iccid ICCID of the SIM card
* @param {String} [options.product] SIM cards for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
removeSIM({ iccid, product, auth, headers, context }: RemoveSIMOptions): Promise>;
/**
* List valid build targets to be used for compiling
* @param {Object} options Options for this API call
* @param {Boolean} [options.onlyFeatured=false] Only list featured build targets
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
listBuildTargets({ onlyFeatured, auth, headers, context }: ListBuildTargetsOptions): Promise>;
/**
* List firmware libraries
* @param {Object} options Options for this API call
* @param {Number} options.page Page index (default, first page)
* @param {Number} options.limit Number of items per page
* @param {String} options.filter Search term for the libraries
* @param {String} options.sort Ordering key for the library list
* @param {Array} options.architectures List of architectures to filter
* @param {String} options.category Category to filter
* @param {String} options.scope The library scope to list. Default is 'all'. Other values are
* - 'all' - list public libraries and my private libraries
* - 'public' - list only public libraries
* - 'private' - list only my private libraries
* - 'mine' - list my libraries (public and private)
* - 'official' - list only official libraries
* - 'verified' - list only verified libraries
* - 'featured' - list only featured libraries
* @param {String} options.excludeScopes list of scopes to exclude
* @param {String} options.category Category to filter
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise
*/
listLibraries({ page, limit, filter, sort, architectures, category, scope, excludeScopes, auth, headers, context }: ListLibrariesOptions): Promise>;
private _asList;
/**
* Get firmware library details
* @param {Object} options Options for this API call
* @param {String} options.name Name of the library to fetch
* @param {String} options.version Version of the library to fetch (default: latest)
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise
*/
getLibrary({ name, version, auth, headers, context }: GetLibraryOptions): Promise>;
/**
* Firmware library details for each version
* @param {Object} options Options for this API call
* @param {String} options.name Name of the library to fetch
* @param {Number} options.page Page index (default, first page)
* @param {Number} options.limit Number of items per page
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise
*/
getLibraryVersions({ name, page, limit, auth, headers, context }: GetLibraryVersionsOptions): Promise>;
/**
* Contribute a new library version from a compressed archive
* @param {Object} options Options for this API call
* @param {String | Buffer} options.archive Compressed archive file containing the library sources
* Either a path or Buffer of the file contents in Node, or a File or Blob in the browser.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise
*/
contributeLibrary({ archive, auth, headers, context }: ContributeLibraryOptions): Promise>;
/**
* Publish the latest version of a library to the public
* @param {Object} options Options for this API call
* @param {String} options.name Name of the library to publish
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise
*/
publishLibrary({ name, auth, headers, context }: PublishLibraryOptions): Promise>;
/**
* Delete one version of a library or an entire private library
* @param {Object} options Options for this API call
* @param {String} options.name Name of the library to remove
* @param {String} options.force Key to force deleting a public library
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
deleteLibrary({ name, force, auth, headers, context }: DeleteLibraryOptions): Promise>;
/**
* Download an external file that may not be on the API
* @param {Object} options Options for this API call
* @param {String} options.uri URL of the file.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise that resolves with the binary data
*/
downloadFile({ uri, headers, context }: DownloadFileOptions): Promise;
/**
* List OAuth client created by the account
* @param {Object} options Options for this API call
* @param {String} [options.product] List clients for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise
*/
listOAuthClients({ product, auth, headers, context }: ListOAuthClientsOptions): Promise>;
/**
* Create an OAuth client
* @param {Object} options Options for this API call
* @param {String} options.name Name of the OAuth client
* @param {String} options.type web, installed or web
* @param {String} [options.redirect_uri] URL to redirect after OAuth flow. Only for type web.
* @param {Object} [options.scope] Limits what the access tokens created by this client can do.
* @param {String} [options.product] Create client for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
createOAuthClient({ name, type, redirect_uri, scope, product, auth, headers, context }: {
name: string;
type: string;
redirect_uri?: string;
scope?: Record;
product?: string | number;
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Update an OAuth client
* @param {Object} options Options for this API call
* @param {String} options.clientId The OAuth client to update
* @param {String} [options.name] New Name of the OAuth client
* @param {Object} [options.scope] New scope of the OAuth client
* @param {String} [options.product] Update client linked to this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
updateOAuthClient({ clientId, name, scope, product, auth, headers, context }: UpdateOAuthClientOptions): Promise>;
/**
* Delete an OAuth client
* @param {Object} options Options for this API call
* @param {String} options.clientId The OAuth client to update
* @param {String} [options.product] OAuth client linked to this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
deleteOAuthClient({ clientId, product, auth, headers, context }: DeleteOAuthClientOptions): Promise>;
/**
* List products the account has access to
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise
*/
listProducts({ auth, headers, context }: ListProductsOptions): Promise>;
/**
* Get detailed information about a product
* @param {Object} options Options for this API call
* @param {String} options.product Product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise
*/
getProduct({ product, auth, headers, context }: GetProductOptions): Promise>;
/**
* List product firmware versions
* @param {Object} options Options for this API call
* @param {String} options.product Firmware for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
listProductFirmware({ product, auth, headers, context }: ListProductFirmwareOptions): Promise>;
/**
* List product firmware versions
* @param {Object} options Options for this API call
* @param {Object} options.file Path or Buffer of the new firmware file
* Either a path or Buffer of the file contents in Node, or a File or Blob in the browser.
* @param {Number} options.version Version number of new firmware
* @param {String} options.title Short identifier for the new firmware
* @param {String} [options.description] Longer description for the new firmware
* @param {String} options.product Firmware for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
uploadProductFirmware({ file, version, title, description, product, auth, headers, context }: UploadProductFirmwareOptions): Promise>;
/**
* Get information about a product firmware version
* @param {Object} options Options for this API call
* @param {Number} options.version Version number of firmware
* @param {String} options.product Firmware for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getProductFirmware({ version, product, auth, headers, context }: GetProductFirmwareOptions): Promise>;
/**
* Update information for a product firmware version
* @param {Object} options Options for this API call
* @param {Number} options.version Version number of new firmware
* @param {String} [options.title] New title
* @param {String} [options.description] New description
* @param {String} options.product Firmware for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
updateProductFirmware({ version, title, description, product, auth, headers, context }: UpdateProductFirmwareOptions): Promise>;
/**
* Download a product firmware binary
* @param {Object} options Options for this API call
* @param {Number} options.version Version number of new firmware
* @param {String} options.product Firmware for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise that resolves with the binary data
*/
downloadProductFirmware({ version, product, auth, headers, context }: DownloadProductFirmwareOptions): Promise;
/**
* Download a tachyon manufacturing backup files
* @param {Object} options Options for this API call
* @param {Number} options.deviceId Device ID
* @param {String} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise} A promise that resolves with the binary data
*/
downloadManufacturingBackup({ deviceId, auth, headers, context }: DownloadManufacturingBackupOptions): Promise;
/**
* Release a product firmware version as the default version
* @param {Object} options Options for this API call
* @param {Number} options.version Version number of new firmware
* @param {String} options.product Firmware for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
releaseProductFirmware({ version, product, product_default, groups, intelligent, auth, headers, context }: ReleaseFirmwareOptions): Promise>;
/**
* List product team members
* @param {Object} options Options for this API call
* @param {String} options.product Team for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
listTeamMembers({ product, auth, headers, context }: ListTeamMembersOptions): Promise>;
/**
* Invite Particle user to a product team
* @param {Object} options Options for this API call
* @param {String} options.username Username for the Particle account
* @param {String} options.product Team for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
inviteTeamMember({ username, product, auth, headers, context }: InviteTeamMemberOptions): Promise>;
/**
* Remove Particle user to a product team
* @param {Object} options Options for this API call
* @param {String} options.username Username for the Particle account
* @param {String} options.product Team for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
removeTeamMember({ username, product, auth, headers, context }: RemoveTeamMemberOptions): Promise>;
/**
* Fetch details about a serial number
* @param {Object} options Options for this API call
* @param {String} options.serialNumber The serial number printed on the barcode of the device packaging
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
lookupSerialNumber({ serialNumber, auth, headers, context }: LookupSerialNumberOptions): Promise>;
/**
* Create a mesh network
* @param {Object} options Options for this API call
* @param {String} options.name Network name
* @param {String} options.deviceId Gateway device ID
* @param {String} [options.iccid] ICCID of the active SIM card (only for cellular gateway devices)
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
createMeshNetwork({ name, deviceId, iccid, auth, headers, context }: CreateMeshNetworkOptions): Promise>;
/**
* Remove a mesh network.
* @param {Object} options Options for this API call
* @param {String} options.networkId Network ID or name
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
removeMeshNetwork({ networkId, auth, headers, context }: RemoveMeshNetworkOptions): Promise>;
/**
* List all mesh networks
* @param {Object} options Options for this API call
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Number} [options.page] Current page of results
* @param {Number} [options.perPage] Records per page
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
listMeshNetworks({ page, perPage, auth, headers, context }: ListMeshNetworksOptions): Promise>;
/**
* Get information about a mesh network.
* @param {Object} options Options for this API call
* @param {String} options.networkId Network ID or name
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getMeshNetwork({ networkId, auth, headers, context }: GetMeshNetworkOptions): Promise>;
/**
* Modify a mesh network.
* @param {Object} options Options for this API call
* @param {String} options.networkId Network ID or name
* @param {String} options.action 'add-device', 'remove-device', 'gateway-enable' or 'gateway-disable'
* @param {String} options.deviceId Device ID
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
updateMeshNetwork({ networkId, action, deviceId, auth, headers, context }: UpdateMeshNetworkOptions): Promise>;
/**
* Add a device to a mesh network.
* @param {Object} options Options for this API call
* @param {String} options.networkId Network ID or name
* @param {String} options.deviceId Device ID
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
addMeshNetworkDevice({ networkId, deviceId, auth, headers, context }: {
networkId: string;
deviceId: string;
auth?: string;
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Remove a device from a mesh network.
* @param {Object} options Options for this API call
* @param {String} [options.networkId] Network ID or name
* @param {String} options.deviceId Device ID
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
removeMeshNetworkDevice({ networkId, deviceId, auth, headers, context }: RemoveMeshNetworkDeviceOptions): Promise>;
/**
* List all devices of a mesh network.
* @param {Object} options Options for this API call
* @param {String} options.networkId Network ID or name
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Number} [options.role] Device role: 'gateway' or 'node'
* @param {Number} [options.page] Current page of results
* @param {Number} [options.perPage] Records per page
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
listMeshNetworkDevices({ networkId, role, page, perPage, auth, headers, context }: ListMeshNetworkDevicesOptions): Promise>;
/**
* Get product configuration
* @param {Object} options Options for this API call
* @param {String} options.product Config for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getProductConfiguration({ auth, product, headers, context }: GetProductConfigurationOptions): Promise>;
/**
* Get product configuration schema
* @param {Object} options Options for this API call
* @param {String} options.product Config for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getProductConfigurationSchema({ auth, product, headers, context }: GetProductConfigurationSchemaOptions): Promise>;
/**
* Get product device's configuration
* @param {Object} options Options for this API call
* @param {String} options.product Config for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {String} options.deviceId Device ID to access
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getProductDeviceConfiguration({ auth, product, deviceId, headers, context }: GetProductDeviceConfigurationOptions): Promise>;
/**
* Get product device's configuration schema
* @param {Object} options Options for this API call
* @param {String} options.product Config for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {String} options.deviceId Device ID to access
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getProductDeviceConfigurationSchema({ auth, product, deviceId, headers, context }: GetProductDeviceConfigurationSchemaOptions): Promise>;
/**
* Set product configuration
* @param {Object} options Options for this API call
* @param {String} options.product Config for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} options.config Product configuration to update
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
setProductConfiguration({ auth, product, config, headers, context }: SetProductConfigurationOptions): Promise>;
/**
* Set product configuration for a specific device within the product
* @param {Object} options Options for this API call
* @param {String} options.product Config for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {Object} options.config Product configuration to update
* @param {String} options.deviceId Device ID to access
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
setProductDeviceConfiguration({ auth, product, deviceId, config, headers, context }: SetProductDeviceConfigurationOptions): Promise>;
/**
* Query location for devices within a product
* @param {Object} options Options for this API call
* @param {String} options.product Locations for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {String} options.dateRange Start and end date in ISO8601 format, separated by comma, to query
* @param {String} options.rectBl Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
* @param {String} options.rectTr Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
* @param {String} options.deviceId Device ID prefix to include in the query
* @param {String} options.deviceName Device name prefix to include in the query
* @param {String} options.groups Array of group names to include in the query
* @param {String} options.page Page of results to display. Defaults to 1
* @param {String} options.perPage Number of results per page. Defaults to 20. Maximum of 100
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getProductLocations({ auth, product, dateRange, rectBl, rectTr, deviceId, deviceName, groups, page, perPage, headers, context }: GetProductLocationsOptions): Promise>;
/**
* Query location for one device within a product
* @param {Object} options Options for this API call
* @param {String} options.product Locations for this product ID or slug
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {String} options.dateRange Start and end date in ISO8601 format, separated by comma, to query
* @param {String} options.rectBl Bottom left of the rectangular bounding box to query. Latitude and longitude separated by comma
* @param {String} options.rectTr Top right of the rectangular bounding box to query. Latitude and longitude separated by comma
* @param {String} options.deviceId Device ID to query
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
* @returns {Promise>} A promise that resolves with the response data
*/
getProductDeviceLocations({ auth, product, dateRange, rectBl, rectTr, deviceId, headers, context }: GetProductDeviceLocationsOptions): Promise>;
/**
* Executes the provided logic function once and returns the result. No logs, runs, etc are saved
*
* NOTE: Any external interactions such as Particle.publish will actually occur when the logic is executed.
*
* @param {Object} options The options for creating the logic function.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {Object} options.logic The logic "function" which will be executed once
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
*
* @returns {Promise>} A promise that resolves with the response data
*/
executeLogic({ auth, org, logic, headers, context }: ExecuteLogicOptions): Promise>;
/**
* Creates a new logic function in the specified organization or sandbox using the provided function data.
*
* When you create a logic function with Event logic triggers, events will immediately
* start being handled by the function code.
*
* When you create a Scheduled logic trigger, it will immediately be scheduled at the next time
* according to the cron and start_at properties.
*
* @param {Object} options The options for creating the logic function.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {Object} options.logicFunction The logic function object containing the function details.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
*
* @returns {Promise} A promise that resolves to the created logic function data.
*/
createLogicFunction({ auth, org, logicFunction, headers, context }: {
auth?: string;
org?: string;
logicFunction: {
name: string;
description?: string;
enabled?: boolean;
source: {
type: 'JavaScript';
code: string;
};
logic_triggers?: object[];
api_username?: string;
};
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Get a logic function in the specified organization or sandbox by logic function ID.
*
* @param {Object} options The options for the logic function.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.logicFunctionId The ID of the logic function to retrieve.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
*
* @returns {Promise} A promise that resolves to the specified logic function data.
*/
getLogicFunction({ auth, org, logicFunctionId, headers, context }: GetLogicFunctionOptions): Promise>;
/**
* Updates an existing logic function in the specified organization or sandbox using the provided function data.
*
* If you include an id on a logic trigger, it will update the logic trigger in place.
*
* @param {Object} options The options for updating the logic function.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.logicFunctionId The ID of the logic function to update.
* @param {Object} options.logicFunction The logic function object containing the logic function details.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context.
*
* @returns {Promise} A promise that resolves to the updated logic function data.
*/
updateLogicFunction({ auth, org, logicFunctionId, logicFunction, headers, context }: {
auth?: string;
org?: string;
logicFunctionId: string;
logicFunction: {
name?: string;
description?: string;
enabled?: boolean;
source?: {
type: 'JavaScript';
code: string;
};
logic_triggers?: object[];
};
headers?: Record;
context?: {
tool?: ToolContext;
project?: ProjectContext;
};
}): Promise>;
/**
* Deletes a logic function in the specified organization or sandbox by logic function ID.
*
* @param {Object} options The options for deleting the logic function.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.logicFunctionId The ID of the logic function to delete.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context.
*
* @returns {Promise>} A promise that resolves with the response data
*/
deleteLogicFunction({ auth, org, logicFunctionId, headers, context }: DeleteLogicFunctionOptions): Promise>;
/**
* Lists all logic functions in the specified organization or sandbox.
*
* @param {Object} options The options for listing logic functions.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {boolean} [options.todayStats] Whether to include today's stats in the response
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context.
*
* @returns {Promise} A promise that resolves to an array of logic functions data.
*/
listLogicFunctions({ auth, org, todayStats, headers, context }: ListLogicFunctionsOptions): Promise>;
/**
* Lists all logic runs for the specified logic function in the specified organization or sandbox.
*
* @param {Object} options The options for the request.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.logicFunctionId The ID of the logic function for which to retrieve the logic runs.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
*
* @returns {Promise} A promise that resolves to an array of logic run data.
*/
listLogicRuns({ auth, org, logicFunctionId, headers, context }: ListLogicRunsOptions): Promise>;
/**
* Retrieves a logic run by its ID for the specified logic function in the specified organization or sandbox.
*
* @param {Object} options The options for the request.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.logicFunctionId The ID of the logic function for which to retrieve the logic run.
* @param {string} options.logicRunId The ID of the logic run to retrieve.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
*
* @returns {Promise} A promise that resolves to an array of logic run data for the specified logic run ID.
*/
getLogicRun({ auth, org, logicFunctionId, logicRunId, headers, context }: GetLogicRunOptions): Promise>;
/**
* Retrieves the logs for a logic run by its ID for the specified logic function in the specified organization or sandbox.
*
* @param {Object} options The options for the request.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The unique identifier of the organization.
* @param {string} options.logicFunctionId The ID of the logic function for which to retrieve the logic run logs.
* @param {string} options.logicRunId The ID of the logic run for which to retrieve the logs.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
*
* @returns {Promise} A promise that resolves to the logs for the specified logic run ID.
*/
getLogicRunLogs({ auth, org, logicFunctionId, logicRunId, headers, context }: GetLogicRunLogsOptions): Promise>;
/**
* Creates a new ledger definition in the specified organization or sandbox.
*
* @param {Object} options The options for creating the ledger definition.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {object} options.ledger The ledger definition object.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
*
* @returns {Promise>} A promise that resolves with the response data
*/
createLedger({ auth, org, ledger, headers, context }: CreateLedgerOptions): Promise>;
/**
* Get a ledger definition in the specified organization or sandbox by ledger name.
*
* @param {Object} options The options for the ledger definition.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.ledgerName The ID of the ledger definition to retrieve.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
*
* @returns {Promise>} A promise that resolves with the response data
*/
getLedger({ auth, org, ledgerName, headers, context }: GetLedgerOptions): Promise>;
/**
* Updates an existing ledger definition in the specified organization or sandbox.
*
* @param {Object} options The options for updating the ledger definition.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.ledgerName Name of the ledger definition to update.
* @param {object} options.ledger The ledger definition object.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context.
*
* @returns {Promise>} A promise that resolves with the response data
*/
updateLedger({ auth, org, ledgerName, ledger, headers, context }: UpdateLedgerOptions): Promise>;
/**
* Archives a ledger definition in the specified organization or sandbox by ledger name.
*
* @param {Object} options The options for archiving the ledger definition.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.ledgerName Name of the ledger definition to archive.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context.
*
* @returns {Promise>} A promise that resolves with the response data
*/
archiveLedger({ auth, org, ledgerName, headers, context }: ArchiveLedgerOptions): Promise>;
/**
* @typedef {"Owner" | "Product" | "Device"} Scope
*/
/**
* Lists all ledger definitions in the specified organization or sandbox.
*
* @param {Object} options The options for listing ledger definitions.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {Scope} [options.scope] Filter to show only ledgers of the specified scope
* @param {boolean} [options.archived] Filter to show only archived ledger or non-archived ledgers. If not provided, all ledgers are returned.
* @param {number} [options.page] Page of results to display
* @param {number} [options.perPage] Number of results per page. Default is 100
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context.
*
* @returns {Promise} A promise that resolves to an array of ledger definition data.
*/
listLedgers({ auth, org, scope, page, perPage, archived, headers, context }: ListLedgersOptions): Promise>;
/**
* Get ledger instance data.
*
* @param {Object} options The options for the ledger instance.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.ledgerName Ledger name.
* @param {string} options.scopeValue Scope value.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
*
* @returns {Promise>} A promise that resolves with the response data
*/
getLedgerInstance({ auth, org, ledgerName, scopeValue, headers, context }: GetLedgerInstanceOptions): Promise>;
/**
* @typedef {"Replace" | "Merge"} SetMode
*/
/**
* Set ledger instance data.
*
* @param {Object} options The options for updating the ledger instance.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.ledgerName Ledger name.
* @param {string} options.scopeValue Scope value.
* @param {object} options.instance The instance with the data
* @param {SetMode} [options.setMode] How the data should be set with existing data. Default is "Replace"
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context.
*
* @returns {Promise>} A promise that resolves with the response data
*/
setLedgerInstance({ auth, org, ledgerName, scopeValue, instance, setMode, headers, context }: SetLedgerInstanceOptions): Promise>;
/**
* Delete a ledger instance in the specified organization or sandbox by ledger name.
*
* @param {Object} options The options for archiving the ledger instance.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.ledgerName Name of the ledger instance to archive.
* @param {string} options.scopeValue Scope value.
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context.
*
* @returns {Promise>} A promise that resolves with the response data
*/
deleteLedgerInstance({ auth, org, ledgerName, scopeValue, headers, context }: DeleteLedgerInstanceOptions): Promise>;
/**
* Lists ledger instances in the specified organization or sandbox.
*
* @param {Object} options The options for listing ledger instances.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The unique identifier of the organization.
* @param {string} options.ledgerName Name of the ledger instance to archive.
* @param {number} [options.page] Page of results to display
* @param {number} [options.perPage] Number of results per page. Default is 100
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context.
*
* @returns {Promise>} A promise that resolves with the response data
*/
listLedgerInstances({ auth, org, ledgerName, page, perPage, headers, context }: ListLedgerInstancesOptions): Promise>;
/**
* List ledger instance versions
*
* @param {Object} options The options for the ledger instance.
* @param {string} [options.auth] The access token. Can be ignored if provided in constructor
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
* @param {string} options.ledgerName Ledger name.
* @param {string} options.scopeValue Scope value.
* @param {string} [options.replacedBefore] ISO date string to filter to instances replaced before this time
* @param {string} [options.replacedAfter] ISO date string to filter to instances replaced after this time
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
* @param {Object} [options.context] Request context
*
* @returns {Promise>} A promise that resolves with the response data
*/
listLedgerInstanceVersions({ auth, org, ledgerName, scopeValue, replacedBefore, replacedAfter, headers, context }: ListLedgerInstanceVersionsOptions): Promise