@@ -31,6 +31,7 @@ export interface IBuildApi extends basem.ClientApiBase {
31
31
listBranches ( project : string , providerName : string , serviceEndpointId ?: string , repository ?: string , branchName ?: string ) : Promise < string [ ] > ;
32
32
getBuildBadge ( project : string , repoType : string , repoId ?: string , branchName ?: string ) : Promise < BuildInterfaces . BuildBadge > ;
33
33
getBuildBadgeData ( project : string , repoType : string , repoId ?: string , branchName ?: string ) : Promise < string > ;
34
+ getRetentionLeasesForBuild ( project : string , buildId : number ) : Promise < BuildInterfaces . RetentionLease [ ] > ;
34
35
deleteBuild ( project : string , buildId : number ) : Promise < void > ;
35
36
getBuild ( project : string , buildId : number , propertyFilters ?: string ) : Promise < BuildInterfaces . Build > ;
36
37
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 {
62
63
getRetentionLeasesByMinimalRetentionLeases ( project : string , leasesToFetch : BuildInterfaces . MinimalRetentionLease [ ] ) : Promise < BuildInterfaces . RetentionLease [ ] > ;
63
64
getRetentionLeasesByOwnerId ( project : string , ownerId ?: string , definitionId ?: number , runId ?: number ) : Promise < BuildInterfaces . RetentionLease [ ] > ;
64
65
getRetentionLeasesByUserId ( project : string , userOwnerId : string , definitionId ?: number , runId ?: number ) : Promise < BuildInterfaces . RetentionLease [ ] > ;
66
+ updateRetentionLease ( leaseUpdate : BuildInterfaces . RetentionLeaseUpdate , project : string , leaseId : number ) : Promise < BuildInterfaces . RetentionLease > ;
65
67
getBuildLog ( project : string , buildId : number , logId : number , startLine ?: number , endLine ?: number ) : Promise < NodeJS . ReadableStream > ;
66
68
getBuildLogLines ( project : string , buildId : number , logId : number , startLine ?: number , endLine ?: number ) : Promise < string [ ] > ;
67
69
getBuildLogs ( project : string , buildId : number ) : Promise < BuildInterfaces . BuildLog [ ] > ;
@@ -771,6 +773,50 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
771
773
} ) ;
772
774
}
773
775
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
+
774
820
/**
775
821
* Deletes a build.
776
822
*
@@ -2141,7 +2187,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
2141
2187
2142
2188
try {
2143
2189
let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2144
- "6.1-preview.1 " ,
2190
+ "6.1-preview.2 " ,
2145
2191
"build" ,
2146
2192
"272051e4-9af1-45b5-ae22-8d960a5539d4" ,
2147
2193
routeValues ) ;
@@ -2191,7 +2237,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
2191
2237
2192
2238
try {
2193
2239
let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2194
- "6.1-preview.1 " ,
2240
+ "6.1-preview.2 " ,
2195
2241
"build" ,
2196
2242
"272051e4-9af1-45b5-ae22-8d960a5539d4" ,
2197
2243
routeValues ,
@@ -2236,7 +2282,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
2236
2282
2237
2283
try {
2238
2284
let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2239
- "6.1-preview.1 " ,
2285
+ "6.1-preview.2 " ,
2240
2286
"build" ,
2241
2287
"272051e4-9af1-45b5-ae22-8d960a5539d4" ,
2242
2288
routeValues ) ;
@@ -2286,7 +2332,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
2286
2332
2287
2333
try {
2288
2334
let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2289
- "6.1-preview.1 " ,
2335
+ "6.1-preview.2 " ,
2290
2336
"build" ,
2291
2337
"272051e4-9af1-45b5-ae22-8d960a5539d4" ,
2292
2338
routeValues ,
@@ -2340,7 +2386,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
2340
2386
2341
2387
try {
2342
2388
let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2343
- "6.1-preview.1 " ,
2389
+ "6.1-preview.2 " ,
2344
2390
"build" ,
2345
2391
"272051e4-9af1-45b5-ae22-8d960a5539d4" ,
2346
2392
routeValues ,
@@ -2397,7 +2443,7 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
2397
2443
2398
2444
try {
2399
2445
let verData : vsom . ClientVersioningData = await this . vsoClient . getVersioningData (
2400
- "6.1-preview.1 " ,
2446
+ "6.1-preview.2 " ,
2401
2447
"build" ,
2402
2448
"272051e4-9af1-45b5-ae22-8d960a5539d4" ,
2403
2449
routeValues ,
@@ -2423,6 +2469,52 @@ export class BuildApi extends basem.ClientApiBase implements IBuildApi {
2423
2469
} ) ;
2424
2470
}
2425
2471
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
+
2426
2518
/**
2427
2519
* Gets an individual log file for a build.
2428
2520
*
0 commit comments