appcenter-cli
Version:
Command line tool for Visual Studio App Center
204 lines (195 loc) • 6.36 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 { BranchConfigurations } 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 {
BranchConfigurationsGetOptionalParams,
BranchConfigurationsGetResponse,
PathsXn26H7V01AppsOwnerNameAppNameBranchesBranchConfigPostRequestbodyContentApplicationJsonSchema,
BranchConfigurationsCreateOptionalParams,
BranchConfigurationsCreateResponse,
Paths1O0K3JpV01AppsOwnerNameAppNameBranchesBranchConfigPutRequestbodyContentApplicationJsonSchema,
BranchConfigurationsUpdateOptionalParams,
BranchConfigurationsUpdateResponse,
BranchConfigurationsDeleteOptionalParams,
BranchConfigurationsDeleteResponse
} from "../models";
/** Class containing BranchConfigurations operations. */
export class BranchConfigurationsImpl implements BranchConfigurations {
private readonly client: AppCenterClient;
/**
* Initialize a new instance of the class BranchConfigurations class.
* @param client Reference to the service client
*/
constructor(client: AppCenterClient) {
this.client = client;
}
/**
* Gets the branch configuration
* @param branch The branch name
* @param ownerName The name of the owner
* @param appName The name of the application
* @param options The options parameters.
*/
get(
branch: string,
ownerName: string,
appName: string,
options?: BranchConfigurationsGetOptionalParams
): Promise<BranchConfigurationsGetResponse> {
return this.client.sendOperationRequest(
{ branch, ownerName, appName, options },
getOperationSpec
);
}
/**
* Configures the branch for build
* @param branch The branch name
* @param ownerName The name of the owner
* @param appName The name of the application
* @param params Parameters of the configuration
* @param options The options parameters.
*/
create(
branch: string,
ownerName: string,
appName: string,
params: PathsXn26H7V01AppsOwnerNameAppNameBranchesBranchConfigPostRequestbodyContentApplicationJsonSchema,
options?: BranchConfigurationsCreateOptionalParams
): Promise<BranchConfigurationsCreateResponse> {
return this.client.sendOperationRequest(
{ branch, ownerName, appName, params, options },
createOperationSpec
);
}
/**
* Reconfigures the branch for build
* @param branch The branch name
* @param ownerName The name of the owner
* @param appName The name of the application
* @param params Parameters of the configuration
* @param options The options parameters.
*/
update(
branch: string,
ownerName: string,
appName: string,
params: Paths1O0K3JpV01AppsOwnerNameAppNameBranchesBranchConfigPutRequestbodyContentApplicationJsonSchema,
options?: BranchConfigurationsUpdateOptionalParams
): Promise<BranchConfigurationsUpdateResponse> {
return this.client.sendOperationRequest(
{ branch, ownerName, appName, params, options },
updateOperationSpec
);
}
/**
* Deletes the branch build configuration
* @param branch The branch name
* @param ownerName The name of the owner
* @param appName The name of the application
* @param options The options parameters.
*/
delete(
branch: string,
ownerName: string,
appName: string,
options?: BranchConfigurationsDeleteOptionalParams
): Promise<BranchConfigurationsDeleteResponse> {
return this.client.sendOperationRequest(
{ branch, ownerName, appName, options },
deleteOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/branches/{branch}/config",
httpMethod: "GET",
responses: {
200: {
bodyMapper:
Mappers.PathsRuhky8V01AppsOwnerNameAppNameBranchesBranchConfigGetResponses200ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.Paths1Pv0ByrV01AppsOwnerNameAppNameBranchesBranchConfigGetResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [
Parameters.$host,
Parameters.ownerName,
Parameters.appName,
Parameters.branch
],
headerParameters: [Parameters.accept],
serializer
};
const createOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/branches/{branch}/config",
httpMethod: "POST",
responses: {
200: {
bodyMapper:
Mappers.PathsYdemoiV01AppsOwnerNameAppNameBranchesBranchConfigPostResponses200ContentApplicationJsonSchema
}
},
requestBody: Parameters.params1,
urlParameters: [
Parameters.$host,
Parameters.ownerName,
Parameters.appName,
Parameters.branch
],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer
};
const updateOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/branches/{branch}/config",
httpMethod: "PUT",
responses: {
200: {
bodyMapper:
Mappers.PathsRa6DxlV01AppsOwnerNameAppNameBranchesBranchConfigPutResponses200ContentApplicationJsonSchema
}
},
requestBody: Parameters.params2,
urlParameters: [
Parameters.$host,
Parameters.ownerName,
Parameters.appName,
Parameters.branch
],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer
};
const deleteOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/branches/{branch}/config",
httpMethod: "DELETE",
responses: {
200: {
bodyMapper:
Mappers.PathsQs07S5V01AppsOwnerNameAppNameBranchesBranchConfigDeleteResponses200ContentApplicationJsonSchema
}
},
requestBody: Parameters.payload,
urlParameters: [
Parameters.$host,
Parameters.ownerName,
Parameters.appName,
Parameters.branch
],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer
};