phrase 1.0.14 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -9
  3. data/docs/Account.md +3 -1
  4. data/docs/AccountDetails.md +5 -1
  5. data/docs/AccountDetails1.md +3 -1
  6. data/docs/AccountSearchResult.md +29 -0
  7. data/docs/Branch.md +5 -1
  8. data/docs/Comment.md +3 -1
  9. data/docs/CurrentUser.md +31 -0
  10. data/docs/JobCreateParameters.md +2 -0
  11. data/docs/JobDetails.md +2 -0
  12. data/docs/JobDetails1.md +2 -0
  13. data/docs/JobLocale.md +5 -1
  14. data/docs/JobTemplate.md +29 -0
  15. data/docs/JobTemplateCreateParameters.md +21 -0
  16. data/docs/JobTemplateLocale.md +23 -0
  17. data/docs/JobTemplateLocaleUpdateParameters.md +23 -0
  18. data/docs/JobTemplateLocalesApi.md +347 -0
  19. data/docs/JobTemplateLocalesCreateParameters.md +23 -0
  20. data/docs/JobTemplatePreview.md +19 -0
  21. data/docs/JobTemplateUpdateParameters.md +21 -0
  22. data/docs/JobTemplateUserPreview.md +23 -0
  23. data/docs/JobTemplatesApi.md +337 -0
  24. data/docs/KeysApi.md +137 -9
  25. data/docs/KeysExcludeParameters.md +23 -0
  26. data/docs/KeysIncludeParameters.md +23 -0
  27. data/docs/KeysSearchParameters.md +1 -1
  28. data/docs/KeysTagParameters.md +1 -1
  29. data/docs/KeysUntagParameters.md +1 -1
  30. data/docs/LocalePreview1.md +23 -0
  31. data/docs/LocalesApi.md +78 -7
  32. data/docs/MemberSpaces.md +2 -2
  33. data/docs/MemberUpdateParameters.md +4 -2
  34. data/docs/Notification.md +41 -0
  35. data/docs/NotificationGroup.md +23 -0
  36. data/docs/NotificationGroupDetail.md +27 -0
  37. data/docs/NotificationGroupsApi.md +194 -0
  38. data/docs/NotificationsApi.md +194 -0
  39. data/docs/OrderCreateParameters.md +2 -0
  40. data/docs/Project.md +2 -0
  41. data/docs/ProjectCreateParameters.md +35 -1
  42. data/docs/ProjectDetails.md +2 -0
  43. data/docs/ProjectsApi.md +7 -1
  44. data/docs/SearchApi.md +72 -0
  45. data/docs/SearchInAccountParameters.md +23 -0
  46. data/docs/Space1.md +25 -0
  47. data/docs/Subscription.md +19 -0
  48. data/docs/TranslationOrder.md +2 -0
  49. data/docs/TranslationsApi.md +25 -25
  50. data/docs/User.md +0 -2
  51. data/docs/UsersApi.md +2 -2
  52. data/lib/phrase.rb +24 -0
  53. data/lib/phrase/api/job_template_locales_api.rb +417 -0
  54. data/lib/phrase/api/job_templates_api.rb +387 -0
  55. data/lib/phrase/api/keys_api.rb +158 -10
  56. data/lib/phrase/api/locales_api.rb +85 -5
  57. data/lib/phrase/api/notification_groups_api.rb +202 -0
  58. data/lib/phrase/api/notifications_api.rb +202 -0
  59. data/lib/phrase/api/projects_api.rb +9 -0
  60. data/lib/phrase/api/search_api.rb +84 -0
  61. data/lib/phrase/api/translations_api.rb +35 -35
  62. data/lib/phrase/api/users_api.rb +3 -3
  63. data/lib/phrase/models/account.rb +13 -4
  64. data/lib/phrase/models/account_details.rb +22 -4
  65. data/lib/phrase/models/account_details1.rb +10 -1
  66. data/lib/phrase/models/account_search_result.rb +250 -0
  67. data/lib/phrase/models/branch.rb +19 -1
  68. data/lib/phrase/models/comment.rb +15 -4
  69. data/lib/phrase/models/current_user.rb +257 -0
  70. data/lib/phrase/models/job_create_parameters.rb +11 -1
  71. data/lib/phrase/models/job_details.rb +10 -1
  72. data/lib/phrase/models/job_details1.rb +10 -1
  73. data/lib/phrase/models/job_locale.rb +22 -4
  74. data/lib/phrase/models/job_template.rb +248 -0
  75. data/lib/phrase/models/job_template_create_parameters.rb +220 -0
  76. data/lib/phrase/models/job_template_locale.rb +223 -0
  77. data/lib/phrase/models/job_template_locale_update_parameters.rb +234 -0
  78. data/lib/phrase/models/job_template_locales_create_parameters.rb +234 -0
  79. data/lib/phrase/models/job_template_preview.rb +203 -0
  80. data/lib/phrase/models/job_template_update_parameters.rb +220 -0
  81. data/lib/phrase/models/job_template_user_preview.rb +221 -0
  82. data/lib/phrase/models/keys_exclude_parameters.rb +225 -0
  83. data/lib/phrase/models/keys_include_parameters.rb +225 -0
  84. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  85. data/lib/phrase/models/keys_tag_parameters.rb +1 -1
  86. data/lib/phrase/models/keys_untag_parameters.rb +1 -1
  87. data/lib/phrase/models/locale_preview1.rb +221 -0
  88. data/lib/phrase/models/member_spaces.rb +2 -2
  89. data/lib/phrase/models/member_update_parameters.rb +12 -2
  90. data/lib/phrase/models/notification.rb +302 -0
  91. data/lib/phrase/models/notification_group.rb +221 -0
  92. data/lib/phrase/models/notification_group_detail.rb +239 -0
  93. data/lib/phrase/models/order_create_parameters.rb +11 -1
  94. data/lib/phrase/models/project.rb +10 -1
  95. data/lib/phrase/models/project_create_parameters.rb +174 -4
  96. data/lib/phrase/models/project_details.rb +10 -1
  97. data/lib/phrase/models/search_in_account_parameters.rb +225 -0
  98. data/lib/phrase/models/space1.rb +230 -0
  99. data/lib/phrase/models/subscription.rb +203 -0
  100. data/lib/phrase/models/translation_order.rb +10 -1
  101. data/lib/phrase/models/user.rb +1 -10
  102. data/lib/phrase/version.rb +1 -1
  103. data/spec/api/job_template_locales_api_spec.rb +103 -0
  104. data/spec/api/job_templates_api_spec.rb +98 -0
  105. data/spec/api/keys_api_spec.rb +32 -4
  106. data/spec/api/locales_api_spec.rb +19 -2
  107. data/spec/api/notification_groups_api_spec.rb +62 -0
  108. data/spec/api/notifications_api_spec.rb +62 -0
  109. data/spec/api/projects_api_spec.rb +3 -0
  110. data/spec/api/search_api_spec.rb +37 -0
  111. data/spec/api/translations_api_spec.rb +10 -10
  112. data/spec/api/users_api_spec.rb +1 -1
  113. data/spec/models/account_details1_spec.rb +6 -0
  114. data/spec/models/account_details_spec.rb +12 -0
  115. data/spec/models/account_search_result_spec.rb +65 -0
  116. data/spec/models/account_spec.rb +6 -0
  117. data/spec/models/branch_spec.rb +12 -0
  118. data/spec/models/comment_spec.rb +6 -0
  119. data/spec/models/current_user_spec.rb +71 -0
  120. data/spec/models/job_create_parameters_spec.rb +6 -0
  121. data/spec/models/job_details1_spec.rb +6 -0
  122. data/spec/models/job_details_spec.rb +6 -0
  123. data/spec/models/job_locale_spec.rb +12 -0
  124. data/spec/models/job_template_create_parameters_spec.rb +41 -0
  125. data/spec/models/job_template_locale_spec.rb +47 -0
  126. data/spec/models/job_template_locale_update_parameters_spec.rb +47 -0
  127. data/spec/models/job_template_locales_create_parameters_spec.rb +47 -0
  128. data/spec/models/job_template_preview_spec.rb +35 -0
  129. data/spec/models/job_template_spec.rb +65 -0
  130. data/spec/models/job_template_update_parameters_spec.rb +41 -0
  131. data/spec/models/job_template_user_preview_spec.rb +47 -0
  132. data/spec/models/keys_exclude_parameters_spec.rb +47 -0
  133. data/spec/models/keys_include_parameters_spec.rb +47 -0
  134. data/spec/models/locale_preview1_spec.rb +47 -0
  135. data/spec/models/member_update_parameters_spec.rb +6 -0
  136. data/spec/models/notification_group_detail_spec.rb +59 -0
  137. data/spec/models/notification_group_spec.rb +47 -0
  138. data/spec/models/notification_spec.rb +101 -0
  139. data/spec/models/order_create_parameters_spec.rb +6 -0
  140. data/spec/models/project_create_parameters_spec.rb +102 -0
  141. data/spec/models/project_details_spec.rb +6 -0
  142. data/spec/models/project_spec.rb +6 -0
  143. data/spec/models/search_in_account_parameters_spec.rb +47 -0
  144. data/spec/models/space1_spec.rb +53 -0
  145. data/spec/models/subscription_spec.rb +35 -0
  146. data/spec/models/translation_order_spec.rb +6 -0
  147. data/spec/models/user_spec.rb +0 -6
  148. metadata +263 -167
@@ -7,6 +7,78 @@ module Phrase
7
7
  def initialize(api_client = ApiClient.default)
8
8
  @api_client = api_client
9
9
  end
10
+ # List locales used in account
11
+ # List all locales unique by locale code used across all projects within an account.
12
+ # @param id [String] ID
13
+ # @param [Hash] opts the optional parameters
14
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
15
+ # @option opts [Integer] :page Page number
16
+ # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
17
+ # @return [Array<LocalePreview1>]
18
+ def account_locales(id, opts = {})
19
+ data, _status_code, _headers = account_locales_with_http_info(id, opts)
20
+ data
21
+ end
22
+
23
+ # List locales used in account
24
+ # List all locales unique by locale code used across all projects within an account.
25
+ # @param id [String] ID
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
28
+ # @option opts [Integer] :page Page number
29
+ # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
30
+ # @return [Array<(Response<(Array<LocalePreview1>)>, Integer, Hash)>] Response<(Array<LocalePreview1>)> data, response status code and response headers
31
+ def account_locales_with_http_info(id, opts = {})
32
+ if @api_client.config.debugging
33
+ @api_client.config.logger.debug 'Calling API: LocalesApi.account_locales ...'
34
+ end
35
+ # verify the required parameter 'id' is set
36
+ if @api_client.config.client_side_validation && id.nil?
37
+ fail ArgumentError, "Missing the required parameter 'id' when calling LocalesApi.account_locales"
38
+ end
39
+ # resource path
40
+ local_var_path = '/accounts/{account_id}/locales'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
45
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
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
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
52
+
53
+ # form parameters
54
+ form_params = opts[:form_params] || {}
55
+
56
+ # http body (model)
57
+ post_body = opts[:body]
58
+
59
+ # return_type
60
+ return_type = opts[:return_type] || 'Array<LocalePreview1>'
61
+
62
+ # auth_names
63
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
64
+
65
+ new_options = opts.merge(
66
+ :header_params => header_params,
67
+ :query_params => query_params,
68
+ :form_params => form_params,
69
+ :body => post_body,
70
+ :auth_names => auth_names,
71
+ :return_type => return_type
72
+ )
73
+
74
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
75
+ if @api_client.config.debugging
76
+ @api_client.config.logger.debug "API called: LocalesApi#account_locales\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
77
+ end
78
+ response = ::Phrase::Response.new(data, headers)
79
+ return response, status_code, headers
80
+ end
81
+
10
82
  # Create a locale
11
83
  # Create a new locale.
12
84
  # @param project_id [String] Project ID
@@ -161,7 +233,7 @@ module Phrase
161
233
  # @param [Hash] opts the optional parameters
162
234
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
163
235
  # @option opts [String] :branch specify the branch to use
164
- # @option opts [String] :file_format File format name. See the format guide for all supported file formats.
236
+ # @option opts [String] :file_format File format name. See the &lt;a href&#x3D;\&quot;https://help.phrase.com/help/supported-platforms-and-formats\&quot;&gt;format guide&lt;/a&gt; for all supported file formats.
165
237
  # @option opts [String] :tags Limit results to keys tagged with a list of comma separated tag names.
166
238
  # @option opts [String] :tag Limit download to tagged keys. This parameter is deprecated. Please use the \&quot;tags\&quot; parameter instead
167
239
  # @option opts [Boolean] :include_empty_translations Indicates whether keys without translations should be included in the output as well.
@@ -175,7 +247,8 @@ module Phrase
175
247
  # @option opts [Boolean] :include_unverified_translations if set to false unverified translations are excluded
176
248
  # @option opts [Boolean] :use_last_reviewed_version If set to true the last reviewed version of a translation is used. This is only available if the review workflow (currently in beta) is enabled for the project.
177
249
  # @option opts [String] :fallback_locale_id If a key has no translation in the locale being downloaded the translation in the fallback locale will be used. Provide the public ID of the locale that should be used as the fallback. Requires include_empty_translations to be set to &lt;code&gt;true&lt;/code&gt;.
178
- # @return [nil]
250
+ # @option opts [String] :source_locale_id Provides the source language of a corresponding job as the source language of the generated locale file. This parameter will be ignored unless used in combination with a &lt;code&gt;tag&lt;/code&gt; parameter indicating a specific job.
251
+ # @return [File]
179
252
  def locale_download(project_id, id, opts = {})
180
253
  data, _status_code, _headers = locale_download_with_http_info(project_id, id, opts)
181
254
  data
@@ -188,7 +261,7 @@ module Phrase
188
261
  # @param [Hash] opts the optional parameters
189
262
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
190
263
  # @option opts [String] :branch specify the branch to use
191
- # @option opts [String] :file_format File format name. See the format guide for all supported file formats.
264
+ # @option opts [String] :file_format File format name. See the &lt;a href&#x3D;\&quot;https://help.phrase.com/help/supported-platforms-and-formats\&quot;&gt;format guide&lt;/a&gt; for all supported file formats.
192
265
  # @option opts [String] :tags Limit results to keys tagged with a list of comma separated tag names.
193
266
  # @option opts [String] :tag Limit download to tagged keys. This parameter is deprecated. Please use the \&quot;tags\&quot; parameter instead
194
267
  # @option opts [Boolean] :include_empty_translations Indicates whether keys without translations should be included in the output as well.
@@ -202,7 +275,8 @@ module Phrase
202
275
  # @option opts [Boolean] :include_unverified_translations if set to false unverified translations are excluded
203
276
  # @option opts [Boolean] :use_last_reviewed_version If set to true the last reviewed version of a translation is used. This is only available if the review workflow (currently in beta) is enabled for the project.
204
277
  # @option opts [String] :fallback_locale_id If a key has no translation in the locale being downloaded the translation in the fallback locale will be used. Provide the public ID of the locale that should be used as the fallback. Requires include_empty_translations to be set to &lt;code&gt;true&lt;/code&gt;.
205
- # @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
278
+ # @option opts [String] :source_locale_id Provides the source language of a corresponding job as the source language of the generated locale file. This parameter will be ignored unless used in combination with a &lt;code&gt;tag&lt;/code&gt; parameter indicating a specific job.
279
+ # @return [Array<(Response<(File)>, Integer, Hash)>] Response<(File)> data, response status code and response headers
206
280
  def locale_download_with_http_info(project_id, id, opts = {})
207
281
  if @api_client.config.debugging
208
282
  @api_client.config.logger.debug 'Calling API: LocalesApi.locale_download ...'
@@ -235,9 +309,12 @@ module Phrase
235
309
  query_params[:'include_unverified_translations'] = opts[:'include_unverified_translations'] if !opts[:'include_unverified_translations'].nil?
236
310
  query_params[:'use_last_reviewed_version'] = opts[:'use_last_reviewed_version'] if !opts[:'use_last_reviewed_version'].nil?
237
311
  query_params[:'fallback_locale_id'] = opts[:'fallback_locale_id'] if !opts[:'fallback_locale_id'].nil?
312
+ query_params[:'source_locale_id'] = opts[:'source_locale_id'] if !opts[:'source_locale_id'].nil?
238
313
 
239
314
  # header parameters
240
315
  header_params = opts[:header_params] || {}
316
+ # HTTP header 'Accept' (if needed)
317
+ header_params['Accept'] = @api_client.select_header_accept(['*'])
241
318
  header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
242
319
 
243
320
  # form parameters
@@ -247,7 +324,7 @@ module Phrase
247
324
  post_body = opts[:body]
248
325
 
249
326
  # return_type
250
- return_type = opts[:return_type]
327
+ return_type = opts[:return_type] || 'File'
251
328
 
252
329
  # auth_names
253
330
  auth_names = opts[:auth_names] || ['Basic', 'Token']
@@ -431,6 +508,7 @@ module Phrase
431
508
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
432
509
  # @option opts [Integer] :page Page number
433
510
  # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
511
+ # @option opts [String] :sort_by Sort locales. Valid options are \&quot;name_asc\&quot;, \&quot;name_desc\&quot;, \&quot;default_asc\&quot;, \&quot;default_desc\&quot;.
434
512
  # @option opts [String] :branch specify the branch to use
435
513
  # @return [Array<Locale>]
436
514
  def locales_list(project_id, opts = {})
@@ -445,6 +523,7 @@ module Phrase
445
523
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
446
524
  # @option opts [Integer] :page Page number
447
525
  # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
526
+ # @option opts [String] :sort_by Sort locales. Valid options are \&quot;name_asc\&quot;, \&quot;name_desc\&quot;, \&quot;default_asc\&quot;, \&quot;default_desc\&quot;.
448
527
  # @option opts [String] :branch specify the branch to use
449
528
  # @return [Array<(Response<(Array<Locale>)>, Integer, Hash)>] Response<(Array<Locale>)> data, response status code and response headers
450
529
  def locales_list_with_http_info(project_id, opts = {})
@@ -462,6 +541,7 @@ module Phrase
462
541
  query_params = opts[:query_params] || {}
463
542
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
464
543
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
544
+ query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
465
545
  query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
466
546
 
467
547
  # header parameters
@@ -0,0 +1,202 @@
1
+ require 'cgi'
2
+
3
+ module Phrase
4
+ class NotificationGroupsApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = ApiClient.default)
8
+ @api_client = api_client
9
+ end
10
+ # List notification groups
11
+ # List all notification groups from the current user
12
+ # @param [Hash] opts the optional parameters
13
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
14
+ # @option opts [Integer] :page Page number
15
+ # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
16
+ # @return [Array<Object>]
17
+ def notification_groups_list(opts = {})
18
+ data, _status_code, _headers = notification_groups_list_with_http_info(opts)
19
+ data
20
+ end
21
+
22
+ # List notification groups
23
+ # List all notification groups from the current user
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
26
+ # @option opts [Integer] :page Page number
27
+ # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
28
+ # @return [Array<(Response<(Array<Object>)>, Integer, Hash)>] Response<(Array<Object>)> data, response status code and response headers
29
+ def notification_groups_list_with_http_info(opts = {})
30
+ if @api_client.config.debugging
31
+ @api_client.config.logger.debug 'Calling API: NotificationGroupsApi.notification_groups_list ...'
32
+ end
33
+ # resource path
34
+ local_var_path = '/notification_groups'
35
+
36
+ # query parameters
37
+ query_params = opts[:query_params] || {}
38
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
39
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
40
+
41
+ # header parameters
42
+ header_params = opts[:header_params] || {}
43
+ # HTTP header 'Accept' (if needed)
44
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
45
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
46
+
47
+ # form parameters
48
+ form_params = opts[:form_params] || {}
49
+
50
+ # http body (model)
51
+ post_body = opts[:body]
52
+
53
+ # return_type
54
+ return_type = opts[:return_type] || 'Array<Object>'
55
+
56
+ # auth_names
57
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
58
+
59
+ new_options = opts.merge(
60
+ :header_params => header_params,
61
+ :query_params => query_params,
62
+ :form_params => form_params,
63
+ :body => post_body,
64
+ :auth_names => auth_names,
65
+ :return_type => return_type
66
+ )
67
+
68
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
69
+ if @api_client.config.debugging
70
+ @api_client.config.logger.debug "API called: NotificationGroupsApi#notification_groups_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
71
+ end
72
+ response = ::Phrase::Response.new(data, headers)
73
+ return response, status_code, headers
74
+ end
75
+
76
+ # Mark all notification groups as read
77
+ # Mark all notification groups of the current user as read
78
+ # @param [Hash] opts the optional parameters
79
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
80
+ # @return [Array<Object>]
81
+ def notification_groups_mark_all_as_read(opts = {})
82
+ data, _status_code, _headers = notification_groups_mark_all_as_read_with_http_info(opts)
83
+ data
84
+ end
85
+
86
+ # Mark all notification groups as read
87
+ # Mark all notification groups of the current user as read
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
90
+ # @return [Array<(Response<(Array<Object>)>, Integer, Hash)>] Response<(Array<Object>)> data, response status code and response headers
91
+ def notification_groups_mark_all_as_read_with_http_info(opts = {})
92
+ if @api_client.config.debugging
93
+ @api_client.config.logger.debug 'Calling API: NotificationGroupsApi.notification_groups_mark_all_as_read ...'
94
+ end
95
+ # resource path
96
+ local_var_path = '/notification_groups/mark_all_as_read'
97
+
98
+ # query parameters
99
+ query_params = opts[:query_params] || {}
100
+
101
+ # header parameters
102
+ header_params = opts[:header_params] || {}
103
+ # HTTP header 'Accept' (if needed)
104
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
105
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
106
+
107
+ # form parameters
108
+ form_params = opts[:form_params] || {}
109
+
110
+ # http body (model)
111
+ post_body = opts[:body]
112
+
113
+ # return_type
114
+ return_type = opts[:return_type] || 'Array<Object>'
115
+
116
+ # auth_names
117
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
118
+
119
+ new_options = opts.merge(
120
+ :header_params => header_params,
121
+ :query_params => query_params,
122
+ :form_params => form_params,
123
+ :body => post_body,
124
+ :auth_names => auth_names,
125
+ :return_type => return_type
126
+ )
127
+
128
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
129
+ if @api_client.config.debugging
130
+ @api_client.config.logger.debug "API called: NotificationGroupsApi#notification_groups_mark_all_as_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
131
+ end
132
+ response = ::Phrase::Response.new(data, headers)
133
+ return response, status_code, headers
134
+ end
135
+
136
+ # Mark a notification group as read
137
+ # Mark a notifications group of the current user as read
138
+ # @param id [String] ID
139
+ # @param [Hash] opts the optional parameters
140
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
141
+ # @return [NotificationGroupDetail]
142
+ def notification_groups_mark_as_read(id, opts = {})
143
+ data, _status_code, _headers = notification_groups_mark_as_read_with_http_info(id, opts)
144
+ data
145
+ end
146
+
147
+ # Mark a notification group as read
148
+ # Mark a notifications group of the current user as read
149
+ # @param id [String] ID
150
+ # @param [Hash] opts the optional parameters
151
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
152
+ # @return [Array<(Response<(NotificationGroupDetail)>, Integer, Hash)>] Response<(NotificationGroupDetail)> data, response status code and response headers
153
+ def notification_groups_mark_as_read_with_http_info(id, opts = {})
154
+ if @api_client.config.debugging
155
+ @api_client.config.logger.debug 'Calling API: NotificationGroupsApi.notification_groups_mark_as_read ...'
156
+ end
157
+ # verify the required parameter 'id' is set
158
+ if @api_client.config.client_side_validation && id.nil?
159
+ fail ArgumentError, "Missing the required parameter 'id' when calling NotificationGroupsApi.notification_groups_mark_as_read"
160
+ end
161
+ # resource path
162
+ local_var_path = '/notification_groups/{id}/mark_as_read'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
163
+
164
+ # query parameters
165
+ query_params = opts[:query_params] || {}
166
+
167
+ # header parameters
168
+ header_params = opts[:header_params] || {}
169
+ # HTTP header 'Accept' (if needed)
170
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
171
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
172
+
173
+ # form parameters
174
+ form_params = opts[:form_params] || {}
175
+
176
+ # http body (model)
177
+ post_body = opts[:body]
178
+
179
+ # return_type
180
+ return_type = opts[:return_type] || 'NotificationGroupDetail'
181
+
182
+ # auth_names
183
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
184
+
185
+ new_options = opts.merge(
186
+ :header_params => header_params,
187
+ :query_params => query_params,
188
+ :form_params => form_params,
189
+ :body => post_body,
190
+ :auth_names => auth_names,
191
+ :return_type => return_type
192
+ )
193
+
194
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
195
+ if @api_client.config.debugging
196
+ @api_client.config.logger.debug "API called: NotificationGroupsApi#notification_groups_mark_as_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
197
+ end
198
+ response = ::Phrase::Response.new(data, headers)
199
+ return response, status_code, headers
200
+ end
201
+ end
202
+ end
@@ -0,0 +1,202 @@
1
+ require 'cgi'
2
+
3
+ module Phrase
4
+ class NotificationsApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = ApiClient.default)
8
+ @api_client = api_client
9
+ end
10
+ # List notifications
11
+ # List all notifications from the current user
12
+ # @param [Hash] opts the optional parameters
13
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
14
+ # @option opts [Integer] :page Page number
15
+ # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
16
+ # @return [Array<Object>]
17
+ def notifications_list(opts = {})
18
+ data, _status_code, _headers = notifications_list_with_http_info(opts)
19
+ data
20
+ end
21
+
22
+ # List notifications
23
+ # List all notifications from the current user
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
26
+ # @option opts [Integer] :page Page number
27
+ # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
28
+ # @return [Array<(Response<(Array<Object>)>, Integer, Hash)>] Response<(Array<Object>)> data, response status code and response headers
29
+ def notifications_list_with_http_info(opts = {})
30
+ if @api_client.config.debugging
31
+ @api_client.config.logger.debug 'Calling API: NotificationsApi.notifications_list ...'
32
+ end
33
+ # resource path
34
+ local_var_path = '/notifications'
35
+
36
+ # query parameters
37
+ query_params = opts[:query_params] || {}
38
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
39
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
40
+
41
+ # header parameters
42
+ header_params = opts[:header_params] || {}
43
+ # HTTP header 'Accept' (if needed)
44
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
45
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
46
+
47
+ # form parameters
48
+ form_params = opts[:form_params] || {}
49
+
50
+ # http body (model)
51
+ post_body = opts[:body]
52
+
53
+ # return_type
54
+ return_type = opts[:return_type] || 'Array<Object>'
55
+
56
+ # auth_names
57
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
58
+
59
+ new_options = opts.merge(
60
+ :header_params => header_params,
61
+ :query_params => query_params,
62
+ :form_params => form_params,
63
+ :body => post_body,
64
+ :auth_names => auth_names,
65
+ :return_type => return_type
66
+ )
67
+
68
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
69
+ if @api_client.config.debugging
70
+ @api_client.config.logger.debug "API called: NotificationsApi#notifications_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
71
+ end
72
+ response = ::Phrase::Response.new(data, headers)
73
+ return response, status_code, headers
74
+ end
75
+
76
+ # Mark all notifications as read
77
+ # Mark all notifications of the current user as read
78
+ # @param [Hash] opts the optional parameters
79
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
80
+ # @return [Array<Object>]
81
+ def notifications_mark_all_as_read(opts = {})
82
+ data, _status_code, _headers = notifications_mark_all_as_read_with_http_info(opts)
83
+ data
84
+ end
85
+
86
+ # Mark all notifications as read
87
+ # Mark all notifications of the current user as read
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
90
+ # @return [Array<(Response<(Array<Object>)>, Integer, Hash)>] Response<(Array<Object>)> data, response status code and response headers
91
+ def notifications_mark_all_as_read_with_http_info(opts = {})
92
+ if @api_client.config.debugging
93
+ @api_client.config.logger.debug 'Calling API: NotificationsApi.notifications_mark_all_as_read ...'
94
+ end
95
+ # resource path
96
+ local_var_path = '/notifications/mark_all_as_read'
97
+
98
+ # query parameters
99
+ query_params = opts[:query_params] || {}
100
+
101
+ # header parameters
102
+ header_params = opts[:header_params] || {}
103
+ # HTTP header 'Accept' (if needed)
104
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
105
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
106
+
107
+ # form parameters
108
+ form_params = opts[:form_params] || {}
109
+
110
+ # http body (model)
111
+ post_body = opts[:body]
112
+
113
+ # return_type
114
+ return_type = opts[:return_type] || 'Array<Object>'
115
+
116
+ # auth_names
117
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
118
+
119
+ new_options = opts.merge(
120
+ :header_params => header_params,
121
+ :query_params => query_params,
122
+ :form_params => form_params,
123
+ :body => post_body,
124
+ :auth_names => auth_names,
125
+ :return_type => return_type
126
+ )
127
+
128
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
129
+ if @api_client.config.debugging
130
+ @api_client.config.logger.debug "API called: NotificationsApi#notifications_mark_all_as_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
131
+ end
132
+ response = ::Phrase::Response.new(data, headers)
133
+ return response, status_code, headers
134
+ end
135
+
136
+ # Get a single notification
137
+ # Get details on a single notification.
138
+ # @param id [String] ID
139
+ # @param [Hash] opts the optional parameters
140
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
141
+ # @return [Notification]
142
+ def notifications_show(id, opts = {})
143
+ data, _status_code, _headers = notifications_show_with_http_info(id, opts)
144
+ data
145
+ end
146
+
147
+ # Get a single notification
148
+ # Get details on a single notification.
149
+ # @param id [String] ID
150
+ # @param [Hash] opts the optional parameters
151
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
152
+ # @return [Array<(Response<(Notification)>, Integer, Hash)>] Response<(Notification)> data, response status code and response headers
153
+ def notifications_show_with_http_info(id, opts = {})
154
+ if @api_client.config.debugging
155
+ @api_client.config.logger.debug 'Calling API: NotificationsApi.notifications_show ...'
156
+ end
157
+ # verify the required parameter 'id' is set
158
+ if @api_client.config.client_side_validation && id.nil?
159
+ fail ArgumentError, "Missing the required parameter 'id' when calling NotificationsApi.notifications_show"
160
+ end
161
+ # resource path
162
+ local_var_path = '/notifications/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
163
+
164
+ # query parameters
165
+ query_params = opts[:query_params] || {}
166
+
167
+ # header parameters
168
+ header_params = opts[:header_params] || {}
169
+ # HTTP header 'Accept' (if needed)
170
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
171
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
172
+
173
+ # form parameters
174
+ form_params = opts[:form_params] || {}
175
+
176
+ # http body (model)
177
+ post_body = opts[:body]
178
+
179
+ # return_type
180
+ return_type = opts[:return_type] || 'Notification'
181
+
182
+ # auth_names
183
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
184
+
185
+ new_options = opts.merge(
186
+ :header_params => header_params,
187
+ :query_params => query_params,
188
+ :form_params => form_params,
189
+ :body => post_body,
190
+ :auth_names => auth_names,
191
+ :return_type => return_type
192
+ )
193
+
194
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
195
+ if @api_client.config.debugging
196
+ @api_client.config.logger.debug "API called: NotificationsApi#notifications_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
197
+ end
198
+ response = ::Phrase::Response.new(data, headers)
199
+ return response, status_code, headers
200
+ end
201
+ end
202
+ end