Skip to content

Latest commit

 

History

History
331 lines (232 loc) · 8.57 KB

VariablesApi.md

File metadata and controls

331 lines (232 loc) · 8.57 KB

Phrase::VariablesApi

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

Method HTTP request Description
variable_create POST /projects/{project_id}/variables Create a variable
variable_delete DELETE /projects/{project_id}/variables/{name} Delete a variable
variable_show GET /projects/{project_id}/variables/{name} Get a single variable
variable_update PATCH /projects/{project_id}/variables/{name} Update a variable
variables_list GET /projects/{project_id}/variables List variables

variable_create

Variable variable_create(project_id, variable_create_parameters, opts)

Create a variable

Create a new variable.

Example

# 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::VariablesApi.new
project_id = 'project_id_example' # String | Project ID
variable_create_parameters = Phrase::VariableCreateParameters.new({name: 'MY_VARIABLE'}) # VariableCreateParameters | 
opts = {
  x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}

begin
  #Create a variable
  result = api_instance.variable_create(project_id, variable_create_parameters, opts)
  pp result
rescue Phrase::ApiError => e
  puts "Exception when calling VariablesApi->variable_create: #{e}"
end

Parameters

Name Type Description Notes
project_id String Project ID
variable_create_parameters VariableCreateParameters
x_phrase_app_otp String Two-Factor-Authentication token (optional) [optional]

Return type

Response<(Variable)>

Authorization

Basic, Token

HTTP request headers

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

variable_delete

variable_delete(project_id, name, opts)

Delete a variable

Delete an existing variable.

Example

# 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::VariablesApi.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 variable
  api_instance.variable_delete(project_id, name, opts)
rescue Phrase::ApiError => e
  puts "Exception when calling VariablesApi->variable_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, Token

HTTP request headers

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

variable_show

Variable variable_show(project_id, name, opts)

Get a single variable

Get details on a single variable for a given project.

Example

# 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::VariablesApi.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 variable
  result = api_instance.variable_show(project_id, name, opts)
  pp result
rescue Phrase::ApiError => e
  puts "Exception when calling VariablesApi->variable_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<(Variable)>

Authorization

Basic, Token

HTTP request headers

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

variable_update

Variable variable_update(project_id, name, variable_update_parameters, opts)

Update a variable

Update an existing variable.

Example

# 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::VariablesApi.new
project_id = 'project_id_example' # String | Project ID
name = 'name_example' # String | name
variable_update_parameters = Phrase::VariableUpdateParameters.new # VariableUpdateParameters | 
opts = {
  x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}

begin
  #Update a variable
  result = api_instance.variable_update(project_id, name, variable_update_parameters, opts)
  pp result
rescue Phrase::ApiError => e
  puts "Exception when calling VariablesApi->variable_update: #{e}"
end

Parameters

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

Return type

Response<(Variable)>

Authorization

Basic, Token

HTTP request headers

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

variables_list

Array<Variable> variables_list(project_id, opts)

List variables

List all variables for the current project.

Example

# 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::VariablesApi.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 variables
  result = api_instance.variables_list(project_id, opts)
  pp result
rescue Phrase::ApiError => e
  puts "Exception when calling VariablesApi->variables_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<Variable>)>

Authorization

Basic, Token

HTTP request headers

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