@@ -17,6 +17,9 @@ import {
1717 Branch ,
1818 BranchFromJSON ,
1919 BranchToJSON ,
20+ BranchCreateComparisonParameters ,
21+ BranchCreateComparisonParametersFromJSON ,
22+ BranchCreateComparisonParametersToJSON ,
2023 BranchCreateParameters ,
2124 BranchCreateParametersFromJSON ,
2225 BranchCreateParametersToJSON ,
@@ -37,6 +40,13 @@ export interface BranchCompareRequest {
3740 xPhraseAppOTP ?: string ;
3841}
3942
43+ export interface BranchComparisonCreateRequest {
44+ projectId : string ;
45+ name : string ;
46+ branchCreateComparisonParameters : BranchCreateComparisonParameters ;
47+ xPhraseAppOTP ?: string ;
48+ }
49+
4050export interface BranchCreateRequest {
4151 projectId : string ;
4252 branchCreateParameters : BranchCreateParameters ;
@@ -89,7 +99,7 @@ export interface BranchesListRequest {
8999export class BranchesApi extends runtime . BaseAPI {
90100
91101 /**
92- * Compare branch with main branch. *Note: Comparing a branch may take several minutes depending on the project size.*
102+ * Compare branch with main branch. *Note: Comparing a branch may take several minutes depending on the project size. Consider using the `POST /compare` endpoint for creating comparison asynchronously .*
93103 * Compare branches
94104 */
95105 async branchCompareRaw ( requestParameters : BranchCompareRequest ) : Promise < runtime . ApiResponse < any > > {
@@ -127,14 +137,68 @@ export class BranchesApi extends runtime.BaseAPI {
127137 }
128138
129139 /**
130- * Compare branch with main branch. *Note: Comparing a branch may take several minutes depending on the project size.*
140+ * Compare branch with main branch. *Note: Comparing a branch may take several minutes depending on the project size. Consider using the `POST /compare` endpoint for creating comparison asynchronously .*
131141 * Compare branches
132142 */
133143 async branchCompare ( requestParameters : BranchCompareRequest ) : Promise < any > {
134144 const response = await this . branchCompareRaw ( requestParameters ) ;
135145 return await response . value ( ) ;
136146 }
137147
148+ /**
149+ * Create a branch comparison asynchronously.
150+ * Create comparison (async.)
151+ */
152+ async branchComparisonCreateRaw ( requestParameters : BranchComparisonCreateRequest ) : Promise < runtime . ApiResponse < any > > {
153+ if ( requestParameters . projectId === null || requestParameters . projectId === undefined ) {
154+ throw new runtime . RequiredError ( 'projectId' , 'Required parameter requestParameters.projectId was null or undefined when calling branchComparisonCreate.' ) ;
155+ }
156+
157+ if ( requestParameters . name === null || requestParameters . name === undefined ) {
158+ throw new runtime . RequiredError ( 'name' , 'Required parameter requestParameters.name was null or undefined when calling branchComparisonCreate.' ) ;
159+ }
160+
161+ if ( requestParameters . branchCreateComparisonParameters === null || requestParameters . branchCreateComparisonParameters === undefined ) {
162+ throw new runtime . RequiredError ( 'branchCreateComparisonParameters' , 'Required parameter requestParameters.branchCreateComparisonParameters was null or undefined when calling branchComparisonCreate.' ) ;
163+ }
164+
165+ const queryParameters : any = { } ;
166+
167+ const headerParameters : runtime . HTTPHeaders = { } ;
168+
169+ headerParameters [ 'Content-Type' ] = 'application/json' ;
170+
171+ if ( requestParameters . xPhraseAppOTP !== undefined && requestParameters . xPhraseAppOTP !== null ) {
172+ headerParameters [ 'X-PhraseApp-OTP' ] = String ( requestParameters . xPhraseAppOTP ) ;
173+ }
174+
175+ if ( this . configuration && ( this . configuration . username !== undefined || this . configuration . password !== undefined ) ) {
176+ headerParameters [ "Authorization" ] = "Basic " + btoa ( this . configuration . username + ":" + this . configuration . password ) ;
177+ }
178+ if ( this . configuration && this . configuration . apiKey ) {
179+ headerParameters [ "Authorization" ] = this . configuration . apiKey ( "Authorization" ) ; // Token authentication
180+ }
181+
182+ const response = await this . request ( {
183+ path : `/projects/{project_id}/branches/{name}/compare` . replace ( `{${ "project_id" } }` , encodeURIComponent ( String ( requestParameters . projectId ) ) ) . replace ( `{${ "name" } }` , encodeURIComponent ( String ( requestParameters . name ) ) ) ,
184+ method : 'POST' ,
185+ headers : headerParameters ,
186+ query : queryParameters ,
187+ body : BranchCreateComparisonParametersToJSON ( requestParameters . branchCreateComparisonParameters ) ,
188+ } ) ;
189+
190+ return new runtime . TextApiResponse ( response ) as any ;
191+ }
192+
193+ /**
194+ * Create a branch comparison asynchronously.
195+ * Create comparison (async.)
196+ */
197+ async branchComparisonCreate ( requestParameters : BranchComparisonCreateRequest ) : Promise < any > {
198+ const response = await this . branchComparisonCreateRaw ( requestParameters ) ;
199+ return await response . value ( ) ;
200+ }
201+
138202 /**
139203 * Create a new branch. *Note: Creating a new branch may take several minutes depending on the project size.*
140204 * Create a branch
@@ -334,7 +398,7 @@ export class BranchesApi extends runtime.BaseAPI {
334398 }
335399
336400 /**
337- * Sync an existing branch. *Note: Only available for branches created with new branching. New branching is currently in private beta *
401+ * Sync an existing branch. *Note: Only available for branches created with new branching.*
338402 * Sync a branch
339403 */
340404 async branchSyncRaw ( requestParameters : BranchSyncRequest ) : Promise < runtime . ApiResponse < any > > {
@@ -379,7 +443,7 @@ export class BranchesApi extends runtime.BaseAPI {
379443 }
380444
381445 /**
382- * Sync an existing branch. *Note: Only available for branches created with new branching. New branching is currently in private beta *
446+ * Sync an existing branch. *Note: Only available for branches created with new branching.*
383447 * Sync a branch
384448 */
385449 async branchSync ( requestParameters : BranchSyncRequest ) : Promise < any > {
0 commit comments