appcenter-cli
Version:
Command line tool for Visual Studio App Center
156 lines (148 loc) • 5.13 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 { RepositoryConfigurations } 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 {
RepositoryConfigurationsListOptionalParams,
RepositoryConfigurationsListResponse,
Paths1P54ZxdV01AppsOwnerNameAppNameRepoConfigPostRequestbodyContentApplicationJsonSchema,
RepositoryConfigurationsCreateOrUpdateOptionalParams,
RepositoryConfigurationsCreateOrUpdateResponse,
RepositoryConfigurationsDeleteOptionalParams,
RepositoryConfigurationsDeleteResponse
} from "../models";
/** Class containing RepositoryConfigurations operations. */
export class RepositoryConfigurationsImpl implements RepositoryConfigurations {
private readonly client: AppCenterClient;
/**
* Initialize a new instance of the class RepositoryConfigurations class.
* @param client Reference to the service client
*/
constructor(client: AppCenterClient) {
this.client = client;
}
/**
* Returns the repository build configuration status of the app
* @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?: RepositoryConfigurationsListOptionalParams
): Promise<RepositoryConfigurationsListResponse> {
return this.client.sendOperationRequest(
{ ownerName, appName, options },
listOperationSpec
);
}
/**
* Configures the repository for build
* @param ownerName The name of the owner
* @param appName The name of the application
* @param repo The repository information
* @param options The options parameters.
*/
createOrUpdate(
ownerName: string,
appName: string,
repo: Paths1P54ZxdV01AppsOwnerNameAppNameRepoConfigPostRequestbodyContentApplicationJsonSchema,
options?: RepositoryConfigurationsCreateOrUpdateOptionalParams
): Promise<RepositoryConfigurationsCreateOrUpdateResponse> {
return this.client.sendOperationRequest(
{ ownerName, appName, repo, options },
createOrUpdateOperationSpec
);
}
/**
* Removes the configuration for the repository
* @param ownerName The name of the owner
* @param appName The name of the application
* @param options The options parameters.
*/
delete(
ownerName: string,
appName: string,
options?: RepositoryConfigurationsDeleteOptionalParams
): Promise<RepositoryConfigurationsDeleteResponse> {
return this.client.sendOperationRequest(
{ ownerName, appName, options },
deleteOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/repo_config",
httpMethod: "GET",
responses: {
200: {
bodyMapper: {
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className:
"PathsIxrc01V01AppsOwnerNameAppNameRepoConfigGetResponses200ContentApplicationJsonSchemaItems"
}
}
}
}
},
default: {
bodyMapper:
Mappers.PathsPitaxjV01AppsOwnerNameAppNameRepoConfigGetResponsesDefaultContentApplicationJsonSchema
}
},
queryParameters: [Parameters.includeInactive],
urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName],
headerParameters: [Parameters.accept],
serializer
};
const createOrUpdateOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/repo_config",
httpMethod: "POST",
responses: {
200: {
bodyMapper:
Mappers.Paths1I47WvgV01AppsOwnerNameAppNameRepoConfigPostResponses200ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.PathsP7E5UzV01AppsOwnerNameAppNameRepoConfigPostResponsesDefaultContentApplicationJsonSchema
}
},
requestBody: Parameters.repo,
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}/repo_config",
httpMethod: "DELETE",
responses: {
200: {
bodyMapper:
Mappers.PathsX38Gw3V01AppsOwnerNameAppNameRepoConfigDeleteResponses200ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.Paths1Lqz171V01AppsOwnerNameAppNameRepoConfigDeleteResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName],
headerParameters: [Parameters.accept],
serializer
};