phrase 1.0.13 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) 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 +73 -6
  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/ScreenshotCreateParameters.md +3 -1
  45. data/docs/ScreenshotMarkerCreateParameters.md +3 -1
  46. data/docs/ScreenshotMarkerUpdateParameters.md +3 -1
  47. data/docs/ScreenshotMarkersApi.md +9 -3
  48. data/docs/ScreenshotUpdateParameters.md +3 -1
  49. data/docs/ScreenshotsApi.md +8 -2
  50. data/docs/SearchApi.md +72 -0
  51. data/docs/SearchInAccountParameters.md +23 -0
  52. data/docs/Space1.md +25 -0
  53. data/docs/Subscription.md +19 -0
  54. data/docs/TranslationOrder.md +2 -0
  55. data/docs/TranslationsApi.md +25 -25
  56. data/docs/User.md +0 -2
  57. data/docs/UsersApi.md +2 -2
  58. data/lib/phrase.rb +24 -0
  59. data/lib/phrase/api/job_template_locales_api.rb +417 -0
  60. data/lib/phrase/api/job_templates_api.rb +387 -0
  61. data/lib/phrase/api/keys_api.rb +158 -10
  62. data/lib/phrase/api/locales_api.rb +76 -5
  63. data/lib/phrase/api/notification_groups_api.rb +202 -0
  64. data/lib/phrase/api/notifications_api.rb +202 -0
  65. data/lib/phrase/api/projects_api.rb +9 -0
  66. data/lib/phrase/api/screenshot_markers_api.rb +9 -0
  67. data/lib/phrase/api/screenshots_api.rb +9 -0
  68. data/lib/phrase/api/search_api.rb +84 -0
  69. data/lib/phrase/api/translations_api.rb +35 -35
  70. data/lib/phrase/api/users_api.rb +3 -3
  71. data/lib/phrase/models/account.rb +13 -4
  72. data/lib/phrase/models/account_details.rb +22 -4
  73. data/lib/phrase/models/account_details1.rb +10 -1
  74. data/lib/phrase/models/account_search_result.rb +250 -0
  75. data/lib/phrase/models/branch.rb +19 -1
  76. data/lib/phrase/models/comment.rb +15 -4
  77. data/lib/phrase/models/current_user.rb +257 -0
  78. data/lib/phrase/models/job_create_parameters.rb +11 -1
  79. data/lib/phrase/models/job_details.rb +10 -1
  80. data/lib/phrase/models/job_details1.rb +10 -1
  81. data/lib/phrase/models/job_locale.rb +22 -4
  82. data/lib/phrase/models/job_template.rb +248 -0
  83. data/lib/phrase/models/job_template_create_parameters.rb +220 -0
  84. data/lib/phrase/models/job_template_locale.rb +223 -0
  85. data/lib/phrase/models/job_template_locale_update_parameters.rb +234 -0
  86. data/lib/phrase/models/job_template_locales_create_parameters.rb +234 -0
  87. data/lib/phrase/models/job_template_preview.rb +203 -0
  88. data/lib/phrase/models/job_template_update_parameters.rb +220 -0
  89. data/lib/phrase/models/job_template_user_preview.rb +221 -0
  90. data/lib/phrase/models/keys_exclude_parameters.rb +225 -0
  91. data/lib/phrase/models/keys_include_parameters.rb +225 -0
  92. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  93. data/lib/phrase/models/keys_tag_parameters.rb +1 -1
  94. data/lib/phrase/models/keys_untag_parameters.rb +1 -1
  95. data/lib/phrase/models/locale_preview1.rb +221 -0
  96. data/lib/phrase/models/member_spaces.rb +2 -2
  97. data/lib/phrase/models/member_update_parameters.rb +12 -2
  98. data/lib/phrase/models/notification.rb +302 -0
  99. data/lib/phrase/models/notification_group.rb +221 -0
  100. data/lib/phrase/models/notification_group_detail.rb +239 -0
  101. data/lib/phrase/models/order_create_parameters.rb +11 -1
  102. data/lib/phrase/models/project.rb +10 -1
  103. data/lib/phrase/models/project_create_parameters.rb +174 -4
  104. data/lib/phrase/models/project_details.rb +10 -1
  105. data/lib/phrase/models/screenshot_create_parameters.rb +11 -1
  106. data/lib/phrase/models/screenshot_marker_create_parameters.rb +11 -1
  107. data/lib/phrase/models/screenshot_marker_update_parameters.rb +11 -1
  108. data/lib/phrase/models/screenshot_update_parameters.rb +11 -1
  109. data/lib/phrase/models/search_in_account_parameters.rb +225 -0
  110. data/lib/phrase/models/space1.rb +230 -0
  111. data/lib/phrase/models/subscription.rb +203 -0
  112. data/lib/phrase/models/translation_order.rb +10 -1
  113. data/lib/phrase/models/user.rb +1 -10
  114. data/lib/phrase/version.rb +1 -1
  115. data/spec/api/job_template_locales_api_spec.rb +103 -0
  116. data/spec/api/job_templates_api_spec.rb +98 -0
  117. data/spec/api/keys_api_spec.rb +32 -4
  118. data/spec/api/locales_api_spec.rb +17 -2
  119. data/spec/api/notification_groups_api_spec.rb +62 -0
  120. data/spec/api/notifications_api_spec.rb +62 -0
  121. data/spec/api/projects_api_spec.rb +3 -0
  122. data/spec/api/screenshot_markers_api_spec.rb +3 -0
  123. data/spec/api/screenshots_api_spec.rb +3 -0
  124. data/spec/api/search_api_spec.rb +37 -0
  125. data/spec/api/translations_api_spec.rb +10 -10
  126. data/spec/api/users_api_spec.rb +1 -1
  127. data/spec/models/account_details1_spec.rb +6 -0
  128. data/spec/models/account_details_spec.rb +12 -0
  129. data/spec/models/account_search_result_spec.rb +65 -0
  130. data/spec/models/account_spec.rb +6 -0
  131. data/spec/models/branch_spec.rb +12 -0
  132. data/spec/models/comment_spec.rb +6 -0
  133. data/spec/models/current_user_spec.rb +71 -0
  134. data/spec/models/job_create_parameters_spec.rb +6 -0
  135. data/spec/models/job_details1_spec.rb +6 -0
  136. data/spec/models/job_details_spec.rb +6 -0
  137. data/spec/models/job_locale_spec.rb +12 -0
  138. data/spec/models/job_template_create_parameters_spec.rb +41 -0
  139. data/spec/models/job_template_locale_spec.rb +47 -0
  140. data/spec/models/job_template_locale_update_parameters_spec.rb +47 -0
  141. data/spec/models/job_template_locales_create_parameters_spec.rb +47 -0
  142. data/spec/models/job_template_preview_spec.rb +35 -0
  143. data/spec/models/job_template_spec.rb +65 -0
  144. data/spec/models/job_template_update_parameters_spec.rb +41 -0
  145. data/spec/models/job_template_user_preview_spec.rb +47 -0
  146. data/spec/models/keys_exclude_parameters_spec.rb +47 -0
  147. data/spec/models/keys_include_parameters_spec.rb +47 -0
  148. data/spec/models/locale_preview1_spec.rb +47 -0
  149. data/spec/models/member_update_parameters_spec.rb +6 -0
  150. data/spec/models/notification_group_detail_spec.rb +59 -0
  151. data/spec/models/notification_group_spec.rb +47 -0
  152. data/spec/models/notification_spec.rb +101 -0
  153. data/spec/models/order_create_parameters_spec.rb +6 -0
  154. data/spec/models/project_create_parameters_spec.rb +102 -0
  155. data/spec/models/project_details_spec.rb +6 -0
  156. data/spec/models/project_spec.rb +6 -0
  157. data/spec/models/screenshot_create_parameters_spec.rb +6 -0
  158. data/spec/models/screenshot_marker_create_parameters_spec.rb +6 -0
  159. data/spec/models/screenshot_marker_update_parameters_spec.rb +6 -0
  160. data/spec/models/screenshot_update_parameters_spec.rb +6 -0
  161. data/spec/models/search_in_account_parameters_spec.rb +47 -0
  162. data/spec/models/space1_spec.rb +53 -0
  163. data/spec/models/subscription_spec.rb +35 -0
  164. data/spec/models/translation_order_spec.rb +6 -0
  165. data/spec/models/user_spec.rb +0 -6
  166. metadata +263 -167
@@ -7,6 +7,72 @@ 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 [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<LocalePreview1>]
17
+ def account_locales(opts = {})
18
+ data, _status_code, _headers = account_locales_with_http_info(opts)
19
+ data
20
+ end
21
+
22
+ # List locales used in account
23
+ # List all locales unique by locale code used across all projects within an account.
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<LocalePreview1>)>, Integer, Hash)>] Response<(Array<LocalePreview1>)> data, response status code and response headers
29
+ def account_locales_with_http_info(opts = {})
30
+ if @api_client.config.debugging
31
+ @api_client.config.logger.debug 'Calling API: LocalesApi.account_locales ...'
32
+ end
33
+ # resource path
34
+ local_var_path = '/accounts/{account_id}/locales'
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<LocalePreview1>'
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: LocalesApi#account_locales\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
+
10
76
  # Create a locale
11
77
  # Create a new locale.
12
78
  # @param project_id [String] Project ID
@@ -161,7 +227,7 @@ module Phrase
161
227
  # @param [Hash] opts the optional parameters
162
228
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
163
229
  # @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.
230
+ # @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
231
  # @option opts [String] :tags Limit results to keys tagged with a list of comma separated tag names.
166
232
  # @option opts [String] :tag Limit download to tagged keys. This parameter is deprecated. Please use the \&quot;tags\&quot; parameter instead
167
233
  # @option opts [Boolean] :include_empty_translations Indicates whether keys without translations should be included in the output as well.
@@ -175,7 +241,7 @@ module Phrase
175
241
  # @option opts [Boolean] :include_unverified_translations if set to false unverified translations are excluded
176
242
  # @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
243
  # @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]
244
+ # @return [File]
179
245
  def locale_download(project_id, id, opts = {})
180
246
  data, _status_code, _headers = locale_download_with_http_info(project_id, id, opts)
181
247
  data
@@ -188,7 +254,7 @@ module Phrase
188
254
  # @param [Hash] opts the optional parameters
189
255
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
190
256
  # @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.
257
+ # @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
258
  # @option opts [String] :tags Limit results to keys tagged with a list of comma separated tag names.
193
259
  # @option opts [String] :tag Limit download to tagged keys. This parameter is deprecated. Please use the \&quot;tags\&quot; parameter instead
194
260
  # @option opts [Boolean] :include_empty_translations Indicates whether keys without translations should be included in the output as well.
@@ -202,7 +268,7 @@ module Phrase
202
268
  # @option opts [Boolean] :include_unverified_translations if set to false unverified translations are excluded
203
269
  # @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
270
  # @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
271
+ # @return [Array<(Response<(File)>, Integer, Hash)>] Response<(File)> data, response status code and response headers
206
272
  def locale_download_with_http_info(project_id, id, opts = {})
207
273
  if @api_client.config.debugging
208
274
  @api_client.config.logger.debug 'Calling API: LocalesApi.locale_download ...'
@@ -238,6 +304,8 @@ module Phrase
238
304
 
239
305
  # header parameters
240
306
  header_params = opts[:header_params] || {}
307
+ # HTTP header 'Accept' (if needed)
308
+ header_params['Accept'] = @api_client.select_header_accept(['*'])
241
309
  header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
242
310
 
243
311
  # form parameters
@@ -247,7 +315,7 @@ module Phrase
247
315
  post_body = opts[:body]
248
316
 
249
317
  # return_type
250
- return_type = opts[:return_type]
318
+ return_type = opts[:return_type] || 'File'
251
319
 
252
320
  # auth_names
253
321
  auth_names = opts[:auth_names] || ['Basic', 'Token']
@@ -431,6 +499,7 @@ module Phrase
431
499
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
432
500
  # @option opts [Integer] :page Page number
433
501
  # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
502
+ # @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
503
  # @option opts [String] :branch specify the branch to use
435
504
  # @return [Array<Locale>]
436
505
  def locales_list(project_id, opts = {})
@@ -445,6 +514,7 @@ module Phrase
445
514
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
446
515
  # @option opts [Integer] :page Page number
447
516
  # @option opts [Integer] :per_page allows you to specify a page size up to 100 items, 25 by default
517
+ # @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
518
  # @option opts [String] :branch specify the branch to use
449
519
  # @return [Array<(Response<(Array<Locale>)>, Integer, Hash)>] Response<(Array<Locale>)> data, response status code and response headers
450
520
  def locales_list_with_http_info(project_id, opts = {})
@@ -462,6 +532,7 @@ module Phrase
462
532
  query_params = opts[:query_params] || {}
463
533
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
464
534
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
535
+ query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
465
536
  query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
466
537
 
467
538
  # 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