phrase 2.0.0 → 2.1.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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +41 -3
  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/JobTemplate.md +29 -0
  10. data/docs/JobTemplateCreateParameters.md +21 -0
  11. data/docs/JobTemplateLocale.md +23 -0
  12. data/docs/JobTemplateLocaleUpdateParameters.md +23 -0
  13. data/docs/JobTemplateLocalesApi.md +347 -0
  14. data/docs/JobTemplateLocalesCreateParameters.md +23 -0
  15. data/docs/JobTemplatePreview.md +19 -0
  16. data/docs/JobTemplateUpdateParameters.md +21 -0
  17. data/docs/JobTemplateUserPreview.md +23 -0
  18. data/docs/JobTemplatesApi.md +337 -0
  19. data/docs/KeysApi.md +132 -4
  20. data/docs/KeysExcludeParameters.md +23 -0
  21. data/docs/KeysIncludeParameters.md +23 -0
  22. data/docs/KeysSearchParameters.md +1 -1
  23. data/docs/KeysTagParameters.md +1 -1
  24. data/docs/KeysUntagParameters.md +1 -1
  25. data/docs/LocalePreview1.md +23 -0
  26. data/docs/LocalesApi.md +68 -2
  27. data/docs/MemberSpaces.md +2 -2
  28. data/docs/MemberUpdateParameters.md +4 -2
  29. data/docs/Notification.md +41 -0
  30. data/docs/NotificationGroup.md +23 -0
  31. data/docs/NotificationGroupDetail.md +27 -0
  32. data/docs/NotificationGroupsApi.md +194 -0
  33. data/docs/NotificationsApi.md +194 -0
  34. data/docs/OrderCreateParameters.md +2 -0
  35. data/docs/Project.md +2 -0
  36. data/docs/ProjectCreateParameters.md +35 -1
  37. data/docs/ProjectDetails.md +2 -0
  38. data/docs/ProjectsApi.md +7 -1
  39. data/docs/SearchApi.md +72 -0
  40. data/docs/SearchInAccountParameters.md +23 -0
  41. data/docs/Space1.md +25 -0
  42. data/docs/Subscription.md +19 -0
  43. data/docs/TranslationOrder.md +2 -0
  44. data/docs/User.md +0 -2
  45. data/lib/phrase.rb +23 -0
  46. data/lib/phrase/api/job_template_locales_api.rb +417 -0
  47. data/lib/phrase/api/job_templates_api.rb +387 -0
  48. data/lib/phrase/api/keys_api.rb +152 -4
  49. data/lib/phrase/api/locales_api.rb +71 -2
  50. data/lib/phrase/api/notification_groups_api.rb +202 -0
  51. data/lib/phrase/api/notifications_api.rb +202 -0
  52. data/lib/phrase/api/projects_api.rb +9 -0
  53. data/lib/phrase/api/search_api.rb +84 -0
  54. data/lib/phrase/models/account.rb +13 -4
  55. data/lib/phrase/models/account_details.rb +22 -4
  56. data/lib/phrase/models/account_details1.rb +10 -1
  57. data/lib/phrase/models/account_search_result.rb +250 -0
  58. data/lib/phrase/models/branch.rb +19 -1
  59. data/lib/phrase/models/comment.rb +15 -4
  60. data/lib/phrase/models/job_template.rb +248 -0
  61. data/lib/phrase/models/job_template_create_parameters.rb +220 -0
  62. data/lib/phrase/models/job_template_locale.rb +223 -0
  63. data/lib/phrase/models/job_template_locale_update_parameters.rb +234 -0
  64. data/lib/phrase/models/job_template_locales_create_parameters.rb +234 -0
  65. data/lib/phrase/models/job_template_preview.rb +203 -0
  66. data/lib/phrase/models/job_template_update_parameters.rb +220 -0
  67. data/lib/phrase/models/job_template_user_preview.rb +221 -0
  68. data/lib/phrase/models/keys_exclude_parameters.rb +225 -0
  69. data/lib/phrase/models/keys_include_parameters.rb +225 -0
  70. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  71. data/lib/phrase/models/keys_tag_parameters.rb +1 -1
  72. data/lib/phrase/models/keys_untag_parameters.rb +1 -1
  73. data/lib/phrase/models/locale_preview1.rb +221 -0
  74. data/lib/phrase/models/member_spaces.rb +2 -2
  75. data/lib/phrase/models/member_update_parameters.rb +12 -2
  76. data/lib/phrase/models/notification.rb +302 -0
  77. data/lib/phrase/models/notification_group.rb +221 -0
  78. data/lib/phrase/models/notification_group_detail.rb +239 -0
  79. data/lib/phrase/models/order_create_parameters.rb +11 -1
  80. data/lib/phrase/models/project.rb +10 -1
  81. data/lib/phrase/models/project_create_parameters.rb +174 -4
  82. data/lib/phrase/models/project_details.rb +10 -1
  83. data/lib/phrase/models/search_in_account_parameters.rb +225 -0
  84. data/lib/phrase/models/space1.rb +230 -0
  85. data/lib/phrase/models/subscription.rb +203 -0
  86. data/lib/phrase/models/translation_order.rb +10 -1
  87. data/lib/phrase/models/user.rb +1 -10
  88. data/lib/phrase/version.rb +1 -1
  89. data/spec/api/job_template_locales_api_spec.rb +103 -0
  90. data/spec/api/job_templates_api_spec.rb +98 -0
  91. data/spec/api/keys_api_spec.rb +30 -2
  92. data/spec/api/locales_api_spec.rb +16 -1
  93. data/spec/api/notification_groups_api_spec.rb +62 -0
  94. data/spec/api/notifications_api_spec.rb +62 -0
  95. data/spec/api/projects_api_spec.rb +3 -0
  96. data/spec/api/search_api_spec.rb +37 -0
  97. data/spec/models/account_details1_spec.rb +6 -0
  98. data/spec/models/account_details_spec.rb +12 -0
  99. data/spec/models/account_search_result_spec.rb +65 -0
  100. data/spec/models/account_spec.rb +6 -0
  101. data/spec/models/branch_spec.rb +12 -0
  102. data/spec/models/comment_spec.rb +6 -0
  103. data/spec/models/job_template_create_parameters_spec.rb +41 -0
  104. data/spec/models/job_template_locale_spec.rb +47 -0
  105. data/spec/models/job_template_locale_update_parameters_spec.rb +47 -0
  106. data/spec/models/job_template_locales_create_parameters_spec.rb +47 -0
  107. data/spec/models/job_template_preview_spec.rb +35 -0
  108. data/spec/models/job_template_spec.rb +65 -0
  109. data/spec/models/job_template_update_parameters_spec.rb +41 -0
  110. data/spec/models/job_template_user_preview_spec.rb +47 -0
  111. data/spec/models/keys_exclude_parameters_spec.rb +47 -0
  112. data/spec/models/keys_include_parameters_spec.rb +47 -0
  113. data/spec/models/locale_preview1_spec.rb +47 -0
  114. data/spec/models/member_update_parameters_spec.rb +6 -0
  115. data/spec/models/notification_group_detail_spec.rb +59 -0
  116. data/spec/models/notification_group_spec.rb +47 -0
  117. data/spec/models/notification_spec.rb +101 -0
  118. data/spec/models/order_create_parameters_spec.rb +6 -0
  119. data/spec/models/project_create_parameters_spec.rb +102 -0
  120. data/spec/models/project_details_spec.rb +6 -0
  121. data/spec/models/project_spec.rb +6 -0
  122. data/spec/models/search_in_account_parameters_spec.rb +47 -0
  123. data/spec/models/space1_spec.rb +53 -0
  124. data/spec/models/subscription_spec.rb +35 -0
  125. data/spec/models/translation_order_spec.rb +6 -0
  126. data/spec/models/user_spec.rb +0 -6
  127. metadata +268 -176
@@ -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.
@@ -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.
@@ -433,6 +499,7 @@ module Phrase
433
499
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
434
500
  # @option opts [Integer] :page Page number
435
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;.
436
503
  # @option opts [String] :branch specify the branch to use
437
504
  # @return [Array<Locale>]
438
505
  def locales_list(project_id, opts = {})
@@ -447,6 +514,7 @@ module Phrase
447
514
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
448
515
  # @option opts [Integer] :page Page number
449
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;.
450
518
  # @option opts [String] :branch specify the branch to use
451
519
  # @return [Array<(Response<(Array<Locale>)>, Integer, Hash)>] Response<(Array<Locale>)> data, response status code and response headers
452
520
  def locales_list_with_http_info(project_id, opts = {})
@@ -464,6 +532,7 @@ module Phrase
464
532
  query_params = opts[:query_params] || {}
465
533
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
466
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?
467
536
  query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
468
537
 
469
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