import { RpcMethod } from './commonTypes'; export type ApiTokensService_Create = RpcMethod; export type ApiTokensService_Get = RpcMethod; export type ApiTokensService_List = RpcMethod; export type ApiTokensService_Update = RpcMethod; export type ApiTokensService_Delete = RpcMethod; export type ApiTokensService_GrantRightOnApplication = RpcMethod; export type ApiTokensService_GrantDeviceDataModificationRightOnApplication = RpcMethod; export type ApiTokensService_GrantMessageRightAll = RpcMethod; export type ApiTokensService_GrantDeviceDataModificationRightAll = RpcMethod; export interface ApiTokensService { /** Creates a new API access token (account-scoped or device-scoped) for the account, returning the generated token value once. Use to issue programmatic API credentials; the raw token value is only present in this response. */ Create: ApiTokensService_Create; /** Returns one API token by its token code, including type and the resolved application/group restrictions. Use after list_api_tokens to inspect a single token's scope. */ Get: ApiTokensService_Get; /** Lists the account's API tokens with paging, ordering and optional name search. Use to browse issued tokens or find a token code before get/update/delete. */ List: ApiTokensService_List; /** Updates an API token's name and/or restriction scope by token code, overwriting the stored restrictions. Use to rename a token or change which applications, groups and modify rights it carries. */ Update: ApiTokensService_Update; /** Permanently deletes an API token by token code, revoking its programmatic access. Cannot be undone; a second delete of the same code returns not-found. */ Delete: ApiTokensService_Delete; /** Grants one modify right (account, application, tag or message) or a specific application/group message right across all account-type API tokens of the account. Use to broaden existing account tokens' scope without editing each token individually. */ GrantRightOnApplication: ApiTokensService_GrantRightOnApplication; /** Grants device-data modification rights for one application code across all device-type API tokens of the account. Use to let existing device tokens modify data for a newly added application. */ GrantDeviceDataModificationRightOnApplication: ApiTokensService_GrantDeviceDataModificationRightOnApplication; /** Toggles message rights over all applications and groups on one account-type API token: select_all grants modify-message on every app/group, false revokes them all. Use to quickly select or clear all message scopes for a single token. */ GrantMessageRightAll: ApiTokensService_GrantMessageRightAll; /** Toggles device-data modification rights over all applications on one device-type API token: select_all grants every app, false revokes them all. Use to quickly select or clear all device-data scopes for a single token. */ GrantDeviceDataModificationRightAll: ApiTokensService_GrantDeviceDataModificationRightAll; } export type Restrictions = { /** Application codes (XXXXX-XXXXX) the token may send messages to */ messageApplications: string[]; /** Application group codes the token may send messages to */ messageGroups: string[]; /** Application codes (XXXXX-XXXXX) the token may modify device data for */ deviceDataApplications: string[]; /** Allow modifying account resources */ modifyAccount: boolean; /** Allow modifying application resources */ modifyApplication: boolean; /** Allow sending/modifying messages */ modifyMessage: boolean; /** Allow modifying tags */ modifyTag: boolean; /** Grant all applications instead of an explicit message_applications list */ applicationsSelectAll: boolean; /** Grant all application groups instead of an explicit message_groups list */ groupsSelectAll: boolean; /** Grant all applications instead of an explicit device_data_applications list */ deviceDataSelectAll: boolean; }; export type CreateApiTokenRequest = { /** Token display name (max 64 characters) */ name?: string; /** Token type: "account" for full API access or "device" for device-data only; defaults to account */ type?: string; /** Scope limits (applications, groups and modify rights) applied to the token */ restrictions?: Restrictions; }; export type CreateApiTokenResponse = { code: string; name: string; value: string; type: string; restrictions: Restrictions; }; export type GetApiTokenRequest = { /** API token code */ code?: string; }; export type GetApiTokenResponse = { code: string; name: string; value: string; type: string; restrictions: Restrictions; }; export type ListApiTokensRequest_OrderBy = 'NAME' | 'CREATED'; export type ListApiTokensRequest_OrderDirection = 'ASC' | 'DESC'; export type ListApiTokensRequest = { orderBy?: ListApiTokensRequest_OrderBy; orderDirection?: ListApiTokensRequest_OrderDirection; page?: number; perPage?: number; /** like %name% */ searchByName?: string; }; export type ListApiTokensResponse_ApiToken = { code: string; name: string; value: string; type: string; }; export type ListApiTokensResponse = { apiTokens: ListApiTokensResponse_ApiToken[]; page: number; perPage: number; total: number; }; export type UpdateApiTokenRequest = { /** API token code */ code?: string; /** New token display name (max 64 characters) */ name?: string; /** New scope limits; overwrites the token's current restrictions */ restrictions?: Restrictions; }; export type UpdateApiTokenResponse = { code: string; name: string; value: string; type: string; restrictions: Restrictions; }; export type DeleteApiTokenRequest = { /** API token code */ code?: string; }; export type DeleteApiTokenResponse = {}; export type GrantRightOnApplicationRequest_ModifyAccount = {}; export type GrantRightOnApplicationRequest_ModifyApplication = {}; export type GrantRightOnApplicationRequest_ModifyTag = {}; export type GrantRightOnApplicationRequest_ModifyMessage = {}; export type GrantRightOnApplicationRequest_MessageApplications = { /** Application code (XXXXX-XXXXX) to grant message rights on */ applicationCode: string; }; export type GrantRightOnApplicationRequest_MessageGroups = { /** Application group code to grant message rights on */ applicationGroupCode: string; }; export type GrantRightOnApplicationRequest_kind_modifyAccount = { type: 'modifyAccount'; data: GrantRightOnApplicationRequest_ModifyAccount; }; export type GrantRightOnApplicationRequest_kind_modifyApplication = { type: 'modifyApplication'; data: GrantRightOnApplicationRequest_ModifyApplication; }; export type GrantRightOnApplicationRequest_kind_modifyTag = { type: 'modifyTag'; data: GrantRightOnApplicationRequest_ModifyTag; }; export type GrantRightOnApplicationRequest_kind_modifyMessage = { type: 'modifyMessage'; data: GrantRightOnApplicationRequest_ModifyMessage; }; export type GrantRightOnApplicationRequest_kind_messageApplications = { type: 'messageApplications'; data: GrantRightOnApplicationRequest_MessageApplications; }; export type GrantRightOnApplicationRequest_kind_messageGroups = { type: 'messageGroups'; data: GrantRightOnApplicationRequest_MessageGroups; }; export type GrantRightOnApplicationRequest_kind = GrantRightOnApplicationRequest_kind_modifyAccount | GrantRightOnApplicationRequest_kind_modifyApplication | GrantRightOnApplicationRequest_kind_modifyTag | GrantRightOnApplicationRequest_kind_modifyMessage | GrantRightOnApplicationRequest_kind_messageApplications | GrantRightOnApplicationRequest_kind_messageGroups; export type GrantRightOnApplicationRequest = { kind: GrantRightOnApplicationRequest_kind; }; export type GrantRightOnApplicationResponse = {}; export type GrantDeviceDataModificationRightOnApplicationRequest_DeviceDataApplications = { /** Application code (XXXXX-XXXXX) to grant device-data modification on */ applicationCode: string; }; export type GrantDeviceDataModificationRightOnApplicationRequest_kind_deviceDataApplications = { type: 'deviceDataApplications'; data: GrantDeviceDataModificationRightOnApplicationRequest_DeviceDataApplications; }; export type GrantDeviceDataModificationRightOnApplicationRequest_kind = GrantDeviceDataModificationRightOnApplicationRequest_kind_deviceDataApplications; export type GrantDeviceDataModificationRightOnApplicationRequest = { kind: GrantDeviceDataModificationRightOnApplicationRequest_kind; }; export type GrantDeviceDataModificationRightOnApplicationResponse = {}; export type GrantMessageRightAllRequest = { /** API token code */ code?: string; /** true grants message rights on all apps/groups, false revokes them all */ selectAll?: boolean; }; export type GrantMessageRightAllResponse = {}; export type GrantDeviceDataModificationRightAllRequest = { /** API token code */ code?: string; /** true grants device-data rights on all apps, false revokes them all */ selectAll?: boolean; }; export type GrantDeviceDataModificationRightAllResponse = {};