Skip to content

Latest commit

 

History

History
657 lines (482 loc) · 28.9 KB

File metadata and controls

657 lines (482 loc) · 28.9 KB

phrase_api.BranchesApi

All URIs are relative to https://api.phrase.com/v2

Method HTTP request Description
branch_compare GET /projects/{project_id}/branches/{name}/compare Compare branches
branch_comparison_create POST /projects/{project_id}/branches/{name}/compare Create comparison (async.)
branch_create POST /projects/{project_id}/branches Create a branch
branch_delete DELETE /projects/{project_id}/branches/{name} Delete a branch
branch_merge PATCH /projects/{project_id}/branches/{name}/merge Merge a branch
branch_show GET /projects/{project_id}/branches/{name} Get a single branch
branch_sync PATCH /projects/{project_id}/branches/{name}/sync Sync a branch
branch_update PATCH /projects/{project_id}/branches/{name} Update a branch
branches_list GET /projects/{project_id}/branches List branches

branch_compare

branch_compare(project_id, name, x_phrase_app_otp=x_phrase_app_otp)

Compare branches

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.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.BranchesApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    name = 'name_example' # str | name (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)

    try:
        # Compare branches
        api_instance.branch_compare(project_id, name, x_phrase_app_otp=x_phrase_app_otp)
    except ApiException as e:
        print("Exception when calling BranchesApi->branch_compare: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
name str name
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]

Return type

void (empty response body)

Authorization

Basic, Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
409 Conflict * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

branch_comparison_create

branch_comparison_create(project_id, name, branch_create_comparison_parameters, x_phrase_app_otp=x_phrase_app_otp)

Create comparison (async.)

Create a branch comparison asynchronously.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.BranchesApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    name = 'name_example' # str | name (required)
    branch_create_comparison_parameters = phrase_api.BranchCreateComparisonParameters() # BranchCreateComparisonParameters |  (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)

    try:
        # Create comparison (async.)
        api_instance.branch_comparison_create(project_id, name, branch_create_comparison_parameters, x_phrase_app_otp=x_phrase_app_otp)
    except ApiException as e:
        print("Exception when calling BranchesApi->branch_comparison_create: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
name str name
branch_create_comparison_parameters BranchCreateComparisonParameters
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]

Return type

void (empty response body)

Authorization

Basic, Token

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

HTTP response details

Status code Description Response headers
202 Accepted * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
409 Conflict * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

branch_create

Branch branch_create(project_id, branch_create_parameters, x_phrase_app_otp=x_phrase_app_otp)

Create a branch

Create a new branch. Branch project provisioning runs asynchronously, so the newly created branch is returned in a transitional state (typically creating_branch) and only reaches success once the underlying project has been set up. Poll the branch resource until its state becomes success before performing further operations on it. Requires the Branching feature to be enabled on the account. Note: Creating a new branch may take several minutes depending on the project size.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.BranchesApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    branch_create_parameters = phrase_api.BranchCreateParameters() # BranchCreateParameters |  (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)

    try:
        # Create a branch
        api_response = api_instance.branch_create(project_id, branch_create_parameters, x_phrase_app_otp=x_phrase_app_otp)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling BranchesApi->branch_create: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
branch_create_parameters BranchCreateParameters
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]

Return type

Branch

Authorization

Basic, Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
401 Unauthorized -
403 Forbidden * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
422 Unprocessable entity * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

branch_delete

branch_delete(project_id, name, x_phrase_app_otp=x_phrase_app_otp)

Delete a branch

Delete an existing branch. A branch cannot be deleted while it still has open jobs or open translation orders attached to its branch project — in that case the request is rejected with 409 Conflict. A branch whose current state does not allow deletion (for example, while a merge or sync is in progress) is rejected with 422 Unprocessable Entity. Requires the Branching feature to be enabled on the account.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.BranchesApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    name = 'name_example' # str | name (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)

    try:
        # Delete a branch
        api_instance.branch_delete(project_id, name, x_phrase_app_otp=x_phrase_app_otp)
    except ApiException as e:
        print("Exception when calling BranchesApi->branch_delete: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
name str name
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]

Return type

void (empty response body)

Authorization

Basic, Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 The resource was deleted successfully. * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
401 Unauthorized -
403 Forbidden * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
409 Conflict * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
422 Unprocessable entity * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

branch_merge

branch_merge(project_id, name, branch_merge_parameters, x_phrase_app_otp=x_phrase_app_otp)

Merge a branch

Merge an existing branch back into its base branch. The merge runs asynchronously. The branch transitions to merging_branch and settles in merged, merge_error, or merge_conflict once the background job completes; the response body for this request is empty. Poll the branch resource to observe the final state. A branch cannot be merged while it still has open jobs or open translation orders attached to its branch project — in that case the request is rejected with 409 Conflict. A branch whose current state does not allow a merge is rejected with 422 Unprocessable Entity. Requires the Branching feature to be enabled on the account. Note: Merging a branch may take several minutes depending on diff size.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.BranchesApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    name = 'name_example' # str | name (required)
    branch_merge_parameters = phrase_api.BranchMergeParameters() # BranchMergeParameters |  (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)

    try:
        # Merge a branch
        api_instance.branch_merge(project_id, name, branch_merge_parameters, x_phrase_app_otp=x_phrase_app_otp)
    except ApiException as e:
        print("Exception when calling BranchesApi->branch_merge: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
name str name
branch_merge_parameters BranchMergeParameters
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]

Return type

void (empty response body)

Authorization

Basic, Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK. The merge has been scheduled. The response body is empty; observe progress by polling the branch resource. * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
401 Unauthorized -
403 Forbidden * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
409 Conflict * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
422 Unprocessable entity * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

branch_show

Branch branch_show(project_id, name, x_phrase_app_otp=x_phrase_app_otp)

Get a single branch

Get details on a single branch for a given project. Requires the Branching feature to be enabled on the account.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.BranchesApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    name = 'name_example' # str | name (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)

    try:
        # Get a single branch
        api_response = api_instance.branch_show(project_id, name, x_phrase_app_otp=x_phrase_app_otp)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling BranchesApi->branch_show: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
name str name
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]

Return type

Branch

Authorization

Basic, Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
401 Unauthorized -
403 Forbidden * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

branch_sync

branch_sync(project_id, name, branch_sync_parameters, x_phrase_app_otp=x_phrase_app_otp)

Sync a branch

Pull changes from the base branch into this branch, applying the chosen conflict-resolution strategy. The sync runs asynchronously. The branch transitions to syncing_branch and settles back into success (or merge_conflict / branch_error) once the background job completes; the response body for this request is empty. Poll the branch resource to observe the final state. Only branches created with the newer branching system can be synced. Requests against branches from the older system, or against branches whose current state does not allow a sync, are rejected with 422 Unprocessable Entity and an empty body. Requires the Branching feature to be enabled on the account.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.BranchesApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    name = 'name_example' # str | name (required)
    branch_sync_parameters = phrase_api.BranchSyncParameters() # BranchSyncParameters |  (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)

    try:
        # Sync a branch
        api_instance.branch_sync(project_id, name, branch_sync_parameters, x_phrase_app_otp=x_phrase_app_otp)
    except ApiException as e:
        print("Exception when calling BranchesApi->branch_sync: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
name str name
branch_sync_parameters BranchSyncParameters
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]

Return type

void (empty response body)

Authorization

Basic, Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK. The sync has been scheduled. The response body is empty; observe progress by polling the branch resource. * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
401 Unauthorized -
403 Forbidden * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
422 Unprocessable entity * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

branch_update

Branch branch_update(project_id, name, branch_update_parameters, x_phrase_app_otp=x_phrase_app_otp)

Update a branch

Update an existing branch. Only the branch name can be changed. Requires the Branching feature to be enabled on the account.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.BranchesApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    name = 'name_example' # str | name (required)
    branch_update_parameters = phrase_api.BranchUpdateParameters() # BranchUpdateParameters |  (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)

    try:
        # Update a branch
        api_response = api_instance.branch_update(project_id, name, branch_update_parameters, x_phrase_app_otp=x_phrase_app_otp)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling BranchesApi->branch_update: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
name str name
branch_update_parameters BranchUpdateParameters
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]

Return type

Branch

Authorization

Basic, Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
401 Unauthorized -
403 Forbidden * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
422 Unprocessable entity * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

branches_list

List[Branch] branches_list(project_id, x_phrase_app_otp=x_phrase_app_otp, page=page, per_page=per_page)

List branches

List all branches of the current project. Requires the Branching feature to be enabled on the account.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.BranchesApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)
    page = 1 # int | Page number
    per_page = 25 # int | Limit on the number of objects to be returned, between 1 and 100. 25 by default

    try:
        # List branches
        api_response = api_instance.branches_list(project_id, x_phrase_app_otp=x_phrase_app_otp, page=page, per_page=per_page)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling BranchesApi->branches_list: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]
page int Page number [optional]
per_page int Limit on the number of objects to be returned, between 1 and 100. 25 by default [optional]

Return type

List[Branch]

Authorization

Basic, Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
* Link -
* Pagination -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
401 Unauthorized -
403 Forbidden * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]