sendmux-sending 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/LICENSE +21 -0
  4. data/README.md +95 -0
  5. data/lib/sendmux/sending/client.rb +9 -1
  6. data/lib/sendmux/sending/version.rb +1 -1
  7. data/lib/sendmux_sending_generated/api/attachments_api.rb +370 -0
  8. data/lib/sendmux_sending_generated/api/emails_api.rb +2 -20
  9. data/lib/sendmux_sending_generated/api/meta_api.rb +82 -0
  10. data/lib/sendmux_sending_generated/api_client.rb +9 -3
  11. data/lib/sendmux_sending_generated/api_error.rb +2 -2
  12. data/lib/sendmux_sending_generated/api_model_base.rb +2 -2
  13. data/lib/sendmux_sending_generated/configuration.rb +2 -2
  14. data/lib/sendmux_sending_generated/models/address.rb +2 -2
  15. data/lib/sendmux_sending_generated/models/attachment.rb +78 -249
  16. data/lib/sendmux_sending_generated/models/attachment_upload_data.rb +284 -0
  17. data/lib/sendmux_sending_generated/models/attachment_upload_intent_data.rb +337 -0
  18. data/lib/sendmux_sending_generated/models/attachment_upload_intent_request.rb +279 -0
  19. data/lib/sendmux_sending_generated/models/attachment_upload_intent_response.rb +223 -0
  20. data/lib/sendmux_sending_generated/models/attachment_upload_response.rb +223 -0
  21. data/lib/sendmux_sending_generated/models/batch_result_item.rb +2 -2
  22. data/lib/sendmux_sending_generated/models/batch_send_request.rb +2 -2
  23. data/lib/sendmux_sending_generated/models/batch_send_success_data.rb +2 -2
  24. data/lib/sendmux_sending_generated/models/batch_send_success_response.rb +2 -2
  25. data/lib/sendmux_sending_generated/models/batch_summary.rb +2 -2
  26. data/lib/sendmux_sending_generated/models/email_send_request.rb +3 -3
  27. data/lib/sendmux_sending_generated/models/error_detail.rb +2 -2
  28. data/lib/sendmux_sending_generated/models/error_issue.rb +2 -2
  29. data/lib/sendmux_sending_generated/models/error_response.rb +2 -2
  30. data/lib/sendmux_sending_generated/models/inline_attachment.rb +274 -0
  31. data/lib/sendmux_sending_generated/models/meta.rb +2 -2
  32. data/lib/sendmux_sending_generated/models/recipient.rb +2 -2
  33. data/lib/sendmux_sending_generated/models/send_success_data.rb +2 -2
  34. data/lib/sendmux_sending_generated/models/send_success_response.rb +2 -2
  35. data/lib/sendmux_sending_generated/models/success_envelope.rb +2 -2
  36. data/lib/sendmux_sending_generated/models/uploaded_attachment_ref.rb +176 -0
  37. data/lib/sendmux_sending_generated/version.rb +2 -2
  38. data/lib/sendmux_sending_generated.rb +11 -2
  39. metadata +22 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 918f45018116ebe842bcaf14f9c9c2508b341f06e1d7177640a669e5ca5cd4d2
4
- data.tar.gz: cbc93b2be68a0b6b83421ff36b7c5123ef26b0df35a71726c7eb584c0f2fedf8
3
+ metadata.gz: 6dbfe224c407947d8b0b69e3c8ac663c5d2e6af75b820ef775971f40fb659545
4
+ data.tar.gz: d73c320e4b15a22d56b28a82e96076780c5b77009e185f0a4e7fcc517785ea40
5
5
  SHA512:
6
- metadata.gz: aad5e18355aca1dddc0d5ed536d8fa38ac97c1131bf2c17ee0faafa95a84ba5e90997ca970d6bce89131649cb2f685c47996d0428f8bc0d90120917a11977176
7
- data.tar.gz: 0c308914b4d52a68b0eea4c7c69f78f7c15551b8bcb492677312bd18898786c0b35df705565ecbb5395c1b745afaed6354967dc62aefe645b7a6d3a2c6e3a5f6
6
+ metadata.gz: 20b08ea90472135d92dcf0e346790489cd219c2f64c8004b0dbc3881cc01746eb8b0b98862bb27e9bd55999fd771098116f69dda0373916bce80e9979780e65c
7
+ data.tar.gz: a05947636992ca4e2b71d35cc73219a008c53000d83eb4a954bda632bbd3ccbc6e6924c2810ef510eb5b7506c8762d257bf6c631da7e8aa21c6681ce0bdf45fb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.0](https://github.com/Sendmux/sendmux-sdk/compare/ruby-sending/v1.1.0...ruby-sending/v1.2.0) (2026-07-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * **sdk:** add sending attachment upload surfaces ([#96](https://github.com/Sendmux/sendmux-sdk/issues/96)) ([b8f9d5f](https://github.com/Sendmux/sendmux-sdk/commit/b8f9d5fe3c1ae510db82ce05c55cbcad92b43b44))
9
+
10
+ ## [1.1.0](https://github.com/Sendmux/sendmux-sdk/compare/ruby-sending/v1.0.0...ruby-sending/v1.1.0) (2026-07-01)
11
+
12
+
13
+ ### Features
14
+
15
+ * allow owner-approved agent tokens for sending ([9d1cb7d](https://github.com/Sendmux/sendmux-sdk/commit/9d1cb7df3df5aef1f59a4990dc087178ba3a7b21))
16
+
3
17
  ## 1.0.0 (2026-06-02)
4
18
 
5
19
 
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sendmux
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,3 +1,98 @@
1
1
  # sendmux-sending
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/sendmux-sending.svg)](https://rubygems.org/gems/sendmux-sending)
4
+ [![CI](https://github.com/Sendmux/sendmux-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/Sendmux/sendmux-sdk/actions/workflows/ci.yml)
5
+ [![Licence: MIT](https://img.shields.io/badge/licence-MIT-blue.svg)](https://github.com/Sendmux/sendmux-sdk/blob/main/LICENSE)
6
+
3
7
  Ruby SDK package for the Sendmux Sending API.
8
+
9
+ ## Documentation
10
+
11
+ - Ruby SDK guide: https://sendmux.ai/docs/sdks/ruby
12
+ - Sending API reference: https://sendmux.ai/docs/sending-api
13
+ - Source: https://github.com/Sendmux/sendmux-sdk/tree/main/packages/ruby/sending
14
+ - Changelog: https://github.com/Sendmux/sendmux-sdk/blob/main/packages/ruby/sending/CHANGELOG.md
15
+
16
+ ## Requirements
17
+
18
+ - Ruby 3.1 or newer.
19
+ - A send-capable `smx_mbx_` key or owner-approved Sending-resource `smx_agent_` token.
20
+
21
+ ## Installation
22
+
23
+ ```sh
24
+ gem install sendmux-sending
25
+ ```
26
+
27
+ Or add it to your Gemfile:
28
+
29
+ ```ruby
30
+ gem "sendmux-sending", "~> 1.0"
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ Create a sending client with a send-capable key before calling generated operations.
36
+
37
+ ```ruby
38
+ require "sendmux/sending"
39
+
40
+ client = Sendmux::Sending::Client.new(
41
+ api_key: ENV.fetch("SENDMUX_MAILBOX_KEY")
42
+ )
43
+
44
+ request = Sendmux::Sending::Generated::EmailSendRequest.new(
45
+ from: Sendmux::Sending::Generated::Address.new(email: "sender@example.com"),
46
+ to: Sendmux::Sending::Generated::Address.new(email: "recipient@example.com"),
47
+ subject: "Hello from Sendmux",
48
+ text_body: "This message was sent with the Sendmux Ruby SDK."
49
+ )
50
+
51
+ response = client.emails.sending_send_email(
52
+ request,
53
+ Sendmux::Core::Headers.idempotency_key("send-email-001")
54
+ )
55
+
56
+ puts response.data.message_id
57
+ ```
58
+
59
+ ### Client surface
60
+
61
+ `Sendmux::Sending::Client` exposes:
62
+
63
+ - `client.emails` for `sending_send_email` and `sending_send_email_batch`.
64
+ - `client.meta` for `sending_get_open_api_spec`.
65
+
66
+ Pass `base_url:` only when you are targeting an explicitly provided Sendmux endpoint for a controlled environment.
67
+
68
+ ### Idempotency and retries
69
+
70
+ Mutating sending operations accept the `:idempotency_key` option. Use `Sendmux::Core::Headers.idempotency_key` so retries are safe when a request is replayable.
71
+
72
+ ```ruby
73
+ client.emails.sending_send_email(
74
+ request,
75
+ Sendmux::Core::Headers.idempotency_key("send-email-002")
76
+ )
77
+ ```
78
+
79
+ ### Errors
80
+
81
+ Generated API errors are mapped to `Sendmux::Core::ApiError`.
82
+
83
+ ```ruby
84
+ begin
85
+ client.emails.sending_send_email(request)
86
+ rescue Sendmux::Core::ApiError => error
87
+ warn "#{error.status} #{error.code}: #{error.message}"
88
+ end
89
+ ```
90
+
91
+ ## Support
92
+
93
+ - Documentation: https://sendmux.ai/docs
94
+ - Contact: contact@sendmux.ai
95
+
96
+ ## Licence
97
+
98
+ MIT licence. See https://github.com/Sendmux/sendmux-sdk/blob/main/LICENSE.
@@ -19,16 +19,24 @@ module Sendmux
19
19
  @configuration = Sendmux::Core::Auth.configure_bearer(
20
20
  Generated::Configuration.new,
21
21
  api_key,
22
- Sendmux::Core::ApiKeySurface::ROOT,
22
+ Sendmux::Core::ApiKeySurface::SENDING,
23
23
  base_url: base_url
24
24
  )
25
25
  Sendmux::Core::Retry.configure(@configuration, retry_options)
26
26
  @api_client = ApiClient.new(@configuration)
27
27
  end
28
28
 
29
+ def attachments
30
+ @attachments ||= Generated::AttachmentsApi.new(@api_client)
31
+ end
32
+
29
33
  def emails
30
34
  @emails ||= Generated::EmailsApi.new(@api_client)
31
35
  end
36
+
37
+ def meta
38
+ @meta ||= Generated::MetaApi.new(@api_client)
39
+ end
32
40
  end
33
41
  end
34
42
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sendmux
4
4
  module Sending
5
- VERSION = '1.0.0'
5
+ VERSION = '1.2.0'
6
6
  end
7
7
  end
@@ -0,0 +1,370 @@
1
+ =begin
2
+ #Sendmux Sending API
3
+
4
+ #Send emails programmatically via the Sendmux email infrastructure. Every response carries an `X-Request-Id` header; errors include a `retryable` flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept an `Idempotency-Key` header for safe retries.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Sendmux::Sending::Generated
16
+ class AttachmentsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Upload bytes to an attachment upload URL
23
+ # Upload the exact binary bytes for a previously-created attachment upload URL. This operation uses the short-lived upload token header returned by POST /emails/attachment-uploads, not a Sendmux API key.
24
+ # @param x_sendmux_upload_token [String] Short-lived upload token returned by POST /emails/attachment-uploads.
25
+ # @param content_length [Integer] Exact number of bytes in the binary request body.
26
+ # @param upload_id [String] Upload intent ID returned by POST /emails/attachment-uploads.
27
+ # @param body [File]
28
+ # @param [Hash] opts the optional parameters
29
+ # @return [AttachmentUploadResponse]
30
+ def sending_complete_attachment_upload(x_sendmux_upload_token, content_length, upload_id, body, opts = {})
31
+ data, _status_code, _headers = sending_complete_attachment_upload_with_http_info(x_sendmux_upload_token, content_length, upload_id, body, opts)
32
+ data
33
+ end
34
+
35
+ # Upload bytes to an attachment upload URL
36
+ # Upload the exact binary bytes for a previously-created attachment upload URL. This operation uses the short-lived upload token header returned by POST /emails/attachment-uploads, not a Sendmux API key.
37
+ # @param x_sendmux_upload_token [String] Short-lived upload token returned by POST /emails/attachment-uploads.
38
+ # @param content_length [Integer] Exact number of bytes in the binary request body.
39
+ # @param upload_id [String] Upload intent ID returned by POST /emails/attachment-uploads.
40
+ # @param body [File]
41
+ # @param [Hash] opts the optional parameters
42
+ # @return [Array<(AttachmentUploadResponse, Integer, Hash)>] AttachmentUploadResponse data, response status code and response headers
43
+ def sending_complete_attachment_upload_with_http_info(x_sendmux_upload_token, content_length, upload_id, body, opts = {})
44
+ if @api_client.config.debugging
45
+ @api_client.config.logger.debug 'Calling API: AttachmentsApi.sending_complete_attachment_upload ...'
46
+ end
47
+ # verify the required parameter 'x_sendmux_upload_token' is set
48
+ if @api_client.config.client_side_validation && x_sendmux_upload_token.nil?
49
+ fail ArgumentError, "Missing the required parameter 'x_sendmux_upload_token' when calling AttachmentsApi.sending_complete_attachment_upload"
50
+ end
51
+ # verify the required parameter 'content_length' is set
52
+ if @api_client.config.client_side_validation && content_length.nil?
53
+ fail ArgumentError, "Missing the required parameter 'content_length' when calling AttachmentsApi.sending_complete_attachment_upload"
54
+ end
55
+ if @api_client.config.client_side_validation && content_length < 1
56
+ fail ArgumentError, 'invalid value for "content_length" when calling AttachmentsApi.sending_complete_attachment_upload, must be greater than or equal to 1.'
57
+ end
58
+
59
+ # verify the required parameter 'upload_id' is set
60
+ if @api_client.config.client_side_validation && upload_id.nil?
61
+ fail ArgumentError, "Missing the required parameter 'upload_id' when calling AttachmentsApi.sending_complete_attachment_upload"
62
+ end
63
+ pattern = Regexp.new(/^upl_[a-z0-9]{24}$/)
64
+ if @api_client.config.client_side_validation && upload_id !~ pattern
65
+ fail ArgumentError, "invalid value for 'upload_id' when calling AttachmentsApi.sending_complete_attachment_upload, must conform to the pattern #{pattern}."
66
+ end
67
+
68
+ # verify the required parameter 'body' is set
69
+ if @api_client.config.client_side_validation && body.nil?
70
+ fail ArgumentError, "Missing the required parameter 'body' when calling AttachmentsApi.sending_complete_attachment_upload"
71
+ end
72
+ # resource path
73
+ local_var_path = '/emails/attachment-uploads/{upload_id}'.sub('{upload_id}', CGI.escape(upload_id.to_s))
74
+
75
+ # query parameters
76
+ query_params = opts[:query_params] || {}
77
+
78
+ # header parameters
79
+ header_params = opts[:header_params] || {}
80
+ # HTTP header 'Accept' (if needed)
81
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
82
+ # HTTP header 'Content-Type'
83
+ content_type = @api_client.select_header_content_type(['application/octet-stream'])
84
+ if !content_type.nil?
85
+ header_params['Content-Type'] = content_type
86
+ end
87
+ header_params[:'X-Sendmux-Upload-Token'] = x_sendmux_upload_token
88
+ header_params[:'Content-Length'] = content_length
89
+
90
+ # form parameters
91
+ form_params = opts[:form_params] || {}
92
+
93
+ # http body (model)
94
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
95
+
96
+ # return_type
97
+ return_type = opts[:debug_return_type] || 'AttachmentUploadResponse'
98
+
99
+ # auth_names
100
+ auth_names = opts[:debug_auth_names] || []
101
+
102
+ new_options = opts.merge(
103
+ :operation => :"AttachmentsApi.sending_complete_attachment_upload",
104
+ :header_params => header_params,
105
+ :query_params => query_params,
106
+ :form_params => form_params,
107
+ :body => post_body,
108
+ :auth_names => auth_names,
109
+ :return_type => return_type
110
+ )
111
+
112
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
113
+ if @api_client.config.debugging
114
+ @api_client.config.logger.debug "API called: AttachmentsApi#sending_complete_attachment_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
115
+ end
116
+ return data, status_code, headers
117
+ end
118
+
119
+ # Create an attachment upload URL
120
+ # Create a short-lived upload URL and token that lets a remote client PUT one binary attachment without exposing the API key on the upload request. Requires `email.send` permission.
121
+ # @param attachment_upload_intent_request [AttachmentUploadIntentRequest]
122
+ # @param [Hash] opts the optional parameters
123
+ # @option opts [String] :idempotency_key Optional client-generated key to make the request idempotent for 24 hours. Replays under the same key return the cached response; a reused key with a different body returns 409 idempotency_conflict.
124
+ # @return [AttachmentUploadIntentResponse]
125
+ def sending_create_attachment_upload(attachment_upload_intent_request, opts = {})
126
+ data, _status_code, _headers = sending_create_attachment_upload_with_http_info(attachment_upload_intent_request, opts)
127
+ data
128
+ end
129
+
130
+ # Create an attachment upload URL
131
+ # Create a short-lived upload URL and token that lets a remote client PUT one binary attachment without exposing the API key on the upload request. Requires &#x60;email.send&#x60; permission.
132
+ # @param attachment_upload_intent_request [AttachmentUploadIntentRequest]
133
+ # @param [Hash] opts the optional parameters
134
+ # @option opts [String] :idempotency_key Optional client-generated key to make the request idempotent for 24 hours. Replays under the same key return the cached response; a reused key with a different body returns 409 idempotency_conflict.
135
+ # @return [Array<(AttachmentUploadIntentResponse, Integer, Hash)>] AttachmentUploadIntentResponse data, response status code and response headers
136
+ def sending_create_attachment_upload_with_http_info(attachment_upload_intent_request, opts = {})
137
+ if @api_client.config.debugging
138
+ @api_client.config.logger.debug 'Calling API: AttachmentsApi.sending_create_attachment_upload ...'
139
+ end
140
+ # verify the required parameter 'attachment_upload_intent_request' is set
141
+ if @api_client.config.client_side_validation && attachment_upload_intent_request.nil?
142
+ fail ArgumentError, "Missing the required parameter 'attachment_upload_intent_request' when calling AttachmentsApi.sending_create_attachment_upload"
143
+ end
144
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
145
+ fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling AttachmentsApi.sending_create_attachment_upload, the character length must be smaller than or equal to 255.'
146
+ end
147
+
148
+ # resource path
149
+ local_var_path = '/emails/attachment-uploads'
150
+
151
+ # query parameters
152
+ query_params = opts[:query_params] || {}
153
+
154
+ # header parameters
155
+ header_params = opts[:header_params] || {}
156
+ # HTTP header 'Accept' (if needed)
157
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
158
+ # HTTP header 'Content-Type'
159
+ content_type = @api_client.select_header_content_type(['application/json'])
160
+ if !content_type.nil?
161
+ header_params['Content-Type'] = content_type
162
+ end
163
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
164
+
165
+ # form parameters
166
+ form_params = opts[:form_params] || {}
167
+
168
+ # http body (model)
169
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(attachment_upload_intent_request)
170
+
171
+ # return_type
172
+ return_type = opts[:debug_return_type] || 'AttachmentUploadIntentResponse'
173
+
174
+ # auth_names
175
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
176
+
177
+ new_options = opts.merge(
178
+ :operation => :"AttachmentsApi.sending_create_attachment_upload",
179
+ :header_params => header_params,
180
+ :query_params => query_params,
181
+ :form_params => form_params,
182
+ :body => post_body,
183
+ :auth_names => auth_names,
184
+ :return_type => return_type
185
+ )
186
+
187
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
188
+ if @api_client.config.debugging
189
+ @api_client.config.logger.debug "API called: AttachmentsApi#sending_create_attachment_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
190
+ end
191
+ return data, status_code, headers
192
+ end
193
+
194
+ # Get attachment metadata
195
+ # Return metadata for a temporary uploaded attachment owned by the authenticated team. File bytes are not returned.
196
+ # @param attachment_id [String] Temporary attachment ID returned by an upload endpoint.
197
+ # @param [Hash] opts the optional parameters
198
+ # @return [AttachmentUploadResponse]
199
+ def sending_get_attachment(attachment_id, opts = {})
200
+ data, _status_code, _headers = sending_get_attachment_with_http_info(attachment_id, opts)
201
+ data
202
+ end
203
+
204
+ # Get attachment metadata
205
+ # Return metadata for a temporary uploaded attachment owned by the authenticated team. File bytes are not returned.
206
+ # @param attachment_id [String] Temporary attachment ID returned by an upload endpoint.
207
+ # @param [Hash] opts the optional parameters
208
+ # @return [Array<(AttachmentUploadResponse, Integer, Hash)>] AttachmentUploadResponse data, response status code and response headers
209
+ def sending_get_attachment_with_http_info(attachment_id, opts = {})
210
+ if @api_client.config.debugging
211
+ @api_client.config.logger.debug 'Calling API: AttachmentsApi.sending_get_attachment ...'
212
+ end
213
+ # verify the required parameter 'attachment_id' is set
214
+ if @api_client.config.client_side_validation && attachment_id.nil?
215
+ fail ArgumentError, "Missing the required parameter 'attachment_id' when calling AttachmentsApi.sending_get_attachment"
216
+ end
217
+ pattern = Regexp.new(/^att_[a-z0-9]{24}$/)
218
+ if @api_client.config.client_side_validation && attachment_id !~ pattern
219
+ fail ArgumentError, "invalid value for 'attachment_id' when calling AttachmentsApi.sending_get_attachment, must conform to the pattern #{pattern}."
220
+ end
221
+
222
+ # resource path
223
+ local_var_path = '/emails/attachments/{attachment_id}'.sub('{attachment_id}', CGI.escape(attachment_id.to_s))
224
+
225
+ # query parameters
226
+ query_params = opts[:query_params] || {}
227
+
228
+ # header parameters
229
+ header_params = opts[:header_params] || {}
230
+ # HTTP header 'Accept' (if needed)
231
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
232
+
233
+ # form parameters
234
+ form_params = opts[:form_params] || {}
235
+
236
+ # http body (model)
237
+ post_body = opts[:debug_body]
238
+
239
+ # return_type
240
+ return_type = opts[:debug_return_type] || 'AttachmentUploadResponse'
241
+
242
+ # auth_names
243
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
244
+
245
+ new_options = opts.merge(
246
+ :operation => :"AttachmentsApi.sending_get_attachment",
247
+ :header_params => header_params,
248
+ :query_params => query_params,
249
+ :form_params => form_params,
250
+ :body => post_body,
251
+ :auth_names => auth_names,
252
+ :return_type => return_type
253
+ )
254
+
255
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
256
+ if @api_client.config.debugging
257
+ @api_client.config.logger.debug "API called: AttachmentsApi#sending_get_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
258
+ end
259
+ return data, status_code, headers
260
+ end
261
+
262
+ # Upload an attachment
263
+ # Upload binary attachment bytes and receive a temporary attachment_id for use in attachments[]. Requires `email.send` permission.
264
+ # @param content_length [Integer] Exact number of bytes in the binary request body.
265
+ # @param filename [String] Filename to associate with the uploaded attachment.
266
+ # @param body [File]
267
+ # @param [Hash] opts the optional parameters
268
+ # @option opts [String] :idempotency_key Optional client-generated key to make the request idempotent for 24 hours. Replays under the same key return the cached response; a reused key with a different body returns 409 idempotency_conflict.
269
+ # @option opts [String] :content_type MIME type override for the uploaded attachment.
270
+ # @return [AttachmentUploadResponse]
271
+ def sending_upload_attachment(content_length, filename, body, opts = {})
272
+ data, _status_code, _headers = sending_upload_attachment_with_http_info(content_length, filename, body, opts)
273
+ data
274
+ end
275
+
276
+ # Upload an attachment
277
+ # Upload binary attachment bytes and receive a temporary attachment_id for use in attachments[]. Requires &#x60;email.send&#x60; permission.
278
+ # @param content_length [Integer] Exact number of bytes in the binary request body.
279
+ # @param filename [String] Filename to associate with the uploaded attachment.
280
+ # @param body [File]
281
+ # @param [Hash] opts the optional parameters
282
+ # @option opts [String] :idempotency_key Optional client-generated key to make the request idempotent for 24 hours. Replays under the same key return the cached response; a reused key with a different body returns 409 idempotency_conflict.
283
+ # @option opts [String] :content_type MIME type override for the uploaded attachment.
284
+ # @return [Array<(AttachmentUploadResponse, Integer, Hash)>] AttachmentUploadResponse data, response status code and response headers
285
+ def sending_upload_attachment_with_http_info(content_length, filename, body, opts = {})
286
+ if @api_client.config.debugging
287
+ @api_client.config.logger.debug 'Calling API: AttachmentsApi.sending_upload_attachment ...'
288
+ end
289
+ # verify the required parameter 'content_length' is set
290
+ if @api_client.config.client_side_validation && content_length.nil?
291
+ fail ArgumentError, "Missing the required parameter 'content_length' when calling AttachmentsApi.sending_upload_attachment"
292
+ end
293
+ if @api_client.config.client_side_validation && content_length < 1
294
+ fail ArgumentError, 'invalid value for "content_length" when calling AttachmentsApi.sending_upload_attachment, must be greater than or equal to 1.'
295
+ end
296
+
297
+ # verify the required parameter 'filename' is set
298
+ if @api_client.config.client_side_validation && filename.nil?
299
+ fail ArgumentError, "Missing the required parameter 'filename' when calling AttachmentsApi.sending_upload_attachment"
300
+ end
301
+ if @api_client.config.client_side_validation && filename.to_s.length > 255
302
+ fail ArgumentError, 'invalid value for "filename" when calling AttachmentsApi.sending_upload_attachment, the character length must be smaller than or equal to 255.'
303
+ end
304
+
305
+ if @api_client.config.client_side_validation && filename.to_s.length < 1
306
+ fail ArgumentError, 'invalid value for "filename" when calling AttachmentsApi.sending_upload_attachment, the character length must be greater than or equal to 1.'
307
+ end
308
+
309
+ # verify the required parameter 'body' is set
310
+ if @api_client.config.client_side_validation && body.nil?
311
+ fail ArgumentError, "Missing the required parameter 'body' when calling AttachmentsApi.sending_upload_attachment"
312
+ end
313
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
314
+ fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling AttachmentsApi.sending_upload_attachment, the character length must be smaller than or equal to 255.'
315
+ end
316
+
317
+ if @api_client.config.client_side_validation && !opts[:'content_type'].nil? && opts[:'content_type'].to_s.length > 255
318
+ fail ArgumentError, 'invalid value for "opts[:"content_type"]" when calling AttachmentsApi.sending_upload_attachment, the character length must be smaller than or equal to 255.'
319
+ end
320
+
321
+ # resource path
322
+ local_var_path = '/emails/attachments'
323
+
324
+ # query parameters
325
+ query_params = opts[:query_params] || {}
326
+ query_params[:'filename'] = filename
327
+ query_params[:'content_type'] = opts[:'content_type'] if !opts[:'content_type'].nil?
328
+
329
+ # header parameters
330
+ header_params = opts[:header_params] || {}
331
+ # HTTP header 'Accept' (if needed)
332
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
333
+ # HTTP header 'Content-Type'
334
+ content_type = @api_client.select_header_content_type(['application/octet-stream'])
335
+ if !content_type.nil?
336
+ header_params['Content-Type'] = content_type
337
+ end
338
+ header_params[:'Content-Length'] = content_length
339
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
340
+
341
+ # form parameters
342
+ form_params = opts[:form_params] || {}
343
+
344
+ # http body (model)
345
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
346
+
347
+ # return_type
348
+ return_type = opts[:debug_return_type] || 'AttachmentUploadResponse'
349
+
350
+ # auth_names
351
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
352
+
353
+ new_options = opts.merge(
354
+ :operation => :"AttachmentsApi.sending_upload_attachment",
355
+ :header_params => header_params,
356
+ :query_params => query_params,
357
+ :form_params => form_params,
358
+ :body => post_body,
359
+ :auth_names => auth_names,
360
+ :return_type => return_type
361
+ )
362
+
363
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
364
+ if @api_client.config.debugging
365
+ @api_client.config.logger.debug "API called: AttachmentsApi#sending_upload_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
366
+ end
367
+ return data, status_code, headers
368
+ end
369
+ end
370
+ end
@@ -1,7 +1,7 @@
1
1
  =begin
2
- #SendMux Sending API
2
+ #Sendmux Sending API
3
3
 
4
- #Send emails programmatically via the SendMux email infrastructure. Every response carries an `X-Request-Id` header; errors include a `retryable` flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept an `Idempotency-Key` header for safe retries.
4
+ #Send emails programmatically via the Sendmux email infrastructure. Every response carries an `X-Request-Id` header; errors include a `retryable` flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept an `Idempotency-Key` header for safe retries.
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
 
@@ -48,15 +48,6 @@ module Sendmux::Sending::Generated
48
48
  fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.sending_send_email, the character length must be smaller than or equal to 255.'
49
49
  end
50
50
 
51
- if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length < 1
52
- fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.sending_send_email, the character length must be greater than or equal to 1.'
53
- end
54
-
55
- pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
56
- if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern
57
- fail ArgumentError, "invalid value for 'opts[:\"idempotency_key\"]' when calling EmailsApi.sending_send_email, must conform to the pattern #{pattern}."
58
- end
59
-
60
51
  # resource path
61
52
  local_var_path = '/emails/send'
62
53
 
@@ -132,15 +123,6 @@ module Sendmux::Sending::Generated
132
123
  fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.sending_send_email_batch, the character length must be smaller than or equal to 255.'
133
124
  end
134
125
 
135
- if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length < 1
136
- fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling EmailsApi.sending_send_email_batch, the character length must be greater than or equal to 1.'
137
- end
138
-
139
- pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
140
- if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern
141
- fail ArgumentError, "invalid value for 'opts[:\"idempotency_key\"]' when calling EmailsApi.sending_send_email_batch, must conform to the pattern #{pattern}."
142
- end
143
-
144
126
  # resource path
145
127
  local_var_path = '/emails/send/batch'
146
128