phrase 1.0.8 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -3
- data/docs/BranchName.md +17 -0
- data/docs/Invitation.md +9 -1
- data/docs/InvitationCreateParameters.md +4 -0
- data/docs/InvitationUpdateParameters.md +4 -0
- data/docs/InvitationUpdateSettingsParameters.md +19 -0
- data/docs/InvitationsApi.md +66 -0
- data/docs/Job.md +5 -3
- data/docs/JobDetails.md +4 -2
- data/docs/JobLocale.md +3 -1
- data/docs/LocalesApi.md +2 -0
- data/docs/Member.md +7 -1
- data/docs/MemberProjectDetail.md +35 -0
- data/docs/MemberProjectDetailProjectRoles.md +19 -0
- data/docs/MemberSpaces.md +25 -0
- data/docs/MemberUpdateParameters.md +4 -0
- data/docs/MemberUpdateSettingsParameters.md +19 -0
- data/docs/MembersApi.md +66 -0
- data/docs/ProjectUpdateParameters.md +43 -9
- data/docs/Variable.md +23 -0
- data/docs/VariableCreateParameters.md +19 -0
- data/docs/VariableUpdateParameters.md +19 -0
- data/docs/VariablesApi.md +331 -0
- data/docs/Webhook.md +2 -0
- data/docs/WebhookCreateParameters.md +3 -1
- data/docs/WebhookUpdateParameters.md +3 -1
- data/lib/phrase.rb +10 -0
- data/lib/phrase/api/invitations_api.rb +80 -0
- data/lib/phrase/api/locales_api.rb +3 -0
- data/lib/phrase/api/members_api.rb +80 -0
- data/lib/phrase/api/variables_api.rb +378 -0
- data/lib/phrase/models/branch_name.rb +194 -0
- data/lib/phrase/models/invitation.rb +48 -4
- data/lib/phrase/models/invitation_create_parameters.rb +25 -1
- data/lib/phrase/models/invitation_update_parameters.rb +25 -1
- data/lib/phrase/models/invitation_update_settings_parameters.rb +207 -0
- data/lib/phrase/models/job.rb +22 -13
- data/lib/phrase/models/job_details.rb +19 -10
- data/lib/phrase/models/job_locale.rb +13 -4
- data/lib/phrase/models/member.rb +35 -4
- data/lib/phrase/models/member_project_detail.rb +285 -0
- data/lib/phrase/models/member_project_detail_project_roles.rb +203 -0
- data/lib/phrase/models/member_spaces.rb +230 -0
- data/lib/phrase/models/member_update_parameters.rb +25 -1
- data/lib/phrase/models/member_update_settings_parameters.rb +207 -0
- data/lib/phrase/models/project_update_parameters.rb +183 -13
- data/lib/phrase/models/variable.rb +221 -0
- data/lib/phrase/models/variable_create_parameters.rb +205 -0
- data/lib/phrase/models/variable_update_parameters.rb +205 -0
- data/lib/phrase/models/webhook.rb +10 -1
- data/lib/phrase/models/webhook_create_parameters.rb +14 -4
- data/lib/phrase/models/webhook_update_parameters.rb +14 -4
- data/lib/phrase/version.rb +1 -1
- data/spec/api/invitations_api_spec.rb +15 -0
- data/spec/api/locales_api_spec.rb +1 -0
- data/spec/api/members_api_spec.rb +15 -0
- data/spec/api/variables_api_spec.rb +95 -0
- data/spec/models/branch_name_spec.rb +29 -0
- data/spec/models/invitation_create_parameters_spec.rb +12 -0
- data/spec/models/invitation_spec.rb +24 -0
- data/spec/models/invitation_update_parameters_spec.rb +12 -0
- data/spec/models/invitation_update_settings_parameters_spec.rb +35 -0
- data/spec/models/job_details_spec.rb +9 -3
- data/spec/models/job_locale_spec.rb +6 -0
- data/spec/models/job_spec.rb +9 -3
- data/spec/models/member_project_detail_project_roles_spec.rb +35 -0
- data/spec/models/member_project_detail_spec.rb +83 -0
- data/spec/models/member_spaces_spec.rb +53 -0
- data/spec/models/member_spec.rb +18 -0
- data/spec/models/member_update_parameters_spec.rb +12 -0
- data/spec/models/member_update_settings_parameters_spec.rb +35 -0
- data/spec/models/project_update_parameters_spec.rb +103 -1
- data/spec/models/variable_create_parameters_spec.rb +35 -0
- data/spec/models/variable_spec.rb +47 -0
- data/spec/models/variable_update_parameters_spec.rb +35 -0
- data/spec/models/webhook_create_parameters_spec.rb +6 -0
- data/spec/models/webhook_spec.rb +6 -0
- data/spec/models/webhook_update_parameters_spec.rb +6 -0
- metadata +205 -165
data/docs/Webhook.md
CHANGED
@@ -9,6 +9,7 @@ Name | Type | Description | Notes
|
|
9
9
|
**description** | **String** | | [optional]
|
10
10
|
**events** | **Array<String>** | | [optional]
|
11
11
|
**active** | **Boolean** | | [optional]
|
12
|
+
**include_branches** | **Boolean** | | [optional]
|
12
13
|
**created_at** | **DateTime** | | [optional]
|
13
14
|
**updated_at** | **DateTime** | | [optional]
|
14
15
|
|
@@ -22,6 +23,7 @@ instance = Phrase::Webhook.new(id: null,
|
|
22
23
|
description: null,
|
23
24
|
events: null,
|
24
25
|
active: null,
|
26
|
+
include_branches: null,
|
25
27
|
created_at: null,
|
26
28
|
updated_at: null)
|
27
29
|
```
|
@@ -9,6 +9,7 @@ Name | Type | Description | Notes
|
|
9
9
|
**description** | **String** | Webhook description | [optional]
|
10
10
|
**events** | **String** | List of event names to trigger the webhook (separated by comma) | [optional]
|
11
11
|
**active** | **Boolean** | Whether webhook is active or inactive | [optional]
|
12
|
+
**include_branches** | **Boolean** | If enabled, webhook will also be triggered for events from branches of the project specified. | [optional]
|
12
13
|
|
13
14
|
## Code Sample
|
14
15
|
|
@@ -19,7 +20,8 @@ instance = Phrase::WebhookCreateParameters.new(callback_url: http://example.com/
|
|
19
20
|
secret: secr3t,
|
20
21
|
description: My webhook for chat notifications,
|
21
22
|
events: locales:create,translations:update,
|
22
|
-
active: null
|
23
|
+
active: null,
|
24
|
+
include_branches: null)
|
23
25
|
```
|
24
26
|
|
25
27
|
|
@@ -9,6 +9,7 @@ Name | Type | Description | Notes
|
|
9
9
|
**description** | **String** | Webhook description | [optional]
|
10
10
|
**events** | **String** | List of event names to trigger the webhook (separated by comma) | [optional]
|
11
11
|
**active** | **Boolean** | Whether webhook is active or inactive | [optional]
|
12
|
+
**include_branches** | **Boolean** | If enabled, webhook will also be triggered for events from branches of the project specified. | [optional]
|
12
13
|
|
13
14
|
## Code Sample
|
14
15
|
|
@@ -19,7 +20,8 @@ instance = Phrase::WebhookUpdateParameters.new(callback_url: http://example.com/
|
|
19
20
|
secret: secr3t,
|
20
21
|
description: My webhook for chat notifications,
|
21
22
|
events: locales:create,translations:update,
|
22
|
-
active: null
|
23
|
+
active: null,
|
24
|
+
include_branches: null)
|
23
25
|
```
|
24
26
|
|
25
27
|
|
data/lib/phrase.rb
CHANGED
@@ -28,6 +28,7 @@ require 'phrase/models/blacklisted_key_update_parameters'
|
|
28
28
|
require 'phrase/models/branch'
|
29
29
|
require 'phrase/models/branch_create_parameters'
|
30
30
|
require 'phrase/models/branch_merge_parameters'
|
31
|
+
require 'phrase/models/branch_name'
|
31
32
|
require 'phrase/models/branch_update_parameters'
|
32
33
|
require 'phrase/models/comment'
|
33
34
|
require 'phrase/models/comment_create_parameters'
|
@@ -60,6 +61,7 @@ require 'phrase/models/inline_response422_errors'
|
|
60
61
|
require 'phrase/models/invitation'
|
61
62
|
require 'phrase/models/invitation_create_parameters'
|
62
63
|
require 'phrase/models/invitation_update_parameters'
|
64
|
+
require 'phrase/models/invitation_update_settings_parameters'
|
63
65
|
require 'phrase/models/job'
|
64
66
|
require 'phrase/models/job_complete_parameters'
|
65
67
|
require 'phrase/models/job_create_parameters'
|
@@ -89,7 +91,11 @@ require 'phrase/models/locale_preview'
|
|
89
91
|
require 'phrase/models/locale_statistics'
|
90
92
|
require 'phrase/models/locale_update_parameters'
|
91
93
|
require 'phrase/models/member'
|
94
|
+
require 'phrase/models/member_project_detail'
|
95
|
+
require 'phrase/models/member_project_detail_project_roles'
|
96
|
+
require 'phrase/models/member_spaces'
|
92
97
|
require 'phrase/models/member_update_parameters'
|
98
|
+
require 'phrase/models/member_update_settings_parameters'
|
93
99
|
require 'phrase/models/order_confirm_parameters'
|
94
100
|
require 'phrase/models/order_create_parameters'
|
95
101
|
require 'phrase/models/project'
|
@@ -161,6 +167,9 @@ require 'phrase/models/upload_create_parameters'
|
|
161
167
|
require 'phrase/models/upload_summary'
|
162
168
|
require 'phrase/models/user'
|
163
169
|
require 'phrase/models/user_preview'
|
170
|
+
require 'phrase/models/variable'
|
171
|
+
require 'phrase/models/variable_create_parameters'
|
172
|
+
require 'phrase/models/variable_update_parameters'
|
164
173
|
require 'phrase/models/webhook'
|
165
174
|
require 'phrase/models/webhook_create_parameters'
|
166
175
|
require 'phrase/models/webhook_update_parameters'
|
@@ -198,6 +207,7 @@ require 'phrase/api/teams_api'
|
|
198
207
|
require 'phrase/api/translations_api'
|
199
208
|
require 'phrase/api/uploads_api'
|
200
209
|
require 'phrase/api/users_api'
|
210
|
+
require 'phrase/api/variables_api'
|
201
211
|
require 'phrase/api/versions_history_api'
|
202
212
|
require 'phrase/api/webhooks_api'
|
203
213
|
|
@@ -375,6 +375,86 @@ module Phrase
|
|
375
375
|
return response, status_code, headers
|
376
376
|
end
|
377
377
|
|
378
|
+
# Update a member's invitation access
|
379
|
+
# Update member's settings in the invitations. Access token scope must include <code>team.manage</code>.
|
380
|
+
# @param project_id [String] Project ID
|
381
|
+
# @param id [String] ID
|
382
|
+
# @param invitation_update_settings_parameters [InvitationUpdateSettingsParameters]
|
383
|
+
# @param [Hash] opts the optional parameters
|
384
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
385
|
+
# @return [Invitation]
|
386
|
+
def invitation_update_settings(project_id, id, invitation_update_settings_parameters, opts = {})
|
387
|
+
data, _status_code, _headers = invitation_update_settings_with_http_info(project_id, id, invitation_update_settings_parameters, opts)
|
388
|
+
data
|
389
|
+
end
|
390
|
+
|
391
|
+
# Update a member's invitation access
|
392
|
+
# Update member's settings in the invitations. Access token scope must include <code>team.manage</code>.
|
393
|
+
# @param project_id [String] Project ID
|
394
|
+
# @param id [String] ID
|
395
|
+
# @param invitation_update_settings_parameters [InvitationUpdateSettingsParameters]
|
396
|
+
# @param [Hash] opts the optional parameters
|
397
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
398
|
+
# @return [Array<(Response<(Invitation)>, Integer, Hash)>] Response<(Invitation)> data, response status code and response headers
|
399
|
+
def invitation_update_settings_with_http_info(project_id, id, invitation_update_settings_parameters, opts = {})
|
400
|
+
if @api_client.config.debugging
|
401
|
+
@api_client.config.logger.debug 'Calling API: InvitationsApi.invitation_update_settings ...'
|
402
|
+
end
|
403
|
+
# verify the required parameter 'project_id' is set
|
404
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
405
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling InvitationsApi.invitation_update_settings"
|
406
|
+
end
|
407
|
+
# verify the required parameter 'id' is set
|
408
|
+
if @api_client.config.client_side_validation && id.nil?
|
409
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling InvitationsApi.invitation_update_settings"
|
410
|
+
end
|
411
|
+
# verify the required parameter 'invitation_update_settings_parameters' is set
|
412
|
+
if @api_client.config.client_side_validation && invitation_update_settings_parameters.nil?
|
413
|
+
fail ArgumentError, "Missing the required parameter 'invitation_update_settings_parameters' when calling InvitationsApi.invitation_update_settings"
|
414
|
+
end
|
415
|
+
# resource path
|
416
|
+
local_var_path = '/projects/{project_id}/invitations/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
417
|
+
|
418
|
+
# query parameters
|
419
|
+
query_params = opts[:query_params] || {}
|
420
|
+
|
421
|
+
# header parameters
|
422
|
+
header_params = opts[:header_params] || {}
|
423
|
+
# HTTP header 'Accept' (if needed)
|
424
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
425
|
+
# HTTP header 'Content-Type'
|
426
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
427
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
428
|
+
|
429
|
+
# form parameters
|
430
|
+
form_params = opts[:form_params] || {}
|
431
|
+
|
432
|
+
# http body (model)
|
433
|
+
post_body = opts[:body] || @api_client.object_to_http_body(invitation_update_settings_parameters)
|
434
|
+
|
435
|
+
# return_type
|
436
|
+
return_type = opts[:return_type] || 'Invitation'
|
437
|
+
|
438
|
+
# auth_names
|
439
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
440
|
+
|
441
|
+
new_options = opts.merge(
|
442
|
+
:header_params => header_params,
|
443
|
+
:query_params => query_params,
|
444
|
+
:form_params => form_params,
|
445
|
+
:body => post_body,
|
446
|
+
:auth_names => auth_names,
|
447
|
+
:return_type => return_type
|
448
|
+
)
|
449
|
+
|
450
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
451
|
+
if @api_client.config.debugging
|
452
|
+
@api_client.config.logger.debug "API called: InvitationsApi#invitation_update_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
453
|
+
end
|
454
|
+
response = ::Phrase::Response.new(data, headers)
|
455
|
+
return response, status_code, headers
|
456
|
+
end
|
457
|
+
|
378
458
|
# List invitations
|
379
459
|
# List invitations for an account. It will also list the accessible resources like projects and locales the invited user has access to. In case nothing is shown the default access from the role is used. Access token scope must include <code>team.manage</code>.
|
380
460
|
# @param account_id [String] Account ID
|
@@ -165,6 +165,7 @@ module Phrase
|
|
165
165
|
# @option opts [String] :tags Limit results to keys tagged with a list of comma separated tag names.
|
166
166
|
# @option opts [String] :tag Limit download to tagged keys. This parameter is deprecated. Please use the \"tags\" parameter instead
|
167
167
|
# @option opts [Boolean] :include_empty_translations Indicates whether keys without translations should be included in the output as well.
|
168
|
+
# @option opts [Boolean] :exclude_empty_zero_forms Indicates whether zero forms should be included when empty in pluralized keys.
|
168
169
|
# @option opts [Boolean] :include_translated_keys Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys.
|
169
170
|
# @option opts [Boolean] :keep_notranslate_tags Indicates whether [NOTRANSLATE] tags should be kept.
|
170
171
|
# @option opts [Boolean] :convert_emoji This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively.
|
@@ -191,6 +192,7 @@ module Phrase
|
|
191
192
|
# @option opts [String] :tags Limit results to keys tagged with a list of comma separated tag names.
|
192
193
|
# @option opts [String] :tag Limit download to tagged keys. This parameter is deprecated. Please use the \"tags\" parameter instead
|
193
194
|
# @option opts [Boolean] :include_empty_translations Indicates whether keys without translations should be included in the output as well.
|
195
|
+
# @option opts [Boolean] :exclude_empty_zero_forms Indicates whether zero forms should be included when empty in pluralized keys.
|
194
196
|
# @option opts [Boolean] :include_translated_keys Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys.
|
195
197
|
# @option opts [Boolean] :keep_notranslate_tags Indicates whether [NOTRANSLATE] tags should be kept.
|
196
198
|
# @option opts [Boolean] :convert_emoji This option is obsolete. Projects that were created on or after Nov 29th 2019 or that did not contain emoji by then will not require this flag any longer since emoji are now supported natively.
|
@@ -223,6 +225,7 @@ module Phrase
|
|
223
225
|
query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?
|
224
226
|
query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?
|
225
227
|
query_params[:'include_empty_translations'] = opts[:'include_empty_translations'] if !opts[:'include_empty_translations'].nil?
|
228
|
+
query_params[:'exclude_empty_zero_forms'] = opts[:'exclude_empty_zero_forms'] if !opts[:'exclude_empty_zero_forms'].nil?
|
226
229
|
query_params[:'include_translated_keys'] = opts[:'include_translated_keys'] if !opts[:'include_translated_keys'].nil?
|
227
230
|
query_params[:'keep_notranslate_tags'] = opts[:'keep_notranslate_tags'] if !opts[:'keep_notranslate_tags'].nil?
|
228
231
|
query_params[:'convert_emoji'] = opts[:'convert_emoji'] if !opts[:'convert_emoji'].nil?
|
@@ -229,6 +229,86 @@ module Phrase
|
|
229
229
|
return response, status_code, headers
|
230
230
|
end
|
231
231
|
|
232
|
+
# Update a member's project settings
|
233
|
+
# Update user settings in the project. Access token scope must include <code>team.manage</code>.
|
234
|
+
# @param project_id [String] Project ID
|
235
|
+
# @param id [String] ID
|
236
|
+
# @param member_update_settings_parameters [MemberUpdateSettingsParameters]
|
237
|
+
# @param [Hash] opts the optional parameters
|
238
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
239
|
+
# @return [MemberProjectDetail]
|
240
|
+
def member_update_settings(project_id, id, member_update_settings_parameters, opts = {})
|
241
|
+
data, _status_code, _headers = member_update_settings_with_http_info(project_id, id, member_update_settings_parameters, opts)
|
242
|
+
data
|
243
|
+
end
|
244
|
+
|
245
|
+
# Update a member's project settings
|
246
|
+
# Update user settings in the project. Access token scope must include <code>team.manage</code>.
|
247
|
+
# @param project_id [String] Project ID
|
248
|
+
# @param id [String] ID
|
249
|
+
# @param member_update_settings_parameters [MemberUpdateSettingsParameters]
|
250
|
+
# @param [Hash] opts the optional parameters
|
251
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
252
|
+
# @return [Array<(Response<(MemberProjectDetail)>, Integer, Hash)>] Response<(MemberProjectDetail)> data, response status code and response headers
|
253
|
+
def member_update_settings_with_http_info(project_id, id, member_update_settings_parameters, opts = {})
|
254
|
+
if @api_client.config.debugging
|
255
|
+
@api_client.config.logger.debug 'Calling API: MembersApi.member_update_settings ...'
|
256
|
+
end
|
257
|
+
# verify the required parameter 'project_id' is set
|
258
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
259
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling MembersApi.member_update_settings"
|
260
|
+
end
|
261
|
+
# verify the required parameter 'id' is set
|
262
|
+
if @api_client.config.client_side_validation && id.nil?
|
263
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling MembersApi.member_update_settings"
|
264
|
+
end
|
265
|
+
# verify the required parameter 'member_update_settings_parameters' is set
|
266
|
+
if @api_client.config.client_side_validation && member_update_settings_parameters.nil?
|
267
|
+
fail ArgumentError, "Missing the required parameter 'member_update_settings_parameters' when calling MembersApi.member_update_settings"
|
268
|
+
end
|
269
|
+
# resource path
|
270
|
+
local_var_path = '/projects/{project_id}/members/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
271
|
+
|
272
|
+
# query parameters
|
273
|
+
query_params = opts[:query_params] || {}
|
274
|
+
|
275
|
+
# header parameters
|
276
|
+
header_params = opts[:header_params] || {}
|
277
|
+
# HTTP header 'Accept' (if needed)
|
278
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
279
|
+
# HTTP header 'Content-Type'
|
280
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
281
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
282
|
+
|
283
|
+
# form parameters
|
284
|
+
form_params = opts[:form_params] || {}
|
285
|
+
|
286
|
+
# http body (model)
|
287
|
+
post_body = opts[:body] || @api_client.object_to_http_body(member_update_settings_parameters)
|
288
|
+
|
289
|
+
# return_type
|
290
|
+
return_type = opts[:return_type] || 'MemberProjectDetail'
|
291
|
+
|
292
|
+
# auth_names
|
293
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
294
|
+
|
295
|
+
new_options = opts.merge(
|
296
|
+
:header_params => header_params,
|
297
|
+
:query_params => query_params,
|
298
|
+
:form_params => form_params,
|
299
|
+
:body => post_body,
|
300
|
+
:auth_names => auth_names,
|
301
|
+
:return_type => return_type
|
302
|
+
)
|
303
|
+
|
304
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
305
|
+
if @api_client.config.debugging
|
306
|
+
@api_client.config.logger.debug "API called: MembersApi#member_update_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
307
|
+
end
|
308
|
+
response = ::Phrase::Response.new(data, headers)
|
309
|
+
return response, status_code, headers
|
310
|
+
end
|
311
|
+
|
232
312
|
# List members
|
233
313
|
# Get all users active in the account. It also lists resources like projects and locales the member has access to. In case nothing is shown the default access from the role is used. Access token scope must include <code>team.manage</code>.
|
234
314
|
# @param account_id [String] Account ID
|
@@ -0,0 +1,378 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class VariablesApi
|
5
|
+
attr_accessor :api_client
|
6
|
+
|
7
|
+
def initialize(api_client = ApiClient.default)
|
8
|
+
@api_client = api_client
|
9
|
+
end
|
10
|
+
# Create a variable
|
11
|
+
# Create a new variable.
|
12
|
+
# @param project_id [String] Project ID
|
13
|
+
# @param variable_create_parameters [VariableCreateParameters]
|
14
|
+
# @param [Hash] opts the optional parameters
|
15
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
16
|
+
# @return [Variable]
|
17
|
+
def variable_create(project_id, variable_create_parameters, opts = {})
|
18
|
+
data, _status_code, _headers = variable_create_with_http_info(project_id, variable_create_parameters, opts)
|
19
|
+
data
|
20
|
+
end
|
21
|
+
|
22
|
+
# Create a variable
|
23
|
+
# Create a new variable.
|
24
|
+
# @param project_id [String] Project ID
|
25
|
+
# @param variable_create_parameters [VariableCreateParameters]
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
28
|
+
# @return [Array<(Response<(Variable)>, Integer, Hash)>] Response<(Variable)> data, response status code and response headers
|
29
|
+
def variable_create_with_http_info(project_id, variable_create_parameters, opts = {})
|
30
|
+
if @api_client.config.debugging
|
31
|
+
@api_client.config.logger.debug 'Calling API: VariablesApi.variable_create ...'
|
32
|
+
end
|
33
|
+
# verify the required parameter 'project_id' is set
|
34
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
35
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling VariablesApi.variable_create"
|
36
|
+
end
|
37
|
+
# verify the required parameter 'variable_create_parameters' is set
|
38
|
+
if @api_client.config.client_side_validation && variable_create_parameters.nil?
|
39
|
+
fail ArgumentError, "Missing the required parameter 'variable_create_parameters' when calling VariablesApi.variable_create"
|
40
|
+
end
|
41
|
+
# resource path
|
42
|
+
local_var_path = '/projects/{project_id}/variables'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
|
43
|
+
|
44
|
+
# query parameters
|
45
|
+
query_params = opts[:query_params] || {}
|
46
|
+
|
47
|
+
# header parameters
|
48
|
+
header_params = opts[:header_params] || {}
|
49
|
+
# HTTP header 'Accept' (if needed)
|
50
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
51
|
+
# HTTP header 'Content-Type'
|
52
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
53
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
54
|
+
|
55
|
+
# form parameters
|
56
|
+
form_params = opts[:form_params] || {}
|
57
|
+
|
58
|
+
# http body (model)
|
59
|
+
post_body = opts[:body] || @api_client.object_to_http_body(variable_create_parameters)
|
60
|
+
|
61
|
+
# return_type
|
62
|
+
return_type = opts[:return_type] || 'Variable'
|
63
|
+
|
64
|
+
# auth_names
|
65
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
66
|
+
|
67
|
+
new_options = opts.merge(
|
68
|
+
:header_params => header_params,
|
69
|
+
:query_params => query_params,
|
70
|
+
:form_params => form_params,
|
71
|
+
:body => post_body,
|
72
|
+
:auth_names => auth_names,
|
73
|
+
:return_type => return_type
|
74
|
+
)
|
75
|
+
|
76
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
77
|
+
if @api_client.config.debugging
|
78
|
+
@api_client.config.logger.debug "API called: VariablesApi#variable_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
79
|
+
end
|
80
|
+
response = ::Phrase::Response.new(data, headers)
|
81
|
+
return response, status_code, headers
|
82
|
+
end
|
83
|
+
|
84
|
+
# Delete a variable
|
85
|
+
# Delete an existing variable.
|
86
|
+
# @param project_id [String] Project ID
|
87
|
+
# @param name [String] name
|
88
|
+
# @param [Hash] opts the optional parameters
|
89
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
90
|
+
# @return [nil]
|
91
|
+
def variable_delete(project_id, name, opts = {})
|
92
|
+
data, _status_code, _headers = variable_delete_with_http_info(project_id, name, opts)
|
93
|
+
data
|
94
|
+
end
|
95
|
+
|
96
|
+
# Delete a variable
|
97
|
+
# Delete an existing variable.
|
98
|
+
# @param project_id [String] Project ID
|
99
|
+
# @param name [String] name
|
100
|
+
# @param [Hash] opts the optional parameters
|
101
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
102
|
+
# @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
|
103
|
+
def variable_delete_with_http_info(project_id, name, opts = {})
|
104
|
+
if @api_client.config.debugging
|
105
|
+
@api_client.config.logger.debug 'Calling API: VariablesApi.variable_delete ...'
|
106
|
+
end
|
107
|
+
# verify the required parameter 'project_id' is set
|
108
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
109
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling VariablesApi.variable_delete"
|
110
|
+
end
|
111
|
+
# verify the required parameter 'name' is set
|
112
|
+
if @api_client.config.client_side_validation && name.nil?
|
113
|
+
fail ArgumentError, "Missing the required parameter 'name' when calling VariablesApi.variable_delete"
|
114
|
+
end
|
115
|
+
# resource path
|
116
|
+
local_var_path = '/projects/{project_id}/variables/{name}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s))
|
117
|
+
|
118
|
+
# query parameters
|
119
|
+
query_params = opts[:query_params] || {}
|
120
|
+
|
121
|
+
# header parameters
|
122
|
+
header_params = opts[:header_params] || {}
|
123
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
124
|
+
|
125
|
+
# form parameters
|
126
|
+
form_params = opts[:form_params] || {}
|
127
|
+
|
128
|
+
# http body (model)
|
129
|
+
post_body = opts[:body]
|
130
|
+
|
131
|
+
# return_type
|
132
|
+
return_type = opts[:return_type]
|
133
|
+
|
134
|
+
# auth_names
|
135
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
136
|
+
|
137
|
+
new_options = opts.merge(
|
138
|
+
:header_params => header_params,
|
139
|
+
:query_params => query_params,
|
140
|
+
:form_params => form_params,
|
141
|
+
:body => post_body,
|
142
|
+
:auth_names => auth_names,
|
143
|
+
:return_type => return_type
|
144
|
+
)
|
145
|
+
|
146
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
147
|
+
if @api_client.config.debugging
|
148
|
+
@api_client.config.logger.debug "API called: VariablesApi#variable_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
149
|
+
end
|
150
|
+
response = ::Phrase::Response.new(data, headers)
|
151
|
+
return response, status_code, headers
|
152
|
+
end
|
153
|
+
|
154
|
+
# Get a single variable
|
155
|
+
# Get details on a single variable for a given project.
|
156
|
+
# @param project_id [String] Project ID
|
157
|
+
# @param name [String] name
|
158
|
+
# @param [Hash] opts the optional parameters
|
159
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
160
|
+
# @return [Variable]
|
161
|
+
def variable_show(project_id, name, opts = {})
|
162
|
+
data, _status_code, _headers = variable_show_with_http_info(project_id, name, opts)
|
163
|
+
data
|
164
|
+
end
|
165
|
+
|
166
|
+
# Get a single variable
|
167
|
+
# Get details on a single variable for a given project.
|
168
|
+
# @param project_id [String] Project ID
|
169
|
+
# @param name [String] name
|
170
|
+
# @param [Hash] opts the optional parameters
|
171
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
172
|
+
# @return [Array<(Response<(Variable)>, Integer, Hash)>] Response<(Variable)> data, response status code and response headers
|
173
|
+
def variable_show_with_http_info(project_id, name, opts = {})
|
174
|
+
if @api_client.config.debugging
|
175
|
+
@api_client.config.logger.debug 'Calling API: VariablesApi.variable_show ...'
|
176
|
+
end
|
177
|
+
# verify the required parameter 'project_id' is set
|
178
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
179
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling VariablesApi.variable_show"
|
180
|
+
end
|
181
|
+
# verify the required parameter 'name' is set
|
182
|
+
if @api_client.config.client_side_validation && name.nil?
|
183
|
+
fail ArgumentError, "Missing the required parameter 'name' when calling VariablesApi.variable_show"
|
184
|
+
end
|
185
|
+
# resource path
|
186
|
+
local_var_path = '/projects/{project_id}/variables/{name}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s))
|
187
|
+
|
188
|
+
# query parameters
|
189
|
+
query_params = opts[:query_params] || {}
|
190
|
+
|
191
|
+
# header parameters
|
192
|
+
header_params = opts[:header_params] || {}
|
193
|
+
# HTTP header 'Accept' (if needed)
|
194
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
195
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
196
|
+
|
197
|
+
# form parameters
|
198
|
+
form_params = opts[:form_params] || {}
|
199
|
+
|
200
|
+
# http body (model)
|
201
|
+
post_body = opts[:body]
|
202
|
+
|
203
|
+
# return_type
|
204
|
+
return_type = opts[:return_type] || 'Variable'
|
205
|
+
|
206
|
+
# auth_names
|
207
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
208
|
+
|
209
|
+
new_options = opts.merge(
|
210
|
+
:header_params => header_params,
|
211
|
+
:query_params => query_params,
|
212
|
+
:form_params => form_params,
|
213
|
+
:body => post_body,
|
214
|
+
:auth_names => auth_names,
|
215
|
+
:return_type => return_type
|
216
|
+
)
|
217
|
+
|
218
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
219
|
+
if @api_client.config.debugging
|
220
|
+
@api_client.config.logger.debug "API called: VariablesApi#variable_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
221
|
+
end
|
222
|
+
response = ::Phrase::Response.new(data, headers)
|
223
|
+
return response, status_code, headers
|
224
|
+
end
|
225
|
+
|
226
|
+
# Update a variable
|
227
|
+
# Update an existing variable.
|
228
|
+
# @param project_id [String] Project ID
|
229
|
+
# @param name [String] name
|
230
|
+
# @param variable_update_parameters [VariableUpdateParameters]
|
231
|
+
# @param [Hash] opts the optional parameters
|
232
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
233
|
+
# @return [Variable]
|
234
|
+
def variable_update(project_id, name, variable_update_parameters, opts = {})
|
235
|
+
data, _status_code, _headers = variable_update_with_http_info(project_id, name, variable_update_parameters, opts)
|
236
|
+
data
|
237
|
+
end
|
238
|
+
|
239
|
+
# Update a variable
|
240
|
+
# Update an existing variable.
|
241
|
+
# @param project_id [String] Project ID
|
242
|
+
# @param name [String] name
|
243
|
+
# @param variable_update_parameters [VariableUpdateParameters]
|
244
|
+
# @param [Hash] opts the optional parameters
|
245
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
246
|
+
# @return [Array<(Response<(Variable)>, Integer, Hash)>] Response<(Variable)> data, response status code and response headers
|
247
|
+
def variable_update_with_http_info(project_id, name, variable_update_parameters, opts = {})
|
248
|
+
if @api_client.config.debugging
|
249
|
+
@api_client.config.logger.debug 'Calling API: VariablesApi.variable_update ...'
|
250
|
+
end
|
251
|
+
# verify the required parameter 'project_id' is set
|
252
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
253
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling VariablesApi.variable_update"
|
254
|
+
end
|
255
|
+
# verify the required parameter 'name' is set
|
256
|
+
if @api_client.config.client_side_validation && name.nil?
|
257
|
+
fail ArgumentError, "Missing the required parameter 'name' when calling VariablesApi.variable_update"
|
258
|
+
end
|
259
|
+
# verify the required parameter 'variable_update_parameters' is set
|
260
|
+
if @api_client.config.client_side_validation && variable_update_parameters.nil?
|
261
|
+
fail ArgumentError, "Missing the required parameter 'variable_update_parameters' when calling VariablesApi.variable_update"
|
262
|
+
end
|
263
|
+
# resource path
|
264
|
+
local_var_path = '/projects/{project_id}/variables/{name}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s))
|
265
|
+
|
266
|
+
# query parameters
|
267
|
+
query_params = opts[:query_params] || {}
|
268
|
+
|
269
|
+
# header parameters
|
270
|
+
header_params = opts[:header_params] || {}
|
271
|
+
# HTTP header 'Accept' (if needed)
|
272
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
273
|
+
# HTTP header 'Content-Type'
|
274
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
275
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
276
|
+
|
277
|
+
# form parameters
|
278
|
+
form_params = opts[:form_params] || {}
|
279
|
+
|
280
|
+
# http body (model)
|
281
|
+
post_body = opts[:body] || @api_client.object_to_http_body(variable_update_parameters)
|
282
|
+
|
283
|
+
# return_type
|
284
|
+
return_type = opts[:return_type] || 'Variable'
|
285
|
+
|
286
|
+
# auth_names
|
287
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
288
|
+
|
289
|
+
new_options = opts.merge(
|
290
|
+
:header_params => header_params,
|
291
|
+
:query_params => query_params,
|
292
|
+
:form_params => form_params,
|
293
|
+
:body => post_body,
|
294
|
+
:auth_names => auth_names,
|
295
|
+
:return_type => return_type
|
296
|
+
)
|
297
|
+
|
298
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
299
|
+
if @api_client.config.debugging
|
300
|
+
@api_client.config.logger.debug "API called: VariablesApi#variable_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
301
|
+
end
|
302
|
+
response = ::Phrase::Response.new(data, headers)
|
303
|
+
return response, status_code, headers
|
304
|
+
end
|
305
|
+
|
306
|
+
# List variables
|
307
|
+
# List all variables for the current project.
|
308
|
+
# @param project_id [String] Project ID
|
309
|
+
# @param [Hash] opts the optional parameters
|
310
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
311
|
+
# @option opts [Integer] :page Page number
|
312
|
+
# @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
|
313
|
+
# @return [Array<Variable>]
|
314
|
+
def variables_list(project_id, opts = {})
|
315
|
+
data, _status_code, _headers = variables_list_with_http_info(project_id, opts)
|
316
|
+
data
|
317
|
+
end
|
318
|
+
|
319
|
+
# List variables
|
320
|
+
# List all variables for the current project.
|
321
|
+
# @param project_id [String] Project ID
|
322
|
+
# @param [Hash] opts the optional parameters
|
323
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
324
|
+
# @option opts [Integer] :page Page number
|
325
|
+
# @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
|
326
|
+
# @return [Array<(Response<(Array<Variable>)>, Integer, Hash)>] Response<(Array<Variable>)> data, response status code and response headers
|
327
|
+
def variables_list_with_http_info(project_id, opts = {})
|
328
|
+
if @api_client.config.debugging
|
329
|
+
@api_client.config.logger.debug 'Calling API: VariablesApi.variables_list ...'
|
330
|
+
end
|
331
|
+
# verify the required parameter 'project_id' is set
|
332
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
333
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling VariablesApi.variables_list"
|
334
|
+
end
|
335
|
+
# resource path
|
336
|
+
local_var_path = '/projects/{project_id}/variables'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
|
337
|
+
|
338
|
+
# query parameters
|
339
|
+
query_params = opts[:query_params] || {}
|
340
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
341
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
342
|
+
|
343
|
+
# header parameters
|
344
|
+
header_params = opts[:header_params] || {}
|
345
|
+
# HTTP header 'Accept' (if needed)
|
346
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
347
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
348
|
+
|
349
|
+
# form parameters
|
350
|
+
form_params = opts[:form_params] || {}
|
351
|
+
|
352
|
+
# http body (model)
|
353
|
+
post_body = opts[:body]
|
354
|
+
|
355
|
+
# return_type
|
356
|
+
return_type = opts[:return_type] || 'Array<Variable>'
|
357
|
+
|
358
|
+
# auth_names
|
359
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
360
|
+
|
361
|
+
new_options = opts.merge(
|
362
|
+
:header_params => header_params,
|
363
|
+
:query_params => query_params,
|
364
|
+
:form_params => form_params,
|
365
|
+
:body => post_body,
|
366
|
+
:auth_names => auth_names,
|
367
|
+
:return_type => return_type
|
368
|
+
)
|
369
|
+
|
370
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
371
|
+
if @api_client.config.debugging
|
372
|
+
@api_client.config.logger.debug "API called: VariablesApi#variables_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
373
|
+
end
|
374
|
+
response = ::Phrase::Response.new(data, headers)
|
375
|
+
return response, status_code, headers
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|