appcenter-cli
Version:
Command line tool for Visual Studio App Center
139 lines (131 loc) • 4.48 kB
text/typescript
/*
* 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 { LegacyCodePushAcquisition } 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 {
LegacyCodePushAcquisitionUpdateCheckOptionalParams,
LegacyCodePushAcquisitionUpdateCheckResponse,
PathsPkpkpaV01LegacyReportstatusDownloadPostRequestbodyContentApplicationJsonSchema,
LegacyCodePushAcquisitionUpdateDownloadStatusOptionalParams,
PathsIy9KlqV01LegacyReportstatusDeployPostRequestbodyContentApplicationJsonSchema,
LegacyCodePushAcquisitionUpdateInstallsStatusOptionalParams
} from "../models";
/** Class containing LegacyCodePushAcquisition operations. */
export class LegacyCodePushAcquisitionImpl
implements LegacyCodePushAcquisition {
private readonly client: AppCenterClient;
/**
* Initialize a new instance of the class LegacyCodePushAcquisition class.
* @param client Reference to the service client
*/
constructor(client: AppCenterClient) {
this.client = client;
}
/**
* Check for updates
* @param options The options parameters.
*/
updateCheck(
options?: LegacyCodePushAcquisitionUpdateCheckOptionalParams
): Promise<LegacyCodePushAcquisitionUpdateCheckResponse> {
return this.client.sendOperationRequest(
{ options },
updateCheckOperationSpec
);
}
/**
* Report download of specified release
* @param releaseMetadata Deployment status metric properties
* @param options The options parameters.
*/
updateDownloadStatus(
releaseMetadata: PathsPkpkpaV01LegacyReportstatusDownloadPostRequestbodyContentApplicationJsonSchema,
options?: LegacyCodePushAcquisitionUpdateDownloadStatusOptionalParams
): Promise<void> {
return this.client.sendOperationRequest(
{ releaseMetadata, options },
updateDownloadStatusOperationSpec
);
}
/**
* Report deploy of specified release
* @param releaseMetadata Deployment status metric properties
* @param options The options parameters.
*/
updateInstallsStatus(
releaseMetadata: PathsIy9KlqV01LegacyReportstatusDeployPostRequestbodyContentApplicationJsonSchema,
options?: LegacyCodePushAcquisitionUpdateInstallsStatusOptionalParams
): Promise<void> {
return this.client.sendOperationRequest(
{ releaseMetadata, options },
updateInstallsStatusOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const updateCheckOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/legacy/updateCheck",
httpMethod: "GET",
responses: {
200: {
bodyMapper:
Mappers.PathsJ7Rnt8V01LegacyUpdatecheckGetResponses200ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.PathsNsgzhkV01LegacyUpdatecheckGetResponsesDefaultContentApplicationJsonSchema
}
},
queryParameters: [
Parameters.deploymentKey,
Parameters.appVersion,
Parameters.packageHash,
Parameters.label,
Parameters.clientUniqueId,
Parameters.isCompanion
],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer
};
const updateDownloadStatusOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/legacy/reportStatus/download",
httpMethod: "POST",
responses: {
200: {},
default: {
bodyMapper:
Mappers.Paths6DbuoaV01LegacyReportstatusDownloadPostResponsesDefaultContentApplicationJsonSchema
}
},
requestBody: Parameters.releaseMetadata,
urlParameters: [Parameters.$host],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer
};
const updateInstallsStatusOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/legacy/reportStatus/deploy",
httpMethod: "POST",
responses: {
200: {},
default: {
bodyMapper:
Mappers.Paths1Ho5Wt0V01LegacyReportstatusDeployPostResponsesDefaultContentApplicationJsonSchema
}
},
requestBody: Parameters.releaseMetadata1,
urlParameters: [Parameters.$host],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer
};