# Phrase::BranchesApi
All URIs are relative to *https://api.phrase.com/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**branch_compare**](BranchesApi.md#branch_compare) | **GET** /projects/{project_id}/branches/{name}/compare | Compare branches
[**branch_create**](BranchesApi.md#branch_create) | **POST** /projects/{project_id}/branches | Create a branch
[**branch_delete**](BranchesApi.md#branch_delete) | **DELETE** /projects/{project_id}/branches/{name} | Delete a branch
[**branch_merge**](BranchesApi.md#branch_merge) | **PATCH** /projects/{project_id}/branches/{name}/merge | Merge a branch
[**branch_show**](BranchesApi.md#branch_show) | **GET** /projects/{project_id}/branches/{name} | Get a single branch
[**branch_update**](BranchesApi.md#branch_update) | **PATCH** /projects/{project_id}/branches/{name} | Update a branch
[**branches_list**](BranchesApi.md#branches_list) | **GET** /projects/{project_id}/branches | List branches
## branch_compare
> branch_compare(project_id, name, opts)
Compare branches
Compare branch with main branch.
Note: Comparing a branch may take several minutes depending on the project size.
### Example
```ruby
# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
# Configure API key authorization: Token
config.api_key['Authorization'] = 'YOUR API KEY'
config.api_key_prefix['Authorization'] = 'token'
end
api_instance = Phrase::BranchesApi.new
project_id = 'project_id_example' # String | Project ID
name = 'name_example' # String | name
opts = {
x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}
begin
#Compare branches
api_instance.branch_compare(project_id, name, opts)
rescue Phrase::ApiError => e
puts "Exception when calling BranchesApi->branch_compare: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**project_id** | **String**| Project ID |
**name** | **String**| name |
**x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional]
### Return type
Response<(nil (empty response body))>
### Authorization
[Basic](../README.md#Basic), [Token](../README.md#Token)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
## branch_create
> Branch branch_create(project_id, branch_create_parameters, opts)
Create a branch
Create a new branch.
Note: Creating a new branch may take several minutes depending on the project size.
### Example
```ruby
# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
# Configure API key authorization: Token
config.api_key['Authorization'] = 'YOUR API KEY'
config.api_key_prefix['Authorization'] = 'token'
end
api_instance = Phrase::BranchesApi.new
project_id = 'project_id_example' # String | Project ID
branch_create_parameters = Phrase::BranchCreateParameters.new({name: 'my-branch'}) # BranchCreateParameters |
opts = {
x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}
begin
#Create a branch
result = api_instance.branch_create(project_id, branch_create_parameters, opts)
pp result
rescue Phrase::ApiError => e
puts "Exception when calling BranchesApi->branch_create: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**project_id** | **String**| Project ID |
**branch_create_parameters** | [**BranchCreateParameters**](BranchCreateParameters.md)| |
**x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional]
### Return type
Response<([**Branch**](Branch.md))>
### Authorization
[Basic](../README.md#Basic), [Token](../README.md#Token)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## branch_delete
> branch_delete(project_id, name, opts)
Delete a branch
Delete an existing branch.
### Example
```ruby
# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
# Configure API key authorization: Token
config.api_key['Authorization'] = 'YOUR API KEY'
config.api_key_prefix['Authorization'] = 'token'
end
api_instance = Phrase::BranchesApi.new
project_id = 'project_id_example' # String | Project ID
name = 'name_example' # String | name
opts = {
x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}
begin
#Delete a branch
api_instance.branch_delete(project_id, name, opts)
rescue Phrase::ApiError => e
puts "Exception when calling BranchesApi->branch_delete: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**project_id** | **String**| Project ID |
**name** | **String**| name |
**x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional]
### Return type
Response<(nil (empty response body))>
### Authorization
[Basic](../README.md#Basic), [Token](../README.md#Token)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
## branch_merge
> branch_merge(project_id, name, branch_merge_parameters, opts)
Merge a branch
Merge an existing branch.
Note: Merging a branch may take several minutes depending on diff size.
### Example
```ruby
# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
# Configure API key authorization: Token
config.api_key['Authorization'] = 'YOUR API KEY'
config.api_key_prefix['Authorization'] = 'token'
end
api_instance = Phrase::BranchesApi.new
project_id = 'project_id_example' # String | Project ID
name = 'name_example' # String | name
branch_merge_parameters = Phrase::BranchMergeParameters.new # BranchMergeParameters |
opts = {
x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}
begin
#Merge a branch
api_instance.branch_merge(project_id, name, branch_merge_parameters, opts)
rescue Phrase::ApiError => e
puts "Exception when calling BranchesApi->branch_merge: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**project_id** | **String**| Project ID |
**name** | **String**| name |
**branch_merge_parameters** | [**BranchMergeParameters**](BranchMergeParameters.md)| |
**x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional]
### Return type
Response<(nil (empty response body))>
### Authorization
[Basic](../README.md#Basic), [Token](../README.md#Token)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
## branch_show
> Branch branch_show(project_id, name, opts)
Get a single branch
Get details on a single branch for a given project.
### Example
```ruby
# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
# Configure API key authorization: Token
config.api_key['Authorization'] = 'YOUR API KEY'
config.api_key_prefix['Authorization'] = 'token'
end
api_instance = Phrase::BranchesApi.new
project_id = 'project_id_example' # String | Project ID
name = 'name_example' # String | name
opts = {
x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}
begin
#Get a single branch
result = api_instance.branch_show(project_id, name, opts)
pp result
rescue Phrase::ApiError => e
puts "Exception when calling BranchesApi->branch_show: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**project_id** | **String**| Project ID |
**name** | **String**| name |
**x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional]
### Return type
Response<([**Branch**](Branch.md))>
### Authorization
[Basic](../README.md#Basic), [Token](../README.md#Token)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## branch_update
> Branch branch_update(project_id, name, branch_update_parameters, opts)
Update a branch
Update an existing branch.
### Example
```ruby
# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
# Configure API key authorization: Token
config.api_key['Authorization'] = 'YOUR API KEY'
config.api_key_prefix['Authorization'] = 'token'
end
api_instance = Phrase::BranchesApi.new
project_id = 'project_id_example' # String | Project ID
name = 'name_example' # String | name
branch_update_parameters = Phrase::BranchUpdateParameters.new # BranchUpdateParameters |
opts = {
x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}
begin
#Update a branch
result = api_instance.branch_update(project_id, name, branch_update_parameters, opts)
pp result
rescue Phrase::ApiError => e
puts "Exception when calling BranchesApi->branch_update: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**project_id** | **String**| Project ID |
**name** | **String**| name |
**branch_update_parameters** | [**BranchUpdateParameters**](BranchUpdateParameters.md)| |
**x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional]
### Return type
Response<([**Branch**](Branch.md))>
### Authorization
[Basic](../README.md#Basic), [Token](../README.md#Token)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## branches_list
> Array<Branch> branches_list(project_id, opts)
List branches
List all branches the of the current project.
### Example
```ruby
# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
# Configure API key authorization: Token
config.api_key['Authorization'] = 'YOUR API KEY'
config.api_key_prefix['Authorization'] = 'token'
end
api_instance = Phrase::BranchesApi.new
project_id = 'project_id_example' # String | Project ID
opts = {
x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional)
page: 1, # Integer | Page number
per_page: 25 # Integer | Limit on the number of objects to be returned, between 1 and 100. 25 by default
}
begin
#List branches
result = api_instance.branches_list(project_id, opts)
pp result
rescue Phrase::ApiError => e
puts "Exception when calling BranchesApi->branches_list: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**project_id** | **String**| Project ID |
**x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional]
**page** | **Integer**| Page number | [optional]
**per_page** | **Integer**| Limit on the number of objects to be returned, between 1 and 100. 25 by default | [optional]
### Return type
Response<([**Array<Branch>**](Branch.md))>
### Authorization
[Basic](../README.md#Basic), [Token](../README.md#Token)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json