import { EndpointClientConfig } from '../endpoint-client'; import { Endpoint } from '../endpoint'; import { IconImage, Owner, PrincipalType, SuccessResponse, ViewPrincipalType } from '../types'; export declare const smartAppTypeValues: readonly ["API_ONLY"]; export declare const viewSmartAppTypeValues: readonly ["API_ONLY", "LAMBDA_SMART_APP", "WEBHOOK_SMART_APP"]; export type SmartAppType = typeof smartAppTypeValues[number]; export type ViewSmartAppType = typeof viewSmartAppTypeValues[number]; export declare const smartAppClassificationValues: readonly ["AUTOMATION", "SERVICE", "DEVICE", "CONNECTED_SERVICE"]; export type SmartAppClassification = typeof smartAppClassificationValues[number]; export declare const smartAppTargetStatusValues: readonly ["PENDING", "CONFIRMED"]; export type SmartAppTargetStatus = typeof smartAppTargetStatusValues[number]; export declare const signatureTypeValues: readonly ["APP_RSA", "ST_PADLOCK"]; export type SignatureType = typeof signatureTypeValues[number]; export type LambdaSmartApp = { /** * A list of AWS ARNs referencing a Lambda function. */ functions: string[]; }; export type WebhookSmartApp = { /** * A URL that should be invoked during execution. */ targetUrl: string; /** * The registration status of a target url. */ targetStatus?: SmartAppTargetStatus; /** * The public half of an RSA key pair. Useful for verifying a Webhook * execution request signature to ensure it came from SmartThings. */ publicKey?: string; /** * The http signature type used for authorizing event delivery. * APP_RSA generates an RSA key pair that will be used to verify requests * from SmartThings. ST_PADLOCK requires verification through SmartThings * public certificate. */ signatureType?: SignatureType; }; export type ApiOnlySubscription = { targetUrl: string; targetStatus: SmartAppTargetStatus; }; export type ApiOnlySmartApp = { subscription?: ApiOnlySubscription; /** * Link to the apps privacy policy. Url scheme must be https. * * This field is required for business plans. * * Must be <= 2048 */ privacyPolicyUrl?: string; }; export type ApiOnlySmartAppRequest = Omit & { /** * Optional target url to receive events. Url scheme must be https. * * Must be <= 2048 characters. */ targetUrl?: string; }; export type SmartAppUISettings = { dashboardCardsEnabled: boolean; preInstallDashboardCardsEnabled: boolean; pluginId?: string; pluginUri?: string; }; export type SmartAppBase = { /** * A user defined unique identifier for an app. It is alpha-numeric, may * contain dashes, underscores, periods, and be less then 250 characters * long. It must be unique within your account. */ appName: string; /** * Denotes the type of app. */ appType: ViewSmartAppType; /** * An App maybe associated to many classifications. A classification * drives how the integration is presented to the user in the SmartThings * mobile clients. These classifications include: * * AUTOMATION - Denotes an integration that should display under the "Automation" tab in mobile clients. * SERVICE - Denotes an integration that is classified as a "Service". * DEVICE - Denotes an integration that should display under the "Device" tab in mobile clients. * CONNECTED_SERVICE - Denotes an integration that should display under the "Connected Services" menu in mobile clients. */ classifications: SmartAppClassification[]; /** * A default display name for an app. */ displayName: string; /** * A default description for an app. */ description: string; }; export type SmartAppUpdateRequest = Omit & { appType: SmartAppType; /** * Inform the installation systems that a particular app can only be * installed once within a user's account. */ singleInstance?: boolean; /** * A default icon image for the app. */ iconImage?: IconImage; /** * Details related to an ApiOnly Smart App implementation. * This model should only be specified for apps of type API_ONLY. */ apiOnly?: ApiOnlySmartAppRequest; /** * A collection of settings to drive user interface in SmartThings clients. */ ui?: SmartAppUISettings; }; export type SmartAppCreateRequest = SmartAppUpdateRequest & { /** * A globally unique, developer-defined identifier for an app. It is * alpha-numeric, may contain dashes, underscores, periods, and must * be less then 250 characters long. */ appName: string; /** * Denotes the principal type to be used with the app. * Default is LOCATION. */ principalType?: PrincipalType; /** * App OAuth settings. */ oauth?: Partial; }; export type PagedSmartApp = SmartAppBase & { /** * A globally unique identifier for an app. */ appId: string; /** * A default icon image for the app. */ iconImage?: Required; /** * A typed model which provides information around ownership of a specific domain. */ owner: Owner; /** * A UTC ISO-8601 Date-Time String */ createdDate: string; /** * A UTC ISO-8601 Date-Time String */ lastUpdatedDate: string; }; export type SmartAppResponse = PagedSmartApp & { /** * Denotes the principal type used with the app. */ principalType: ViewPrincipalType; /** * Inform the installation systems that a particular app can only be * installed once within a user's account. */ singleInstance: boolean; /** * System generated metadata that impacts eligibility requirements around * installing an App. */ installMetadata: { [key: string]: string; }; lambdaSmartApp?: LambdaSmartApp; webhookSmartApp?: WebhookSmartApp; apiOnly?: ApiOnlySmartApp; ui: SmartAppUISettings; }; export type SmartAppCreationResponse = { app: SmartAppResponse; oauthClientId: string; oauthClientSecret: string; }; export type GenerateSmartAppOAuthRequest = { /** * A name given to the OAuth Client. */ clientName: string; /** * A list of SmartThings API OAuth scope identifiers that maybe required to * execute your integration. */ scope: string[]; }; export type SmartAppOAuthRequest = GenerateSmartAppOAuthRequest & { /** * A list of redirect URIs. Maximum of 10 URIs. */ redirectUris: string[]; /** * A list of CORS domains. Maximum of 10 domains. */ corsDomains?: string[]; }; export type SmartAppOAuthResponse = SmartAppOAuthRequest; export type GenerateSmartAppOAuthResponse = { oauthClientDetails: SmartAppOAuthResponse; oauthClientId: string; oauthClientSecret: string; }; export type SmartAppSettingsRequest = { settings?: { [key: string]: string; }; }; export type SmartAppSettingsResponse = Required; export type SmartAppListOptions = { /** * account/organization id * * If not specified, Smart Apps for your default organization will be displayed. */ accountId?: string; appType?: ViewSmartAppType; classification?: SmartAppClassification | SmartAppClassification[]; tag?: { [key: string]: string; }; }; export declare class SmartAppsEndpoint extends Endpoint { constructor(config: EndpointClientConfig); /** * Returns a list of all apps belonging to the principal (i.e. the user) */ list(options?: SmartAppListOptions): Promise; /** * Returns a specific app * * @param id either the appId UUID or the appName unique name */ get(id: string): Promise; /** * Create a new app. * * @param data the app definition */ create(data: SmartAppCreateRequest, accountId?: string): Promise; /** * Update an existing app * * @param id either the appId UUID or the appName unique name * @param data the new app definition */ update(id: string, data: SmartAppUpdateRequest): Promise; /** * Get the settings of an app. Settings are string name/value pairs for optional use by the app developer. * @param id either the appId UUID or the appName unique name */ getSettings(id: string): Promise; /** * Update the settings of an app. Settings are string name/value pairs for optional use by the app developer. * @param id either the appId UUID or the appName unique name * @param data the new app settings */ updateSettings(id: string, data: SmartAppSettingsRequest): Promise; /** * Pings the targetUrl of the app to verify its existence. API Access apps must be registered * in order to receive events from SmartThings. * @param id either the appId UUID or the appName unique name */ register(id: string): SuccessResponse; /** * Returns the OAuth information for this app, including the name, scopes, and redirect URLs, if any * @param id either the appId UUID or the appName unique name */ getOauth(id: string): Promise; /** * Updates the OAuth defintion for this app. Use this method to change the scopes or redirect * URLs (for API access apps). This method does not change the clientId or clientSecret of the app. * @param id either the appId UUID or the appName unique name * @param data new OAuth definition */ updateOauth(id: string, data: SmartAppOAuthRequest): Promise; /** * Regenerate clientId and clientSecret for this app. Note that this operation will result in any currently * authorized installed app instances to need to be re-authorized to make calls to SmartThings. * @param id either the appId UUID or the appName unique name * @param data new OAuth definition */ regenerateOauth(id: string, data: GenerateSmartAppOAuthRequest): Promise; /** * Deletes the specified app * @param id either the appId UUID or the appName unique name */ delete(id: string): SuccessResponse; } //# sourceMappingURL=smartapps.d.ts.map