zyphr 0.1.75 → 0.1.76

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -1
  3. data/docs/CreateInboxLabelRequest.md +20 -0
  4. data/docs/Draft.md +36 -0
  5. data/docs/DraftAddress.md +20 -0
  6. data/docs/DraftListResponse.md +20 -0
  7. data/docs/DraftRequest.md +30 -0
  8. data/docs/DraftResponse.md +20 -0
  9. data/docs/ForwardEmailRequest.md +34 -0
  10. data/docs/InboundEmailApi.md +1853 -157
  11. data/docs/InboxLabel.md +26 -0
  12. data/docs/InboxLabelListResponse.md +20 -0
  13. data/docs/InboxLabelResponse.md +20 -0
  14. data/docs/{ReplyToInboundEmailRequest.md → ReplyEmailRequest.md} +3 -3
  15. data/docs/Thread.md +40 -0
  16. data/docs/ThreadEmail.md +38 -0
  17. data/docs/ThreadEmailAttachmentsInner.md +24 -0
  18. data/docs/ThreadEmailFrom.md +20 -0
  19. data/docs/ThreadEmailListResponse.md +20 -0
  20. data/docs/ThreadEmailResponse.md +20 -0
  21. data/docs/ThreadFolder.md +15 -0
  22. data/docs/ThreadLabelsInner.md +22 -0
  23. data/docs/ThreadLabelsRequest.md +18 -0
  24. data/docs/ThreadListResponse.md +20 -0
  25. data/docs/ThreadListResponseMeta.md +20 -0
  26. data/docs/ThreadResponse.md +20 -0
  27. data/docs/UpdateInboxLabelRequest.md +20 -0
  28. data/docs/UpdateThreadRequest.md +22 -0
  29. data/lib/zyphr/api/inbound_email_api.rb +1768 -168
  30. data/lib/zyphr/models/create_inbox_label_request.rb +272 -0
  31. data/lib/zyphr/models/draft.rb +375 -0
  32. data/lib/zyphr/models/draft_address.rb +249 -0
  33. data/lib/zyphr/models/draft_list_response.rb +231 -0
  34. data/lib/zyphr/models/draft_request.rb +299 -0
  35. data/lib/zyphr/models/draft_response.rb +229 -0
  36. data/lib/zyphr/models/forward_email_request.rb +393 -0
  37. data/lib/zyphr/models/inbox_label.rb +258 -0
  38. data/lib/zyphr/models/inbox_label_list_response.rb +231 -0
  39. data/lib/zyphr/models/inbox_label_response.rb +229 -0
  40. data/lib/zyphr/models/{reply_to_inbound_email_request.rb → reply_email_request.rb} +4 -3
  41. data/lib/zyphr/models/thread.rb +352 -0
  42. data/lib/zyphr/models/thread_email.rb +353 -0
  43. data/lib/zyphr/models/thread_email_attachments_inner.rb +248 -0
  44. data/lib/zyphr/models/thread_email_from.rb +230 -0
  45. data/lib/zyphr/models/thread_email_list_response.rb +231 -0
  46. data/lib/zyphr/models/thread_email_response.rb +229 -0
  47. data/lib/zyphr/models/thread_folder.rb +43 -0
  48. data/lib/zyphr/models/thread_labels_inner.rb +239 -0
  49. data/lib/zyphr/models/thread_labels_request.rb +248 -0
  50. data/lib/zyphr/models/thread_list_response.rb +231 -0
  51. data/lib/zyphr/models/thread_list_response_meta.rb +237 -0
  52. data/lib/zyphr/models/thread_response.rb +229 -0
  53. data/lib/zyphr/models/update_inbox_label_request.rb +264 -0
  54. data/lib/zyphr/models/update_thread_request.rb +262 -0
  55. data/lib/zyphr.rb +25 -1
  56. data/spec/api/inbound_email_api_spec.rb +292 -1
  57. data/spec/models/create_inbox_label_request_spec.rb +42 -0
  58. data/spec/models/draft_address_spec.rb +42 -0
  59. data/spec/models/draft_list_response_spec.rb +42 -0
  60. data/spec/models/draft_request_spec.rb +72 -0
  61. data/spec/models/draft_response_spec.rb +42 -0
  62. data/spec/models/draft_spec.rb +90 -0
  63. data/spec/models/forward_email_request_spec.rb +88 -0
  64. data/spec/models/inbox_label_list_response_spec.rb +42 -0
  65. data/spec/models/inbox_label_response_spec.rb +42 -0
  66. data/spec/models/inbox_label_spec.rb +60 -0
  67. data/spec/models/{reply_to_inbound_email_request_spec.rb → reply_email_request_spec.rb} +6 -6
  68. data/spec/models/thread_email_attachments_inner_spec.rb +54 -0
  69. data/spec/models/thread_email_from_spec.rb +42 -0
  70. data/spec/models/thread_email_list_response_spec.rb +42 -0
  71. data/spec/models/thread_email_response_spec.rb +42 -0
  72. data/spec/models/thread_email_spec.rb +100 -0
  73. data/spec/models/thread_folder_spec.rb +30 -0
  74. data/spec/models/thread_labels_inner_spec.rb +48 -0
  75. data/spec/models/thread_labels_request_spec.rb +36 -0
  76. data/spec/models/thread_list_response_meta_spec.rb +42 -0
  77. data/spec/models/thread_list_response_spec.rb +42 -0
  78. data/spec/models/thread_response_spec.rb +42 -0
  79. data/spec/models/thread_spec.rb +102 -0
  80. data/spec/models/update_inbox_label_request_spec.rb +42 -0
  81. data/spec/models/update_thread_request_spec.rb +48 -0
  82. data/zyphr.gemspec +1 -1
  83. metadata +102 -6
@@ -19,6 +19,78 @@ module Zyphr
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Add labels to a thread
23
+ # @param thread_id [String]
24
+ # @param thread_labels_request [ThreadLabelsRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [ThreadResponse]
27
+ def add_inbox_thread_labels(thread_id, thread_labels_request, opts = {})
28
+ data, _status_code, _headers = add_inbox_thread_labels_with_http_info(thread_id, thread_labels_request, opts)
29
+ data
30
+ end
31
+
32
+ # Add labels to a thread
33
+ # @param thread_id [String]
34
+ # @param thread_labels_request [ThreadLabelsRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(ThreadResponse, Integer, Hash)>] ThreadResponse data, response status code and response headers
37
+ def add_inbox_thread_labels_with_http_info(thread_id, thread_labels_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.add_inbox_thread_labels ...'
40
+ end
41
+ # verify the required parameter 'thread_id' is set
42
+ if @api_client.config.client_side_validation && thread_id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'thread_id' when calling InboundEmailApi.add_inbox_thread_labels"
44
+ end
45
+ # verify the required parameter 'thread_labels_request' is set
46
+ if @api_client.config.client_side_validation && thread_labels_request.nil?
47
+ fail ArgumentError, "Missing the required parameter 'thread_labels_request' when calling InboundEmailApi.add_inbox_thread_labels"
48
+ end
49
+ # resource path
50
+ local_var_path = '/inboxes/threads/{threadId}/labels'.sub('{' + 'threadId' + '}', CGI.escape(thread_id.to_s))
51
+
52
+ # query parameters
53
+ query_params = opts[:query_params] || {}
54
+
55
+ # header parameters
56
+ header_params = opts[:header_params] || {}
57
+ # HTTP header 'Accept' (if needed)
58
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
59
+ # HTTP header 'Content-Type'
60
+ content_type = @api_client.select_header_content_type(['application/json'])
61
+ if !content_type.nil?
62
+ header_params['Content-Type'] = content_type
63
+ end
64
+
65
+ # form parameters
66
+ form_params = opts[:form_params] || {}
67
+
68
+ # http body (model)
69
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(thread_labels_request)
70
+
71
+ # return_type
72
+ return_type = opts[:debug_return_type] || 'ThreadResponse'
73
+
74
+ # auth_names
75
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
76
+
77
+ new_options = opts.merge(
78
+ :operation => :"InboundEmailApi.add_inbox_thread_labels",
79
+ :header_params => header_params,
80
+ :query_params => query_params,
81
+ :form_params => form_params,
82
+ :body => post_body,
83
+ :auth_names => auth_names,
84
+ :return_type => return_type
85
+ )
86
+
87
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
88
+ if @api_client.config.debugging
89
+ @api_client.config.logger.debug "API called: InboundEmailApi#add_inbox_thread_labels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
90
+ end
91
+ return data, status_code, headers
92
+ end
93
+
22
94
  # Create an inbox
23
95
  # Create a named receiving address, `<local_part>@inbound.<domain>`, on a domain with inbound email enabled. Mail is routed to the named inbox matching its address, otherwise to the domain's catch-all inbox (`*@inbound.<domain>`, created when inbound is enabled); with the catch-all disabled it is dropped. Test-mode keys cannot create, update or delete inboxes, because inboxes change live mail routing. Requires a plan with inbound email (Starter or higher).
24
96
  # @param create_inbox_request [CreateInboxRequest]
@@ -87,52 +159,59 @@ module Zyphr
87
159
  return data, status_code, headers
88
160
  end
89
161
 
90
- # Delete an inbox
91
- # Delete a named inbox. Mail it already received is kept (its `inbox_id` becomes null), and new mail to its address goes to the catch-all if enabled. The catch-all cannot be deleted (422 `catch_all_not_deletable`); disable it with `PATCH { \"enabled\": false }`.
92
- # @param id [String]
162
+ # Create a draft
163
+ # Every field is optional; the draft is checked when it is sent. Give a `thread_id` to draft a reply: Zyphr sets its recipient and subject from the thread when it is sent, so a reply draft can't have `to` or `subject`. Without a thread, the draft is a new email.
164
+ # @param draft_request [DraftRequest]
93
165
  # @param [Hash] opts the optional parameters
94
- # @return [nil]
95
- def delete_inbox(id, opts = {})
96
- delete_inbox_with_http_info(id, opts)
97
- nil
166
+ # @return [DraftResponse]
167
+ def create_inbox_draft(draft_request, opts = {})
168
+ data, _status_code, _headers = create_inbox_draft_with_http_info(draft_request, opts)
169
+ data
98
170
  end
99
171
 
100
- # Delete an inbox
101
- # Delete a named inbox. Mail it already received is kept (its &#x60;inbox_id&#x60; becomes null), and new mail to its address goes to the catch-all if enabled. The catch-all cannot be deleted (422 &#x60;catch_all_not_deletable&#x60;); disable it with &#x60;PATCH { \&quot;enabled\&quot;: false }&#x60;.
102
- # @param id [String]
172
+ # Create a draft
173
+ # Every field is optional; the draft is checked when it is sent. Give a &#x60;thread_id&#x60; to draft a reply: Zyphr sets its recipient and subject from the thread when it is sent, so a reply draft can&#39;t have &#x60;to&#x60; or &#x60;subject&#x60;. Without a thread, the draft is a new email.
174
+ # @param draft_request [DraftRequest]
103
175
  # @param [Hash] opts the optional parameters
104
- # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
105
- def delete_inbox_with_http_info(id, opts = {})
176
+ # @return [Array<(DraftResponse, Integer, Hash)>] DraftResponse data, response status code and response headers
177
+ def create_inbox_draft_with_http_info(draft_request, opts = {})
106
178
  if @api_client.config.debugging
107
- @api_client.config.logger.debug 'Calling API: InboundEmailApi.delete_inbox ...'
179
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.create_inbox_draft ...'
108
180
  end
109
- # verify the required parameter 'id' is set
110
- if @api_client.config.client_side_validation && id.nil?
111
- fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.delete_inbox"
181
+ # verify the required parameter 'draft_request' is set
182
+ if @api_client.config.client_side_validation && draft_request.nil?
183
+ fail ArgumentError, "Missing the required parameter 'draft_request' when calling InboundEmailApi.create_inbox_draft"
112
184
  end
113
185
  # resource path
114
- local_var_path = '/inboxes/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
186
+ local_var_path = '/inboxes/drafts'
115
187
 
116
188
  # query parameters
117
189
  query_params = opts[:query_params] || {}
118
190
 
119
191
  # header parameters
120
192
  header_params = opts[:header_params] || {}
193
+ # HTTP header 'Accept' (if needed)
194
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
195
+ # HTTP header 'Content-Type'
196
+ content_type = @api_client.select_header_content_type(['application/json'])
197
+ if !content_type.nil?
198
+ header_params['Content-Type'] = content_type
199
+ end
121
200
 
122
201
  # form parameters
123
202
  form_params = opts[:form_params] || {}
124
203
 
125
204
  # http body (model)
126
- post_body = opts[:debug_body]
205
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(draft_request)
127
206
 
128
207
  # return_type
129
- return_type = opts[:debug_return_type]
208
+ return_type = opts[:debug_return_type] || 'DraftResponse'
130
209
 
131
210
  # auth_names
132
211
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
133
212
 
134
213
  new_options = opts.merge(
135
- :operation => :"InboundEmailApi.delete_inbox",
214
+ :operation => :"InboundEmailApi.create_inbox_draft",
136
215
  :header_params => header_params,
137
216
  :query_params => query_params,
138
217
  :form_params => form_params,
@@ -141,44 +220,36 @@ module Zyphr
141
220
  :return_type => return_type
142
221
  )
143
222
 
144
- data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
223
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
145
224
  if @api_client.config.debugging
146
- @api_client.config.logger.debug "API called: InboundEmailApi#delete_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
225
+ @api_client.config.logger.debug "API called: InboundEmailApi#create_inbox_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
147
226
  end
148
227
  return data, status_code, headers
149
228
  end
150
229
 
151
- # Get an attachment download URL
152
- # Return a short-lived presigned S3 download URL for one attachment of a received email. `attachmentId` is the positional id from the email's `attachments` array.
153
- # @param id [String]
154
- # @param attachment_id [String]
230
+ # Create a label
231
+ # @param create_inbox_label_request [CreateInboxLabelRequest]
155
232
  # @param [Hash] opts the optional parameters
156
- # @return [InboundAttachmentUrlResponse]
157
- def get_inbound_attachment_url(id, attachment_id, opts = {})
158
- data, _status_code, _headers = get_inbound_attachment_url_with_http_info(id, attachment_id, opts)
233
+ # @return [InboxLabelResponse]
234
+ def create_inbox_label(create_inbox_label_request, opts = {})
235
+ data, _status_code, _headers = create_inbox_label_with_http_info(create_inbox_label_request, opts)
159
236
  data
160
237
  end
161
238
 
162
- # Get an attachment download URL
163
- # Return a short-lived presigned S3 download URL for one attachment of a received email. &#x60;attachmentId&#x60; is the positional id from the email&#39;s &#x60;attachments&#x60; array.
164
- # @param id [String]
165
- # @param attachment_id [String]
239
+ # Create a label
240
+ # @param create_inbox_label_request [CreateInboxLabelRequest]
166
241
  # @param [Hash] opts the optional parameters
167
- # @return [Array<(InboundAttachmentUrlResponse, Integer, Hash)>] InboundAttachmentUrlResponse data, response status code and response headers
168
- def get_inbound_attachment_url_with_http_info(id, attachment_id, opts = {})
242
+ # @return [Array<(InboxLabelResponse, Integer, Hash)>] InboxLabelResponse data, response status code and response headers
243
+ def create_inbox_label_with_http_info(create_inbox_label_request, opts = {})
169
244
  if @api_client.config.debugging
170
- @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbound_attachment_url ...'
171
- end
172
- # verify the required parameter 'id' is set
173
- if @api_client.config.client_side_validation && id.nil?
174
- fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.get_inbound_attachment_url"
245
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.create_inbox_label ...'
175
246
  end
176
- # verify the required parameter 'attachment_id' is set
177
- if @api_client.config.client_side_validation && attachment_id.nil?
178
- fail ArgumentError, "Missing the required parameter 'attachment_id' when calling InboundEmailApi.get_inbound_attachment_url"
247
+ # verify the required parameter 'create_inbox_label_request' is set
248
+ if @api_client.config.client_side_validation && create_inbox_label_request.nil?
249
+ fail ArgumentError, "Missing the required parameter 'create_inbox_label_request' when calling InboundEmailApi.create_inbox_label"
179
250
  end
180
251
  # resource path
181
- local_var_path = '/inbound-emails/{id}/attachments/{attachmentId}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s))
252
+ local_var_path = '/inboxes/labels'
182
253
 
183
254
  # query parameters
184
255
  query_params = opts[:query_params] || {}
@@ -187,21 +258,26 @@ module Zyphr
187
258
  header_params = opts[:header_params] || {}
188
259
  # HTTP header 'Accept' (if needed)
189
260
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
261
+ # HTTP header 'Content-Type'
262
+ content_type = @api_client.select_header_content_type(['application/json'])
263
+ if !content_type.nil?
264
+ header_params['Content-Type'] = content_type
265
+ end
190
266
 
191
267
  # form parameters
192
268
  form_params = opts[:form_params] || {}
193
269
 
194
270
  # http body (model)
195
- post_body = opts[:debug_body]
271
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_inbox_label_request)
196
272
 
197
273
  # return_type
198
- return_type = opts[:debug_return_type] || 'InboundAttachmentUrlResponse'
274
+ return_type = opts[:debug_return_type] || 'InboxLabelResponse'
199
275
 
200
276
  # auth_names
201
277
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
202
278
 
203
279
  new_options = opts.merge(
204
- :operation => :"InboundEmailApi.get_inbound_attachment_url",
280
+ :operation => :"InboundEmailApi.create_inbox_label",
205
281
  :header_params => header_params,
206
282
  :query_params => query_params,
207
283
  :form_params => form_params,
@@ -210,46 +286,44 @@ module Zyphr
210
286
  :return_type => return_type
211
287
  )
212
288
 
213
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
289
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
214
290
  if @api_client.config.debugging
215
- @api_client.config.logger.debug "API called: InboundEmailApi#get_inbound_attachment_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
291
+ @api_client.config.logger.debug "API called: InboundEmailApi#create_inbox_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
216
292
  end
217
293
  return data, status_code, headers
218
294
  end
219
295
 
220
- # Get a received email
221
- # Retrieve a single inbound email by id (scoped to the project).
296
+ # Delete an inbox
297
+ # Delete a named inbox. Mail it already received is kept (its `inbox_id` becomes null), and new mail to its address goes to the catch-all if enabled. The catch-all cannot be deleted (422 `catch_all_not_deletable`); disable it with `PATCH { \"enabled\": false }`.
222
298
  # @param id [String]
223
299
  # @param [Hash] opts the optional parameters
224
- # @return [InboundEmailResponse]
225
- def get_inbound_email(id, opts = {})
226
- data, _status_code, _headers = get_inbound_email_with_http_info(id, opts)
227
- data
300
+ # @return [nil]
301
+ def delete_inbox(id, opts = {})
302
+ delete_inbox_with_http_info(id, opts)
303
+ nil
228
304
  end
229
305
 
230
- # Get a received email
231
- # Retrieve a single inbound email by id (scoped to the project).
306
+ # Delete an inbox
307
+ # Delete a named inbox. Mail it already received is kept (its &#x60;inbox_id&#x60; becomes null), and new mail to its address goes to the catch-all if enabled. The catch-all cannot be deleted (422 &#x60;catch_all_not_deletable&#x60;); disable it with &#x60;PATCH { \&quot;enabled\&quot;: false }&#x60;.
232
308
  # @param id [String]
233
309
  # @param [Hash] opts the optional parameters
234
- # @return [Array<(InboundEmailResponse, Integer, Hash)>] InboundEmailResponse data, response status code and response headers
235
- def get_inbound_email_with_http_info(id, opts = {})
310
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
311
+ def delete_inbox_with_http_info(id, opts = {})
236
312
  if @api_client.config.debugging
237
- @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbound_email ...'
313
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.delete_inbox ...'
238
314
  end
239
315
  # verify the required parameter 'id' is set
240
316
  if @api_client.config.client_side_validation && id.nil?
241
- fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.get_inbound_email"
317
+ fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.delete_inbox"
242
318
  end
243
319
  # resource path
244
- local_var_path = '/inbound-emails/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
320
+ local_var_path = '/inboxes/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
245
321
 
246
322
  # query parameters
247
323
  query_params = opts[:query_params] || {}
248
324
 
249
325
  # header parameters
250
326
  header_params = opts[:header_params] || {}
251
- # HTTP header 'Accept' (if needed)
252
- header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
253
327
 
254
328
  # form parameters
255
329
  form_params = opts[:form_params] || {}
@@ -258,13 +332,13 @@ module Zyphr
258
332
  post_body = opts[:debug_body]
259
333
 
260
334
  # return_type
261
- return_type = opts[:debug_return_type] || 'InboundEmailResponse'
335
+ return_type = opts[:debug_return_type]
262
336
 
263
337
  # auth_names
264
338
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
265
339
 
266
340
  new_options = opts.merge(
267
- :operation => :"InboundEmailApi.get_inbound_email",
341
+ :operation => :"InboundEmailApi.delete_inbox",
268
342
  :header_params => header_params,
269
343
  :query_params => query_params,
270
344
  :form_params => form_params,
@@ -273,44 +347,42 @@ module Zyphr
273
347
  :return_type => return_type
274
348
  )
275
349
 
276
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
350
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
277
351
  if @api_client.config.debugging
278
- @api_client.config.logger.debug "API called: InboundEmailApi#get_inbound_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
352
+ @api_client.config.logger.debug "API called: InboundEmailApi#delete_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
279
353
  end
280
354
  return data, status_code, headers
281
355
  end
282
356
 
283
- # Get an inbox
284
- # @param id [String]
357
+ # Delete a draft
358
+ # @param draft_id [String]
285
359
  # @param [Hash] opts the optional parameters
286
- # @return [InboxResponse]
287
- def get_inbox(id, opts = {})
288
- data, _status_code, _headers = get_inbox_with_http_info(id, opts)
289
- data
360
+ # @return [nil]
361
+ def delete_inbox_draft(draft_id, opts = {})
362
+ delete_inbox_draft_with_http_info(draft_id, opts)
363
+ nil
290
364
  end
291
365
 
292
- # Get an inbox
293
- # @param id [String]
366
+ # Delete a draft
367
+ # @param draft_id [String]
294
368
  # @param [Hash] opts the optional parameters
295
- # @return [Array<(InboxResponse, Integer, Hash)>] InboxResponse data, response status code and response headers
296
- def get_inbox_with_http_info(id, opts = {})
369
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
370
+ def delete_inbox_draft_with_http_info(draft_id, opts = {})
297
371
  if @api_client.config.debugging
298
- @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbox ...'
372
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.delete_inbox_draft ...'
299
373
  end
300
- # verify the required parameter 'id' is set
301
- if @api_client.config.client_side_validation && id.nil?
302
- fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.get_inbox"
374
+ # verify the required parameter 'draft_id' is set
375
+ if @api_client.config.client_side_validation && draft_id.nil?
376
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling InboundEmailApi.delete_inbox_draft"
303
377
  end
304
378
  # resource path
305
- local_var_path = '/inboxes/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
379
+ local_var_path = '/inboxes/drafts/{draftId}'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s))
306
380
 
307
381
  # query parameters
308
382
  query_params = opts[:query_params] || {}
309
383
 
310
384
  # header parameters
311
385
  header_params = opts[:header_params] || {}
312
- # HTTP header 'Accept' (if needed)
313
- header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
314
386
 
315
387
  # form parameters
316
388
  form_params = opts[:form_params] || {}
@@ -319,13 +391,13 @@ module Zyphr
319
391
  post_body = opts[:debug_body]
320
392
 
321
393
  # return_type
322
- return_type = opts[:debug_return_type] || 'InboxResponse'
394
+ return_type = opts[:debug_return_type]
323
395
 
324
396
  # auth_names
325
397
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
326
398
 
327
399
  new_options = opts.merge(
328
- :operation => :"InboundEmailApi.get_inbox",
400
+ :operation => :"InboundEmailApi.delete_inbox_draft",
329
401
  :header_params => header_params,
330
402
  :query_params => query_params,
331
403
  :form_params => form_params,
@@ -334,66 +406,44 @@ module Zyphr
334
406
  :return_type => return_type
335
407
  )
336
408
 
337
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
409
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
338
410
  if @api_client.config.debugging
339
- @api_client.config.logger.debug "API called: InboundEmailApi#get_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
411
+ @api_client.config.logger.debug "API called: InboundEmailApi#delete_inbox_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
340
412
  end
341
413
  return data, status_code, headers
342
414
  end
343
415
 
344
- # List received emails
345
- # List inbound (received) emails for the project, newest first. By default only delivered mail (`received`/`processed`) is returned; pass `include_withheld=true` to also see quarantined/dropped.
416
+ # Delete a label
417
+ # Also removes it from every thread.
418
+ # @param label_id [String]
346
419
  # @param [Hash] opts the optional parameters
347
- # @option opts [String] :status
348
- # @option opts [String] :to Filter by receiving address
349
- # @option opts [String] :inbox_id Only mail that landed in this inbox (see /inboxes)
350
- # @option opts [Boolean] :include_withheld Include quarantined/dropped mail
351
- # @option opts [Integer] :limit (default to 50)
352
- # @option opts [Integer] :offset (default to 0)
353
- # @return [InboundEmailListResponse]
354
- def list_inbound_emails(opts = {})
355
- data, _status_code, _headers = list_inbound_emails_with_http_info(opts)
356
- data
420
+ # @return [nil]
421
+ def delete_inbox_label(label_id, opts = {})
422
+ delete_inbox_label_with_http_info(label_id, opts)
423
+ nil
357
424
  end
358
425
 
359
- # List received emails
360
- # List inbound (received) emails for the project, newest first. By default only delivered mail (&#x60;received&#x60;/&#x60;processed&#x60;) is returned; pass &#x60;include_withheld&#x3D;true&#x60; to also see quarantined/dropped.
426
+ # Delete a label
427
+ # Also removes it from every thread.
428
+ # @param label_id [String]
361
429
  # @param [Hash] opts the optional parameters
362
- # @option opts [String] :status
363
- # @option opts [String] :to Filter by receiving address
364
- # @option opts [String] :inbox_id Only mail that landed in this inbox (see /inboxes)
365
- # @option opts [Boolean] :include_withheld Include quarantined/dropped mail
366
- # @option opts [Integer] :limit (default to 50)
367
- # @option opts [Integer] :offset (default to 0)
368
- # @return [Array<(InboundEmailListResponse, Integer, Hash)>] InboundEmailListResponse data, response status code and response headers
369
- def list_inbound_emails_with_http_info(opts = {})
430
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
431
+ def delete_inbox_label_with_http_info(label_id, opts = {})
370
432
  if @api_client.config.debugging
371
- @api_client.config.logger.debug 'Calling API: InboundEmailApi.list_inbound_emails ...'
372
- end
373
- allowable_values = ["received", "processed", "quarantined", "dropped", "failed"]
374
- if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
375
- fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
433
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.delete_inbox_label ...'
376
434
  end
377
- if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
378
- fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboundEmailApi.list_inbound_emails, must be smaller than or equal to 100.'
435
+ # verify the required parameter 'label_id' is set
436
+ if @api_client.config.client_side_validation && label_id.nil?
437
+ fail ArgumentError, "Missing the required parameter 'label_id' when calling InboundEmailApi.delete_inbox_label"
379
438
  end
380
-
381
439
  # resource path
382
- local_var_path = '/inbound-emails'
440
+ local_var_path = '/inboxes/labels/{labelId}'.sub('{' + 'labelId' + '}', CGI.escape(label_id.to_s))
383
441
 
384
442
  # query parameters
385
443
  query_params = opts[:query_params] || {}
386
- query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
387
- query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
388
- query_params[:'inbox_id'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
389
- query_params[:'include_withheld'] = opts[:'include_withheld'] if !opts[:'include_withheld'].nil?
390
- query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
391
- query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
392
444
 
393
445
  # header parameters
394
446
  header_params = opts[:header_params] || {}
395
- # HTTP header 'Accept' (if needed)
396
- header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
397
447
 
398
448
  # form parameters
399
449
  form_params = opts[:form_params] || {}
@@ -402,13 +452,13 @@ module Zyphr
402
452
  post_body = opts[:debug_body]
403
453
 
404
454
  # return_type
405
- return_type = opts[:debug_return_type] || 'InboundEmailListResponse'
455
+ return_type = opts[:debug_return_type]
406
456
 
407
457
  # auth_names
408
458
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
409
459
 
410
460
  new_options = opts.merge(
411
- :operation => :"InboundEmailApi.list_inbound_emails",
461
+ :operation => :"InboundEmailApi.delete_inbox_label",
412
462
  :header_params => header_params,
413
463
  :query_params => query_params,
414
464
  :form_params => form_params,
@@ -417,41 +467,44 @@ module Zyphr
417
467
  :return_type => return_type
418
468
  )
419
469
 
420
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
470
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
421
471
  if @api_client.config.debugging
422
- @api_client.config.logger.debug "API called: InboundEmailApi#list_inbound_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
472
+ @api_client.config.logger.debug "API called: InboundEmailApi#delete_inbox_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
423
473
  end
424
474
  return data, status_code, headers
425
475
  end
426
476
 
427
- # List inboxes
477
+ # Delete a thread
478
+ # Deletes the conversation. Its emails are kept and still appear in the received list, unthreaded.
479
+ # @param thread_id [String]
428
480
  # @param [Hash] opts the optional parameters
429
- # @option opts [Boolean] :include_counts Add &#x60;received_count&#x60; to each inbox and &#x60;meta.received_total&#x60; (all delivered mail, including mail with no inbox). Counts use the same filter as the default received-email list.
430
- # @return [InboxListResponse]
431
- def list_inboxes(opts = {})
432
- data, _status_code, _headers = list_inboxes_with_http_info(opts)
433
- data
481
+ # @return [nil]
482
+ def delete_inbox_thread(thread_id, opts = {})
483
+ delete_inbox_thread_with_http_info(thread_id, opts)
484
+ nil
434
485
  end
435
486
 
436
- # List inboxes
487
+ # Delete a thread
488
+ # Deletes the conversation. Its emails are kept and still appear in the received list, unthreaded.
489
+ # @param thread_id [String]
437
490
  # @param [Hash] opts the optional parameters
438
- # @option opts [Boolean] :include_counts Add &#x60;received_count&#x60; to each inbox and &#x60;meta.received_total&#x60; (all delivered mail, including mail with no inbox). Counts use the same filter as the default received-email list.
439
- # @return [Array<(InboxListResponse, Integer, Hash)>] InboxListResponse data, response status code and response headers
440
- def list_inboxes_with_http_info(opts = {})
491
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
492
+ def delete_inbox_thread_with_http_info(thread_id, opts = {})
441
493
  if @api_client.config.debugging
442
- @api_client.config.logger.debug 'Calling API: InboundEmailApi.list_inboxes ...'
494
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.delete_inbox_thread ...'
495
+ end
496
+ # verify the required parameter 'thread_id' is set
497
+ if @api_client.config.client_side_validation && thread_id.nil?
498
+ fail ArgumentError, "Missing the required parameter 'thread_id' when calling InboundEmailApi.delete_inbox_thread"
443
499
  end
444
500
  # resource path
445
- local_var_path = '/inboxes'
501
+ local_var_path = '/inboxes/threads/{threadId}'.sub('{' + 'threadId' + '}', CGI.escape(thread_id.to_s))
446
502
 
447
503
  # query parameters
448
504
  query_params = opts[:query_params] || {}
449
- query_params[:'include_counts'] = opts[:'include_counts'] if !opts[:'include_counts'].nil?
450
505
 
451
506
  # header parameters
452
507
  header_params = opts[:header_params] || {}
453
- # HTTP header 'Accept' (if needed)
454
- header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
455
508
 
456
509
  # form parameters
457
510
  form_params = opts[:form_params] || {}
@@ -460,13 +513,13 @@ module Zyphr
460
513
  post_body = opts[:debug_body]
461
514
 
462
515
  # return_type
463
- return_type = opts[:debug_return_type] || 'InboxListResponse'
516
+ return_type = opts[:debug_return_type]
464
517
 
465
518
  # auth_names
466
519
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
467
520
 
468
521
  new_options = opts.merge(
469
- :operation => :"InboundEmailApi.list_inboxes",
522
+ :operation => :"InboundEmailApi.delete_inbox_thread",
470
523
  :header_params => header_params,
471
524
  :query_params => query_params,
472
525
  :form_params => form_params,
@@ -475,46 +528,46 @@ module Zyphr
475
528
  :return_type => return_type
476
529
  )
477
530
 
478
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
531
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
479
532
  if @api_client.config.debugging
480
- @api_client.config.logger.debug "API called: InboundEmailApi#list_inboxes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
533
+ @api_client.config.logger.debug "API called: InboundEmailApi#delete_inbox_thread\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
481
534
  end
482
535
  return data, status_code, headers
483
536
  end
484
537
 
485
- # Reply to a received email
486
- # Send a reply to a received email that threads under the original in the recipient's mail client. Zyphr sets `to` (the original sender), the `Re:` subject, and the `In-Reply-To` / `References` headers from the received email; any of those fields in the body are ignored. Everything else behaves exactly like `POST /emails` (`html`/`text`, `send_at`/`delay`, quotas, suppression). A reply is relationship mail (no `List-Unsubscribe` headers; a recipient's marketing unsubscribe and the throttle's random drop do not block it; bounces and complaints still do) when the received email passed DMARC, the reply is not `classification: marketing`, it is sent within 30 days of receipt, and it is one of the first 3 such replies to that email. Otherwise it is sent as ordinary mail. Templates are not supported, because a template's own subject would break threading. Quarantined or dropped mail cannot be replied to.
538
+ # Forward a received email
539
+ # Send a received email on to someone else. Zyphr sets the `Fwd:` subject and quotes the original (sender, date, subject, recipients and body) under your optional `text`/`html` note. The original attachments go with it unless `include_attachments` is false; they are copied inside Zyphr, never re-uploaded. The whole email, attachments included, must fit the 10 MB email limit (about 7 MB of attachments). `reply_to` defaults to the inbox address, so an answer comes back to Zyphr. The forward joins the email's thread. It is ordinary mail: suppression and unsubscribes apply. Forwards are sent immediately (no `send_at`/`delay`) and cannot use a template. Quarantined or dropped mail cannot be forwarded.
487
540
  # @param id [String]
488
- # @param reply_to_inbound_email_request [ReplyToInboundEmailRequest]
541
+ # @param forward_email_request [ForwardEmailRequest]
489
542
  # @param [Hash] opts the optional parameters
490
543
  # @option opts [String] :idempotency_key
491
544
  # @return [SendEmailResponse]
492
- def reply_to_inbound_email(id, reply_to_inbound_email_request, opts = {})
493
- data, _status_code, _headers = reply_to_inbound_email_with_http_info(id, reply_to_inbound_email_request, opts)
545
+ def forward_inbound_email(id, forward_email_request, opts = {})
546
+ data, _status_code, _headers = forward_inbound_email_with_http_info(id, forward_email_request, opts)
494
547
  data
495
548
  end
496
549
 
497
- # Reply to a received email
498
- # Send a reply to a received email that threads under the original in the recipient&#39;s mail client. Zyphr sets &#x60;to&#x60; (the original sender), the &#x60;Re:&#x60; subject, and the &#x60;In-Reply-To&#x60; / &#x60;References&#x60; headers from the received email; any of those fields in the body are ignored. Everything else behaves exactly like &#x60;POST /emails&#x60; (&#x60;html&#x60;/&#x60;text&#x60;, &#x60;send_at&#x60;/&#x60;delay&#x60;, quotas, suppression). A reply is relationship mail (no &#x60;List-Unsubscribe&#x60; headers; a recipient&#39;s marketing unsubscribe and the throttle&#39;s random drop do not block it; bounces and complaints still do) when the received email passed DMARC, the reply is not &#x60;classification: marketing&#x60;, it is sent within 30 days of receipt, and it is one of the first 3 such replies to that email. Otherwise it is sent as ordinary mail. Templates are not supported, because a template&#39;s own subject would break threading. Quarantined or dropped mail cannot be replied to.
550
+ # Forward a received email
551
+ # Send a received email on to someone else. Zyphr sets the &#x60;Fwd:&#x60; subject and quotes the original (sender, date, subject, recipients and body) under your optional &#x60;text&#x60;/&#x60;html&#x60; note. The original attachments go with it unless &#x60;include_attachments&#x60; is false; they are copied inside Zyphr, never re-uploaded. The whole email, attachments included, must fit the 10 MB email limit (about 7 MB of attachments). &#x60;reply_to&#x60; defaults to the inbox address, so an answer comes back to Zyphr. The forward joins the email&#39;s thread. It is ordinary mail: suppression and unsubscribes apply. Forwards are sent immediately (no &#x60;send_at&#x60;/&#x60;delay&#x60;) and cannot use a template. Quarantined or dropped mail cannot be forwarded.
499
552
  # @param id [String]
500
- # @param reply_to_inbound_email_request [ReplyToInboundEmailRequest]
553
+ # @param forward_email_request [ForwardEmailRequest]
501
554
  # @param [Hash] opts the optional parameters
502
555
  # @option opts [String] :idempotency_key
503
556
  # @return [Array<(SendEmailResponse, Integer, Hash)>] SendEmailResponse data, response status code and response headers
504
- def reply_to_inbound_email_with_http_info(id, reply_to_inbound_email_request, opts = {})
557
+ def forward_inbound_email_with_http_info(id, forward_email_request, opts = {})
505
558
  if @api_client.config.debugging
506
- @api_client.config.logger.debug 'Calling API: InboundEmailApi.reply_to_inbound_email ...'
559
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.forward_inbound_email ...'
507
560
  end
508
561
  # verify the required parameter 'id' is set
509
562
  if @api_client.config.client_side_validation && id.nil?
510
- fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.reply_to_inbound_email"
563
+ fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.forward_inbound_email"
511
564
  end
512
- # verify the required parameter 'reply_to_inbound_email_request' is set
513
- if @api_client.config.client_side_validation && reply_to_inbound_email_request.nil?
514
- fail ArgumentError, "Missing the required parameter 'reply_to_inbound_email_request' when calling InboundEmailApi.reply_to_inbound_email"
565
+ # verify the required parameter 'forward_email_request' is set
566
+ if @api_client.config.client_side_validation && forward_email_request.nil?
567
+ fail ArgumentError, "Missing the required parameter 'forward_email_request' when calling InboundEmailApi.forward_inbound_email"
515
568
  end
516
569
  # resource path
517
- local_var_path = '/inbound-emails/{id}/reply'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
570
+ local_var_path = '/inbound-emails/{id}/forward'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
518
571
 
519
572
  # query parameters
520
573
  query_params = opts[:query_params] || {}
@@ -534,7 +587,7 @@ module Zyphr
534
587
  form_params = opts[:form_params] || {}
535
588
 
536
589
  # http body (model)
537
- post_body = opts[:debug_body] || @api_client.object_to_http_body(reply_to_inbound_email_request)
590
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(forward_email_request)
538
591
 
539
592
  # return_type
540
593
  return_type = opts[:debug_return_type] || 'SendEmailResponse'
@@ -543,7 +596,1117 @@ module Zyphr
543
596
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
544
597
 
545
598
  new_options = opts.merge(
546
- :operation => :"InboundEmailApi.reply_to_inbound_email",
599
+ :operation => :"InboundEmailApi.forward_inbound_email",
600
+ :header_params => header_params,
601
+ :query_params => query_params,
602
+ :form_params => form_params,
603
+ :body => post_body,
604
+ :auth_names => auth_names,
605
+ :return_type => return_type
606
+ )
607
+
608
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
609
+ if @api_client.config.debugging
610
+ @api_client.config.logger.debug "API called: InboundEmailApi#forward_inbound_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
611
+ end
612
+ return data, status_code, headers
613
+ end
614
+
615
+ # Forward an email in a thread
616
+ # Forwards one received email of the thread, exactly as `POST /inbound-emails/{id}/forward` does: `Fwd:` subject, the original quoted under your note, its attachments copied unless `include_attachments` is false, and `reply_to` defaulting to the inbox address. The forward joins this thread. Sent emails cannot be forwarded here. Test-mode keys cannot forward.
617
+ # @param thread_id [String]
618
+ # @param email_id [String]
619
+ # @param forward_email_request [ForwardEmailRequest]
620
+ # @param [Hash] opts the optional parameters
621
+ # @option opts [String] :idempotency_key
622
+ # @return [SendEmailResponse]
623
+ def forward_inbox_thread_email(thread_id, email_id, forward_email_request, opts = {})
624
+ data, _status_code, _headers = forward_inbox_thread_email_with_http_info(thread_id, email_id, forward_email_request, opts)
625
+ data
626
+ end
627
+
628
+ # Forward an email in a thread
629
+ # Forwards one received email of the thread, exactly as &#x60;POST /inbound-emails/{id}/forward&#x60; does: &#x60;Fwd:&#x60; subject, the original quoted under your note, its attachments copied unless &#x60;include_attachments&#x60; is false, and &#x60;reply_to&#x60; defaulting to the inbox address. The forward joins this thread. Sent emails cannot be forwarded here. Test-mode keys cannot forward.
630
+ # @param thread_id [String]
631
+ # @param email_id [String]
632
+ # @param forward_email_request [ForwardEmailRequest]
633
+ # @param [Hash] opts the optional parameters
634
+ # @option opts [String] :idempotency_key
635
+ # @return [Array<(SendEmailResponse, Integer, Hash)>] SendEmailResponse data, response status code and response headers
636
+ def forward_inbox_thread_email_with_http_info(thread_id, email_id, forward_email_request, opts = {})
637
+ if @api_client.config.debugging
638
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.forward_inbox_thread_email ...'
639
+ end
640
+ # verify the required parameter 'thread_id' is set
641
+ if @api_client.config.client_side_validation && thread_id.nil?
642
+ fail ArgumentError, "Missing the required parameter 'thread_id' when calling InboundEmailApi.forward_inbox_thread_email"
643
+ end
644
+ # verify the required parameter 'email_id' is set
645
+ if @api_client.config.client_side_validation && email_id.nil?
646
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling InboundEmailApi.forward_inbox_thread_email"
647
+ end
648
+ # verify the required parameter 'forward_email_request' is set
649
+ if @api_client.config.client_side_validation && forward_email_request.nil?
650
+ fail ArgumentError, "Missing the required parameter 'forward_email_request' when calling InboundEmailApi.forward_inbox_thread_email"
651
+ end
652
+ # resource path
653
+ local_var_path = '/inboxes/threads/{threadId}/emails/{emailId}/forward'.sub('{' + 'threadId' + '}', CGI.escape(thread_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
654
+
655
+ # query parameters
656
+ query_params = opts[:query_params] || {}
657
+
658
+ # header parameters
659
+ header_params = opts[:header_params] || {}
660
+ # HTTP header 'Accept' (if needed)
661
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
662
+ # HTTP header 'Content-Type'
663
+ content_type = @api_client.select_header_content_type(['application/json'])
664
+ if !content_type.nil?
665
+ header_params['Content-Type'] = content_type
666
+ end
667
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
668
+
669
+ # form parameters
670
+ form_params = opts[:form_params] || {}
671
+
672
+ # http body (model)
673
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(forward_email_request)
674
+
675
+ # return_type
676
+ return_type = opts[:debug_return_type] || 'SendEmailResponse'
677
+
678
+ # auth_names
679
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
680
+
681
+ new_options = opts.merge(
682
+ :operation => :"InboundEmailApi.forward_inbox_thread_email",
683
+ :header_params => header_params,
684
+ :query_params => query_params,
685
+ :form_params => form_params,
686
+ :body => post_body,
687
+ :auth_names => auth_names,
688
+ :return_type => return_type
689
+ )
690
+
691
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
692
+ if @api_client.config.debugging
693
+ @api_client.config.logger.debug "API called: InboundEmailApi#forward_inbox_thread_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
694
+ end
695
+ return data, status_code, headers
696
+ end
697
+
698
+ # Get an attachment download URL
699
+ # Return a short-lived presigned S3 download URL for one attachment of a received email. `attachmentId` is the positional id from the email's `attachments` array.
700
+ # @param id [String]
701
+ # @param attachment_id [String]
702
+ # @param [Hash] opts the optional parameters
703
+ # @return [InboundAttachmentUrlResponse]
704
+ def get_inbound_attachment_url(id, attachment_id, opts = {})
705
+ data, _status_code, _headers = get_inbound_attachment_url_with_http_info(id, attachment_id, opts)
706
+ data
707
+ end
708
+
709
+ # Get an attachment download URL
710
+ # Return a short-lived presigned S3 download URL for one attachment of a received email. &#x60;attachmentId&#x60; is the positional id from the email&#39;s &#x60;attachments&#x60; array.
711
+ # @param id [String]
712
+ # @param attachment_id [String]
713
+ # @param [Hash] opts the optional parameters
714
+ # @return [Array<(InboundAttachmentUrlResponse, Integer, Hash)>] InboundAttachmentUrlResponse data, response status code and response headers
715
+ def get_inbound_attachment_url_with_http_info(id, attachment_id, opts = {})
716
+ if @api_client.config.debugging
717
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbound_attachment_url ...'
718
+ end
719
+ # verify the required parameter 'id' is set
720
+ if @api_client.config.client_side_validation && id.nil?
721
+ fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.get_inbound_attachment_url"
722
+ end
723
+ # verify the required parameter 'attachment_id' is set
724
+ if @api_client.config.client_side_validation && attachment_id.nil?
725
+ fail ArgumentError, "Missing the required parameter 'attachment_id' when calling InboundEmailApi.get_inbound_attachment_url"
726
+ end
727
+ # resource path
728
+ local_var_path = '/inbound-emails/{id}/attachments/{attachmentId}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s))
729
+
730
+ # query parameters
731
+ query_params = opts[:query_params] || {}
732
+
733
+ # header parameters
734
+ header_params = opts[:header_params] || {}
735
+ # HTTP header 'Accept' (if needed)
736
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
737
+
738
+ # form parameters
739
+ form_params = opts[:form_params] || {}
740
+
741
+ # http body (model)
742
+ post_body = opts[:debug_body]
743
+
744
+ # return_type
745
+ return_type = opts[:debug_return_type] || 'InboundAttachmentUrlResponse'
746
+
747
+ # auth_names
748
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
749
+
750
+ new_options = opts.merge(
751
+ :operation => :"InboundEmailApi.get_inbound_attachment_url",
752
+ :header_params => header_params,
753
+ :query_params => query_params,
754
+ :form_params => form_params,
755
+ :body => post_body,
756
+ :auth_names => auth_names,
757
+ :return_type => return_type
758
+ )
759
+
760
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
761
+ if @api_client.config.debugging
762
+ @api_client.config.logger.debug "API called: InboundEmailApi#get_inbound_attachment_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
763
+ end
764
+ return data, status_code, headers
765
+ end
766
+
767
+ # Get a received email
768
+ # Retrieve a single inbound email by id (scoped to the project).
769
+ # @param id [String]
770
+ # @param [Hash] opts the optional parameters
771
+ # @return [InboundEmailResponse]
772
+ def get_inbound_email(id, opts = {})
773
+ data, _status_code, _headers = get_inbound_email_with_http_info(id, opts)
774
+ data
775
+ end
776
+
777
+ # Get a received email
778
+ # Retrieve a single inbound email by id (scoped to the project).
779
+ # @param id [String]
780
+ # @param [Hash] opts the optional parameters
781
+ # @return [Array<(InboundEmailResponse, Integer, Hash)>] InboundEmailResponse data, response status code and response headers
782
+ def get_inbound_email_with_http_info(id, opts = {})
783
+ if @api_client.config.debugging
784
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbound_email ...'
785
+ end
786
+ # verify the required parameter 'id' is set
787
+ if @api_client.config.client_side_validation && id.nil?
788
+ fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.get_inbound_email"
789
+ end
790
+ # resource path
791
+ local_var_path = '/inbound-emails/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
792
+
793
+ # query parameters
794
+ query_params = opts[:query_params] || {}
795
+
796
+ # header parameters
797
+ header_params = opts[:header_params] || {}
798
+ # HTTP header 'Accept' (if needed)
799
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
800
+
801
+ # form parameters
802
+ form_params = opts[:form_params] || {}
803
+
804
+ # http body (model)
805
+ post_body = opts[:debug_body]
806
+
807
+ # return_type
808
+ return_type = opts[:debug_return_type] || 'InboundEmailResponse'
809
+
810
+ # auth_names
811
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
812
+
813
+ new_options = opts.merge(
814
+ :operation => :"InboundEmailApi.get_inbound_email",
815
+ :header_params => header_params,
816
+ :query_params => query_params,
817
+ :form_params => form_params,
818
+ :body => post_body,
819
+ :auth_names => auth_names,
820
+ :return_type => return_type
821
+ )
822
+
823
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
824
+ if @api_client.config.debugging
825
+ @api_client.config.logger.debug "API called: InboundEmailApi#get_inbound_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
826
+ end
827
+ return data, status_code, headers
828
+ end
829
+
830
+ # Get an inbox
831
+ # @param id [String]
832
+ # @param [Hash] opts the optional parameters
833
+ # @return [InboxResponse]
834
+ def get_inbox(id, opts = {})
835
+ data, _status_code, _headers = get_inbox_with_http_info(id, opts)
836
+ data
837
+ end
838
+
839
+ # Get an inbox
840
+ # @param id [String]
841
+ # @param [Hash] opts the optional parameters
842
+ # @return [Array<(InboxResponse, Integer, Hash)>] InboxResponse data, response status code and response headers
843
+ def get_inbox_with_http_info(id, opts = {})
844
+ if @api_client.config.debugging
845
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbox ...'
846
+ end
847
+ # verify the required parameter 'id' is set
848
+ if @api_client.config.client_side_validation && id.nil?
849
+ fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.get_inbox"
850
+ end
851
+ # resource path
852
+ local_var_path = '/inboxes/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
853
+
854
+ # query parameters
855
+ query_params = opts[:query_params] || {}
856
+
857
+ # header parameters
858
+ header_params = opts[:header_params] || {}
859
+ # HTTP header 'Accept' (if needed)
860
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
861
+
862
+ # form parameters
863
+ form_params = opts[:form_params] || {}
864
+
865
+ # http body (model)
866
+ post_body = opts[:debug_body]
867
+
868
+ # return_type
869
+ return_type = opts[:debug_return_type] || 'InboxResponse'
870
+
871
+ # auth_names
872
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
873
+
874
+ new_options = opts.merge(
875
+ :operation => :"InboundEmailApi.get_inbox",
876
+ :header_params => header_params,
877
+ :query_params => query_params,
878
+ :form_params => form_params,
879
+ :body => post_body,
880
+ :auth_names => auth_names,
881
+ :return_type => return_type
882
+ )
883
+
884
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
885
+ if @api_client.config.debugging
886
+ @api_client.config.logger.debug "API called: InboundEmailApi#get_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
887
+ end
888
+ return data, status_code, headers
889
+ end
890
+
891
+ # Get a draft
892
+ # @param draft_id [String]
893
+ # @param [Hash] opts the optional parameters
894
+ # @return [DraftResponse]
895
+ def get_inbox_draft(draft_id, opts = {})
896
+ data, _status_code, _headers = get_inbox_draft_with_http_info(draft_id, opts)
897
+ data
898
+ end
899
+
900
+ # Get a draft
901
+ # @param draft_id [String]
902
+ # @param [Hash] opts the optional parameters
903
+ # @return [Array<(DraftResponse, Integer, Hash)>] DraftResponse data, response status code and response headers
904
+ def get_inbox_draft_with_http_info(draft_id, opts = {})
905
+ if @api_client.config.debugging
906
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbox_draft ...'
907
+ end
908
+ # verify the required parameter 'draft_id' is set
909
+ if @api_client.config.client_side_validation && draft_id.nil?
910
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling InboundEmailApi.get_inbox_draft"
911
+ end
912
+ # resource path
913
+ local_var_path = '/inboxes/drafts/{draftId}'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s))
914
+
915
+ # query parameters
916
+ query_params = opts[:query_params] || {}
917
+
918
+ # header parameters
919
+ header_params = opts[:header_params] || {}
920
+ # HTTP header 'Accept' (if needed)
921
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
922
+
923
+ # form parameters
924
+ form_params = opts[:form_params] || {}
925
+
926
+ # http body (model)
927
+ post_body = opts[:debug_body]
928
+
929
+ # return_type
930
+ return_type = opts[:debug_return_type] || 'DraftResponse'
931
+
932
+ # auth_names
933
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
934
+
935
+ new_options = opts.merge(
936
+ :operation => :"InboundEmailApi.get_inbox_draft",
937
+ :header_params => header_params,
938
+ :query_params => query_params,
939
+ :form_params => form_params,
940
+ :body => post_body,
941
+ :auth_names => auth_names,
942
+ :return_type => return_type
943
+ )
944
+
945
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
946
+ if @api_client.config.debugging
947
+ @api_client.config.logger.debug "API called: InboundEmailApi#get_inbox_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
948
+ end
949
+ return data, status_code, headers
950
+ end
951
+
952
+ # Get a label
953
+ # @param label_id [String]
954
+ # @param [Hash] opts the optional parameters
955
+ # @return [InboxLabelResponse]
956
+ def get_inbox_label(label_id, opts = {})
957
+ data, _status_code, _headers = get_inbox_label_with_http_info(label_id, opts)
958
+ data
959
+ end
960
+
961
+ # Get a label
962
+ # @param label_id [String]
963
+ # @param [Hash] opts the optional parameters
964
+ # @return [Array<(InboxLabelResponse, Integer, Hash)>] InboxLabelResponse data, response status code and response headers
965
+ def get_inbox_label_with_http_info(label_id, opts = {})
966
+ if @api_client.config.debugging
967
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbox_label ...'
968
+ end
969
+ # verify the required parameter 'label_id' is set
970
+ if @api_client.config.client_side_validation && label_id.nil?
971
+ fail ArgumentError, "Missing the required parameter 'label_id' when calling InboundEmailApi.get_inbox_label"
972
+ end
973
+ # resource path
974
+ local_var_path = '/inboxes/labels/{labelId}'.sub('{' + 'labelId' + '}', CGI.escape(label_id.to_s))
975
+
976
+ # query parameters
977
+ query_params = opts[:query_params] || {}
978
+
979
+ # header parameters
980
+ header_params = opts[:header_params] || {}
981
+ # HTTP header 'Accept' (if needed)
982
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
983
+
984
+ # form parameters
985
+ form_params = opts[:form_params] || {}
986
+
987
+ # http body (model)
988
+ post_body = opts[:debug_body]
989
+
990
+ # return_type
991
+ return_type = opts[:debug_return_type] || 'InboxLabelResponse'
992
+
993
+ # auth_names
994
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
995
+
996
+ new_options = opts.merge(
997
+ :operation => :"InboundEmailApi.get_inbox_label",
998
+ :header_params => header_params,
999
+ :query_params => query_params,
1000
+ :form_params => form_params,
1001
+ :body => post_body,
1002
+ :auth_names => auth_names,
1003
+ :return_type => return_type
1004
+ )
1005
+
1006
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1007
+ if @api_client.config.debugging
1008
+ @api_client.config.logger.debug "API called: InboundEmailApi#get_inbox_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1009
+ end
1010
+ return data, status_code, headers
1011
+ end
1012
+
1013
+ # Get a thread
1014
+ # @param thread_id [String]
1015
+ # @param [Hash] opts the optional parameters
1016
+ # @return [ThreadResponse]
1017
+ def get_inbox_thread(thread_id, opts = {})
1018
+ data, _status_code, _headers = get_inbox_thread_with_http_info(thread_id, opts)
1019
+ data
1020
+ end
1021
+
1022
+ # Get a thread
1023
+ # @param thread_id [String]
1024
+ # @param [Hash] opts the optional parameters
1025
+ # @return [Array<(ThreadResponse, Integer, Hash)>] ThreadResponse data, response status code and response headers
1026
+ def get_inbox_thread_with_http_info(thread_id, opts = {})
1027
+ if @api_client.config.debugging
1028
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbox_thread ...'
1029
+ end
1030
+ # verify the required parameter 'thread_id' is set
1031
+ if @api_client.config.client_side_validation && thread_id.nil?
1032
+ fail ArgumentError, "Missing the required parameter 'thread_id' when calling InboundEmailApi.get_inbox_thread"
1033
+ end
1034
+ # resource path
1035
+ local_var_path = '/inboxes/threads/{threadId}'.sub('{' + 'threadId' + '}', CGI.escape(thread_id.to_s))
1036
+
1037
+ # query parameters
1038
+ query_params = opts[:query_params] || {}
1039
+
1040
+ # header parameters
1041
+ header_params = opts[:header_params] || {}
1042
+ # HTTP header 'Accept' (if needed)
1043
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1044
+
1045
+ # form parameters
1046
+ form_params = opts[:form_params] || {}
1047
+
1048
+ # http body (model)
1049
+ post_body = opts[:debug_body]
1050
+
1051
+ # return_type
1052
+ return_type = opts[:debug_return_type] || 'ThreadResponse'
1053
+
1054
+ # auth_names
1055
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1056
+
1057
+ new_options = opts.merge(
1058
+ :operation => :"InboundEmailApi.get_inbox_thread",
1059
+ :header_params => header_params,
1060
+ :query_params => query_params,
1061
+ :form_params => form_params,
1062
+ :body => post_body,
1063
+ :auth_names => auth_names,
1064
+ :return_type => return_type
1065
+ )
1066
+
1067
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1068
+ if @api_client.config.debugging
1069
+ @api_client.config.logger.debug "API called: InboundEmailApi#get_inbox_thread\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1070
+ end
1071
+ return data, status_code, headers
1072
+ end
1073
+
1074
+ # Get an email in a thread
1075
+ # @param thread_id [String]
1076
+ # @param email_id [String]
1077
+ # @param [Hash] opts the optional parameters
1078
+ # @return [ThreadEmailResponse]
1079
+ def get_inbox_thread_email(thread_id, email_id, opts = {})
1080
+ data, _status_code, _headers = get_inbox_thread_email_with_http_info(thread_id, email_id, opts)
1081
+ data
1082
+ end
1083
+
1084
+ # Get an email in a thread
1085
+ # @param thread_id [String]
1086
+ # @param email_id [String]
1087
+ # @param [Hash] opts the optional parameters
1088
+ # @return [Array<(ThreadEmailResponse, Integer, Hash)>] ThreadEmailResponse data, response status code and response headers
1089
+ def get_inbox_thread_email_with_http_info(thread_id, email_id, opts = {})
1090
+ if @api_client.config.debugging
1091
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbox_thread_email ...'
1092
+ end
1093
+ # verify the required parameter 'thread_id' is set
1094
+ if @api_client.config.client_side_validation && thread_id.nil?
1095
+ fail ArgumentError, "Missing the required parameter 'thread_id' when calling InboundEmailApi.get_inbox_thread_email"
1096
+ end
1097
+ # verify the required parameter 'email_id' is set
1098
+ if @api_client.config.client_side_validation && email_id.nil?
1099
+ fail ArgumentError, "Missing the required parameter 'email_id' when calling InboundEmailApi.get_inbox_thread_email"
1100
+ end
1101
+ # resource path
1102
+ local_var_path = '/inboxes/threads/{threadId}/emails/{emailId}'.sub('{' + 'threadId' + '}', CGI.escape(thread_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
1103
+
1104
+ # query parameters
1105
+ query_params = opts[:query_params] || {}
1106
+
1107
+ # header parameters
1108
+ header_params = opts[:header_params] || {}
1109
+ # HTTP header 'Accept' (if needed)
1110
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1111
+
1112
+ # form parameters
1113
+ form_params = opts[:form_params] || {}
1114
+
1115
+ # http body (model)
1116
+ post_body = opts[:debug_body]
1117
+
1118
+ # return_type
1119
+ return_type = opts[:debug_return_type] || 'ThreadEmailResponse'
1120
+
1121
+ # auth_names
1122
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1123
+
1124
+ new_options = opts.merge(
1125
+ :operation => :"InboundEmailApi.get_inbox_thread_email",
1126
+ :header_params => header_params,
1127
+ :query_params => query_params,
1128
+ :form_params => form_params,
1129
+ :body => post_body,
1130
+ :auth_names => auth_names,
1131
+ :return_type => return_type
1132
+ )
1133
+
1134
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1135
+ if @api_client.config.debugging
1136
+ @api_client.config.logger.debug "API called: InboundEmailApi#get_inbox_thread_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1137
+ end
1138
+ return data, status_code, headers
1139
+ end
1140
+
1141
+ # List received emails
1142
+ # List inbound (received) emails for the project, newest first. By default only delivered mail (`received`/`processed`) is returned; pass `include_withheld=true` to also see quarantined/dropped.
1143
+ # @param [Hash] opts the optional parameters
1144
+ # @option opts [String] :status
1145
+ # @option opts [String] :to Filter by receiving address
1146
+ # @option opts [String] :inbox_id Only mail that landed in this inbox (see /inboxes)
1147
+ # @option opts [Boolean] :include_withheld Include quarantined/dropped mail
1148
+ # @option opts [Integer] :limit (default to 50)
1149
+ # @option opts [Integer] :offset (default to 0)
1150
+ # @return [InboundEmailListResponse]
1151
+ def list_inbound_emails(opts = {})
1152
+ data, _status_code, _headers = list_inbound_emails_with_http_info(opts)
1153
+ data
1154
+ end
1155
+
1156
+ # List received emails
1157
+ # List inbound (received) emails for the project, newest first. By default only delivered mail (&#x60;received&#x60;/&#x60;processed&#x60;) is returned; pass &#x60;include_withheld&#x3D;true&#x60; to also see quarantined/dropped.
1158
+ # @param [Hash] opts the optional parameters
1159
+ # @option opts [String] :status
1160
+ # @option opts [String] :to Filter by receiving address
1161
+ # @option opts [String] :inbox_id Only mail that landed in this inbox (see /inboxes)
1162
+ # @option opts [Boolean] :include_withheld Include quarantined/dropped mail
1163
+ # @option opts [Integer] :limit (default to 50)
1164
+ # @option opts [Integer] :offset (default to 0)
1165
+ # @return [Array<(InboundEmailListResponse, Integer, Hash)>] InboundEmailListResponse data, response status code and response headers
1166
+ def list_inbound_emails_with_http_info(opts = {})
1167
+ if @api_client.config.debugging
1168
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.list_inbound_emails ...'
1169
+ end
1170
+ allowable_values = ["received", "processed", "quarantined", "dropped", "failed"]
1171
+ if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
1172
+ fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
1173
+ end
1174
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
1175
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboundEmailApi.list_inbound_emails, must be smaller than or equal to 100.'
1176
+ end
1177
+
1178
+ # resource path
1179
+ local_var_path = '/inbound-emails'
1180
+
1181
+ # query parameters
1182
+ query_params = opts[:query_params] || {}
1183
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
1184
+ query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
1185
+ query_params[:'inbox_id'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
1186
+ query_params[:'include_withheld'] = opts[:'include_withheld'] if !opts[:'include_withheld'].nil?
1187
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1188
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
1189
+
1190
+ # header parameters
1191
+ header_params = opts[:header_params] || {}
1192
+ # HTTP header 'Accept' (if needed)
1193
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1194
+
1195
+ # form parameters
1196
+ form_params = opts[:form_params] || {}
1197
+
1198
+ # http body (model)
1199
+ post_body = opts[:debug_body]
1200
+
1201
+ # return_type
1202
+ return_type = opts[:debug_return_type] || 'InboundEmailListResponse'
1203
+
1204
+ # auth_names
1205
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1206
+
1207
+ new_options = opts.merge(
1208
+ :operation => :"InboundEmailApi.list_inbound_emails",
1209
+ :header_params => header_params,
1210
+ :query_params => query_params,
1211
+ :form_params => form_params,
1212
+ :body => post_body,
1213
+ :auth_names => auth_names,
1214
+ :return_type => return_type
1215
+ )
1216
+
1217
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1218
+ if @api_client.config.debugging
1219
+ @api_client.config.logger.debug "API called: InboundEmailApi#list_inbound_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1220
+ end
1221
+ return data, status_code, headers
1222
+ end
1223
+
1224
+ # List drafts
1225
+ # Unsent emails in the project, newest first. Filter to one thread's drafts with `thread_id`.
1226
+ # @param [Hash] opts the optional parameters
1227
+ # @option opts [String] :thread_id
1228
+ # @option opts [Integer] :limit (default to 25)
1229
+ # @option opts [String] :cursor &#x60;meta.next_cursor&#x60; from the previous page
1230
+ # @return [DraftListResponse]
1231
+ def list_inbox_drafts(opts = {})
1232
+ data, _status_code, _headers = list_inbox_drafts_with_http_info(opts)
1233
+ data
1234
+ end
1235
+
1236
+ # List drafts
1237
+ # Unsent emails in the project, newest first. Filter to one thread&#39;s drafts with &#x60;thread_id&#x60;.
1238
+ # @param [Hash] opts the optional parameters
1239
+ # @option opts [String] :thread_id
1240
+ # @option opts [Integer] :limit (default to 25)
1241
+ # @option opts [String] :cursor &#x60;meta.next_cursor&#x60; from the previous page
1242
+ # @return [Array<(DraftListResponse, Integer, Hash)>] DraftListResponse data, response status code and response headers
1243
+ def list_inbox_drafts_with_http_info(opts = {})
1244
+ if @api_client.config.debugging
1245
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.list_inbox_drafts ...'
1246
+ end
1247
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
1248
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboundEmailApi.list_inbox_drafts, must be smaller than or equal to 100.'
1249
+ end
1250
+
1251
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
1252
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboundEmailApi.list_inbox_drafts, must be greater than or equal to 1.'
1253
+ end
1254
+
1255
+ # resource path
1256
+ local_var_path = '/inboxes/drafts'
1257
+
1258
+ # query parameters
1259
+ query_params = opts[:query_params] || {}
1260
+ query_params[:'thread_id'] = opts[:'thread_id'] if !opts[:'thread_id'].nil?
1261
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1262
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
1263
+
1264
+ # header parameters
1265
+ header_params = opts[:header_params] || {}
1266
+ # HTTP header 'Accept' (if needed)
1267
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1268
+
1269
+ # form parameters
1270
+ form_params = opts[:form_params] || {}
1271
+
1272
+ # http body (model)
1273
+ post_body = opts[:debug_body]
1274
+
1275
+ # return_type
1276
+ return_type = opts[:debug_return_type] || 'DraftListResponse'
1277
+
1278
+ # auth_names
1279
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1280
+
1281
+ new_options = opts.merge(
1282
+ :operation => :"InboundEmailApi.list_inbox_drafts",
1283
+ :header_params => header_params,
1284
+ :query_params => query_params,
1285
+ :form_params => form_params,
1286
+ :body => post_body,
1287
+ :auth_names => auth_names,
1288
+ :return_type => return_type
1289
+ )
1290
+
1291
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1292
+ if @api_client.config.debugging
1293
+ @api_client.config.logger.debug "API called: InboundEmailApi#list_inbox_drafts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1294
+ end
1295
+ return data, status_code, headers
1296
+ end
1297
+
1298
+ # List labels
1299
+ # @param [Hash] opts the optional parameters
1300
+ # @return [InboxLabelListResponse]
1301
+ def list_inbox_labels(opts = {})
1302
+ data, _status_code, _headers = list_inbox_labels_with_http_info(opts)
1303
+ data
1304
+ end
1305
+
1306
+ # List labels
1307
+ # @param [Hash] opts the optional parameters
1308
+ # @return [Array<(InboxLabelListResponse, Integer, Hash)>] InboxLabelListResponse data, response status code and response headers
1309
+ def list_inbox_labels_with_http_info(opts = {})
1310
+ if @api_client.config.debugging
1311
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.list_inbox_labels ...'
1312
+ end
1313
+ # resource path
1314
+ local_var_path = '/inboxes/labels'
1315
+
1316
+ # query parameters
1317
+ query_params = opts[:query_params] || {}
1318
+
1319
+ # header parameters
1320
+ header_params = opts[:header_params] || {}
1321
+ # HTTP header 'Accept' (if needed)
1322
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1323
+
1324
+ # form parameters
1325
+ form_params = opts[:form_params] || {}
1326
+
1327
+ # http body (model)
1328
+ post_body = opts[:debug_body]
1329
+
1330
+ # return_type
1331
+ return_type = opts[:debug_return_type] || 'InboxLabelListResponse'
1332
+
1333
+ # auth_names
1334
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1335
+
1336
+ new_options = opts.merge(
1337
+ :operation => :"InboundEmailApi.list_inbox_labels",
1338
+ :header_params => header_params,
1339
+ :query_params => query_params,
1340
+ :form_params => form_params,
1341
+ :body => post_body,
1342
+ :auth_names => auth_names,
1343
+ :return_type => return_type
1344
+ )
1345
+
1346
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1347
+ if @api_client.config.debugging
1348
+ @api_client.config.logger.debug "API called: InboundEmailApi#list_inbox_labels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1349
+ end
1350
+ return data, status_code, headers
1351
+ end
1352
+
1353
+ # List a thread's emails
1354
+ # The conversation, oldest first, received (`inbound`) and sent (`outbound`) together.
1355
+ # @param thread_id [String]
1356
+ # @param [Hash] opts the optional parameters
1357
+ # @option opts [Integer] :limit (default to 50)
1358
+ # @option opts [String] :cursor
1359
+ # @return [ThreadEmailListResponse]
1360
+ def list_inbox_thread_emails(thread_id, opts = {})
1361
+ data, _status_code, _headers = list_inbox_thread_emails_with_http_info(thread_id, opts)
1362
+ data
1363
+ end
1364
+
1365
+ # List a thread&#39;s emails
1366
+ # The conversation, oldest first, received (&#x60;inbound&#x60;) and sent (&#x60;outbound&#x60;) together.
1367
+ # @param thread_id [String]
1368
+ # @param [Hash] opts the optional parameters
1369
+ # @option opts [Integer] :limit (default to 50)
1370
+ # @option opts [String] :cursor
1371
+ # @return [Array<(ThreadEmailListResponse, Integer, Hash)>] ThreadEmailListResponse data, response status code and response headers
1372
+ def list_inbox_thread_emails_with_http_info(thread_id, opts = {})
1373
+ if @api_client.config.debugging
1374
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.list_inbox_thread_emails ...'
1375
+ end
1376
+ # verify the required parameter 'thread_id' is set
1377
+ if @api_client.config.client_side_validation && thread_id.nil?
1378
+ fail ArgumentError, "Missing the required parameter 'thread_id' when calling InboundEmailApi.list_inbox_thread_emails"
1379
+ end
1380
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
1381
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboundEmailApi.list_inbox_thread_emails, must be smaller than or equal to 100.'
1382
+ end
1383
+
1384
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
1385
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboundEmailApi.list_inbox_thread_emails, must be greater than or equal to 1.'
1386
+ end
1387
+
1388
+ # resource path
1389
+ local_var_path = '/inboxes/threads/{threadId}/emails'.sub('{' + 'threadId' + '}', CGI.escape(thread_id.to_s))
1390
+
1391
+ # query parameters
1392
+ query_params = opts[:query_params] || {}
1393
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1394
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
1395
+
1396
+ # header parameters
1397
+ header_params = opts[:header_params] || {}
1398
+ # HTTP header 'Accept' (if needed)
1399
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1400
+
1401
+ # form parameters
1402
+ form_params = opts[:form_params] || {}
1403
+
1404
+ # http body (model)
1405
+ post_body = opts[:debug_body]
1406
+
1407
+ # return_type
1408
+ return_type = opts[:debug_return_type] || 'ThreadEmailListResponse'
1409
+
1410
+ # auth_names
1411
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1412
+
1413
+ new_options = opts.merge(
1414
+ :operation => :"InboundEmailApi.list_inbox_thread_emails",
1415
+ :header_params => header_params,
1416
+ :query_params => query_params,
1417
+ :form_params => form_params,
1418
+ :body => post_body,
1419
+ :auth_names => auth_names,
1420
+ :return_type => return_type
1421
+ )
1422
+
1423
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1424
+ if @api_client.config.debugging
1425
+ @api_client.config.logger.debug "API called: InboundEmailApi#list_inbox_thread_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1426
+ end
1427
+ return data, status_code, headers
1428
+ end
1429
+
1430
+ # List threads
1431
+ # Conversations in the project, most recent activity first. A thread groups received mail and your replies by their `In-Reply-To` / `References` headers. Filters combine with AND; `q` matches the subject, participant addresses and message text. Paginate with the `next_cursor` from the previous page.
1432
+ # @param [Hash] opts the optional parameters
1433
+ # @option opts [String] :inbox_id
1434
+ # @option opts [ThreadFolder] :folder
1435
+ # @option opts [Boolean] :read
1436
+ # @option opts [String] :assignee_user_id
1437
+ # @option opts [String] :label_id
1438
+ # @option opts [String] :q
1439
+ # @option opts [Integer] :limit (default to 25)
1440
+ # @option opts [String] :cursor
1441
+ # @return [ThreadListResponse]
1442
+ def list_inbox_threads(opts = {})
1443
+ data, _status_code, _headers = list_inbox_threads_with_http_info(opts)
1444
+ data
1445
+ end
1446
+
1447
+ # List threads
1448
+ # Conversations in the project, most recent activity first. A thread groups received mail and your replies by their &#x60;In-Reply-To&#x60; / &#x60;References&#x60; headers. Filters combine with AND; &#x60;q&#x60; matches the subject, participant addresses and message text. Paginate with the &#x60;next_cursor&#x60; from the previous page.
1449
+ # @param [Hash] opts the optional parameters
1450
+ # @option opts [String] :inbox_id
1451
+ # @option opts [ThreadFolder] :folder
1452
+ # @option opts [Boolean] :read
1453
+ # @option opts [String] :assignee_user_id
1454
+ # @option opts [String] :label_id
1455
+ # @option opts [String] :q
1456
+ # @option opts [Integer] :limit (default to 25)
1457
+ # @option opts [String] :cursor
1458
+ # @return [Array<(ThreadListResponse, Integer, Hash)>] ThreadListResponse data, response status code and response headers
1459
+ def list_inbox_threads_with_http_info(opts = {})
1460
+ if @api_client.config.debugging
1461
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.list_inbox_threads ...'
1462
+ end
1463
+ if @api_client.config.client_side_validation && !opts[:'q'].nil? && opts[:'q'].to_s.length > 200
1464
+ fail ArgumentError, 'invalid value for "opts[:"q"]" when calling InboundEmailApi.list_inbox_threads, the character length must be smaller than or equal to 200.'
1465
+ end
1466
+
1467
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
1468
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboundEmailApi.list_inbox_threads, must be smaller than or equal to 100.'
1469
+ end
1470
+
1471
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
1472
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboundEmailApi.list_inbox_threads, must be greater than or equal to 1.'
1473
+ end
1474
+
1475
+ # resource path
1476
+ local_var_path = '/inboxes/threads'
1477
+
1478
+ # query parameters
1479
+ query_params = opts[:query_params] || {}
1480
+ query_params[:'inbox_id'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
1481
+ query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
1482
+ query_params[:'read'] = opts[:'read'] if !opts[:'read'].nil?
1483
+ query_params[:'assignee_user_id'] = opts[:'assignee_user_id'] if !opts[:'assignee_user_id'].nil?
1484
+ query_params[:'label_id'] = opts[:'label_id'] if !opts[:'label_id'].nil?
1485
+ query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
1486
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1487
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
1488
+
1489
+ # header parameters
1490
+ header_params = opts[:header_params] || {}
1491
+ # HTTP header 'Accept' (if needed)
1492
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1493
+
1494
+ # form parameters
1495
+ form_params = opts[:form_params] || {}
1496
+
1497
+ # http body (model)
1498
+ post_body = opts[:debug_body]
1499
+
1500
+ # return_type
1501
+ return_type = opts[:debug_return_type] || 'ThreadListResponse'
1502
+
1503
+ # auth_names
1504
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1505
+
1506
+ new_options = opts.merge(
1507
+ :operation => :"InboundEmailApi.list_inbox_threads",
1508
+ :header_params => header_params,
1509
+ :query_params => query_params,
1510
+ :form_params => form_params,
1511
+ :body => post_body,
1512
+ :auth_names => auth_names,
1513
+ :return_type => return_type
1514
+ )
1515
+
1516
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1517
+ if @api_client.config.debugging
1518
+ @api_client.config.logger.debug "API called: InboundEmailApi#list_inbox_threads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1519
+ end
1520
+ return data, status_code, headers
1521
+ end
1522
+
1523
+ # List inboxes
1524
+ # @param [Hash] opts the optional parameters
1525
+ # @option opts [Boolean] :include_counts Add &#x60;received_count&#x60; to each inbox and &#x60;meta.received_total&#x60; (all delivered mail, including mail with no inbox). Counts use the same filter as the default received-email list.
1526
+ # @return [InboxListResponse]
1527
+ def list_inboxes(opts = {})
1528
+ data, _status_code, _headers = list_inboxes_with_http_info(opts)
1529
+ data
1530
+ end
1531
+
1532
+ # List inboxes
1533
+ # @param [Hash] opts the optional parameters
1534
+ # @option opts [Boolean] :include_counts Add &#x60;received_count&#x60; to each inbox and &#x60;meta.received_total&#x60; (all delivered mail, including mail with no inbox). Counts use the same filter as the default received-email list.
1535
+ # @return [Array<(InboxListResponse, Integer, Hash)>] InboxListResponse data, response status code and response headers
1536
+ def list_inboxes_with_http_info(opts = {})
1537
+ if @api_client.config.debugging
1538
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.list_inboxes ...'
1539
+ end
1540
+ # resource path
1541
+ local_var_path = '/inboxes'
1542
+
1543
+ # query parameters
1544
+ query_params = opts[:query_params] || {}
1545
+ query_params[:'include_counts'] = opts[:'include_counts'] if !opts[:'include_counts'].nil?
1546
+
1547
+ # header parameters
1548
+ header_params = opts[:header_params] || {}
1549
+ # HTTP header 'Accept' (if needed)
1550
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1551
+
1552
+ # form parameters
1553
+ form_params = opts[:form_params] || {}
1554
+
1555
+ # http body (model)
1556
+ post_body = opts[:debug_body]
1557
+
1558
+ # return_type
1559
+ return_type = opts[:debug_return_type] || 'InboxListResponse'
1560
+
1561
+ # auth_names
1562
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1563
+
1564
+ new_options = opts.merge(
1565
+ :operation => :"InboundEmailApi.list_inboxes",
1566
+ :header_params => header_params,
1567
+ :query_params => query_params,
1568
+ :form_params => form_params,
1569
+ :body => post_body,
1570
+ :auth_names => auth_names,
1571
+ :return_type => return_type
1572
+ )
1573
+
1574
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1575
+ if @api_client.config.debugging
1576
+ @api_client.config.logger.debug "API called: InboundEmailApi#list_inboxes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1577
+ end
1578
+ return data, status_code, headers
1579
+ end
1580
+
1581
+ # Remove a label from a thread
1582
+ # @param thread_id [String]
1583
+ # @param label_id [String]
1584
+ # @param [Hash] opts the optional parameters
1585
+ # @return [ThreadResponse]
1586
+ def remove_inbox_thread_label(thread_id, label_id, opts = {})
1587
+ data, _status_code, _headers = remove_inbox_thread_label_with_http_info(thread_id, label_id, opts)
1588
+ data
1589
+ end
1590
+
1591
+ # Remove a label from a thread
1592
+ # @param thread_id [String]
1593
+ # @param label_id [String]
1594
+ # @param [Hash] opts the optional parameters
1595
+ # @return [Array<(ThreadResponse, Integer, Hash)>] ThreadResponse data, response status code and response headers
1596
+ def remove_inbox_thread_label_with_http_info(thread_id, label_id, opts = {})
1597
+ if @api_client.config.debugging
1598
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.remove_inbox_thread_label ...'
1599
+ end
1600
+ # verify the required parameter 'thread_id' is set
1601
+ if @api_client.config.client_side_validation && thread_id.nil?
1602
+ fail ArgumentError, "Missing the required parameter 'thread_id' when calling InboundEmailApi.remove_inbox_thread_label"
1603
+ end
1604
+ # verify the required parameter 'label_id' is set
1605
+ if @api_client.config.client_side_validation && label_id.nil?
1606
+ fail ArgumentError, "Missing the required parameter 'label_id' when calling InboundEmailApi.remove_inbox_thread_label"
1607
+ end
1608
+ # resource path
1609
+ local_var_path = '/inboxes/threads/{threadId}/labels/{labelId}'.sub('{' + 'threadId' + '}', CGI.escape(thread_id.to_s)).sub('{' + 'labelId' + '}', CGI.escape(label_id.to_s))
1610
+
1611
+ # query parameters
1612
+ query_params = opts[:query_params] || {}
1613
+
1614
+ # header parameters
1615
+ header_params = opts[:header_params] || {}
1616
+ # HTTP header 'Accept' (if needed)
1617
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1618
+
1619
+ # form parameters
1620
+ form_params = opts[:form_params] || {}
1621
+
1622
+ # http body (model)
1623
+ post_body = opts[:debug_body]
1624
+
1625
+ # return_type
1626
+ return_type = opts[:debug_return_type] || 'ThreadResponse'
1627
+
1628
+ # auth_names
1629
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1630
+
1631
+ new_options = opts.merge(
1632
+ :operation => :"InboundEmailApi.remove_inbox_thread_label",
1633
+ :header_params => header_params,
1634
+ :query_params => query_params,
1635
+ :form_params => form_params,
1636
+ :body => post_body,
1637
+ :auth_names => auth_names,
1638
+ :return_type => return_type
1639
+ )
1640
+
1641
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
1642
+ if @api_client.config.debugging
1643
+ @api_client.config.logger.debug "API called: InboundEmailApi#remove_inbox_thread_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1644
+ end
1645
+ return data, status_code, headers
1646
+ end
1647
+
1648
+ # Reply to a received email
1649
+ # Send a reply to a received email that threads under the original in the recipient's mail client. Zyphr sets `to` (the original sender), the `Re:` subject, and the `In-Reply-To` / `References` headers from the received email; any of those fields in the body are ignored. Everything else behaves exactly like `POST /emails` (`html`/`text`, `send_at`/`delay`, quotas, suppression). A reply is relationship mail (no `List-Unsubscribe` headers; a recipient's marketing unsubscribe and the throttle's random drop do not block it; bounces and complaints still do) when the received email passed DMARC, the reply is not `classification: marketing`, it is sent within 30 days of receipt, and it is one of the first 3 such replies to that email. Otherwise it is sent as ordinary mail. Templates are not supported, because a template's own subject would break threading. Quarantined or dropped mail cannot be replied to.
1650
+ # @param id [String]
1651
+ # @param reply_email_request [ReplyEmailRequest]
1652
+ # @param [Hash] opts the optional parameters
1653
+ # @option opts [String] :idempotency_key
1654
+ # @return [SendEmailResponse]
1655
+ def reply_to_inbound_email(id, reply_email_request, opts = {})
1656
+ data, _status_code, _headers = reply_to_inbound_email_with_http_info(id, reply_email_request, opts)
1657
+ data
1658
+ end
1659
+
1660
+ # Reply to a received email
1661
+ # Send a reply to a received email that threads under the original in the recipient&#39;s mail client. Zyphr sets &#x60;to&#x60; (the original sender), the &#x60;Re:&#x60; subject, and the &#x60;In-Reply-To&#x60; / &#x60;References&#x60; headers from the received email; any of those fields in the body are ignored. Everything else behaves exactly like &#x60;POST /emails&#x60; (&#x60;html&#x60;/&#x60;text&#x60;, &#x60;send_at&#x60;/&#x60;delay&#x60;, quotas, suppression). A reply is relationship mail (no &#x60;List-Unsubscribe&#x60; headers; a recipient&#39;s marketing unsubscribe and the throttle&#39;s random drop do not block it; bounces and complaints still do) when the received email passed DMARC, the reply is not &#x60;classification: marketing&#x60;, it is sent within 30 days of receipt, and it is one of the first 3 such replies to that email. Otherwise it is sent as ordinary mail. Templates are not supported, because a template&#39;s own subject would break threading. Quarantined or dropped mail cannot be replied to.
1662
+ # @param id [String]
1663
+ # @param reply_email_request [ReplyEmailRequest]
1664
+ # @param [Hash] opts the optional parameters
1665
+ # @option opts [String] :idempotency_key
1666
+ # @return [Array<(SendEmailResponse, Integer, Hash)>] SendEmailResponse data, response status code and response headers
1667
+ def reply_to_inbound_email_with_http_info(id, reply_email_request, opts = {})
1668
+ if @api_client.config.debugging
1669
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.reply_to_inbound_email ...'
1670
+ end
1671
+ # verify the required parameter 'id' is set
1672
+ if @api_client.config.client_side_validation && id.nil?
1673
+ fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.reply_to_inbound_email"
1674
+ end
1675
+ # verify the required parameter 'reply_email_request' is set
1676
+ if @api_client.config.client_side_validation && reply_email_request.nil?
1677
+ fail ArgumentError, "Missing the required parameter 'reply_email_request' when calling InboundEmailApi.reply_to_inbound_email"
1678
+ end
1679
+ # resource path
1680
+ local_var_path = '/inbound-emails/{id}/reply'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
1681
+
1682
+ # query parameters
1683
+ query_params = opts[:query_params] || {}
1684
+
1685
+ # header parameters
1686
+ header_params = opts[:header_params] || {}
1687
+ # HTTP header 'Accept' (if needed)
1688
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1689
+ # HTTP header 'Content-Type'
1690
+ content_type = @api_client.select_header_content_type(['application/json'])
1691
+ if !content_type.nil?
1692
+ header_params['Content-Type'] = content_type
1693
+ end
1694
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1695
+
1696
+ # form parameters
1697
+ form_params = opts[:form_params] || {}
1698
+
1699
+ # http body (model)
1700
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(reply_email_request)
1701
+
1702
+ # return_type
1703
+ return_type = opts[:debug_return_type] || 'SendEmailResponse'
1704
+
1705
+ # auth_names
1706
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1707
+
1708
+ new_options = opts.merge(
1709
+ :operation => :"InboundEmailApi.reply_to_inbound_email",
547
1710
  :header_params => header_params,
548
1711
  :query_params => query_params,
549
1712
  :form_params => form_params,
@@ -559,6 +1722,223 @@ module Zyphr
559
1722
  return data, status_code, headers
560
1723
  end
561
1724
 
1725
+ # Reply to a thread
1726
+ # Replies to the newest received email in the thread, exactly as `POST /inbound-emails/{id}/reply` does: the recipient, `Re:` subject and threading headers come from that email, and `reply_to` defaults to the inbox address so the customer's answer comes back to this thread. Test-mode keys cannot reply here.
1727
+ # @param thread_id [String]
1728
+ # @param reply_email_request [ReplyEmailRequest]
1729
+ # @param [Hash] opts the optional parameters
1730
+ # @option opts [String] :idempotency_key
1731
+ # @return [SendEmailResponse]
1732
+ def reply_to_inbox_thread(thread_id, reply_email_request, opts = {})
1733
+ data, _status_code, _headers = reply_to_inbox_thread_with_http_info(thread_id, reply_email_request, opts)
1734
+ data
1735
+ end
1736
+
1737
+ # Reply to a thread
1738
+ # Replies to the newest received email in the thread, exactly as &#x60;POST /inbound-emails/{id}/reply&#x60; does: the recipient, &#x60;Re:&#x60; subject and threading headers come from that email, and &#x60;reply_to&#x60; defaults to the inbox address so the customer&#39;s answer comes back to this thread. Test-mode keys cannot reply here.
1739
+ # @param thread_id [String]
1740
+ # @param reply_email_request [ReplyEmailRequest]
1741
+ # @param [Hash] opts the optional parameters
1742
+ # @option opts [String] :idempotency_key
1743
+ # @return [Array<(SendEmailResponse, Integer, Hash)>] SendEmailResponse data, response status code and response headers
1744
+ def reply_to_inbox_thread_with_http_info(thread_id, reply_email_request, opts = {})
1745
+ if @api_client.config.debugging
1746
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.reply_to_inbox_thread ...'
1747
+ end
1748
+ # verify the required parameter 'thread_id' is set
1749
+ if @api_client.config.client_side_validation && thread_id.nil?
1750
+ fail ArgumentError, "Missing the required parameter 'thread_id' when calling InboundEmailApi.reply_to_inbox_thread"
1751
+ end
1752
+ # verify the required parameter 'reply_email_request' is set
1753
+ if @api_client.config.client_side_validation && reply_email_request.nil?
1754
+ fail ArgumentError, "Missing the required parameter 'reply_email_request' when calling InboundEmailApi.reply_to_inbox_thread"
1755
+ end
1756
+ # resource path
1757
+ local_var_path = '/inboxes/threads/{threadId}/reply'.sub('{' + 'threadId' + '}', CGI.escape(thread_id.to_s))
1758
+
1759
+ # query parameters
1760
+ query_params = opts[:query_params] || {}
1761
+
1762
+ # header parameters
1763
+ header_params = opts[:header_params] || {}
1764
+ # HTTP header 'Accept' (if needed)
1765
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1766
+ # HTTP header 'Content-Type'
1767
+ content_type = @api_client.select_header_content_type(['application/json'])
1768
+ if !content_type.nil?
1769
+ header_params['Content-Type'] = content_type
1770
+ end
1771
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1772
+
1773
+ # form parameters
1774
+ form_params = opts[:form_params] || {}
1775
+
1776
+ # http body (model)
1777
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(reply_email_request)
1778
+
1779
+ # return_type
1780
+ return_type = opts[:debug_return_type] || 'SendEmailResponse'
1781
+
1782
+ # auth_names
1783
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1784
+
1785
+ new_options = opts.merge(
1786
+ :operation => :"InboundEmailApi.reply_to_inbox_thread",
1787
+ :header_params => header_params,
1788
+ :query_params => query_params,
1789
+ :form_params => form_params,
1790
+ :body => post_body,
1791
+ :auth_names => auth_names,
1792
+ :return_type => return_type
1793
+ )
1794
+
1795
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1796
+ if @api_client.config.debugging
1797
+ @api_client.config.logger.debug "API called: InboundEmailApi#reply_to_inbox_thread\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1798
+ end
1799
+ return data, status_code, headers
1800
+ end
1801
+
1802
+ # Send a draft
1803
+ # A draft in a thread is sent exactly like `POST /inboxes/threads/{id}/reply`: to the thread's newest received email, with the `Re:` subject, threading headers, and `reply_to` defaulting to the inbox address. A draft with no thread is sent like `POST /emails`. The draft is deleted once the send is accepted; if the send is refused (a 4xx) the draft is kept and can be fixed and sent again. Takes no body.
1804
+ # @param draft_id [String]
1805
+ # @param [Hash] opts the optional parameters
1806
+ # @option opts [String] :idempotency_key
1807
+ # @return [SendEmailResponse]
1808
+ def send_inbox_draft(draft_id, opts = {})
1809
+ data, _status_code, _headers = send_inbox_draft_with_http_info(draft_id, opts)
1810
+ data
1811
+ end
1812
+
1813
+ # Send a draft
1814
+ # A draft in a thread is sent exactly like &#x60;POST /inboxes/threads/{id}/reply&#x60;: to the thread&#39;s newest received email, with the &#x60;Re:&#x60; subject, threading headers, and &#x60;reply_to&#x60; defaulting to the inbox address. A draft with no thread is sent like &#x60;POST /emails&#x60;. The draft is deleted once the send is accepted; if the send is refused (a 4xx) the draft is kept and can be fixed and sent again. Takes no body.
1815
+ # @param draft_id [String]
1816
+ # @param [Hash] opts the optional parameters
1817
+ # @option opts [String] :idempotency_key
1818
+ # @return [Array<(SendEmailResponse, Integer, Hash)>] SendEmailResponse data, response status code and response headers
1819
+ def send_inbox_draft_with_http_info(draft_id, opts = {})
1820
+ if @api_client.config.debugging
1821
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.send_inbox_draft ...'
1822
+ end
1823
+ # verify the required parameter 'draft_id' is set
1824
+ if @api_client.config.client_side_validation && draft_id.nil?
1825
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling InboundEmailApi.send_inbox_draft"
1826
+ end
1827
+ # resource path
1828
+ local_var_path = '/inboxes/drafts/{draftId}/send'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s))
1829
+
1830
+ # query parameters
1831
+ query_params = opts[:query_params] || {}
1832
+
1833
+ # header parameters
1834
+ header_params = opts[:header_params] || {}
1835
+ # HTTP header 'Accept' (if needed)
1836
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1837
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1838
+
1839
+ # form parameters
1840
+ form_params = opts[:form_params] || {}
1841
+
1842
+ # http body (model)
1843
+ post_body = opts[:debug_body]
1844
+
1845
+ # return_type
1846
+ return_type = opts[:debug_return_type] || 'SendEmailResponse'
1847
+
1848
+ # auth_names
1849
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1850
+
1851
+ new_options = opts.merge(
1852
+ :operation => :"InboundEmailApi.send_inbox_draft",
1853
+ :header_params => header_params,
1854
+ :query_params => query_params,
1855
+ :form_params => form_params,
1856
+ :body => post_body,
1857
+ :auth_names => auth_names,
1858
+ :return_type => return_type
1859
+ )
1860
+
1861
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1862
+ if @api_client.config.debugging
1863
+ @api_client.config.logger.debug "API called: InboundEmailApi#send_inbox_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1864
+ end
1865
+ return data, status_code, headers
1866
+ end
1867
+
1868
+ # Set a thread's labels
1869
+ # Replaces the thread's labels with exactly `label_ids` (an empty list clears them).
1870
+ # @param thread_id [String]
1871
+ # @param thread_labels_request [ThreadLabelsRequest]
1872
+ # @param [Hash] opts the optional parameters
1873
+ # @return [ThreadResponse]
1874
+ def set_inbox_thread_labels(thread_id, thread_labels_request, opts = {})
1875
+ data, _status_code, _headers = set_inbox_thread_labels_with_http_info(thread_id, thread_labels_request, opts)
1876
+ data
1877
+ end
1878
+
1879
+ # Set a thread&#39;s labels
1880
+ # Replaces the thread&#39;s labels with exactly &#x60;label_ids&#x60; (an empty list clears them).
1881
+ # @param thread_id [String]
1882
+ # @param thread_labels_request [ThreadLabelsRequest]
1883
+ # @param [Hash] opts the optional parameters
1884
+ # @return [Array<(ThreadResponse, Integer, Hash)>] ThreadResponse data, response status code and response headers
1885
+ def set_inbox_thread_labels_with_http_info(thread_id, thread_labels_request, opts = {})
1886
+ if @api_client.config.debugging
1887
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.set_inbox_thread_labels ...'
1888
+ end
1889
+ # verify the required parameter 'thread_id' is set
1890
+ if @api_client.config.client_side_validation && thread_id.nil?
1891
+ fail ArgumentError, "Missing the required parameter 'thread_id' when calling InboundEmailApi.set_inbox_thread_labels"
1892
+ end
1893
+ # verify the required parameter 'thread_labels_request' is set
1894
+ if @api_client.config.client_side_validation && thread_labels_request.nil?
1895
+ fail ArgumentError, "Missing the required parameter 'thread_labels_request' when calling InboundEmailApi.set_inbox_thread_labels"
1896
+ end
1897
+ # resource path
1898
+ local_var_path = '/inboxes/threads/{threadId}/labels'.sub('{' + 'threadId' + '}', CGI.escape(thread_id.to_s))
1899
+
1900
+ # query parameters
1901
+ query_params = opts[:query_params] || {}
1902
+
1903
+ # header parameters
1904
+ header_params = opts[:header_params] || {}
1905
+ # HTTP header 'Accept' (if needed)
1906
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1907
+ # HTTP header 'Content-Type'
1908
+ content_type = @api_client.select_header_content_type(['application/json'])
1909
+ if !content_type.nil?
1910
+ header_params['Content-Type'] = content_type
1911
+ end
1912
+
1913
+ # form parameters
1914
+ form_params = opts[:form_params] || {}
1915
+
1916
+ # http body (model)
1917
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(thread_labels_request)
1918
+
1919
+ # return_type
1920
+ return_type = opts[:debug_return_type] || 'ThreadResponse'
1921
+
1922
+ # auth_names
1923
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
1924
+
1925
+ new_options = opts.merge(
1926
+ :operation => :"InboundEmailApi.set_inbox_thread_labels",
1927
+ :header_params => header_params,
1928
+ :query_params => query_params,
1929
+ :form_params => form_params,
1930
+ :body => post_body,
1931
+ :auth_names => auth_names,
1932
+ :return_type => return_type
1933
+ )
1934
+
1935
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
1936
+ if @api_client.config.debugging
1937
+ @api_client.config.logger.debug "API called: InboundEmailApi#set_inbox_thread_labels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1938
+ end
1939
+ return data, status_code, headers
1940
+ end
1941
+
562
1942
  # Update an inbox
563
1943
  # Rename the inbox or change the display name recipients see. The address cannot change. On the catch-all, `enabled: false` turns on strict addresses: mail to any address without a named inbox is dropped until it is re-enabled. Named inboxes cannot be disabled (422 `not_catch_all`).
564
1944
  # @param id [String]
@@ -632,5 +2012,225 @@ module Zyphr
632
2012
  end
633
2013
  return data, status_code, headers
634
2014
  end
2015
+
2016
+ # Update a draft
2017
+ # Change any field; `null` clears it. A draft that is being sent can't be changed.
2018
+ # @param draft_id [String]
2019
+ # @param draft_request [DraftRequest]
2020
+ # @param [Hash] opts the optional parameters
2021
+ # @return [DraftResponse]
2022
+ def update_inbox_draft(draft_id, draft_request, opts = {})
2023
+ data, _status_code, _headers = update_inbox_draft_with_http_info(draft_id, draft_request, opts)
2024
+ data
2025
+ end
2026
+
2027
+ # Update a draft
2028
+ # Change any field; &#x60;null&#x60; clears it. A draft that is being sent can&#39;t be changed.
2029
+ # @param draft_id [String]
2030
+ # @param draft_request [DraftRequest]
2031
+ # @param [Hash] opts the optional parameters
2032
+ # @return [Array<(DraftResponse, Integer, Hash)>] DraftResponse data, response status code and response headers
2033
+ def update_inbox_draft_with_http_info(draft_id, draft_request, opts = {})
2034
+ if @api_client.config.debugging
2035
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.update_inbox_draft ...'
2036
+ end
2037
+ # verify the required parameter 'draft_id' is set
2038
+ if @api_client.config.client_side_validation && draft_id.nil?
2039
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling InboundEmailApi.update_inbox_draft"
2040
+ end
2041
+ # verify the required parameter 'draft_request' is set
2042
+ if @api_client.config.client_side_validation && draft_request.nil?
2043
+ fail ArgumentError, "Missing the required parameter 'draft_request' when calling InboundEmailApi.update_inbox_draft"
2044
+ end
2045
+ # resource path
2046
+ local_var_path = '/inboxes/drafts/{draftId}'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s))
2047
+
2048
+ # query parameters
2049
+ query_params = opts[:query_params] || {}
2050
+
2051
+ # header parameters
2052
+ header_params = opts[:header_params] || {}
2053
+ # HTTP header 'Accept' (if needed)
2054
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2055
+ # HTTP header 'Content-Type'
2056
+ content_type = @api_client.select_header_content_type(['application/json'])
2057
+ if !content_type.nil?
2058
+ header_params['Content-Type'] = content_type
2059
+ end
2060
+
2061
+ # form parameters
2062
+ form_params = opts[:form_params] || {}
2063
+
2064
+ # http body (model)
2065
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(draft_request)
2066
+
2067
+ # return_type
2068
+ return_type = opts[:debug_return_type] || 'DraftResponse'
2069
+
2070
+ # auth_names
2071
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
2072
+
2073
+ new_options = opts.merge(
2074
+ :operation => :"InboundEmailApi.update_inbox_draft",
2075
+ :header_params => header_params,
2076
+ :query_params => query_params,
2077
+ :form_params => form_params,
2078
+ :body => post_body,
2079
+ :auth_names => auth_names,
2080
+ :return_type => return_type
2081
+ )
2082
+
2083
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
2084
+ if @api_client.config.debugging
2085
+ @api_client.config.logger.debug "API called: InboundEmailApi#update_inbox_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2086
+ end
2087
+ return data, status_code, headers
2088
+ end
2089
+
2090
+ # Update a label
2091
+ # @param label_id [String]
2092
+ # @param update_inbox_label_request [UpdateInboxLabelRequest]
2093
+ # @param [Hash] opts the optional parameters
2094
+ # @return [InboxLabelResponse]
2095
+ def update_inbox_label(label_id, update_inbox_label_request, opts = {})
2096
+ data, _status_code, _headers = update_inbox_label_with_http_info(label_id, update_inbox_label_request, opts)
2097
+ data
2098
+ end
2099
+
2100
+ # Update a label
2101
+ # @param label_id [String]
2102
+ # @param update_inbox_label_request [UpdateInboxLabelRequest]
2103
+ # @param [Hash] opts the optional parameters
2104
+ # @return [Array<(InboxLabelResponse, Integer, Hash)>] InboxLabelResponse data, response status code and response headers
2105
+ def update_inbox_label_with_http_info(label_id, update_inbox_label_request, opts = {})
2106
+ if @api_client.config.debugging
2107
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.update_inbox_label ...'
2108
+ end
2109
+ # verify the required parameter 'label_id' is set
2110
+ if @api_client.config.client_side_validation && label_id.nil?
2111
+ fail ArgumentError, "Missing the required parameter 'label_id' when calling InboundEmailApi.update_inbox_label"
2112
+ end
2113
+ # verify the required parameter 'update_inbox_label_request' is set
2114
+ if @api_client.config.client_side_validation && update_inbox_label_request.nil?
2115
+ fail ArgumentError, "Missing the required parameter 'update_inbox_label_request' when calling InboundEmailApi.update_inbox_label"
2116
+ end
2117
+ # resource path
2118
+ local_var_path = '/inboxes/labels/{labelId}'.sub('{' + 'labelId' + '}', CGI.escape(label_id.to_s))
2119
+
2120
+ # query parameters
2121
+ query_params = opts[:query_params] || {}
2122
+
2123
+ # header parameters
2124
+ header_params = opts[:header_params] || {}
2125
+ # HTTP header 'Accept' (if needed)
2126
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2127
+ # HTTP header 'Content-Type'
2128
+ content_type = @api_client.select_header_content_type(['application/json'])
2129
+ if !content_type.nil?
2130
+ header_params['Content-Type'] = content_type
2131
+ end
2132
+
2133
+ # form parameters
2134
+ form_params = opts[:form_params] || {}
2135
+
2136
+ # http body (model)
2137
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_inbox_label_request)
2138
+
2139
+ # return_type
2140
+ return_type = opts[:debug_return_type] || 'InboxLabelResponse'
2141
+
2142
+ # auth_names
2143
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
2144
+
2145
+ new_options = opts.merge(
2146
+ :operation => :"InboundEmailApi.update_inbox_label",
2147
+ :header_params => header_params,
2148
+ :query_params => query_params,
2149
+ :form_params => form_params,
2150
+ :body => post_body,
2151
+ :auth_names => auth_names,
2152
+ :return_type => return_type
2153
+ )
2154
+
2155
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
2156
+ if @api_client.config.debugging
2157
+ @api_client.config.logger.debug "API called: InboundEmailApi#update_inbox_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2158
+ end
2159
+ return data, status_code, headers
2160
+ end
2161
+
2162
+ # Update a thread
2163
+ # Move it to a folder, mark it read or unread, or assign it to a member of your account (`null` unassigns).
2164
+ # @param thread_id [String]
2165
+ # @param update_thread_request [UpdateThreadRequest]
2166
+ # @param [Hash] opts the optional parameters
2167
+ # @return [ThreadResponse]
2168
+ def update_inbox_thread(thread_id, update_thread_request, opts = {})
2169
+ data, _status_code, _headers = update_inbox_thread_with_http_info(thread_id, update_thread_request, opts)
2170
+ data
2171
+ end
2172
+
2173
+ # Update a thread
2174
+ # Move it to a folder, mark it read or unread, or assign it to a member of your account (&#x60;null&#x60; unassigns).
2175
+ # @param thread_id [String]
2176
+ # @param update_thread_request [UpdateThreadRequest]
2177
+ # @param [Hash] opts the optional parameters
2178
+ # @return [Array<(ThreadResponse, Integer, Hash)>] ThreadResponse data, response status code and response headers
2179
+ def update_inbox_thread_with_http_info(thread_id, update_thread_request, opts = {})
2180
+ if @api_client.config.debugging
2181
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.update_inbox_thread ...'
2182
+ end
2183
+ # verify the required parameter 'thread_id' is set
2184
+ if @api_client.config.client_side_validation && thread_id.nil?
2185
+ fail ArgumentError, "Missing the required parameter 'thread_id' when calling InboundEmailApi.update_inbox_thread"
2186
+ end
2187
+ # verify the required parameter 'update_thread_request' is set
2188
+ if @api_client.config.client_side_validation && update_thread_request.nil?
2189
+ fail ArgumentError, "Missing the required parameter 'update_thread_request' when calling InboundEmailApi.update_inbox_thread"
2190
+ end
2191
+ # resource path
2192
+ local_var_path = '/inboxes/threads/{threadId}'.sub('{' + 'threadId' + '}', CGI.escape(thread_id.to_s))
2193
+
2194
+ # query parameters
2195
+ query_params = opts[:query_params] || {}
2196
+
2197
+ # header parameters
2198
+ header_params = opts[:header_params] || {}
2199
+ # HTTP header 'Accept' (if needed)
2200
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2201
+ # HTTP header 'Content-Type'
2202
+ content_type = @api_client.select_header_content_type(['application/json'])
2203
+ if !content_type.nil?
2204
+ header_params['Content-Type'] = content_type
2205
+ end
2206
+
2207
+ # form parameters
2208
+ form_params = opts[:form_params] || {}
2209
+
2210
+ # http body (model)
2211
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_thread_request)
2212
+
2213
+ # return_type
2214
+ return_type = opts[:debug_return_type] || 'ThreadResponse'
2215
+
2216
+ # auth_names
2217
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
2218
+
2219
+ new_options = opts.merge(
2220
+ :operation => :"InboundEmailApi.update_inbox_thread",
2221
+ :header_params => header_params,
2222
+ :query_params => query_params,
2223
+ :form_params => form_params,
2224
+ :body => post_body,
2225
+ :auth_names => auth_names,
2226
+ :return_type => return_type
2227
+ )
2228
+
2229
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
2230
+ if @api_client.config.debugging
2231
+ @api_client.config.logger.debug "API called: InboundEmailApi#update_inbox_thread\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2232
+ end
2233
+ return data, status_code, headers
2234
+ end
635
2235
  end
636
2236
  end