UNPKG

appcenter-cli

Version:

Command line tool for Visual Studio App Center

483 lines (467 loc) 15.1 kB
/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { Push } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { AppCenterClient } from "../appCenterClient"; import { PushConfigExistsOptionalParams, PushGetConfigOptionalParams, PushGetConfigResponse, Paths1Nw7A47V01AppsOwnerNameAppNamePushNotificationsConfigPutRequestbodyContentApplicationJsonSchema, PushSetConfigOptionalParams, PushSetConfigResponse, PushDeleteConfigOptionalParams, PushGetOptionalParams, PushGetResponse, PushListOptionalParams, PushListResponse, PostContentSchemaNotificationContent, PushSendOptionalParams, PushSendResponse, PushDeleteOptionalParams, PushDeleteInstallIdOptionalParams, PushExportDevicesStatusOptionalParams, PushExportDevicesStatusResponse, PushExportDevicesOptionalParams, PushExportDevicesResponse } from "../models"; /** Class containing Push operations. */ export class PushImpl implements Push { private readonly client: AppCenterClient; /** * Initialize a new instance of the class Push class. * @param client Reference to the service client */ constructor(client: AppCenterClient) { this.client = client; } /** * Returns whether a push configuration exists for the selected app. * @param ownerName The name of the owner * @param appName The name of the application * @param options The options parameters. */ configExists( ownerName: string, appName: string, options?: PushConfigExistsOptionalParams ): Promise<void> { return this.client.sendOperationRequest( { ownerName, appName, options }, configExistsOperationSpec ); } /** * Get the push configuration for the selected app. * @param ownerName The name of the owner * @param appName The name of the application * @param options The options parameters. */ getConfig( ownerName: string, appName: string, options?: PushGetConfigOptionalParams ): Promise<PushGetConfigResponse> { return this.client.sendOperationRequest( { ownerName, appName, options }, getConfigOperationSpec ); } /** * Set the push configuration for the selected app. * @param ownerName The name of the owner * @param appName The name of the application * @param properties Notification configurations. * @param options The options parameters. */ setConfig( ownerName: string, appName: string, properties: Paths1Nw7A47V01AppsOwnerNameAppNamePushNotificationsConfigPutRequestbodyContentApplicationJsonSchema, options?: PushSetConfigOptionalParams ): Promise<PushSetConfigResponse> { return this.client.sendOperationRequest( { ownerName, appName, properties, options }, setConfigOperationSpec ); } /** * Delete the push configuration for the selected app. * @param ownerName The name of the owner * @param appName The name of the application * @param options The options parameters. */ deleteConfig( ownerName: string, appName: string, options?: PushDeleteConfigOptionalParams ): Promise<void> { return this.client.sendOperationRequest( { ownerName, appName, options }, deleteConfigOperationSpec ); } /** * Get details about a specific notification. * @param notificationId The id of the notification. * @param ownerName The name of the owner * @param appName The name of the application * @param options The options parameters. */ get( notificationId: string, ownerName: string, appName: string, options?: PushGetOptionalParams ): Promise<PushGetResponse> { return this.client.sendOperationRequest( { notificationId, ownerName, appName, options }, getOperationSpec ); } /** * Get a list of notifications from the service. * @param ownerName The name of the owner * @param appName The name of the application * @param options The options parameters. */ list( ownerName: string, appName: string, options?: PushListOptionalParams ): Promise<PushListResponse> { return this.client.sendOperationRequest( { ownerName, appName, options }, listOperationSpec ); } /** * Send a notification to one or more devices. * @param ownerName The name of the owner * @param appName The name of the application * @param notificationContent Notification definition object * @param options The options parameters. */ send( ownerName: string, appName: string, notificationContent: PostContentSchemaNotificationContent, options?: PushSendOptionalParams ): Promise<PushSendResponse> { return this.client.sendOperationRequest( { ownerName, appName, notificationContent, options }, sendOperationSpec ); } /** * Delete a notification. * @param ownerName The name of the owner * @param appName The name of the application * @param values List of notification Ids. * @param options The options parameters. */ delete( ownerName: string, appName: string, values: string[], options?: PushDeleteOptionalParams ): Promise<void> { return this.client.sendOperationRequest( { ownerName, appName, values, options }, deleteOperationSpec ); } /** * Delete a device with the selected installId. * @param installId device install id * @param ownerName The name of the owner * @param appName The name of the application * @param options The options parameters. */ deleteInstallId( installId: string, ownerName: string, appName: string, options?: PushDeleteInstallIdOptionalParams ): Promise<void> { return this.client.sendOperationRequest( { installId, ownerName, appName, options }, deleteInstallIdOperationSpec ); } /** * Get the status of an export operation. * @param exportId The id of the export. * @param ownerName The name of the owner * @param appName The name of the application * @param options The options parameters. */ exportDevicesStatus( exportId: string, ownerName: string, appName: string, options?: PushExportDevicesStatusOptionalParams ): Promise<PushExportDevicesStatusResponse> { return this.client.sendOperationRequest( { exportId, ownerName, appName, options }, exportDevicesStatusOperationSpec ); } /** * Exports information for all devices using Push to Azure Blob Storage * @param ownerName The name of the owner * @param appName The name of the application * @param blobContainerSasUri A shared access signature (SAS) URI with Read, Write and Delete * permissions on a container. * @param options The options parameters. */ exportDevices( ownerName: string, appName: string, blobContainerSasUri: string, options?: PushExportDevicesOptionalParams ): Promise<PushExportDevicesResponse> { return this.client.sendOperationRequest( { ownerName, appName, blobContainerSasUri, options }, exportDevicesOperationSpec ); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const configExistsOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/push/notifications_config", httpMethod: "HEAD", responses: { 204: {}, 404: {}, default: { bodyMapper: Mappers.Paths1Hot65IV01AppsOwnerNameAppNamePushNotificationsConfigHeadResponsesDefaultContentApplicationJsonSchema } }, urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName], headerParameters: [Parameters.accept], serializer }; const getConfigOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/push/notifications_config", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Paths1C7Oun7V01AppsOwnerNameAppNamePushNotificationsConfigGetResponses200ContentApplicationJsonSchema }, default: { bodyMapper: Mappers.PathsO0Ll17V01AppsOwnerNameAppNamePushNotificationsConfigGetResponsesDefaultContentApplicationJsonSchema } }, urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName], headerParameters: [Parameters.accept], serializer }; const setConfigOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/push/notifications_config", httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.Paths176Xq3CV01AppsOwnerNameAppNamePushNotificationsConfigPutResponses200ContentApplicationJsonSchema }, default: { bodyMapper: Mappers.PathsFgy7YfV01AppsOwnerNameAppNamePushNotificationsConfigPutResponsesDefaultContentApplicationJsonSchema } }, requestBody: Parameters.properties1, urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", serializer }; const deleteConfigOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/push/notifications_config", httpMethod: "DELETE", responses: { 200: {}, default: { bodyMapper: Mappers.PathsFm6Bs9V01AppsOwnerNameAppNamePushNotificationsConfigDeleteResponsesDefaultContentApplicationJsonSchema } }, urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName], headerParameters: [Parameters.accept], serializer }; const getOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/push/notifications/{notification_id}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Paths1NjrudiV01AppsOwnerNameAppNamePushNotificationsNotificationIdGetResponses200ContentApplicationJsonSchema }, default: { bodyMapper: Mappers.PathsY2MpnfV01AppsOwnerNameAppNamePushNotificationsNotificationIdGetResponsesDefaultContentApplicationJsonSchema } }, urlParameters: [ Parameters.$host, Parameters.ownerName, Parameters.appName, Parameters.notificationId ], headerParameters: [Parameters.accept], serializer }; const listOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/push/notifications", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Paths1YjfjrmV01AppsOwnerNameAppNamePushNotificationsGetResponses200ContentApplicationJsonSchema }, default: { bodyMapper: Mappers.Paths1Ua4CuvV01AppsOwnerNameAppNamePushNotificationsGetResponsesDefaultContentApplicationJsonSchema } }, queryParameters: [ Parameters.top1, Parameters.skiptoken, Parameters.orderby, Parameters.inlinecount, Parameters.includeArchived ], urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName], headerParameters: [Parameters.accept], serializer }; const sendOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/push/notifications", httpMethod: "POST", responses: { 202: { bodyMapper: Mappers.PathsKpnezyV01AppsOwnerNameAppNamePushNotificationsPostResponses202ContentApplicationJsonSchema, headersMapper: Mappers.PushSendHeaders }, default: { bodyMapper: Mappers.Paths1Kwjsi2V01AppsOwnerNameAppNamePushNotificationsPostResponsesDefaultContentApplicationJsonSchema } }, requestBody: { parameterPath: { notificationTarget: ["options", "notificationTarget"], notificationContent: ["notificationContent"] }, mapper: { ...Mappers.Paths13Dzhd2V01AppsOwnerNameAppNamePushNotificationsPostRequestbodyContentApplicationJsonSchema, required: true } }, urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", serializer }; const deleteOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/push/notifications", httpMethod: "DELETE", responses: { 200: {}, default: { bodyMapper: Mappers.PathsC8NkptV01AppsOwnerNameAppNamePushNotificationsDeleteResponsesDefaultContentApplicationJsonSchema } }, requestBody: { parameterPath: { values: ["values"] }, mapper: { ...Mappers.Paths5M7Cf2V01AppsOwnerNameAppNamePushNotificationsDeleteRequestbodyContentApplicationJsonSchema, required: true } }, urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", serializer }; const deleteInstallIdOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/push/devices/{install_id}", httpMethod: "DELETE", responses: { 200: {}, default: { bodyMapper: Mappers.Paths11E7Jh9V01AppsOwnerNameAppNamePushDevicesInstallIdDeleteResponsesDefaultContentApplicationJsonSchema } }, urlParameters: [ Parameters.$host, Parameters.ownerName, Parameters.appName, Parameters.installId ], headerParameters: [Parameters.accept], serializer }; const exportDevicesStatusOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/push/device_exports/{export_id}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Paths1UomvgvV01AppsOwnerNameAppNamePushDeviceExportsExportIdGetResponses200ContentApplicationJsonSchema }, default: { bodyMapper: Mappers.Paths18Cvs3GV01AppsOwnerNameAppNamePushDeviceExportsExportIdGetResponsesDefaultContentApplicationJsonSchema } }, urlParameters: [ Parameters.$host, Parameters.ownerName, Parameters.appName, Parameters.exportId ], headerParameters: [Parameters.accept], serializer }; const exportDevicesOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/push/device_exports", httpMethod: "POST", responses: { 202: { bodyMapper: Mappers.Paths11Qat48V01AppsOwnerNameAppNamePushDeviceExportsPostResponses202ContentApplicationJsonSchema }, default: { bodyMapper: Mappers.Paths801PuuV01AppsOwnerNameAppNamePushDeviceExportsPostResponsesDefaultContentApplicationJsonSchema } }, requestBody: { parameterPath: { blobContainerSasUri: ["blobContainerSasUri"] }, mapper: { ...Mappers.Paths1H0K4SgV01AppsOwnerNameAppNamePushDeviceExportsPostRequestbodyContentApplicationJsonSchema, required: true } }, urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", serializer };