appcenter-cli
Version:
Command line tool for Visual Studio App Center
681 lines (660 loc) • 20 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 { Apps } 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 {
AppsGetForOrgUserOptionalParams,
AppsGetForOrgUserResponse,
PathsDf5UdfV01OrgsOrgNameAppsPostRequestbodyContentApplicationJsonSchema,
AppsCreateForOrgOptionalParams,
AppsCreateForOrgResponse,
AppsListForOrgOptionalParams,
AppsListForOrgResponse,
AppsRemoveUserOptionalParams,
Enum183,
AppsUpdateUserPermissionsOptionalParams,
AppsTransferToOrgOptionalParams,
AppsTransferToOrgResponse,
AppsTransferOwnershipOptionalParams,
AppsTransferOwnershipResponse,
AppsListTestersOptionalParams,
AppsListTestersResponse,
AppsGetTeamsOptionalParams,
AppsGetTeamsResponse,
AppsUpdateAvatarOptionalParams,
AppsUpdateAvatarResponse,
AppsDeleteAvatarOptionalParams,
AppsDeleteAvatarResponse,
AppsGetOptionalParams,
AppsGetResponse,
AppsUpdateOptionalParams,
AppsUpdateResponse,
AppsDeleteOptionalParams,
Paths1XqwatgV01AppsPostRequestbodyContentApplicationJsonSchema,
AppsCreateOptionalParams,
AppsCreateResponse,
AppsListOptionalParams,
AppsListResponse
} from "../models";
/** Class containing Apps operations. */
export class AppsImpl implements Apps {
private readonly client: AppCenterClient;
/**
* Initialize a new instance of the class Apps class.
* @param client Reference to the service client
*/
constructor(client: AppCenterClient) {
this.client = client;
}
/**
* Get a user apps information from an organization by name
* @param orgName The organization's name
* @param userName The slug name of the user
* @param options The options parameters.
*/
getForOrgUser(
orgName: string,
userName: string,
options?: AppsGetForOrgUserOptionalParams
): Promise<AppsGetForOrgUserResponse> {
return this.client.sendOperationRequest(
{ orgName, userName, options },
getForOrgUserOperationSpec
);
}
/**
* Creates a new app for the organization and returns it to the caller
* @param orgName The organization's name
* @param app The data for the app
* @param options The options parameters.
*/
createForOrg(
orgName: string,
app: PathsDf5UdfV01OrgsOrgNameAppsPostRequestbodyContentApplicationJsonSchema,
options?: AppsCreateForOrgOptionalParams
): Promise<AppsCreateForOrgResponse> {
return this.client.sendOperationRequest(
{ orgName, app, options },
createForOrgOperationSpec
);
}
/**
* Returns a list of apps for the organization
* @param orgName The organization's name
* @param options The options parameters.
*/
listForOrg(
orgName: string,
options?: AppsListForOrgOptionalParams
): Promise<AppsListForOrgResponse> {
return this.client.sendOperationRequest(
{ orgName, options },
listForOrgOperationSpec
);
}
/**
* Removes the user from the app
* @param ownerName The name of the owner
* @param appName The name of the application
* @param userEmail The user email of the user to delete
* @param options The options parameters.
*/
removeUser(
ownerName: string,
appName: string,
userEmail: string,
options?: AppsRemoveUserOptionalParams
): Promise<void> {
return this.client.sendOperationRequest(
{ ownerName, appName, userEmail, options },
removeUserOperationSpec
);
}
/**
* Update user permission for the app
* @param ownerName The name of the owner
* @param appName The name of the application
* @param userEmail The user email of the user to patch
* @param permissions The permissions the user has for the app
* @param options The options parameters.
*/
updateUserPermissions(
ownerName: string,
appName: string,
userEmail: string,
permissions: Enum183[],
options?: AppsUpdateUserPermissionsOptionalParams
): Promise<void> {
return this.client.sendOperationRequest(
{ ownerName, appName, userEmail, permissions, options },
updateUserPermissionsOperationSpec
);
}
/**
* Transfers ownership of an app to a new organization
* @param ownerName The name of the owner
* @param appName The name of the application
* @param options The options parameters.
*/
transferToOrg(
ownerName: string,
appName: string,
options?: AppsTransferToOrgOptionalParams
): Promise<AppsTransferToOrgResponse> {
return this.client.sendOperationRequest(
{ ownerName, appName, options },
transferToOrgOperationSpec
);
}
/**
* Transfers ownership of an app to a different user or organization
* @param ownerName The name of the owner
* @param appName The name of the application
* @param destinationOwnerName The name of the owner (user or organization) to which the app is being
* transferred
* @param options The options parameters.
*/
transferOwnership(
ownerName: string,
appName: string,
destinationOwnerName: string,
options?: AppsTransferOwnershipOptionalParams
): Promise<AppsTransferOwnershipResponse> {
return this.client.sendOperationRequest(
{ ownerName, appName, destinationOwnerName, options },
transferOwnershipOperationSpec
);
}
/**
* Returns the testers associated with the app specified with the given app name which belongs to the
* given owner.
* @param ownerName The name of the owner
* @param appName The name of the application
* @param options The options parameters.
*/
listTesters(
ownerName: string,
appName: string,
options?: AppsListTestersOptionalParams
): Promise<AppsListTestersResponse> {
return this.client.sendOperationRequest(
{ ownerName, appName, options },
listTestersOperationSpec
);
}
/**
* Returns the details of all teams that have access to the app.
* @param appName The name of the application
* @param ownerName The name of the owner
* @param options The options parameters.
*/
getTeams(
appName: string,
ownerName: string,
options?: AppsGetTeamsOptionalParams
): Promise<AppsGetTeamsResponse> {
return this.client.sendOperationRequest(
{ appName, ownerName, options },
getTeamsOperationSpec
);
}
/**
* Sets the app avatar
* @param ownerName The name of the owner
* @param appName The name of the application
* @param options The options parameters.
*/
updateAvatar(
ownerName: string,
appName: string,
options?: AppsUpdateAvatarOptionalParams
): Promise<AppsUpdateAvatarResponse> {
return this.client.sendOperationRequest(
{ ownerName, appName, options },
updateAvatarOperationSpec
);
}
/**
* Deletes the uploaded app avatar
* @param ownerName The name of the owner
* @param appName The name of the application
* @param options The options parameters.
*/
deleteAvatar(
ownerName: string,
appName: string,
options?: AppsDeleteAvatarOptionalParams
): Promise<AppsDeleteAvatarResponse> {
return this.client.sendOperationRequest(
{ ownerName, appName, options },
deleteAvatarOperationSpec
);
}
/**
* Return a specific app with the given app name which belongs to the given owner.
* @param ownerName The name of the owner
* @param appName The name of the application
* @param options The options parameters.
*/
get(
ownerName: string,
appName: string,
options?: AppsGetOptionalParams
): Promise<AppsGetResponse> {
return this.client.sendOperationRequest(
{ ownerName, appName, options },
getOperationSpec
);
}
/**
* Partially updates a single app
* @param appName The name of the application
* @param ownerName The name of the owner
* @param options The options parameters.
*/
update(
appName: string,
ownerName: string,
options?: AppsUpdateOptionalParams
): Promise<AppsUpdateResponse> {
return this.client.sendOperationRequest(
{ appName, ownerName, options },
updateOperationSpec
);
}
/**
* Delete an app
* @param appName The name of the application
* @param ownerName The name of the owner
* @param options The options parameters.
*/
delete(
appName: string,
ownerName: string,
options?: AppsDeleteOptionalParams
): Promise<void> {
return this.client.sendOperationRequest(
{ appName, ownerName, options },
deleteOperationSpec
);
}
/**
* Creates a new app and returns it to the caller
* @param app The data for the app
* @param options The options parameters.
*/
create(
app: Paths1XqwatgV01AppsPostRequestbodyContentApplicationJsonSchema,
options?: AppsCreateOptionalParams
): Promise<AppsCreateResponse> {
return this.client.sendOperationRequest(
{ app, options },
createOperationSpec
);
}
/**
* Returns a list of apps
* @param options The options parameters.
*/
list(options?: AppsListOptionalParams): Promise<AppsListResponse> {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getForOrgUserOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/orgs/{org_name}/users/{user_name}/apps",
httpMethod: "GET",
responses: {
200: {
bodyMapper: {
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className:
"Paths1CionenV01OrgsOrgNameUsersUserNameAppsGetResponses200ContentApplicationJsonSchemaItems"
}
}
}
}
},
default: {
bodyMapper:
Mappers.PathsBzcytsV01OrgsOrgNameUsersUserNameAppsGetResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [Parameters.$host, Parameters.orgName, Parameters.userName],
headerParameters: [Parameters.accept],
serializer
};
const createForOrgOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/orgs/{org_name}/apps",
httpMethod: "POST",
responses: {
200: {
bodyMapper:
Mappers.PathsZsi63SV01OrgsOrgNameAppsPostResponses200ContentApplicationJsonSchema
},
201: {
bodyMapper:
Mappers.Paths15X4K8OV01OrgsOrgNameAppsPostResponses201ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.Paths7Ywy9V01OrgsOrgNameAppsPostResponsesDefaultContentApplicationJsonSchema
}
},
requestBody: Parameters.app,
urlParameters: [Parameters.$host, Parameters.orgName],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer
};
const listForOrgOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/orgs/{org_name}/apps",
httpMethod: "GET",
responses: {
200: {
bodyMapper: {
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className:
"PathsPmjc9ZV01OrgsOrgNameAppsGetResponses200ContentApplicationJsonSchemaItems"
}
}
}
}
},
default: {
bodyMapper:
Mappers.Paths14Atv4RV01OrgsOrgNameAppsGetResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [Parameters.$host, Parameters.orgName],
headerParameters: [Parameters.accept],
serializer
};
const removeUserOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/users/{user_email}",
httpMethod: "DELETE",
responses: {
204: {},
default: {
bodyMapper:
Mappers.Paths7XqutjV01AppsOwnerNameAppNameUsersUserEmailDeleteResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [
Parameters.$host,
Parameters.ownerName,
Parameters.appName,
Parameters.userEmail4
],
headerParameters: [Parameters.accept],
serializer
};
const updateUserPermissionsOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/users/{user_email}",
httpMethod: "PATCH",
responses: {
204: {},
default: {
bodyMapper:
Mappers.Paths19GxrayV01AppsOwnerNameAppNameUsersUserEmailPatchResponsesDefaultContentApplicationJsonSchema
}
},
requestBody: {
parameterPath: { permissions: ["permissions"] },
mapper: {
...Mappers.PathsG6C5PhV01AppsOwnerNameAppNameUsersUserEmailPatchRequestbodyContentApplicationJsonSchema,
required: true
}
},
urlParameters: [
Parameters.$host,
Parameters.ownerName,
Parameters.appName,
Parameters.userEmail4
],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer
};
const transferToOrgOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/transfer_to_org",
httpMethod: "POST",
responses: {
200: {
bodyMapper:
Mappers.Paths1LnjnxdV01AppsOwnerNameAppNameTransferToOrgPostResponses200ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.PathsE169PrV01AppsOwnerNameAppNameTransferToOrgPostResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName],
headerParameters: [Parameters.accept],
serializer
};
const transferOwnershipOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/transfer/{destination_owner_name}",
httpMethod: "POST",
responses: {
200: {
bodyMapper:
Mappers.Paths17Wfdp6V01AppsOwnerNameAppNameTransferDestinationOwnerNamePostResponses200ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.Paths15Hmn0IV01AppsOwnerNameAppNameTransferDestinationOwnerNamePostResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [
Parameters.$host,
Parameters.ownerName,
Parameters.appName,
Parameters.destinationOwnerName
],
headerParameters: [Parameters.accept],
serializer
};
const listTestersOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/testers",
httpMethod: "GET",
responses: {
200: {
bodyMapper: {
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className:
"Paths9J1VrgV01AppsOwnerNameAppNameTestersGetResponses200ContentApplicationJsonSchemaItems"
}
}
}
}
},
default: {
bodyMapper:
Mappers.Paths2WblseV01AppsOwnerNameAppNameTestersGetResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName],
headerParameters: [Parameters.accept],
serializer
};
const getTeamsOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/teams",
httpMethod: "GET",
responses: {
200: {
bodyMapper: {
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className:
"Paths1Sq4J2RV01AppsOwnerNameAppNameTeamsGetResponses200ContentApplicationJsonSchemaItems"
}
}
}
}
},
default: {
bodyMapper:
Mappers.Paths1YwiryhV01AppsOwnerNameAppNameTeamsGetResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName],
headerParameters: [Parameters.accept],
serializer
};
const updateAvatarOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/avatar",
httpMethod: "POST",
responses: {
200: {
bodyMapper:
Mappers.Paths1X598I8V01AppsOwnerNameAppNameAvatarPostResponses200ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.Paths17Ufom9V01AppsOwnerNameAppNameAvatarPostResponsesDefaultContentApplicationJsonSchema
}
},
formDataParameters: [Parameters.avatar],
urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName],
headerParameters: [Parameters.contentType1, Parameters.accept1],
serializer
};
const deleteAvatarOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}/avatar",
httpMethod: "DELETE",
responses: {
200: {
bodyMapper:
Mappers.Paths1Jhcvh4V01AppsOwnerNameAppNameAvatarDeleteResponses200ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.PathsB7Jif8V01AppsOwnerNameAppNameAvatarDeleteResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName],
headerParameters: [Parameters.accept],
serializer
};
const getOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}",
httpMethod: "GET",
responses: {
200: {
bodyMapper:
Mappers.PathsRv9AxzV01AppsOwnerNameAppNameGetResponses200ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.PathsZhn7DqV01AppsOwnerNameAppNameGetResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName],
headerParameters: [Parameters.accept],
serializer
};
const updateOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps/{owner_name}/{app_name}",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper:
Mappers.PathsPcp6H8V01AppsOwnerNameAppNamePatchResponses200ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.PathsJbts1XV01AppsOwnerNameAppNamePatchResponsesDefaultContentApplicationJsonSchema
}
},
requestBody: Parameters.app1,
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}",
httpMethod: "DELETE",
responses: {
204: {},
default: {
bodyMapper:
Mappers.Paths1BdpjjmV01AppsOwnerNameAppNameDeleteResponsesDefaultContentApplicationJsonSchema
}
},
urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName],
headerParameters: [Parameters.accept],
serializer
};
const createOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps",
httpMethod: "POST",
responses: {
201: {
bodyMapper:
Mappers.Paths1Xn0TpgV01AppsPostResponses201ContentApplicationJsonSchema
},
default: {
bodyMapper:
Mappers.PathsV9XtwoV01AppsPostResponsesDefaultContentApplicationJsonSchema
}
},
requestBody: Parameters.app2,
urlParameters: [Parameters.$host],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer
};
const listOperationSpec: coreClient.OperationSpec = {
path: "/v0.1/apps",
httpMethod: "GET",
responses: {
200: {
bodyMapper: {
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className:
"PathsEh92XyV01AppsGetResponses200ContentApplicationJsonSchemaItems"
}
}
}
}
},
default: {
bodyMapper:
Mappers.Paths127V8Y9V01AppsGetResponsesDefaultContentApplicationJsonSchema
}
},
queryParameters: [Parameters.orderBy],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer
};