@@ -375,51 +375,66 @@ export default class httpClient {
375375 } , ctx . log )
376376 }
377377
378- processSnapshotCaps ( ctx : Context , snapshot : ProcessedSnapshot , snapshotUuid : string , capsBuildId : string , capsProjectToken : string , discoveryErrors : DiscoveryErrors , variantCount : number , sync : boolean = false ) {
378+ processSnapshotCaps ( ctx : Context , snapshot : ProcessedSnapshot , snapshotUuid : string , capsBuildId : string , capsProjectToken : string , discoveryErrors : DiscoveryErrors , variantCount : number , sync : boolean = false , approvalThreshold : number | undefined , rejectionThreshold : number | undefined ) {
379+ const requestData : any = {
380+ name : snapshot . name ,
381+ url : snapshot . url ,
382+ snapshotUuid : snapshotUuid ,
383+ variantCount : variantCount ,
384+ test : {
385+ type : ctx . testType ,
386+ source : 'cli'
387+ } ,
388+ doRemoteDiscovery : snapshot . options . doRemoteDiscovery ,
389+ discoveryErrors : discoveryErrors ,
390+ sync : sync
391+ }
392+ if ( approvalThreshold !== undefined ) {
393+ requestData . approvalThreshold = approvalThreshold ;
394+ }
395+ if ( rejectionThreshold !== undefined ) {
396+ requestData . rejectionThreshold = rejectionThreshold ;
397+ }
379398 return this . request ( {
380399 url : `/build/${ capsBuildId } /snapshot` ,
381400 method : 'POST' ,
382401 headers : {
383402 'Content-Type' : 'application/json' ,
384403 projectToken : capsProjectToken !== '' ? capsProjectToken : this . projectToken
385404 } ,
386- data : {
387- name : snapshot . name ,
388- url : snapshot . url ,
389- snapshotUuid : snapshotUuid ,
390- variantCount : variantCount ,
391- test : {
392- type : ctx . testType ,
393- source : 'cli'
394- } ,
395- doRemoteDiscovery : snapshot . options . doRemoteDiscovery ,
396- discoveryErrors : discoveryErrors ,
397- sync : sync
398- }
405+ data : requestData
399406 } , ctx . log )
400407 }
401408
402- uploadSnapshotForCaps ( ctx : Context , snapshot : ProcessedSnapshot , capsBuildId : string , capsProjectToken : string , discoveryErrors : DiscoveryErrors , variantCount : number , sync : boolean = false ) {
409+ uploadSnapshotForCaps ( ctx : Context , snapshot : ProcessedSnapshot , capsBuildId : string , capsProjectToken : string , discoveryErrors : DiscoveryErrors , variantCount : number , sync : boolean = false , approvalThreshold : number | undefined , rejectionThreshold : number | undefined ) {
403410 // Use capsBuildId if provided, otherwise fallback to ctx.build.id
404411 const buildId = capsBuildId !== '' ? capsBuildId : ctx . build . id ;
405-
412+
413+ const requestData : any = {
414+ snapshot,
415+ test : {
416+ type : ctx . testType ,
417+ source : 'cli'
418+ } ,
419+ discoveryErrors : discoveryErrors ,
420+ variantCount : variantCount ,
421+ sync : sync
422+ }
423+ if ( approvalThreshold !== undefined ) {
424+ requestData . approvalThreshold = approvalThreshold ;
425+ }
426+ if ( rejectionThreshold !== undefined ) {
427+ requestData . rejectionThreshold = rejectionThreshold ;
428+ }
429+
406430 return this . request ( {
407431 url : `/builds/${ buildId } /snapshot` ,
408432 method : 'POST' ,
409433 headers : {
410434 'Content-Type' : 'application/json' ,
411435 projectToken : capsProjectToken !== '' ? capsProjectToken : this . projectToken // Use capsProjectToken dynamically
412436 } ,
413- data : {
414- snapshot,
415- test : {
416- type : ctx . testType ,
417- source : 'cli'
418- } ,
419- discoveryErrors : discoveryErrors ,
420- variantCount : variantCount ,
421- sync : sync
422- }
437+ data : requestData
423438 } , ctx . log ) ;
424439 }
425440
0 commit comments