zyphr 0.1.70 → 0.1.72

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.
@@ -0,0 +1,20 @@
1
+ # Zyphr::UpdateInboxRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **name** | **String** | | [optional] |
8
+ | **from_name** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'zyphr'
14
+
15
+ instance = Zyphr::UpdateInboxRequest.new(
16
+ name: null,
17
+ from_name: null
18
+ )
19
+ ```
20
+
@@ -19,6 +19,135 @@ module Zyphr
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Create an inbox
23
+ # Create a named receiving address, `<local_part>@inbound.<domain>`, on a domain with inbound email enabled. Test-mode keys cannot create, update or delete inboxes, because inboxes change live mail routing. Once a domain has at least one inbox, mail to any other address on it is dropped; a domain with no inboxes keeps receiving at every address. Requires a plan with inbound email (Starter or higher).
24
+ # @param create_inbox_request [CreateInboxRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [InboxResponse]
27
+ def create_inbox(create_inbox_request, opts = {})
28
+ data, _status_code, _headers = create_inbox_with_http_info(create_inbox_request, opts)
29
+ data
30
+ end
31
+
32
+ # Create an inbox
33
+ # Create a named receiving address, &#x60;&lt;local_part&gt;@inbound.&lt;domain&gt;&#x60;, on a domain with inbound email enabled. Test-mode keys cannot create, update or delete inboxes, because inboxes change live mail routing. Once a domain has at least one inbox, mail to any other address on it is dropped; a domain with no inboxes keeps receiving at every address. Requires a plan with inbound email (Starter or higher).
34
+ # @param create_inbox_request [CreateInboxRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(InboxResponse, Integer, Hash)>] InboxResponse data, response status code and response headers
37
+ def create_inbox_with_http_info(create_inbox_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.create_inbox ...'
40
+ end
41
+ # verify the required parameter 'create_inbox_request' is set
42
+ if @api_client.config.client_side_validation && create_inbox_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'create_inbox_request' when calling InboundEmailApi.create_inbox"
44
+ end
45
+ # resource path
46
+ local_var_path = '/inboxes'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_inbox_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'InboxResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"InboundEmailApi.create_inbox",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: InboundEmailApi#create_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Delete an inbox
91
+ # Delete the inbox. Mail it already received is kept (its `inbox_id` becomes null). If it was the domain's last inbox, the domain goes back to receiving at every address.
92
+ # @param id [String]
93
+ # @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
98
+ end
99
+
100
+ # Delete an inbox
101
+ # Delete the inbox. Mail it already received is kept (its &#x60;inbox_id&#x60; becomes null). If it was the domain&#39;s last inbox, the domain goes back to receiving at every address.
102
+ # @param id [String]
103
+ # @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 = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.delete_inbox ...'
108
+ 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"
112
+ end
113
+ # resource path
114
+ local_var_path = '/inboxes/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+
122
+ # form parameters
123
+ form_params = opts[:form_params] || {}
124
+
125
+ # http body (model)
126
+ post_body = opts[:debug_body]
127
+
128
+ # return_type
129
+ return_type = opts[:debug_return_type]
130
+
131
+ # auth_names
132
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
133
+
134
+ new_options = opts.merge(
135
+ :operation => :"InboundEmailApi.delete_inbox",
136
+ :header_params => header_params,
137
+ :query_params => query_params,
138
+ :form_params => form_params,
139
+ :body => post_body,
140
+ :auth_names => auth_names,
141
+ :return_type => return_type
142
+ )
143
+
144
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
145
+ 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}"
147
+ end
148
+ return data, status_code, headers
149
+ end
150
+
22
151
  # Get an attachment download URL
23
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.
24
153
  # @param id [String]
@@ -151,6 +280,67 @@ module Zyphr
151
280
  return data, status_code, headers
152
281
  end
153
282
 
283
+ # Get an inbox
284
+ # @param id [String]
285
+ # @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
290
+ end
291
+
292
+ # Get an inbox
293
+ # @param id [String]
294
+ # @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 = {})
297
+ if @api_client.config.debugging
298
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbox ...'
299
+ 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"
303
+ end
304
+ # resource path
305
+ local_var_path = '/inboxes/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
306
+
307
+ # query parameters
308
+ query_params = opts[:query_params] || {}
309
+
310
+ # header parameters
311
+ 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
+
315
+ # form parameters
316
+ form_params = opts[:form_params] || {}
317
+
318
+ # http body (model)
319
+ post_body = opts[:debug_body]
320
+
321
+ # return_type
322
+ return_type = opts[:debug_return_type] || 'InboxResponse'
323
+
324
+ # auth_names
325
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
326
+
327
+ new_options = opts.merge(
328
+ :operation => :"InboundEmailApi.get_inbox",
329
+ :header_params => header_params,
330
+ :query_params => query_params,
331
+ :form_params => form_params,
332
+ :body => post_body,
333
+ :auth_names => auth_names,
334
+ :return_type => return_type
335
+ )
336
+
337
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
338
+ 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}"
340
+ end
341
+ return data, status_code, headers
342
+ end
343
+
154
344
  # List received emails
155
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.
156
346
  # @param [Hash] opts the optional parameters
@@ -230,5 +420,211 @@ module Zyphr
230
420
  end
231
421
  return data, status_code, headers
232
422
  end
423
+
424
+ # List inboxes
425
+ # @param [Hash] opts the optional parameters
426
+ # @return [InboxListResponse]
427
+ def list_inboxes(opts = {})
428
+ data, _status_code, _headers = list_inboxes_with_http_info(opts)
429
+ data
430
+ end
431
+
432
+ # List inboxes
433
+ # @param [Hash] opts the optional parameters
434
+ # @return [Array<(InboxListResponse, Integer, Hash)>] InboxListResponse data, response status code and response headers
435
+ def list_inboxes_with_http_info(opts = {})
436
+ if @api_client.config.debugging
437
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.list_inboxes ...'
438
+ end
439
+ # resource path
440
+ local_var_path = '/inboxes'
441
+
442
+ # query parameters
443
+ query_params = opts[:query_params] || {}
444
+
445
+ # header parameters
446
+ header_params = opts[:header_params] || {}
447
+ # HTTP header 'Accept' (if needed)
448
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
449
+
450
+ # form parameters
451
+ form_params = opts[:form_params] || {}
452
+
453
+ # http body (model)
454
+ post_body = opts[:debug_body]
455
+
456
+ # return_type
457
+ return_type = opts[:debug_return_type] || 'InboxListResponse'
458
+
459
+ # auth_names
460
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
461
+
462
+ new_options = opts.merge(
463
+ :operation => :"InboundEmailApi.list_inboxes",
464
+ :header_params => header_params,
465
+ :query_params => query_params,
466
+ :form_params => form_params,
467
+ :body => post_body,
468
+ :auth_names => auth_names,
469
+ :return_type => return_type
470
+ )
471
+
472
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
473
+ if @api_client.config.debugging
474
+ @api_client.config.logger.debug "API called: InboundEmailApi#list_inboxes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
475
+ end
476
+ return data, status_code, headers
477
+ end
478
+
479
+ # Reply to a received email
480
+ # 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). Templates are not supported, because a template's own subject would break threading. Quarantined or dropped mail cannot be replied to.
481
+ # @param id [String]
482
+ # @param reply_to_inbound_email_request [ReplyToInboundEmailRequest]
483
+ # @param [Hash] opts the optional parameters
484
+ # @option opts [String] :idempotency_key
485
+ # @return [SendEmailResponse]
486
+ def reply_to_inbound_email(id, reply_to_inbound_email_request, opts = {})
487
+ data, _status_code, _headers = reply_to_inbound_email_with_http_info(id, reply_to_inbound_email_request, opts)
488
+ data
489
+ end
490
+
491
+ # Reply to a received email
492
+ # 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). Templates are not supported, because a template&#39;s own subject would break threading. Quarantined or dropped mail cannot be replied to.
493
+ # @param id [String]
494
+ # @param reply_to_inbound_email_request [ReplyToInboundEmailRequest]
495
+ # @param [Hash] opts the optional parameters
496
+ # @option opts [String] :idempotency_key
497
+ # @return [Array<(SendEmailResponse, Integer, Hash)>] SendEmailResponse data, response status code and response headers
498
+ def reply_to_inbound_email_with_http_info(id, reply_to_inbound_email_request, opts = {})
499
+ if @api_client.config.debugging
500
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.reply_to_inbound_email ...'
501
+ end
502
+ # verify the required parameter 'id' is set
503
+ if @api_client.config.client_side_validation && id.nil?
504
+ fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.reply_to_inbound_email"
505
+ end
506
+ # verify the required parameter 'reply_to_inbound_email_request' is set
507
+ if @api_client.config.client_side_validation && reply_to_inbound_email_request.nil?
508
+ fail ArgumentError, "Missing the required parameter 'reply_to_inbound_email_request' when calling InboundEmailApi.reply_to_inbound_email"
509
+ end
510
+ # resource path
511
+ local_var_path = '/inbound-emails/{id}/reply'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
512
+
513
+ # query parameters
514
+ query_params = opts[:query_params] || {}
515
+
516
+ # header parameters
517
+ header_params = opts[:header_params] || {}
518
+ # HTTP header 'Accept' (if needed)
519
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
520
+ # HTTP header 'Content-Type'
521
+ content_type = @api_client.select_header_content_type(['application/json'])
522
+ if !content_type.nil?
523
+ header_params['Content-Type'] = content_type
524
+ end
525
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
526
+
527
+ # form parameters
528
+ form_params = opts[:form_params] || {}
529
+
530
+ # http body (model)
531
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(reply_to_inbound_email_request)
532
+
533
+ # return_type
534
+ return_type = opts[:debug_return_type] || 'SendEmailResponse'
535
+
536
+ # auth_names
537
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
538
+
539
+ new_options = opts.merge(
540
+ :operation => :"InboundEmailApi.reply_to_inbound_email",
541
+ :header_params => header_params,
542
+ :query_params => query_params,
543
+ :form_params => form_params,
544
+ :body => post_body,
545
+ :auth_names => auth_names,
546
+ :return_type => return_type
547
+ )
548
+
549
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
550
+ if @api_client.config.debugging
551
+ @api_client.config.logger.debug "API called: InboundEmailApi#reply_to_inbound_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
552
+ end
553
+ return data, status_code, headers
554
+ end
555
+
556
+ # Update an inbox
557
+ # Rename the inbox or change the display name recipients see. The address cannot change.
558
+ # @param id [String]
559
+ # @param update_inbox_request [UpdateInboxRequest]
560
+ # @param [Hash] opts the optional parameters
561
+ # @return [InboxResponse]
562
+ def update_inbox(id, update_inbox_request, opts = {})
563
+ data, _status_code, _headers = update_inbox_with_http_info(id, update_inbox_request, opts)
564
+ data
565
+ end
566
+
567
+ # Update an inbox
568
+ # Rename the inbox or change the display name recipients see. The address cannot change.
569
+ # @param id [String]
570
+ # @param update_inbox_request [UpdateInboxRequest]
571
+ # @param [Hash] opts the optional parameters
572
+ # @return [Array<(InboxResponse, Integer, Hash)>] InboxResponse data, response status code and response headers
573
+ def update_inbox_with_http_info(id, update_inbox_request, opts = {})
574
+ if @api_client.config.debugging
575
+ @api_client.config.logger.debug 'Calling API: InboundEmailApi.update_inbox ...'
576
+ end
577
+ # verify the required parameter 'id' is set
578
+ if @api_client.config.client_side_validation && id.nil?
579
+ fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.update_inbox"
580
+ end
581
+ # verify the required parameter 'update_inbox_request' is set
582
+ if @api_client.config.client_side_validation && update_inbox_request.nil?
583
+ fail ArgumentError, "Missing the required parameter 'update_inbox_request' when calling InboundEmailApi.update_inbox"
584
+ end
585
+ # resource path
586
+ local_var_path = '/inboxes/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
587
+
588
+ # query parameters
589
+ query_params = opts[:query_params] || {}
590
+
591
+ # header parameters
592
+ header_params = opts[:header_params] || {}
593
+ # HTTP header 'Accept' (if needed)
594
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
595
+ # HTTP header 'Content-Type'
596
+ content_type = @api_client.select_header_content_type(['application/json'])
597
+ if !content_type.nil?
598
+ header_params['Content-Type'] = content_type
599
+ end
600
+
601
+ # form parameters
602
+ form_params = opts[:form_params] || {}
603
+
604
+ # http body (model)
605
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_inbox_request)
606
+
607
+ # return_type
608
+ return_type = opts[:debug_return_type] || 'InboxResponse'
609
+
610
+ # auth_names
611
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
612
+
613
+ new_options = opts.merge(
614
+ :operation => :"InboundEmailApi.update_inbox",
615
+ :header_params => header_params,
616
+ :query_params => query_params,
617
+ :form_params => form_params,
618
+ :body => post_body,
619
+ :auth_names => auth_names,
620
+ :return_type => return_type
621
+ )
622
+
623
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
624
+ if @api_client.config.debugging
625
+ @api_client.config.logger.debug "API called: InboundEmailApi#update_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
626
+ end
627
+ return data, status_code, headers
628
+ end
233
629
  end
234
630
  end
@@ -163,7 +163,7 @@ module Zyphr
163
163
  end
164
164
 
165
165
  # Send a Slack message
166
- # Send a message to a Slack channel through a connected Slack workspace. Either `text` or `blocks` must be provided. If `connection_id` is omitted, the project's active Slack connection is used. If `channel` is omitted, the connection's default channel is used.
166
+ # Queue a message to a Slack channel through a connected Slack workspace. Either `text` or `blocks` must be provided. If `connection_id` is omitted, the project's active Slack connection is used. If `channel` is omitted, the connection's default channel is used. The message is accepted with status `queued` and delivered asynchronously, with retries on transient Slack errors and rate limits. Poll `GET /slack/messages/{id}` for the outcome: `sent`, with `message_ts`, or `failed`, with the reason.
167
167
  # @param send_slack_message_request [SendSlackMessageRequest]
168
168
  # @param [Hash] opts the optional parameters
169
169
  # @return [SendSlackMessageResponse]
@@ -173,7 +173,7 @@ module Zyphr
173
173
  end
174
174
 
175
175
  # Send a Slack message
176
- # Send a message to a Slack channel through a connected Slack workspace. Either &#x60;text&#x60; or &#x60;blocks&#x60; must be provided. If &#x60;connection_id&#x60; is omitted, the project&#39;s active Slack connection is used. If &#x60;channel&#x60; is omitted, the connection&#39;s default channel is used.
176
+ # Queue a message to a Slack channel through a connected Slack workspace. Either &#x60;text&#x60; or &#x60;blocks&#x60; must be provided. If &#x60;connection_id&#x60; is omitted, the project&#39;s active Slack connection is used. If &#x60;channel&#x60; is omitted, the connection&#39;s default channel is used. The message is accepted with status &#x60;queued&#x60; and delivered asynchronously, with retries on transient Slack errors and rate limits. Poll &#x60;GET /slack/messages/{id}&#x60; for the outcome: &#x60;sent&#x60;, with &#x60;message_ts&#x60;, or &#x60;failed&#x60;, with the reason.
177
177
  # @param send_slack_message_request [SendSlackMessageRequest]
178
178
  # @param [Hash] opts the optional parameters
179
179
  # @return [Array<(SendSlackMessageResponse, Integer, Hash)>] SendSlackMessageResponse data, response status code and response headers