Skip to content

Commit

Permalink
M234 API updates (#585)
Browse files Browse the repository at this point in the history
* M234 API updates

* fix import

* update version
  • Loading branch information
DenisRumyantsev committed Mar 5, 2024
1 parent 37331db commit b0f028c
Show file tree
Hide file tree
Showing 25 changed files with 637 additions and 236 deletions.
20 changes: 11 additions & 9 deletions api/AlertApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface IAlertApi extends basem.ClientApiBase {
getAlertInstances(project: string, alertId: number, repository: string, ref?: string): Promise<AlertInterfaces.AlertAnalysisInstance[]>;
uploadSarif(customHeaders: any, contentStream: NodeJS.ReadableStream, project: string, repository: string): Promise<number>;
getUxFilters(project: string, repository: string, alertType: AlertInterfaces.AlertType): Promise<AlertInterfaces.UxFilters>;
getSarif(sarifId: number): Promise<boolean>;
getSarif(sarifId: number): Promise<AlertInterfaces.SarifUploadStatus>;
}

export class AlertApi extends basem.ClientApiBase implements IAlertApi {
Expand Down Expand Up @@ -257,9 +257,11 @@ export class AlertApi extends basem.ClientApiBase implements IAlertApi {
}

/**
* Get instances of an alert.
*
* @param {string} project - Project ID or project name
* @param {number} alertId
* @param {string} repository
* @param {number} alertId - ID of alert to retrieve
* @param {string} repository - Name or id of a repository that alert is part of
* @param {string} ref
*/
public async getAlertInstances(
Expand Down Expand Up @@ -418,16 +420,16 @@ export class AlertApi extends basem.ClientApiBase implements IAlertApi {
*/
public async getSarif(
sarifId: number
): Promise<boolean> {
): Promise<AlertInterfaces.SarifUploadStatus> {

return new Promise<boolean>(async (resolve, reject) => {
return new Promise<AlertInterfaces.SarifUploadStatus>(async (resolve, reject) => {
let routeValues: any = {
sarifId: sarifId
};

try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"7.2-preview.1",
"7.2-preview.2",
"Alert",
"a04689e7-0f81-48a2-8d18-40654c47494c",
routeValues);
Expand All @@ -436,11 +438,11 @@ export class AlertApi extends basem.ClientApiBase implements IAlertApi {
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);

let res: restm.IRestResponse<boolean>;
res = await this.rest.get<boolean>(url, options);
let res: restm.IRestResponse<AlertInterfaces.SarifUploadStatus>;
res = await this.rest.get<AlertInterfaces.SarifUploadStatus>(url, options);

let ret = this.formatResponse(res.result,
null,
AlertInterfaces.TypeInfo.SarifUploadStatus,
false);

resolve(ret);
Expand Down
14 changes: 8 additions & 6 deletions api/ExtensionManagementApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ export class ExtensionManagementApi extends basem.ClientApiBase implements IExte
public static readonly RESOURCE_AREA_ID = "6c2b0933-3600-42ae-bf8b-93d4f7e83594";

/**
* @param {string} itemId
* @param {boolean} testCommerce
* @param {boolean} isFreeOrTrialInstall
* @param {boolean} isAccountOwner
* @param {boolean} isLinked
* @param {boolean} isConnectedServer
* This API is called by acquisition/install page to get possible user actions like Buy/Request
*
* @param {string} itemId - Fully qualified name of extension (<publisher_id>.<extension_id>)
* @param {boolean} testCommerce - Parameter to test paid preview extension without making azure plans public
* @param {boolean} isFreeOrTrialInstall - Parameter represents install or trial workflow (required for legacy install flows)
* @param {boolean} isAccountOwner - Parameter represents whether user is owner or PCA of an account
* @param {boolean} isLinked - Parameter represents whether account is linked with a subscription
* @param {boolean} isConnectedServer - Parameter represents whether Buy operation should be evaluated
* @param {boolean} isBuyOperationValid
*/
public async getAcquisitionOptions(
Expand Down
22 changes: 12 additions & 10 deletions api/FileContainerApiBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,20 @@ export class FileContainerApiBase extends basem.ClientApiBase implements IFileCo
}

/**
* @param {number} containerId
* @param {string} scope
* @param {string} itemPath
* @param {boolean} metadata
* @param {string} format
* @param {string} downloadFileName
* Gets the specified file container object in a format dependent upon the given parameters or HTTP Accept request header
*
* @param {number} containerId - The requested container Id
* @param {string} scope - A guid representing the scope of the container. This is often the project id.
* @param {string} itemPath - The path to the item of interest
* @param {boolean} metadata - If true, this overrides any specified format parameter or HTTP Accept request header to provide non-recursive information for the given itemPath
* @param {string} format - If specified, this overrides the HTTP Accept request header to return either 'json' or 'zip'. If $format is specified, then api-version should also be specified as a query parameter.
* @param {string} downloadFileName - If specified and returning other than JSON format, then this download name will be used (else defaults to itemPath)
* @param {boolean} includeDownloadTickets
* @param {boolean} isShallow
* @param {boolean} ignoreRequestedMediaType
* @param {boolean} isShallow - If true, returns only immediate children(files & folders) for the given itemPath. False will return all items recursively within itemPath.
* @param {boolean} ignoreRequestedMediaType - Set to true to ignore the HTTP Accept request header. Default is false.
* @param {boolean} includeBlobMetadata
* @param {boolean} saveAbsolutePath
* @param {boolean} preferRedirect
* @param {boolean} saveAbsolutePath - Set to false to not save the absolute path to the specified directory of the artifact in the returned archive. Works only for artifact directories. Default is true.
* @param {boolean} preferRedirect - Set to true to get the redirect response which leads to the stream with content. Default is false.
*/
public async getItems(
containerId: number,
Expand Down
67 changes: 66 additions & 1 deletion api/GalleryApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export interface IGalleryApi extends compatBase.GalleryCompatHttpClientBase {
getPublisher(publisherName: string, flags?: number): Promise<GalleryInterfaces.Publisher>;
updatePublisher(publisher: GalleryInterfaces.Publisher, publisherName: string): Promise<GalleryInterfaces.Publisher>;
updatePublisherMembers(roleAssignments: GalleryInterfaces.PublisherUserRoleAssignmentRef[], publisherName: string, limitToCallerIdentityDomain?: boolean): Promise<GalleryInterfaces.PublisherRoleAssignment[]>;
publishExtensionWithPublisherSignature(customHeaders: any, contentStream: NodeJS.ReadableStream, publisherName: string, extensionName: string, extensionType?: string, reCaptchaToken?: string, bypassScopeCheck?: boolean): Promise<GalleryInterfaces.PublishedExtension>;
getPublisherWithoutToken(publisherName: string): Promise<GalleryInterfaces.Publisher>;
getQuestions(publisherName: string, extensionName: string, count?: number, page?: number, afterDate?: Date): Promise<GalleryInterfaces.QuestionsResult>;
reportQuestion(concern: GalleryInterfaces.Concern, pubName: string, extName: string, questionId: number): Promise<GalleryInterfaces.Concern>;
Expand Down Expand Up @@ -2159,7 +2160,9 @@ export class GalleryApi extends compatBase.GalleryCompatHttpClientBase implement
}

/**
* @param {GalleryInterfaces.AzureRestApiRequestModel} azureRestApiRequestModel
* Rest end point to validate if an Azure publisher owns an extension for 3rd party commerce scenario. Azure only supports POST operations and the above signature is not typical of the REST operations. http://sharepoint/sites/AzureUX/_layouts/15/WopiFrame2.aspx?sourcedoc={A793D31E-6DC6-4174-8FA3-DE3F82B51642}&file=Data%20Market%20Partner%20integration%20with%20Marketplace%20service.docx&action=default
*
* @param {GalleryInterfaces.AzureRestApiRequestModel} azureRestApiRequestModel - All the parameters are sent in the request body
*/
public async extensionValidator(
azureRestApiRequestModel: GalleryInterfaces.AzureRestApiRequestModel
Expand Down Expand Up @@ -2826,6 +2829,68 @@ export class GalleryApi extends compatBase.GalleryCompatHttpClientBase implement
});
}

/**
* @param {NodeJS.ReadableStream} contentStream - Content to upload
* @param {string} publisherName
* @param {string} extensionName
* @param {string} extensionType
* @param {string} reCaptchaToken
* @param {boolean} bypassScopeCheck
*/
public async publishExtensionWithPublisherSignature(
customHeaders: any,
contentStream: NodeJS.ReadableStream,
publisherName: string,
extensionName: string,
extensionType?: string,
reCaptchaToken?: string,
bypassScopeCheck?: boolean
): Promise<GalleryInterfaces.PublishedExtension> {

return new Promise<GalleryInterfaces.PublishedExtension>(async (resolve, reject) => {
let routeValues: any = {
publisherName: publisherName,
extensionName: extensionName
};

let queryValues: any = {
extensionType: extensionType,
reCaptchaToken: reCaptchaToken,
bypassScopeCheck: bypassScopeCheck,
};

customHeaders = customHeaders || {};
customHeaders["Content-Type"] = "multipart/related";

try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"7.2-preview.1",
"gallery",
"e11ea35a-16fe-4b80-ab11-c4cab88a0969",
routeValues,
queryValues);

let url: string = verData.requestUrl!;

let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
options.additionalHeaders = customHeaders;

let res: restm.IRestResponse<GalleryInterfaces.PublishedExtension>;
res = await this.rest.uploadStream<GalleryInterfaces.PublishedExtension>("PUT", url, contentStream, options);

let ret = this.formatResponse(res.result,
GalleryInterfaces.TypeInfo.PublishedExtension,
false);

resolve(ret);
}
catch (err) {
reject(err);
}
});
}

/**
* @param {string} publisherName
*/
Expand Down
6 changes: 4 additions & 2 deletions api/GitApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,10 @@ export class GitApi extends basem.ClientApiBase implements IGitApi {
}

/**
* @param {GitInterfaces.GitQueryBranchStatsCriteria} searchCriteria
* @param {string} repositoryId
* Retrieve statistics for multiple commits
*
* @param {GitInterfaces.GitQueryBranchStatsCriteria} searchCriteria - Base Commit and List of Target Commits to compare.
* @param {string} repositoryId - The name or ID of the repository.
* @param {string} project - Project ID or project name
*/
public async getBranchStatsBatch(
Expand Down
6 changes: 6 additions & 0 deletions api/ManagementApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export class ManagementApi extends basem.ClientApiBase implements IManagementApi
}

/**
* Delete the billing info for an organization.
*
* @param {string} organizationId
*/
public async deleteBillingInfo(
Expand Down Expand Up @@ -82,6 +84,8 @@ export class ManagementApi extends basem.ClientApiBase implements IManagementApi
}

/**
* Delete the meter usage history from Primary SU for an organization.
*
* @param {string} organizationId
*/
public async deleteMeterUsageHistory(
Expand Down Expand Up @@ -164,6 +168,8 @@ export class ManagementApi extends basem.ClientApiBase implements IManagementApi
}

/**
* Save the billing info for an organization.
*
* @param {ManagementInterfaces.BillingInfo} billingInfo
* @param {string} organizationId
*/
Expand Down
32 changes: 17 additions & 15 deletions api/ReleaseApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1220,22 +1220,24 @@ export class ReleaseApi extends basem.ClientApiBase implements IReleaseApi {
}

/**
* Get a list of deployments
*
* @param {string} project - Project ID or project name
* @param {number} definitionId
* @param {number} definitionEnvironmentId
* @param {string} createdBy
* @param {Date} minModifiedTime
* @param {Date} maxModifiedTime
* @param {ReleaseInterfaces.DeploymentStatus} deploymentStatus
* @param {ReleaseInterfaces.DeploymentOperationStatus} operationStatus
* @param {boolean} latestAttemptsOnly
* @param {ReleaseInterfaces.ReleaseQueryOrder} queryOrder
* @param {number} top
* @param {number} continuationToken
* @param {string} createdFor
* @param {Date} minStartedTime
* @param {Date} maxStartedTime
* @param {string} sourceBranch
* @param {number} definitionId - List the deployments for a given definition id.
* @param {number} definitionEnvironmentId - List the deployments for a given definition environment id.
* @param {string} createdBy - List the deployments for which deployments are created as identity specified.
* @param {Date} minModifiedTime - List the deployments with LastModified time >= minModifiedTime.
* @param {Date} maxModifiedTime - List the deployments with LastModified time <= maxModifiedTime.
* @param {ReleaseInterfaces.DeploymentStatus} deploymentStatus - List the deployments with given deployment status. Defult is 'All'.
* @param {ReleaseInterfaces.DeploymentOperationStatus} operationStatus - List the deployments with given operation status. Default is 'All'.
* @param {boolean} latestAttemptsOnly - 'true' to include deployments with latest attempt only. Default is 'false'.
* @param {ReleaseInterfaces.ReleaseQueryOrder} queryOrder - List the deployments with given query order. Default is 'Descending'.
* @param {number} top - List the deployments with given top. Default top is '50' and Max top is '100'.
* @param {number} continuationToken - List the deployments with deployment id >= continuationToken.
* @param {string} createdFor - List the deployments for which deployments are requested as identity specified.
* @param {Date} minStartedTime - List the deployments with StartedOn time >= minStartedTime.
* @param {Date} maxStartedTime - List the deployments with StartedOn time <= maxStartedTime.
* @param {string} sourceBranch - List the deployments that are deployed from given branch name.
*/
public async getDeployments(
project: string,
Expand Down
Loading

0 comments on commit b0f028c

Please sign in to comment.