Skip to content

Commit a8010b6

Browse files
author
Phrase
committed
1 parent 9bfc79d commit a8010b6

15 files changed

+419
-11
lines changed

.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ docs/BlacklistedKeyCreateParameters.md
2424
docs/BlacklistedKeyUpdateParameters.md
2525
docs/BlacklistedKeysApi.md
2626
docs/Branch.md
27+
docs/BranchCreateComparisonParameters.md
2728
docs/BranchCreateParameters.md
2829
docs/BranchMergeParameters.md
2930
docs/BranchName.md
@@ -359,6 +360,7 @@ phrase_api/models/blacklisted_key.py
359360
phrase_api/models/blacklisted_key_create_parameters.py
360361
phrase_api/models/blacklisted_key_update_parameters.py
361362
phrase_api/models/branch.py
363+
phrase_api/models/branch_create_comparison_parameters.py
362364
phrase_api/models/branch_create_parameters.py
363365
phrase_api/models/branch_merge_parameters.py
364366
phrase_api/models/branch_name.py
@@ -590,6 +592,7 @@ test/test_blacklisted_key_create_parameters.py
590592
test/test_blacklisted_key_update_parameters.py
591593
test/test_blacklisted_keys_api.py
592594
test/test_branch.py
595+
test/test_branch_create_comparison_parameters.py
593596
test/test_branch_create_parameters.py
594597
test/test_branch_merge_parameters.py
595598
test/test_branch_name.py

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ Class | Method | HTTP request | Description
166166
*BlacklistedKeysApi* | [**blacklisted_key_update**](docs/BlacklistedKeysApi.md#blacklisted_key_update) | **PATCH** /projects/{project_id}/blacklisted_keys/{id} | Update a blocked key
167167
*BlacklistedKeysApi* | [**blacklisted_keys_list**](docs/BlacklistedKeysApi.md#blacklisted_keys_list) | **GET** /projects/{project_id}/blacklisted_keys | List blocked keys
168168
*BranchesApi* | [**branch_compare**](docs/BranchesApi.md#branch_compare) | **GET** /projects/{project_id}/branches/{name}/compare | Compare branches
169+
*BranchesApi* | [**branch_comparison_create**](docs/BranchesApi.md#branch_comparison_create) | **POST** /projects/{project_id}/branches/{name}/compare | Create comparison (async.)
169170
*BranchesApi* | [**branch_create**](docs/BranchesApi.md#branch_create) | **POST** /projects/{project_id}/branches | Create a branch
170171
*BranchesApi* | [**branch_delete**](docs/BranchesApi.md#branch_delete) | **DELETE** /projects/{project_id}/branches/{name} | Delete a branch
171172
*BranchesApi* | [**branch_merge**](docs/BranchesApi.md#branch_merge) | **PATCH** /projects/{project_id}/branches/{name}/merge | Merge a branch
@@ -449,6 +450,7 @@ Class | Method | HTTP request | Description
449450
- [BlacklistedKeyCreateParameters](docs/BlacklistedKeyCreateParameters.md)
450451
- [BlacklistedKeyUpdateParameters](docs/BlacklistedKeyUpdateParameters.md)
451452
- [Branch](docs/Branch.md)
453+
- [BranchCreateComparisonParameters](docs/BranchCreateComparisonParameters.md)
452454
- [BranchCreateParameters](docs/BranchCreateParameters.md)
453455
- [BranchMergeParameters](docs/BranchMergeParameters.md)
454456
- [BranchName](docs/BranchName.md)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# BranchCreateComparisonParameters
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**direction** | **str** | direction of comparison, possible values are sync or merge (only for v2 branches) | [optional] [default to 'merge']
7+
8+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
9+
10+

docs/BranchesApi.md

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ All URIs are relative to *https://api.phrase.com/v2*
55
Method | HTTP request | Description
66
------------- | ------------- | -------------
77
[**branch_compare**](BranchesApi.md#branch_compare) | **GET** /projects/{project_id}/branches/{name}/compare | Compare branches
8+
[**branch_comparison_create**](BranchesApi.md#branch_comparison_create) | **POST** /projects/{project_id}/branches/{name}/compare | Create comparison (async.)
89
[**branch_create**](BranchesApi.md#branch_create) | **POST** /projects/{project_id}/branches | Create a branch
910
[**branch_delete**](BranchesApi.md#branch_delete) | **DELETE** /projects/{project_id}/branches/{name} | Delete a branch
1011
[**branch_merge**](BranchesApi.md#branch_merge) | **PATCH** /projects/{project_id}/branches/{name}/merge | Merge a branch
@@ -19,7 +20,7 @@ Method | HTTP request | Description
1920
2021
Compare branches
2122

22-
Compare branch with main branch. *Note: Comparing a branch may take several minutes depending on the project size.*
23+
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.*
2324

2425
### Example
2526

@@ -77,6 +78,77 @@ void (empty response body)
7778
**200** | OK | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
7879
**400** | Bad request | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
7980
**404** | Not Found | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
81+
**409** | Conflict | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
82+
**429** | Rate Limiting | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
83+
84+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
85+
86+
# **branch_comparison_create**
87+
> branch_comparison_create(project_id, name, branch_create_comparison_parameters, x_phrase_app_otp=x_phrase_app_otp)
88+
89+
Create comparison (async.)
90+
91+
Create a branch comparison asynchronously.
92+
93+
### Example
94+
95+
```python
96+
from __future__ import print_function
97+
import time
98+
import phrase_api
99+
from phrase_api.rest import ApiException
100+
from pprint import pprint
101+
102+
configuration = phrase_api.Configuration()
103+
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
104+
configuration.api_key_prefix['Authorization'] = 'token'
105+
106+
# Enter a context with an instance of the API client
107+
with phrase_api.ApiClient(configuration) as api_client:
108+
# Create an instance of the API class
109+
api_instance = phrase_api.BranchesApi(api_client)
110+
project_id = 'project_id_example' # str | Project ID (required)
111+
name = 'name_example' # str | name (required)
112+
branch_create_comparison_parameters = phrase_api.BranchCreateComparisonParameters() # BranchCreateComparisonParameters | (required)
113+
x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)
114+
115+
try:
116+
# Create comparison (async.)
117+
api_instance.branch_comparison_create(project_id, name, branch_create_comparison_parameters, x_phrase_app_otp=x_phrase_app_otp)
118+
except ApiException as e:
119+
print("Exception when calling BranchesApi->branch_comparison_create: %s\n" % e)
120+
```
121+
122+
123+
### Parameters
124+
125+
Name | Type | Description | Notes
126+
------------- | ------------- | ------------- | -------------
127+
**project_id** | **str**| Project ID |
128+
**name** | **str**| name |
129+
**branch_create_comparison_parameters** | [**BranchCreateComparisonParameters**](BranchCreateComparisonParameters.md)| |
130+
**x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional]
131+
132+
### Return type
133+
134+
void (empty response body)
135+
136+
### Authorization
137+
138+
[Basic](../README.md#Basic), [Token](../README.md#Token)
139+
140+
### HTTP request headers
141+
142+
- **Content-Type**: application/json
143+
- **Accept**: Not defined
144+
145+
### HTTP response details
146+
| Status code | Description | Response headers |
147+
|-------------|-------------|------------------|
148+
**202** | Accepted | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
149+
**400** | Bad request | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
150+
**404** | Not Found | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
151+
**409** | Conflict | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
80152
**429** | Rate Limiting | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
81153

82154
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
@@ -358,7 +430,7 @@ Name | Type | Description | Notes
358430
359431
Sync a branch
360432

361-
Sync an existing branch. *Note: Only available for branches created with new branching. New branching is currently in private beta*
433+
Sync an existing branch. *Note: Only available for branches created with new branching.*
362434

363435
### Example
364436

phrase_api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
from phrase_api.models.blacklisted_key_create_parameters import BlacklistedKeyCreateParameters
9999
from phrase_api.models.blacklisted_key_update_parameters import BlacklistedKeyUpdateParameters
100100
from phrase_api.models.branch import Branch
101+
from phrase_api.models.branch_create_comparison_parameters import BranchCreateComparisonParameters
101102
from phrase_api.models.branch_create_parameters import BranchCreateParameters
102103
from phrase_api.models.branch_merge_parameters import BranchMergeParameters
103104
from phrase_api.models.branch_name import BranchName

phrase_api/api/branches_api.py

Lines changed: 141 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, api_client=None):
3838
def branch_compare(self, project_id, name, **kwargs): # noqa: E501
3939
"""Compare branches # noqa: E501
4040
41-
Compare branch with main branch. *Note: Comparing a branch may take several minutes depending on the project size.* # noqa: E501
41+
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.* # noqa: E501
4242
This method makes a synchronous HTTP request by default. To make an
4343
asynchronous HTTP request, please pass async_req=True
4444
>>> thread = api.branch_compare(project_id, name, async_req=True)
@@ -65,7 +65,7 @@ def branch_compare(self, project_id, name, **kwargs): # noqa: E501
6565
def branch_compare_with_http_info(self, project_id, name, **kwargs): # noqa: E501
6666
"""Compare branches # noqa: E501
6767
68-
Compare branch with main branch. *Note: Comparing a branch may take several minutes depending on the project size.* # noqa: E501
68+
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.* # noqa: E501
6969
This method makes a synchronous HTTP request by default. To make an
7070
asynchronous HTTP request, please pass async_req=True
7171
>>> thread = api.branch_compare_with_http_info(project_id, name, async_req=True)
@@ -159,6 +159,143 @@ def branch_compare_with_http_info(self, project_id, name, **kwargs): # noqa: E5
159159
_request_timeout=local_var_params.get('_request_timeout'),
160160
collection_formats=collection_formats)
161161

162+
def branch_comparison_create(self, project_id, name, branch_create_comparison_parameters, **kwargs): # noqa: E501
163+
"""Create comparison (async.) # noqa: E501
164+
165+
Create a branch comparison asynchronously. # noqa: E501
166+
This method makes a synchronous HTTP request by default. To make an
167+
asynchronous HTTP request, please pass async_req=True
168+
>>> thread = api.branch_comparison_create(project_id, name, branch_create_comparison_parameters, async_req=True)
169+
>>> result = thread.get()
170+
171+
:param async_req bool: execute request asynchronously
172+
:param str project_id: Project ID (required)
173+
:param str name: name (required)
174+
:param BranchCreateComparisonParameters branch_create_comparison_parameters: (required)
175+
:param str x_phrase_app_otp: Two-Factor-Authentication token (optional)
176+
:param _preload_content: if False, the urllib3.HTTPResponse object will
177+
be returned without reading/decoding response
178+
data. Default is True.
179+
:param _request_timeout: timeout setting for this request. If one
180+
number provided, it will be total request
181+
timeout. It can also be a pair (tuple) of
182+
(connection, read) timeouts.
183+
:return: None
184+
If the method is called asynchronously,
185+
returns the request thread.
186+
"""
187+
kwargs['_return_http_data_only'] = True
188+
return self.branch_comparison_create_with_http_info(project_id, name, branch_create_comparison_parameters, **kwargs) # noqa: E501
189+
190+
def branch_comparison_create_with_http_info(self, project_id, name, branch_create_comparison_parameters, **kwargs): # noqa: E501
191+
"""Create comparison (async.) # noqa: E501
192+
193+
Create a branch comparison asynchronously. # noqa: E501
194+
This method makes a synchronous HTTP request by default. To make an
195+
asynchronous HTTP request, please pass async_req=True
196+
>>> thread = api.branch_comparison_create_with_http_info(project_id, name, branch_create_comparison_parameters, async_req=True)
197+
>>> result = thread.get()
198+
199+
:param async_req bool: execute request asynchronously
200+
:param str project_id: Project ID (required)
201+
:param str name: name (required)
202+
:param BranchCreateComparisonParameters branch_create_comparison_parameters: (required)
203+
:param str x_phrase_app_otp: Two-Factor-Authentication token (optional)
204+
:param _return_http_data_only: response data without head status code
205+
and headers
206+
:param _preload_content: if False, the urllib3.HTTPResponse object will
207+
be returned without reading/decoding response
208+
data. Default is True.
209+
:param _request_timeout: timeout setting for this request. If one
210+
number provided, it will be total request
211+
timeout. It can also be a pair (tuple) of
212+
(connection, read) timeouts.
213+
:return: None
214+
If the method is called asynchronously,
215+
returns the request thread.
216+
"""
217+
218+
local_var_params = locals()
219+
220+
all_params = [
221+
'project_id',
222+
'name',
223+
'branch_create_comparison_parameters',
224+
'x_phrase_app_otp'
225+
]
226+
all_params.extend(
227+
[
228+
'async_req',
229+
'_return_http_data_only',
230+
'_preload_content',
231+
'_request_timeout'
232+
]
233+
)
234+
235+
for key, val in six.iteritems(local_var_params['kwargs']):
236+
if key not in all_params:
237+
raise ApiTypeError(
238+
"Got an unexpected keyword argument '%s'"
239+
" to method branch_comparison_create" % key
240+
)
241+
local_var_params[key] = val
242+
del local_var_params['kwargs']
243+
# verify the required parameter 'project_id' is set
244+
if self.api_client.client_side_validation and ('project_id' not in local_var_params or # noqa: E501
245+
local_var_params['project_id'] is None): # noqa: E501
246+
raise ApiValueError("Missing the required parameter `project_id` when calling `branch_comparison_create`") # noqa: E501
247+
# verify the required parameter 'name' is set
248+
if self.api_client.client_side_validation and ('name' not in local_var_params or # noqa: E501
249+
local_var_params['name'] is None): # noqa: E501
250+
raise ApiValueError("Missing the required parameter `name` when calling `branch_comparison_create`") # noqa: E501
251+
# verify the required parameter 'branch_create_comparison_parameters' is set
252+
if self.api_client.client_side_validation and ('branch_create_comparison_parameters' not in local_var_params or # noqa: E501
253+
local_var_params['branch_create_comparison_parameters'] is None): # noqa: E501
254+
raise ApiValueError("Missing the required parameter `branch_create_comparison_parameters` when calling `branch_comparison_create`") # noqa: E501
255+
256+
collection_formats = {}
257+
258+
path_params = {}
259+
if 'project_id' in local_var_params:
260+
path_params['project_id'] = local_var_params['project_id'] # noqa: E501
261+
if 'name' in local_var_params:
262+
path_params['name'] = local_var_params['name'] # noqa: E501
263+
264+
query_params = []
265+
266+
header_params = {}
267+
if 'x_phrase_app_otp' in local_var_params:
268+
header_params['X-PhraseApp-OTP'] = local_var_params['x_phrase_app_otp'] # noqa: E501
269+
270+
form_params = []
271+
local_var_files = {}
272+
273+
body_params = None
274+
if 'branch_create_comparison_parameters' in local_var_params:
275+
body_params = local_var_params['branch_create_comparison_parameters']
276+
# HTTP header `Content-Type`
277+
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
278+
['application/json']) # noqa: E501
279+
280+
# Authentication setting
281+
auth_settings = ['Basic', 'Token'] # noqa: E501
282+
283+
return self.api_client.call_api(
284+
'/projects/{project_id}/branches/{name}/compare', 'POST',
285+
path_params,
286+
query_params,
287+
header_params,
288+
body=body_params,
289+
post_params=form_params,
290+
files=local_var_files,
291+
response_type=None, # noqa: E501
292+
auth_settings=auth_settings,
293+
async_req=local_var_params.get('async_req'),
294+
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
295+
_preload_content=local_var_params.get('_preload_content', True),
296+
_request_timeout=local_var_params.get('_request_timeout'),
297+
collection_formats=collection_formats)
298+
162299
def branch_create(self, project_id, branch_create_parameters, **kwargs): # noqa: E501
163300
"""Create a branch # noqa: E501
164301
@@ -683,7 +820,7 @@ def branch_show_with_http_info(self, project_id, name, **kwargs): # noqa: E501
683820
def branch_sync(self, project_id, name, branch_sync_parameters, **kwargs): # noqa: E501
684821
"""Sync a branch # noqa: E501
685822
686-
Sync an existing branch. *Note: Only available for branches created with new branching. New branching is currently in private beta* # noqa: E501
823+
Sync an existing branch. *Note: Only available for branches created with new branching.* # noqa: E501
687824
This method makes a synchronous HTTP request by default. To make an
688825
asynchronous HTTP request, please pass async_req=True
689826
>>> thread = api.branch_sync(project_id, name, branch_sync_parameters, async_req=True)
@@ -711,7 +848,7 @@ def branch_sync(self, project_id, name, branch_sync_parameters, **kwargs): # no
711848
def branch_sync_with_http_info(self, project_id, name, branch_sync_parameters, **kwargs): # noqa: E501
712849
"""Sync a branch # noqa: E501
713850
714-
Sync an existing branch. *Note: Only available for branches created with new branching. New branching is currently in private beta* # noqa: E501
851+
Sync an existing branch. *Note: Only available for branches created with new branching.* # noqa: E501
715852
This method makes a synchronous HTTP request by default. To make an
716853
asynchronous HTTP request, please pass async_req=True
717854
>>> thread = api.branch_sync_with_http_info(project_id, name, branch_sync_parameters, async_req=True)

phrase_api/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from phrase_api.models.blacklisted_key_create_parameters import BlacklistedKeyCreateParameters
3030
from phrase_api.models.blacklisted_key_update_parameters import BlacklistedKeyUpdateParameters
3131
from phrase_api.models.branch import Branch
32+
from phrase_api.models.branch_create_comparison_parameters import BranchCreateComparisonParameters
3233
from phrase_api.models.branch_create_parameters import BranchCreateParameters
3334
from phrase_api.models.branch_merge_parameters import BranchMergeParameters
3435
from phrase_api.models.branch_name import BranchName

0 commit comments

Comments
 (0)