phrase 2.13.0 → 2.14.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +9 -3
- data/docs/Comment.md +5 -1
- data/docs/CommentReactionsApi.md +3 -1
- data/docs/CommentRepliesApi.md +427 -0
- data/docs/CommentsApi.md +5 -1
- data/lib/phrase/api/comment_reactions_api.rb +3 -0
- data/lib/phrase/api/comment_replies_api.rb +523 -0
- data/lib/phrase/api/comments_api.rb +6 -0
- data/lib/phrase/models/comment.rb +24 -4
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +1 -0
- data/spec/api/comment_reactions_api_spec.rb +1 -0
- data/spec/api/comment_replies_api_spec.rb +126 -0
- data/spec/api/comments_api_spec.rb +2 -0
- data/spec/models/comment_spec.rb +12 -0
- metadata +6 -2
@@ -0,0 +1,523 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class CommentRepliesApi
|
5
|
+
attr_accessor :api_client
|
6
|
+
|
7
|
+
def initialize(api_client = ApiClient.default)
|
8
|
+
@api_client = api_client
|
9
|
+
end
|
10
|
+
# List replies
|
11
|
+
# List all replies for a comment.
|
12
|
+
# @param project_id [String] Project ID
|
13
|
+
# @param key_id [String] Translation Key ID
|
14
|
+
# @param comment_id [String] Comment ID
|
15
|
+
# @param [Hash] opts the optional parameters
|
16
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
17
|
+
# @option opts [Integer] :page Page number
|
18
|
+
# @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
|
19
|
+
# @option opts [String] :branch specify the branch to use
|
20
|
+
# @return [Array<Comment>]
|
21
|
+
def replies_list(project_id, key_id, comment_id, opts = {})
|
22
|
+
data, _status_code, _headers = replies_list_with_http_info(project_id, key_id, comment_id, opts)
|
23
|
+
data
|
24
|
+
end
|
25
|
+
|
26
|
+
# List replies
|
27
|
+
# List all replies for a comment.
|
28
|
+
# @param project_id [String] Project ID
|
29
|
+
# @param key_id [String] Translation Key ID
|
30
|
+
# @param comment_id [String] Comment ID
|
31
|
+
# @param [Hash] opts the optional parameters
|
32
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
33
|
+
# @option opts [Integer] :page Page number
|
34
|
+
# @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
|
35
|
+
# @option opts [String] :branch specify the branch to use
|
36
|
+
# @return [Array<(Response<(Array<Comment>)>, Integer, Hash)>] Response<(Array<Comment>)> data, response status code and response headers
|
37
|
+
def replies_list_with_http_info(project_id, key_id, comment_id, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: CommentRepliesApi.replies_list ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'project_id' is set
|
42
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentRepliesApi.replies_list"
|
44
|
+
end
|
45
|
+
# verify the required parameter 'key_id' is set
|
46
|
+
if @api_client.config.client_side_validation && key_id.nil?
|
47
|
+
fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentRepliesApi.replies_list"
|
48
|
+
end
|
49
|
+
# verify the required parameter 'comment_id' is set
|
50
|
+
if @api_client.config.client_side_validation && comment_id.nil?
|
51
|
+
fail ArgumentError, "Missing the required parameter 'comment_id' when calling CommentRepliesApi.replies_list"
|
52
|
+
end
|
53
|
+
# resource path
|
54
|
+
local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).sub('{' + 'comment_id' + '}', CGI.escape(comment_id.to_s))
|
55
|
+
|
56
|
+
# query parameters
|
57
|
+
query_params = opts[:query_params] || {}
|
58
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
59
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
60
|
+
query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
|
61
|
+
|
62
|
+
# header parameters
|
63
|
+
header_params = opts[:header_params] || {}
|
64
|
+
# HTTP header 'Accept' (if needed)
|
65
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
66
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
67
|
+
|
68
|
+
# form parameters
|
69
|
+
form_params = opts[:form_params] || {}
|
70
|
+
|
71
|
+
# http body (model)
|
72
|
+
post_body = opts[:body]
|
73
|
+
|
74
|
+
# return_type
|
75
|
+
return_type = opts[:return_type] || 'Array<Comment>'
|
76
|
+
|
77
|
+
# auth_names
|
78
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
79
|
+
|
80
|
+
new_options = opts.merge(
|
81
|
+
:header_params => header_params,
|
82
|
+
:query_params => query_params,
|
83
|
+
:form_params => form_params,
|
84
|
+
:body => post_body,
|
85
|
+
:auth_names => auth_names,
|
86
|
+
:return_type => return_type
|
87
|
+
)
|
88
|
+
|
89
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
90
|
+
if @api_client.config.debugging
|
91
|
+
@api_client.config.logger.debug "API called: CommentRepliesApi#replies_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
92
|
+
end
|
93
|
+
response = ::Phrase::Response.new(data, headers)
|
94
|
+
return response, status_code, headers
|
95
|
+
end
|
96
|
+
|
97
|
+
# Create a reply
|
98
|
+
# Create a new reply for a comment.
|
99
|
+
# @param project_id [String] Project ID
|
100
|
+
# @param key_id [String] Translation Key ID
|
101
|
+
# @param comment_id [String] Comment ID
|
102
|
+
# @param [Hash] opts the optional parameters
|
103
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
104
|
+
# @option opts [String] :branch specify the branch to use
|
105
|
+
# @option opts [String] :message specify the message for the comment
|
106
|
+
# @return [Comment]
|
107
|
+
def reply_create(project_id, key_id, comment_id, opts = {})
|
108
|
+
data, _status_code, _headers = reply_create_with_http_info(project_id, key_id, comment_id, opts)
|
109
|
+
data
|
110
|
+
end
|
111
|
+
|
112
|
+
# Create a reply
|
113
|
+
# Create a new reply for a comment.
|
114
|
+
# @param project_id [String] Project ID
|
115
|
+
# @param key_id [String] Translation Key ID
|
116
|
+
# @param comment_id [String] Comment ID
|
117
|
+
# @param [Hash] opts the optional parameters
|
118
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
119
|
+
# @option opts [String] :branch specify the branch to use
|
120
|
+
# @option opts [String] :message specify the message for the comment
|
121
|
+
# @return [Array<(Response<(Comment)>, Integer, Hash)>] Response<(Comment)> data, response status code and response headers
|
122
|
+
def reply_create_with_http_info(project_id, key_id, comment_id, opts = {})
|
123
|
+
if @api_client.config.debugging
|
124
|
+
@api_client.config.logger.debug 'Calling API: CommentRepliesApi.reply_create ...'
|
125
|
+
end
|
126
|
+
# verify the required parameter 'project_id' is set
|
127
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
128
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentRepliesApi.reply_create"
|
129
|
+
end
|
130
|
+
# verify the required parameter 'key_id' is set
|
131
|
+
if @api_client.config.client_side_validation && key_id.nil?
|
132
|
+
fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentRepliesApi.reply_create"
|
133
|
+
end
|
134
|
+
# verify the required parameter 'comment_id' is set
|
135
|
+
if @api_client.config.client_side_validation && comment_id.nil?
|
136
|
+
fail ArgumentError, "Missing the required parameter 'comment_id' when calling CommentRepliesApi.reply_create"
|
137
|
+
end
|
138
|
+
# resource path
|
139
|
+
local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).sub('{' + 'comment_id' + '}', CGI.escape(comment_id.to_s))
|
140
|
+
|
141
|
+
# query parameters
|
142
|
+
query_params = opts[:query_params] || {}
|
143
|
+
query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
|
144
|
+
query_params[:'message'] = opts[:'message'] if !opts[:'message'].nil?
|
145
|
+
|
146
|
+
# header parameters
|
147
|
+
header_params = opts[:header_params] || {}
|
148
|
+
# HTTP header 'Accept' (if needed)
|
149
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
150
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
151
|
+
|
152
|
+
# form parameters
|
153
|
+
form_params = opts[:form_params] || {}
|
154
|
+
|
155
|
+
# http body (model)
|
156
|
+
post_body = opts[:body]
|
157
|
+
|
158
|
+
# return_type
|
159
|
+
return_type = opts[:return_type] || 'Comment'
|
160
|
+
|
161
|
+
# auth_names
|
162
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
163
|
+
|
164
|
+
new_options = opts.merge(
|
165
|
+
:header_params => header_params,
|
166
|
+
:query_params => query_params,
|
167
|
+
:form_params => form_params,
|
168
|
+
:body => post_body,
|
169
|
+
:auth_names => auth_names,
|
170
|
+
:return_type => return_type
|
171
|
+
)
|
172
|
+
|
173
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
174
|
+
if @api_client.config.debugging
|
175
|
+
@api_client.config.logger.debug "API called: CommentRepliesApi#reply_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
176
|
+
end
|
177
|
+
response = ::Phrase::Response.new(data, headers)
|
178
|
+
return response, status_code, headers
|
179
|
+
end
|
180
|
+
|
181
|
+
# Delete a reply
|
182
|
+
# Delete an existing reply.
|
183
|
+
# @param project_id [String] Project ID
|
184
|
+
# @param key_id [String] Translation Key ID
|
185
|
+
# @param comment_id [String] Comment ID
|
186
|
+
# @param id [String] ID
|
187
|
+
# @param [Hash] opts the optional parameters
|
188
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
189
|
+
# @option opts [String] :branch specify the branch to use
|
190
|
+
# @return [nil]
|
191
|
+
def reply_delete(project_id, key_id, comment_id, id, opts = {})
|
192
|
+
data, _status_code, _headers = reply_delete_with_http_info(project_id, key_id, comment_id, id, opts)
|
193
|
+
data
|
194
|
+
end
|
195
|
+
|
196
|
+
# Delete a reply
|
197
|
+
# Delete an existing reply.
|
198
|
+
# @param project_id [String] Project ID
|
199
|
+
# @param key_id [String] Translation Key ID
|
200
|
+
# @param comment_id [String] Comment ID
|
201
|
+
# @param id [String] ID
|
202
|
+
# @param [Hash] opts the optional parameters
|
203
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
204
|
+
# @option opts [String] :branch specify the branch to use
|
205
|
+
# @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
|
206
|
+
def reply_delete_with_http_info(project_id, key_id, comment_id, id, opts = {})
|
207
|
+
if @api_client.config.debugging
|
208
|
+
@api_client.config.logger.debug 'Calling API: CommentRepliesApi.reply_delete ...'
|
209
|
+
end
|
210
|
+
# verify the required parameter 'project_id' is set
|
211
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
212
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentRepliesApi.reply_delete"
|
213
|
+
end
|
214
|
+
# verify the required parameter 'key_id' is set
|
215
|
+
if @api_client.config.client_side_validation && key_id.nil?
|
216
|
+
fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentRepliesApi.reply_delete"
|
217
|
+
end
|
218
|
+
# verify the required parameter 'comment_id' is set
|
219
|
+
if @api_client.config.client_side_validation && comment_id.nil?
|
220
|
+
fail ArgumentError, "Missing the required parameter 'comment_id' when calling CommentRepliesApi.reply_delete"
|
221
|
+
end
|
222
|
+
# verify the required parameter 'id' is set
|
223
|
+
if @api_client.config.client_side_validation && id.nil?
|
224
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling CommentRepliesApi.reply_delete"
|
225
|
+
end
|
226
|
+
# resource path
|
227
|
+
local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).sub('{' + 'comment_id' + '}', CGI.escape(comment_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
228
|
+
|
229
|
+
# query parameters
|
230
|
+
query_params = opts[:query_params] || {}
|
231
|
+
query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
|
232
|
+
|
233
|
+
# header parameters
|
234
|
+
header_params = opts[:header_params] || {}
|
235
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
236
|
+
|
237
|
+
# form parameters
|
238
|
+
form_params = opts[:form_params] || {}
|
239
|
+
|
240
|
+
# http body (model)
|
241
|
+
post_body = opts[:body]
|
242
|
+
|
243
|
+
# return_type
|
244
|
+
return_type = opts[:return_type]
|
245
|
+
|
246
|
+
# auth_names
|
247
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
248
|
+
|
249
|
+
new_options = opts.merge(
|
250
|
+
:header_params => header_params,
|
251
|
+
:query_params => query_params,
|
252
|
+
:form_params => form_params,
|
253
|
+
:body => post_body,
|
254
|
+
:auth_names => auth_names,
|
255
|
+
:return_type => return_type
|
256
|
+
)
|
257
|
+
|
258
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
259
|
+
if @api_client.config.debugging
|
260
|
+
@api_client.config.logger.debug "API called: CommentRepliesApi#reply_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
261
|
+
end
|
262
|
+
response = ::Phrase::Response.new(data, headers)
|
263
|
+
return response, status_code, headers
|
264
|
+
end
|
265
|
+
|
266
|
+
# Mark a reply as read
|
267
|
+
# Mark a reply as read.
|
268
|
+
# @param project_id [String] Project ID
|
269
|
+
# @param key_id [String] Translation Key ID
|
270
|
+
# @param comment_id [String] Comment ID
|
271
|
+
# @param id [String] ID
|
272
|
+
# @param [Hash] opts the optional parameters
|
273
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
274
|
+
# @option opts [String] :branch specify the branch to use
|
275
|
+
# @return [nil]
|
276
|
+
def reply_mark_as_read(project_id, key_id, comment_id, id, opts = {})
|
277
|
+
data, _status_code, _headers = reply_mark_as_read_with_http_info(project_id, key_id, comment_id, id, opts)
|
278
|
+
data
|
279
|
+
end
|
280
|
+
|
281
|
+
# Mark a reply as read
|
282
|
+
# Mark a reply as read.
|
283
|
+
# @param project_id [String] Project ID
|
284
|
+
# @param key_id [String] Translation Key ID
|
285
|
+
# @param comment_id [String] Comment ID
|
286
|
+
# @param id [String] ID
|
287
|
+
# @param [Hash] opts the optional parameters
|
288
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
289
|
+
# @option opts [String] :branch specify the branch to use
|
290
|
+
# @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
|
291
|
+
def reply_mark_as_read_with_http_info(project_id, key_id, comment_id, id, opts = {})
|
292
|
+
if @api_client.config.debugging
|
293
|
+
@api_client.config.logger.debug 'Calling API: CommentRepliesApi.reply_mark_as_read ...'
|
294
|
+
end
|
295
|
+
# verify the required parameter 'project_id' is set
|
296
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
297
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentRepliesApi.reply_mark_as_read"
|
298
|
+
end
|
299
|
+
# verify the required parameter 'key_id' is set
|
300
|
+
if @api_client.config.client_side_validation && key_id.nil?
|
301
|
+
fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentRepliesApi.reply_mark_as_read"
|
302
|
+
end
|
303
|
+
# verify the required parameter 'comment_id' is set
|
304
|
+
if @api_client.config.client_side_validation && comment_id.nil?
|
305
|
+
fail ArgumentError, "Missing the required parameter 'comment_id' when calling CommentRepliesApi.reply_mark_as_read"
|
306
|
+
end
|
307
|
+
# verify the required parameter 'id' is set
|
308
|
+
if @api_client.config.client_side_validation && id.nil?
|
309
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling CommentRepliesApi.reply_mark_as_read"
|
310
|
+
end
|
311
|
+
# resource path
|
312
|
+
local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies/{id}/mark_as_read'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).sub('{' + 'comment_id' + '}', CGI.escape(comment_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
313
|
+
|
314
|
+
# query parameters
|
315
|
+
query_params = opts[:query_params] || {}
|
316
|
+
query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
|
317
|
+
|
318
|
+
# header parameters
|
319
|
+
header_params = opts[:header_params] || {}
|
320
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
321
|
+
|
322
|
+
# form parameters
|
323
|
+
form_params = opts[:form_params] || {}
|
324
|
+
|
325
|
+
# http body (model)
|
326
|
+
post_body = opts[:body]
|
327
|
+
|
328
|
+
# return_type
|
329
|
+
return_type = opts[:return_type]
|
330
|
+
|
331
|
+
# auth_names
|
332
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
333
|
+
|
334
|
+
new_options = opts.merge(
|
335
|
+
:header_params => header_params,
|
336
|
+
:query_params => query_params,
|
337
|
+
:form_params => form_params,
|
338
|
+
:body => post_body,
|
339
|
+
:auth_names => auth_names,
|
340
|
+
:return_type => return_type
|
341
|
+
)
|
342
|
+
|
343
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
344
|
+
if @api_client.config.debugging
|
345
|
+
@api_client.config.logger.debug "API called: CommentRepliesApi#reply_mark_as_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
346
|
+
end
|
347
|
+
response = ::Phrase::Response.new(data, headers)
|
348
|
+
return response, status_code, headers
|
349
|
+
end
|
350
|
+
|
351
|
+
# Mark a reply as unread
|
352
|
+
# Mark a reply as unread.
|
353
|
+
# @param project_id [String] Project ID
|
354
|
+
# @param key_id [String] Translation Key ID
|
355
|
+
# @param comment_id [String] Comment ID
|
356
|
+
# @param id [String] ID
|
357
|
+
# @param [Hash] opts the optional parameters
|
358
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
359
|
+
# @option opts [String] :branch specify the branch to use
|
360
|
+
# @return [nil]
|
361
|
+
def reply_mark_as_unread(project_id, key_id, comment_id, id, opts = {})
|
362
|
+
data, _status_code, _headers = reply_mark_as_unread_with_http_info(project_id, key_id, comment_id, id, opts)
|
363
|
+
data
|
364
|
+
end
|
365
|
+
|
366
|
+
# Mark a reply as unread
|
367
|
+
# Mark a reply as unread.
|
368
|
+
# @param project_id [String] Project ID
|
369
|
+
# @param key_id [String] Translation Key ID
|
370
|
+
# @param comment_id [String] Comment ID
|
371
|
+
# @param id [String] ID
|
372
|
+
# @param [Hash] opts the optional parameters
|
373
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
374
|
+
# @option opts [String] :branch specify the branch to use
|
375
|
+
# @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
|
376
|
+
def reply_mark_as_unread_with_http_info(project_id, key_id, comment_id, id, opts = {})
|
377
|
+
if @api_client.config.debugging
|
378
|
+
@api_client.config.logger.debug 'Calling API: CommentRepliesApi.reply_mark_as_unread ...'
|
379
|
+
end
|
380
|
+
# verify the required parameter 'project_id' is set
|
381
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
382
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentRepliesApi.reply_mark_as_unread"
|
383
|
+
end
|
384
|
+
# verify the required parameter 'key_id' is set
|
385
|
+
if @api_client.config.client_side_validation && key_id.nil?
|
386
|
+
fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentRepliesApi.reply_mark_as_unread"
|
387
|
+
end
|
388
|
+
# verify the required parameter 'comment_id' is set
|
389
|
+
if @api_client.config.client_side_validation && comment_id.nil?
|
390
|
+
fail ArgumentError, "Missing the required parameter 'comment_id' when calling CommentRepliesApi.reply_mark_as_unread"
|
391
|
+
end
|
392
|
+
# verify the required parameter 'id' is set
|
393
|
+
if @api_client.config.client_side_validation && id.nil?
|
394
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling CommentRepliesApi.reply_mark_as_unread"
|
395
|
+
end
|
396
|
+
# resource path
|
397
|
+
local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies/{id}/mark_as_unread'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).sub('{' + 'comment_id' + '}', CGI.escape(comment_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
398
|
+
|
399
|
+
# query parameters
|
400
|
+
query_params = opts[:query_params] || {}
|
401
|
+
query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
|
402
|
+
|
403
|
+
# header parameters
|
404
|
+
header_params = opts[:header_params] || {}
|
405
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
406
|
+
|
407
|
+
# form parameters
|
408
|
+
form_params = opts[:form_params] || {}
|
409
|
+
|
410
|
+
# http body (model)
|
411
|
+
post_body = opts[:body]
|
412
|
+
|
413
|
+
# return_type
|
414
|
+
return_type = opts[:return_type]
|
415
|
+
|
416
|
+
# auth_names
|
417
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
418
|
+
|
419
|
+
new_options = opts.merge(
|
420
|
+
:header_params => header_params,
|
421
|
+
:query_params => query_params,
|
422
|
+
:form_params => form_params,
|
423
|
+
:body => post_body,
|
424
|
+
:auth_names => auth_names,
|
425
|
+
:return_type => return_type
|
426
|
+
)
|
427
|
+
|
428
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
429
|
+
if @api_client.config.debugging
|
430
|
+
@api_client.config.logger.debug "API called: CommentRepliesApi#reply_mark_as_unread\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
431
|
+
end
|
432
|
+
response = ::Phrase::Response.new(data, headers)
|
433
|
+
return response, status_code, headers
|
434
|
+
end
|
435
|
+
|
436
|
+
# Get a single reply
|
437
|
+
# Get details on a single reply.
|
438
|
+
# @param project_id [String] Project ID
|
439
|
+
# @param key_id [String] Translation Key ID
|
440
|
+
# @param comment_id [String] Comment ID
|
441
|
+
# @param id [String] ID
|
442
|
+
# @param [Hash] opts the optional parameters
|
443
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
444
|
+
# @option opts [String] :branch specify the branch to use
|
445
|
+
# @return [Comment]
|
446
|
+
def reply_show(project_id, key_id, comment_id, id, opts = {})
|
447
|
+
data, _status_code, _headers = reply_show_with_http_info(project_id, key_id, comment_id, id, opts)
|
448
|
+
data
|
449
|
+
end
|
450
|
+
|
451
|
+
# Get a single reply
|
452
|
+
# Get details on a single reply.
|
453
|
+
# @param project_id [String] Project ID
|
454
|
+
# @param key_id [String] Translation Key ID
|
455
|
+
# @param comment_id [String] Comment ID
|
456
|
+
# @param id [String] ID
|
457
|
+
# @param [Hash] opts the optional parameters
|
458
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
459
|
+
# @option opts [String] :branch specify the branch to use
|
460
|
+
# @return [Array<(Response<(Comment)>, Integer, Hash)>] Response<(Comment)> data, response status code and response headers
|
461
|
+
def reply_show_with_http_info(project_id, key_id, comment_id, id, opts = {})
|
462
|
+
if @api_client.config.debugging
|
463
|
+
@api_client.config.logger.debug 'Calling API: CommentRepliesApi.reply_show ...'
|
464
|
+
end
|
465
|
+
# verify the required parameter 'project_id' is set
|
466
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
467
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling CommentRepliesApi.reply_show"
|
468
|
+
end
|
469
|
+
# verify the required parameter 'key_id' is set
|
470
|
+
if @api_client.config.client_side_validation && key_id.nil?
|
471
|
+
fail ArgumentError, "Missing the required parameter 'key_id' when calling CommentRepliesApi.reply_show"
|
472
|
+
end
|
473
|
+
# verify the required parameter 'comment_id' is set
|
474
|
+
if @api_client.config.client_side_validation && comment_id.nil?
|
475
|
+
fail ArgumentError, "Missing the required parameter 'comment_id' when calling CommentRepliesApi.reply_show"
|
476
|
+
end
|
477
|
+
# verify the required parameter 'id' is set
|
478
|
+
if @api_client.config.client_side_validation && id.nil?
|
479
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling CommentRepliesApi.reply_show"
|
480
|
+
end
|
481
|
+
# resource path
|
482
|
+
local_var_path = '/projects/{project_id}/keys/{key_id}/comments/{comment_id}/replies/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'key_id' + '}', CGI.escape(key_id.to_s)).sub('{' + 'comment_id' + '}', CGI.escape(comment_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
483
|
+
|
484
|
+
# query parameters
|
485
|
+
query_params = opts[:query_params] || {}
|
486
|
+
query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
|
487
|
+
|
488
|
+
# header parameters
|
489
|
+
header_params = opts[:header_params] || {}
|
490
|
+
# HTTP header 'Accept' (if needed)
|
491
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
492
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
493
|
+
|
494
|
+
# form parameters
|
495
|
+
form_params = opts[:form_params] || {}
|
496
|
+
|
497
|
+
# http body (model)
|
498
|
+
post_body = opts[:body]
|
499
|
+
|
500
|
+
# return_type
|
501
|
+
return_type = opts[:return_type] || 'Comment'
|
502
|
+
|
503
|
+
# auth_names
|
504
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
505
|
+
|
506
|
+
new_options = opts.merge(
|
507
|
+
:header_params => header_params,
|
508
|
+
:query_params => query_params,
|
509
|
+
:form_params => form_params,
|
510
|
+
:body => post_body,
|
511
|
+
:auth_names => auth_names,
|
512
|
+
:return_type => return_type
|
513
|
+
)
|
514
|
+
|
515
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
516
|
+
if @api_client.config.debugging
|
517
|
+
@api_client.config.logger.debug "API called: CommentRepliesApi#reply_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
518
|
+
end
|
519
|
+
response = ::Phrase::Response.new(data, headers)
|
520
|
+
return response, status_code, headers
|
521
|
+
end
|
522
|
+
end
|
523
|
+
end
|
@@ -14,6 +14,8 @@ module Phrase
|
|
14
14
|
# @param comment_create_parameters [CommentCreateParameters]
|
15
15
|
# @param [Hash] opts the optional parameters
|
16
16
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
17
|
+
# @option opts [String] :message specify the message for the comment
|
18
|
+
# @option opts [Array<String>] :locale_ids specify the locales for the comment
|
17
19
|
# @return [Comment]
|
18
20
|
def comment_create(project_id, key_id, comment_create_parameters, opts = {})
|
19
21
|
data, _status_code, _headers = comment_create_with_http_info(project_id, key_id, comment_create_parameters, opts)
|
@@ -27,6 +29,8 @@ module Phrase
|
|
27
29
|
# @param comment_create_parameters [CommentCreateParameters]
|
28
30
|
# @param [Hash] opts the optional parameters
|
29
31
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
32
|
+
# @option opts [String] :message specify the message for the comment
|
33
|
+
# @option opts [Array<String>] :locale_ids specify the locales for the comment
|
30
34
|
# @return [Array<(Response<(Comment)>, Integer, Hash)>] Response<(Comment)> data, response status code and response headers
|
31
35
|
def comment_create_with_http_info(project_id, key_id, comment_create_parameters, opts = {})
|
32
36
|
if @api_client.config.debugging
|
@@ -49,6 +53,8 @@ module Phrase
|
|
49
53
|
|
50
54
|
# query parameters
|
51
55
|
query_params = opts[:query_params] || {}
|
56
|
+
query_params[:'message'] = opts[:'message'] if !opts[:'message'].nil?
|
57
|
+
query_params[:'locale_ids'] = @api_client.build_collection_param(opts[:'locale_ids'], :multi) if !opts[:'locale_ids'].nil?
|
52
58
|
|
53
59
|
# header parameters
|
54
60
|
header_params = opts[:header_params] || {}
|
@@ -6,6 +6,8 @@ module Phrase
|
|
6
6
|
|
7
7
|
attr_accessor :message
|
8
8
|
|
9
|
+
attr_accessor :has_replies
|
10
|
+
|
9
11
|
attr_accessor :user
|
10
12
|
|
11
13
|
attr_accessor :created_at
|
@@ -14,15 +16,19 @@ module Phrase
|
|
14
16
|
|
15
17
|
attr_accessor :mentioned_users
|
16
18
|
|
19
|
+
attr_accessor :locales
|
20
|
+
|
17
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
18
22
|
def self.attribute_map
|
19
23
|
{
|
20
24
|
:'id' => :'id',
|
21
25
|
:'message' => :'message',
|
26
|
+
:'has_replies' => :'has_replies',
|
22
27
|
:'user' => :'user',
|
23
28
|
:'created_at' => :'created_at',
|
24
29
|
:'updated_at' => :'updated_at',
|
25
|
-
:'mentioned_users' => :'mentioned_users'
|
30
|
+
:'mentioned_users' => :'mentioned_users',
|
31
|
+
:'locales' => :'locales'
|
26
32
|
}
|
27
33
|
end
|
28
34
|
|
@@ -31,10 +37,12 @@ module Phrase
|
|
31
37
|
{
|
32
38
|
:'id' => :'String',
|
33
39
|
:'message' => :'String',
|
40
|
+
:'has_replies' => :'Boolean',
|
34
41
|
:'user' => :'UserPreview',
|
35
42
|
:'created_at' => :'DateTime',
|
36
43
|
:'updated_at' => :'DateTime',
|
37
|
-
:'mentioned_users' => :'Array<UserPreview>'
|
44
|
+
:'mentioned_users' => :'Array<UserPreview>',
|
45
|
+
:'locales' => :'Array<LocalePreview>'
|
38
46
|
}
|
39
47
|
end
|
40
48
|
|
@@ -67,6 +75,10 @@ module Phrase
|
|
67
75
|
self.message = attributes[:'message']
|
68
76
|
end
|
69
77
|
|
78
|
+
if attributes.key?(:'has_replies')
|
79
|
+
self.has_replies = attributes[:'has_replies']
|
80
|
+
end
|
81
|
+
|
70
82
|
if attributes.key?(:'user')
|
71
83
|
self.user = attributes[:'user']
|
72
84
|
end
|
@@ -84,6 +96,12 @@ module Phrase
|
|
84
96
|
self.mentioned_users = value
|
85
97
|
end
|
86
98
|
end
|
99
|
+
|
100
|
+
if attributes.key?(:'locales')
|
101
|
+
if (value = attributes[:'locales']).is_a?(Array)
|
102
|
+
self.locales = value
|
103
|
+
end
|
104
|
+
end
|
87
105
|
end
|
88
106
|
|
89
107
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -106,10 +124,12 @@ module Phrase
|
|
106
124
|
self.class == o.class &&
|
107
125
|
id == o.id &&
|
108
126
|
message == o.message &&
|
127
|
+
has_replies == o.has_replies &&
|
109
128
|
user == o.user &&
|
110
129
|
created_at == o.created_at &&
|
111
130
|
updated_at == o.updated_at &&
|
112
|
-
mentioned_users == o.mentioned_users
|
131
|
+
mentioned_users == o.mentioned_users &&
|
132
|
+
locales == o.locales
|
113
133
|
end
|
114
134
|
|
115
135
|
# @see the `==` method
|
@@ -121,7 +141,7 @@ module Phrase
|
|
121
141
|
# Calculates hash code according to all attributes.
|
122
142
|
# @return [Integer] Hash code
|
123
143
|
def hash
|
124
|
-
[id, message, user, created_at, updated_at, mentioned_users].hash
|
144
|
+
[id, message, has_replies, user, created_at, updated_at, mentioned_users, locales].hash
|
125
145
|
end
|
126
146
|
|
127
147
|
# Builds the object from hash
|
data/lib/phrase/version.rb
CHANGED
data/lib/phrase.rb
CHANGED
@@ -220,6 +220,7 @@ require 'phrase/api/bitbucket_sync_api'
|
|
220
220
|
require 'phrase/api/blacklisted_keys_api'
|
221
221
|
require 'phrase/api/branches_api'
|
222
222
|
require 'phrase/api/comment_reactions_api'
|
223
|
+
require 'phrase/api/comment_replies_api'
|
223
224
|
require 'phrase/api/comments_api'
|
224
225
|
require 'phrase/api/distributions_api'
|
225
226
|
require 'phrase/api/documents_api'
|
@@ -29,6 +29,7 @@ describe 'CommentReactionsApi' do
|
|
29
29
|
# @param [Hash] opts the optional parameters
|
30
30
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
31
31
|
# @option opts [String] :branch specify the branch to use
|
32
|
+
# @option opts [String] :emoji specify the emoji for the reaction
|
32
33
|
# @return [CommentReaction]
|
33
34
|
describe 'reaction_create test' do
|
34
35
|
it 'should work' do
|