@@ -31,6 +31,7 @@ export interface IBuildApi extends basem.ClientApiBase {
3131 listBranches ( project : string , providerName : string , serviceEndpointId ?: string , repository ?: string , branchName ?: string ) : Promise < string [ ] > ;
3232 getBuildBadge ( project : string , repoType : string , repoId ?: string , branchName ?: string ) : Promise < BuildInterfaces . BuildBadge > ;
3333 getBuildBadgeData ( project : string , repoType : string , repoId ?: string , branchName ?: string ) : Promise < string > ;
34+ getRetentionLeasesForBuild ( project : string , buildId : number ) : Promise < BuildInterfaces . RetentionLease [ ] > ;
3435 deleteBuild ( project : string , buildId : number ) : Promise < void > ;
3536 getBuild ( project : string , buildId : number , propertyFilters ?: string ) : Promise < BuildInterfaces . Build > ;
3637 getBuilds ( project : string , definitions ?: number [ ] , queues ?: number [ ] , buildNumber ?: string , minTime ?: Date , maxTime ?: Date , requestedFor ?: string , reasonFilter ?: BuildInterfaces . BuildReason , statusFilter ?: BuildInterfaces . BuildStatus , resultFilter ?: BuildInterfaces . BuildResult , tagFilters ?: string [ ] , properties ?: string [ ] , top ?: number , continuationToken ?: string , maxBuildsPerDefinition ?: number , deletedFilter ?: BuildInterfaces . QueryDeletedOption , queryOrder ?: BuildInterfaces . BuildQueryOrder , branchName ?: string , buildIds ?: number [ ] , repositoryId ?: string , repositoryType ?: string ) : Promise < BuildInterfaces . Build [ ] > ;
@@ -62,6 +63,7 @@ export interface IBuildApi extends basem.ClientApiBase {
6263 getRetentionLeasesByMinimalRetentionLeases ( project : string , leasesToFetch : BuildInterfaces . MinimalRetentionLease [ ] ) : Promise < BuildInterfaces . RetentionLease [ ] > ;
6364 getRetentionLeasesByOwnerId ( project : string , ownerId ?: string , definitionId ?: number , runId ?: number ) : Promise < BuildInterfaces . RetentionLease [ ] > ;
6465 getRetentionLeasesByUserId ( project : string , userOwnerId : string , definitionId ?: number , runId ?: number ) : Promise < BuildInterfaces . RetentionLease [ ] > ;
66+ updateRetentionLease ( leaseUpdate : BuildInterfaces . RetentionLeaseUpdate , project : string , leaseId : number ) : Promise < BuildInterfaces . RetentionLease > ;
6567 getBuildLog ( project : string , buildId : number , logId : number , startLine ?: number , endLine ?: number ) : Promise < NodeJS . ReadableStream > ;
6668 getBuildLogLines ( project : string , buildId : number , logId : number , startLine ?: number , endLine ?: number ) : Promise < string [ ] > ;
6769 getBuildLogs ( project : string , buildId : number ) : Promise < BuildInterfaces . BuildLog [ ] > ;
@@ -771,6 +773,50 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
771773 } ) ;
772774 }
773775
776+ /**
777+ * Gets all retention leases that apply to a specific build.
778+ *
779+ * @param {string } project - Project ID or project name
780+ * @param {number } buildId - The ID of the build.
781+ */
782+ public async getRetentionLeasesForBuild (
783+ project : string ,
784+ buildId : number
785+ ) : Promise < BuildInterfaces . RetentionLease [ ] > {
786+
787+ return new Promise < BuildInterfaces . RetentionLease [ ] > ( async ( resolve , reject ) => {
788+ let routeValues : any = {
789+ project : project ,
790+ buildId : buildId
791+ } ;
792+
793+ try {
794+ let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
795+ "6.1-preview.1" ,
796+ "build" ,
797+ "3da19a6a-f088-45c4-83ce-2ad3a87be6c4" ,
798+ routeValues ) ;
799+
800+ let url : string = verData . requestUrl ! ;
801+ let options : restm . IRequestOptions = this . createRequestOptions ( 'application/json' ,
802+ verData . apiVersion ) ;
803+
804+ let res : restm . IRestResponse < BuildInterfaces . RetentionLease [ ] > ;
805+ res = await this . rest . get < BuildInterfaces . RetentionLease [ ] > ( url , options ) ;
806+
807+ let ret = this . formatResponse ( res . result ,
808+ BuildInterfaces . TypeInfo . RetentionLease ,
809+ true ) ;
810+
811+ resolve ( ret ) ;
812+
813+ }
814+ catch ( err ) {
815+ reject ( err ) ;
816+ }
817+ } ) ;
818+ }
819+
774820 /**
775821 * Deletes a build.
776822 *
@@ -2141,7 +2187,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
21412187
21422188 try {
21432189 let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2144- "6.1-preview.1 " ,
2190+ "6.1-preview.2 " ,
21452191 "build" ,
21462192 "272051e4-9af1-45b5-ae22-8d960a5539d4" ,
21472193 routeValues ) ;
@@ -2191,7 +2237,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
21912237
21922238 try {
21932239 let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2194- "6.1-preview.1 " ,
2240+ "6.1-preview.2 " ,
21952241 "build" ,
21962242 "272051e4-9af1-45b5-ae22-8d960a5539d4" ,
21972243 routeValues ,
@@ -2236,7 +2282,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
22362282
22372283 try {
22382284 let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2239- "6.1-preview.1 " ,
2285+ "6.1-preview.2 " ,
22402286 "build" ,
22412287 "272051e4-9af1-45b5-ae22-8d960a5539d4" ,
22422288 routeValues ) ;
@@ -2286,7 +2332,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
22862332
22872333 try {
22882334 let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2289- "6.1-preview.1 " ,
2335+ "6.1-preview.2 " ,
22902336 "build" ,
22912337 "272051e4-9af1-45b5-ae22-8d960a5539d4" ,
22922338 routeValues ,
@@ -2340,7 +2386,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
23402386
23412387 try {
23422388 let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2343- "6.1-preview.1 " ,
2389+ "6.1-preview.2 " ,
23442390 "build" ,
23452391 "272051e4-9af1-45b5-ae22-8d960a5539d4" ,
23462392 routeValues ,
@@ -2397,7 +2443,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
23972443
23982444 try {
23992445 let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2400- "6.1-preview.1 " ,
2446+ "6.1-preview.2 " ,
24012447 "build" ,
24022448 "272051e4-9af1-45b5-ae22-8d960a5539d4" ,
24032449 routeValues ,
@@ -2423,6 +2469,52 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
24232469 } ) ;
24242470 }
24252471
2472+ /**
2473+ * Updates the duration or pipeline protection status of a retention lease.
2474+ *
2475+ * @param {BuildInterfaces.RetentionLeaseUpdate } leaseUpdate - The new data for the retention lease.
2476+ * @param {string } project - Project ID or project name
2477+ * @param {number } leaseId - The ID of the lease to update.
2478+ */
2479+ public async updateRetentionLease (
2480+ leaseUpdate : BuildInterfaces . RetentionLeaseUpdate ,
2481+ project : string ,
2482+ leaseId : number
2483+ ) : Promise < BuildInterfaces . RetentionLease > {
2484+
2485+ return new Promise < BuildInterfaces . RetentionLease > ( async ( resolve , reject ) => {
2486+ let routeValues : any = {
2487+ project : project ,
2488+ leaseId : leaseId
2489+ } ;
2490+
2491+ try {
2492+ let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2493+ "6.1-preview.2" ,
2494+ "build" ,
2495+ "272051e4-9af1-45b5-ae22-8d960a5539d4" ,
2496+ routeValues ) ;
2497+
2498+ let url : string = verData . requestUrl ! ;
2499+ let options : restm . IRequestOptions = this . createRequestOptions ( 'application/json' ,
2500+ verData . apiVersion ) ;
2501+
2502+ let res : restm . IRestResponse < BuildInterfaces . RetentionLease > ;
2503+ res = await this . rest . update < BuildInterfaces . RetentionLease > ( url , leaseUpdate , options ) ;
2504+
2505+ let ret = this . formatResponse ( res . result ,
2506+ BuildInterfaces . TypeInfo . RetentionLease ,
2507+ false ) ;
2508+
2509+ resolve ( ret ) ;
2510+
2511+ }
2512+ catch ( err ) {
2513+ reject ( err ) ;
2514+ }
2515+ } ) ;
2516+ }
2517+
24262518 /**
24272519 * Gets an individual log file for a build.
24282520 *
0 commit comments