export type ViperAppLinks = {android?: string | undefined, ios?: string | undefined, isLinkingEnabled?: boolean | undefined}; export type EndpointApp = {appName?: string | undefined, partnerName?: string | undefined, oAuthAuthorizationUrl?: string | undefined, lambdaArn?: string | undefined, lambdaArnEU?: string | undefined, lambdaArnAP?: string | undefined, lambdaArnCN?: string | undefined, icon?: string | undefined, icon2x?: string | undefined, icon3x?: string | undefined, endpointAppId?: string | undefined, oAuthClientId?: string | undefined, oAuthClientSecret?: string | undefined, oAuthTokenUrl?: string | undefined, organizationId?: string | undefined, oAuthScope?: string | undefined, userId?: string | undefined, hostingType?: string | undefined, schemaType?: string | undefined, webhookUrl?: string | undefined, certificationStatus?: string | undefined, userEmail?: string | undefined, viperAppLinks?: ViperAppLinks | undefined}; export type UpdateApiSchemaAppsEndpointAppIdArgs = {endpointAppId: string, Authorization: unknown, 'X-ST-Organization'?: unknown | undefined, body: EndpointApp}; export type UpdateApiSchemaAppsEndpointAppIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Schema App Info * * PUT /schema/apps/{endpointAppId} */ export const updateApiSchemaAppsEndpointAppId = async (args: UpdateApiSchemaAppsEndpointAppIdArgs, options?: UpdateApiSchemaAppsEndpointAppIdOptions) => { const {baseUrl = "https://api.smartthings.com/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args['X-ST-Organization'] != null) headers.set("X-ST-Organization", String(args['X-ST-Organization'])) const url = `${baseUrl.replace(/\/+$/, '')}/schema/apps/${encodeURIComponent(String(args.endpointAppId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };