Skip to content

Commit ae62e90

Browse files
author
Phrase
committed
1 parent fe2489c commit ae62e90

35 files changed

Lines changed: 939 additions & 115 deletions

.openapi-generator/FILES

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ docs/TranslationsUnreviewParameters.md
265265
docs/TranslationsUnverifyParameters.md
266266
docs/TranslationsVerifyParameters.md
267267
docs/Upload.md
268+
docs/UploadBatch.md
269+
docs/UploadBatchesApi.md
270+
docs/UploadBatchesCreateParameters.md
268271
docs/UploadSummary.md
269272
docs/UploadsApi.md
270273
docs/User.md
@@ -334,6 +337,7 @@ phrase_api/api/style_guides_api.py
334337
phrase_api/api/tags_api.py
335338
phrase_api/api/teams_api.py
336339
phrase_api/api/translations_api.py
340+
phrase_api/api/upload_batches_api.py
337341
phrase_api/api/uploads_api.py
338342
phrase_api/api/users_api.py
339343
phrase_api/api/variables_api.py
@@ -556,6 +560,8 @@ phrase_api/models/translations_unreview_parameters.py
556560
phrase_api/models/translations_unverify_parameters.py
557561
phrase_api/models/translations_verify_parameters.py
558562
phrase_api/models/upload.py
563+
phrase_api/models/upload_batch.py
564+
phrase_api/models/upload_batches_create_parameters.py
559565
phrase_api/models/upload_summary.py
560566
phrase_api/models/user.py
561567
phrase_api/models/user_preview.py
@@ -834,6 +840,9 @@ test/test_translations_unreview_parameters.py
834840
test/test_translations_unverify_parameters.py
835841
test/test_translations_verify_parameters.py
836842
test/test_upload.py
843+
test/test_upload_batch.py
844+
test/test_upload_batches_api.py
845+
test/test_upload_batches_create_parameters.py
837846
test/test_upload_summary.py
838847
test/test_user.py
839848
test/test_user_preview.py

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ Class | Method | HTTP request | Description
410410
*TranslationsApi* | [**translations_unreview_collection**](docs/TranslationsApi.md#translations_unreview_collection) | **PATCH** /projects/{project_id}/translations/unreview | Unreview translations selected by query
411411
*TranslationsApi* | [**translations_unverify_collection**](docs/TranslationsApi.md#translations_unverify_collection) | **PATCH** /projects/{project_id}/translations/unverify | Unverify translations by query
412412
*TranslationsApi* | [**translations_verify_collection**](docs/TranslationsApi.md#translations_verify_collection) | **PATCH** /projects/{project_id}/translations/verify | Verify translations by query
413+
*UploadBatchesApi* | [**upload_batches_create**](docs/UploadBatchesApi.md#upload_batches_create) | **POST** /projects/{project_id}/upload_batches | Create upload batch
413414
*UploadsApi* | [**upload_create**](docs/UploadsApi.md#upload_create) | **POST** /projects/{project_id}/uploads | Upload a new file
414415
*UploadsApi* | [**upload_show**](docs/UploadsApi.md#upload_show) | **GET** /projects/{project_id}/uploads/{id} | Get a single upload
415416
*UploadsApi* | [**uploads_list**](docs/UploadsApi.md#uploads_list) | **GET** /projects/{project_id}/uploads | List uploads
@@ -645,6 +646,8 @@ Class | Method | HTTP request | Description
645646
- [TranslationsUnverifyParameters](docs/TranslationsUnverifyParameters.md)
646647
- [TranslationsVerifyParameters](docs/TranslationsVerifyParameters.md)
647648
- [Upload](docs/Upload.md)
649+
- [UploadBatch](docs/UploadBatch.md)
650+
- [UploadBatchesCreateParameters](docs/UploadBatchesCreateParameters.md)
648651
- [UploadSummary](docs/UploadSummary.md)
649652
- [User](docs/User.md)
650653
- [UserPreview](docs/UserPreview.md)

docs/UploadBatch.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# UploadBatch
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**state** | **str** | Processing state of the upload batch | [optional]
7+
**delete_unmentioned_keys** | **bool** | Indicates whether unmentioned keys will be deleted after processing all uploads in the batch | [optional]
8+
**created_at** | **datetime** | | [optional]
9+
**updated_at** | **datetime** | | [optional]
10+
**project** | [**ProjectShort**](.md) | | [optional]
11+
**user** | [**UserPreview**](.md) | | [optional]
12+
**uploads** | [**List[Upload]**](Upload.md) | | [optional]
13+
14+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
15+
16+

docs/UploadBatchesApi.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# phrase_api.UploadBatchesApi
2+
3+
All URIs are relative to *https://api.phrase.com/v2*
4+
5+
Method | HTTP request | Description
6+
------------- | ------------- | -------------
7+
[**upload_batches_create**](UploadBatchesApi.md#upload_batches_create) | **POST** /projects/{project_id}/upload_batches | Create upload batch
8+
9+
10+
# **upload_batches_create**
11+
> UploadBatch upload_batches_create(project_id, upload_batches_create_parameters, x_phrase_app_otp=x_phrase_app_otp)
12+
13+
Create upload batch
14+
15+
Groups multiple file uploads into a single batch. Optionally, launches the deletion of unmentioned translation keys after all uploads in the batch are completed.
16+
17+
### Example
18+
19+
```python
20+
from __future__ import print_function
21+
import time
22+
import phrase_api
23+
from phrase_api.rest import ApiException
24+
from pprint import pprint
25+
26+
configuration = phrase_api.Configuration()
27+
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
28+
configuration.api_key_prefix['Authorization'] = 'token'
29+
30+
# Enter a context with an instance of the API client
31+
with phrase_api.ApiClient(configuration) as api_client:
32+
# Create an instance of the API class
33+
api_instance = phrase_api.UploadBatchesApi(api_client)
34+
project_id = 'project_id_example' # str | Project ID (required)
35+
upload_batches_create_parameters = phrase_api.UploadBatchesCreateParameters() # UploadBatchesCreateParameters | (required)
36+
x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)
37+
38+
try:
39+
# Create upload batch
40+
api_response = api_instance.upload_batches_create(project_id, upload_batches_create_parameters, x_phrase_app_otp=x_phrase_app_otp)
41+
pprint(api_response)
42+
except ApiException as e:
43+
print("Exception when calling UploadBatchesApi->upload_batches_create: %s\n" % e)
44+
```
45+
46+
47+
### Parameters
48+
49+
Name | Type | Description | Notes
50+
------------- | ------------- | ------------- | -------------
51+
**project_id** | **str**| Project ID |
52+
**upload_batches_create_parameters** | [**UploadBatchesCreateParameters**](UploadBatchesCreateParameters.md)| |
53+
**x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional]
54+
55+
### Return type
56+
57+
[**UploadBatch**](UploadBatch.md)
58+
59+
### Authorization
60+
61+
[Basic](../README.md#Basic), [Token](../README.md#Token)
62+
63+
### HTTP request headers
64+
65+
- **Content-Type**: application/json
66+
- **Accept**: application/json
67+
68+
### HTTP response details
69+
| Status code | Description | Response headers |
70+
|-------------|-------------|------------------|
71+
**201** | Created | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
72+
**400** | Bad request | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
73+
**404** | Not Found | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
74+
**429** | Rate Limiting | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
75+
76+
[[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)
77+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# UploadBatchesCreateParameters
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**branch** | **str** | specify the branch to use | [optional]
7+
**delete_unmentioned_keys** | **bool** | If set to true, after all uploads in the batch are completed, translation keys that were not mentioned in any of the uploaded files will be deleted. | [optional]
8+
**upload_ids** | **List[str]** | Array of upload IDs to include in the batch |
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11+
12+

phrase_api/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
from phrase_api.api.tags_api import TagsApi
6767
from phrase_api.api.teams_api import TeamsApi
6868
from phrase_api.api.translations_api import TranslationsApi
69+
from phrase_api.api.upload_batches_api import UploadBatchesApi
6970
from phrase_api.api.uploads_api import UploadsApi
7071
from phrase_api.api.users_api import UsersApi
7172
from phrase_api.api.variables_api import VariablesApi
@@ -293,6 +294,8 @@
293294
from phrase_api.models.translations_unverify_parameters import TranslationsUnverifyParameters
294295
from phrase_api.models.translations_verify_parameters import TranslationsVerifyParameters
295296
from phrase_api.models.upload import Upload
297+
from phrase_api.models.upload_batch import UploadBatch
298+
from phrase_api.models.upload_batches_create_parameters import UploadBatchesCreateParameters
296299
from phrase_api.models.upload_summary import UploadSummary
297300
from phrase_api.models.user import User
298301
from phrase_api.models.user_preview import UserPreview

phrase_api/api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
from phrase_api.api.tags_api import TagsApi
5454
from phrase_api.api.teams_api import TeamsApi
5555
from phrase_api.api.translations_api import TranslationsApi
56+
from phrase_api.api.upload_batches_api import UploadBatchesApi
5657
from phrase_api.api.uploads_api import UploadsApi
5758
from phrase_api.api.users_api import UsersApi
5859
from phrase_api.api.variables_api import VariablesApi
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# coding: utf-8
2+
3+
"""
4+
Phrase Strings API Reference
5+
6+
The version of the OpenAPI document: 2.0.0
7+
Contact: support@phrase.com
8+
Generated by: https://openapi-generator.tech
9+
"""
10+
11+
12+
from __future__ import absolute_import
13+
14+
import re # noqa: F401
15+
16+
# python 2 and python 3 compatibility library
17+
import six
18+
19+
from phrase_api.api_client import ApiClient
20+
from phrase_api.exceptions import ( # noqa: F401
21+
ApiTypeError,
22+
ApiValueError
23+
)
24+
25+
26+
class UploadBatchesApi(object):
27+
"""NOTE: This class is auto generated by OpenAPI Generator
28+
Ref: https://openapi-generator.tech
29+
30+
Do not edit the class manually.
31+
"""
32+
33+
def __init__(self, api_client=None):
34+
if api_client is None:
35+
api_client = ApiClient()
36+
self.api_client = api_client
37+
38+
def upload_batches_create(self, project_id, upload_batches_create_parameters, **kwargs): # noqa: E501
39+
"""Create upload batch # noqa: E501
40+
41+
Groups multiple file uploads into a single batch. Optionally, launches the deletion of unmentioned translation keys after all uploads in the batch are completed. # noqa: E501
42+
This method makes a synchronous HTTP request by default. To make an
43+
asynchronous HTTP request, please pass async_req=True
44+
>>> thread = api.upload_batches_create(project_id, upload_batches_create_parameters, async_req=True)
45+
>>> result = thread.get()
46+
47+
:param async_req bool: execute request asynchronously
48+
:param str project_id: Project ID (required)
49+
:param UploadBatchesCreateParameters upload_batches_create_parameters: (required)
50+
:param str x_phrase_app_otp: Two-Factor-Authentication token (optional)
51+
:param _preload_content: if False, the urllib3.HTTPResponse object will
52+
be returned without reading/decoding response
53+
data. Default is True.
54+
:param _request_timeout: timeout setting for this request. If one
55+
number provided, it will be total request
56+
timeout. It can also be a pair (tuple) of
57+
(connection, read) timeouts.
58+
:return: UploadBatch
59+
If the method is called asynchronously,
60+
returns the request thread.
61+
"""
62+
kwargs['_return_http_data_only'] = True
63+
return self.upload_batches_create_with_http_info(project_id, upload_batches_create_parameters, **kwargs) # noqa: E501
64+
65+
def upload_batches_create_with_http_info(self, project_id, upload_batches_create_parameters, **kwargs): # noqa: E501
66+
"""Create upload batch # noqa: E501
67+
68+
Groups multiple file uploads into a single batch. Optionally, launches the deletion of unmentioned translation keys after all uploads in the batch are completed. # noqa: E501
69+
This method makes a synchronous HTTP request by default. To make an
70+
asynchronous HTTP request, please pass async_req=True
71+
>>> thread = api.upload_batches_create_with_http_info(project_id, upload_batches_create_parameters, async_req=True)
72+
>>> result = thread.get()
73+
74+
:param async_req bool: execute request asynchronously
75+
:param str project_id: Project ID (required)
76+
:param UploadBatchesCreateParameters upload_batches_create_parameters: (required)
77+
:param str x_phrase_app_otp: Two-Factor-Authentication token (optional)
78+
:param _return_http_data_only: response data without head status code
79+
and headers
80+
:param _preload_content: if False, the urllib3.HTTPResponse object will
81+
be returned without reading/decoding response
82+
data. Default is True.
83+
:param _request_timeout: timeout setting for this request. If one
84+
number provided, it will be total request
85+
timeout. It can also be a pair (tuple) of
86+
(connection, read) timeouts.
87+
:return: tuple(UploadBatch, status_code(int), headers(HTTPHeaderDict))
88+
If the method is called asynchronously,
89+
returns the request thread.
90+
"""
91+
92+
local_var_params = locals()
93+
94+
all_params = [
95+
'project_id',
96+
'upload_batches_create_parameters',
97+
'x_phrase_app_otp'
98+
]
99+
all_params.extend(
100+
[
101+
'async_req',
102+
'_return_http_data_only',
103+
'_preload_content',
104+
'_request_timeout'
105+
]
106+
)
107+
108+
for key, val in six.iteritems(local_var_params['kwargs']):
109+
if key not in all_params:
110+
raise ApiTypeError(
111+
"Got an unexpected keyword argument '%s'"
112+
" to method upload_batches_create" % key
113+
)
114+
local_var_params[key] = val
115+
del local_var_params['kwargs']
116+
# verify the required parameter 'project_id' is set
117+
if self.api_client.client_side_validation and ('project_id' not in local_var_params or # noqa: E501
118+
local_var_params['project_id'] is None): # noqa: E501
119+
raise ApiValueError("Missing the required parameter `project_id` when calling `upload_batches_create`") # noqa: E501
120+
# verify the required parameter 'upload_batches_create_parameters' is set
121+
if self.api_client.client_side_validation and ('upload_batches_create_parameters' not in local_var_params or # noqa: E501
122+
local_var_params['upload_batches_create_parameters'] is None): # noqa: E501
123+
raise ApiValueError("Missing the required parameter `upload_batches_create_parameters` when calling `upload_batches_create`") # noqa: E501
124+
125+
collection_formats = {}
126+
127+
path_params = {}
128+
if 'project_id' in local_var_params:
129+
path_params['project_id'] = local_var_params['project_id'] # noqa: E501
130+
131+
query_params = []
132+
133+
header_params = {}
134+
if 'x_phrase_app_otp' in local_var_params:
135+
header_params['X-PhraseApp-OTP'] = local_var_params['x_phrase_app_otp'] # noqa: E501
136+
137+
form_params = []
138+
local_var_files = {}
139+
140+
body_params = None
141+
if 'upload_batches_create_parameters' in local_var_params:
142+
body_params = local_var_params['upload_batches_create_parameters']
143+
# HTTP header `Accept`
144+
header_params['Accept'] = self.api_client.select_header_accept(
145+
['application/json']) # noqa: E501
146+
147+
# HTTP header `Content-Type`
148+
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
149+
['application/json']) # noqa: E501
150+
151+
# Authentication setting
152+
auth_settings = ['Basic', 'Token'] # noqa: E501
153+
154+
return self.api_client.call_api(
155+
'/projects/{project_id}/upload_batches', 'POST',
156+
path_params,
157+
query_params,
158+
header_params,
159+
body=body_params,
160+
post_params=form_params,
161+
files=local_var_files,
162+
response_type='UploadBatch', # noqa: E501
163+
auth_settings=auth_settings,
164+
async_req=local_var_params.get('async_req'),
165+
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
166+
_preload_content=local_var_params.get('_preload_content', True),
167+
_request_timeout=local_var_params.get('_request_timeout'),
168+
collection_formats=collection_formats)

phrase_api/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@
224224
from phrase_api.models.translations_unverify_parameters import TranslationsUnverifyParameters
225225
from phrase_api.models.translations_verify_parameters import TranslationsVerifyParameters
226226
from phrase_api.models.upload import Upload
227+
from phrase_api.models.upload_batch import UploadBatch
228+
from phrase_api.models.upload_batches_create_parameters import UploadBatchesCreateParameters
227229
from phrase_api.models.upload_summary import UploadSummary
228230
from phrase_api.models.user import User
229231
from phrase_api.models.user_preview import UserPreview

0 commit comments

Comments
 (0)