sendmux-sending 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +12 -0
- data/README.md +3 -0
- data/lib/sendmux/sending/client.rb +34 -0
- data/lib/sendmux/sending/version.rb +7 -0
- data/lib/sendmux/sending.rb +12 -0
- data/lib/sendmux_sending_generated/api/emails_api.rb +190 -0
- data/lib/sendmux_sending_generated/api_client.rb +441 -0
- data/lib/sendmux_sending_generated/api_error.rb +58 -0
- data/lib/sendmux_sending_generated/api_model_base.rb +88 -0
- data/lib/sendmux_sending_generated/configuration.rb +392 -0
- data/lib/sendmux_sending_generated/models/address.rb +215 -0
- data/lib/sendmux_sending_generated/models/attachment.rb +274 -0
- data/lib/sendmux_sending_generated/models/batch_result_item.rb +256 -0
- data/lib/sendmux_sending_generated/models/batch_send_request.rb +185 -0
- data/lib/sendmux_sending_generated/models/batch_send_success_data.rb +192 -0
- data/lib/sendmux_sending_generated/models/batch_send_success_response.rb +223 -0
- data/lib/sendmux_sending_generated/models/batch_summary.rb +219 -0
- data/lib/sendmux_sending_generated/models/email_send_request.rb +465 -0
- data/lib/sendmux_sending_generated/models/error_detail.rb +251 -0
- data/lib/sendmux_sending_generated/models/error_issue.rb +219 -0
- data/lib/sendmux_sending_generated/models/error_response.rb +216 -0
- data/lib/sendmux_sending_generated/models/meta.rb +165 -0
- data/lib/sendmux_sending_generated/models/recipient.rb +214 -0
- data/lib/sendmux_sending_generated/models/send_success_data.rb +227 -0
- data/lib/sendmux_sending_generated/models/send_success_response.rb +223 -0
- data/lib/sendmux_sending_generated/models/success_envelope.rb +190 -0
- data/lib/sendmux_sending_generated/version.rb +15 -0
- data/lib/sendmux_sending_generated.rb +57 -0
- metadata +146 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 918f45018116ebe842bcaf14f9c9c2508b341f06e1d7177640a669e5ca5cd4d2
|
|
4
|
+
data.tar.gz: cbc93b2be68a0b6b83421ff36b7c5123ef26b0df35a71726c7eb584c0f2fedf8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: aad5e18355aca1dddc0d5ed536d8fa38ac97c1131bf2c17ee0faafa95a84ba5e90997ca970d6bce89131649cb2f685c47996d0428f8bc0d90120917a11977176
|
|
7
|
+
data.tar.gz: 0c308914b4d52a68b0eea4c7c69f78f7c15551b8bcb492677312bd18898786c0b35df705565ecbb5395c1b745afaed6354967dc62aefe645b7a6d3a2c6e3a5f6
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 (2026-06-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **ruby:** add generated SDK packages ([f097fdf](https://github.com/Sendmux/sendmux-sdk/commit/f097fdf6afcbc2a048d9fdb1c9a669fff2a7ca4f))
|
|
9
|
+
|
|
10
|
+
## 1.0.0
|
|
11
|
+
|
|
12
|
+
- Initial generated Ruby Sending API package.
|
data/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sendmux
|
|
4
|
+
module Sending
|
|
5
|
+
DEFAULT_BASE_URL = 'https://smtp.sendmux.ai/api/v1'
|
|
6
|
+
|
|
7
|
+
class ApiClient < Generated::ApiClient
|
|
8
|
+
def call_api(...)
|
|
9
|
+
super
|
|
10
|
+
rescue Generated::ApiError => e
|
|
11
|
+
raise Sendmux::Core::ErrorMapper.map(e)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class Client
|
|
16
|
+
attr_reader :api_client, :configuration
|
|
17
|
+
|
|
18
|
+
def initialize(api_key:, base_url: DEFAULT_BASE_URL, retry_options: nil)
|
|
19
|
+
@configuration = Sendmux::Core::Auth.configure_bearer(
|
|
20
|
+
Generated::Configuration.new,
|
|
21
|
+
api_key,
|
|
22
|
+
Sendmux::Core::ApiKeySurface::ROOT,
|
|
23
|
+
base_url: base_url
|
|
24
|
+
)
|
|
25
|
+
Sendmux::Core::Retry.configure(@configuration, retry_options)
|
|
26
|
+
@api_client = ApiClient.new(@configuration)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def emails
|
|
30
|
+
@emails ||= Generated::EmailsApi.new(@api_client)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,190 @@
|
|
|
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 EmailsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Send a single email
|
|
23
|
+
# Queue a single email for delivery. Requires `email.send` permission.
|
|
24
|
+
# @param email_send_request [EmailSendRequest]
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @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.
|
|
27
|
+
# @return [SendSuccessResponse]
|
|
28
|
+
def sending_send_email(email_send_request, opts = {})
|
|
29
|
+
data, _status_code, _headers = sending_send_email_with_http_info(email_send_request, opts)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Send a single email
|
|
34
|
+
# Queue a single email for delivery. Requires `email.send` permission.
|
|
35
|
+
# @param email_send_request [EmailSendRequest]
|
|
36
|
+
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @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.
|
|
38
|
+
# @return [Array<(SendSuccessResponse, Integer, Hash)>] SendSuccessResponse data, response status code and response headers
|
|
39
|
+
def sending_send_email_with_http_info(email_send_request, opts = {})
|
|
40
|
+
if @api_client.config.debugging
|
|
41
|
+
@api_client.config.logger.debug 'Calling API: EmailsApi.sending_send_email ...'
|
|
42
|
+
end
|
|
43
|
+
# verify the required parameter 'email_send_request' is set
|
|
44
|
+
if @api_client.config.client_side_validation && email_send_request.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'email_send_request' when calling EmailsApi.sending_send_email"
|
|
46
|
+
end
|
|
47
|
+
if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
|
|
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
|
+
end
|
|
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
|
+
# resource path
|
|
61
|
+
local_var_path = '/emails/send'
|
|
62
|
+
|
|
63
|
+
# query parameters
|
|
64
|
+
query_params = opts[:query_params] || {}
|
|
65
|
+
|
|
66
|
+
# header parameters
|
|
67
|
+
header_params = opts[:header_params] || {}
|
|
68
|
+
# HTTP header 'Accept' (if needed)
|
|
69
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
70
|
+
# HTTP header 'Content-Type'
|
|
71
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
72
|
+
if !content_type.nil?
|
|
73
|
+
header_params['Content-Type'] = content_type
|
|
74
|
+
end
|
|
75
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
76
|
+
|
|
77
|
+
# form parameters
|
|
78
|
+
form_params = opts[:form_params] || {}
|
|
79
|
+
|
|
80
|
+
# http body (model)
|
|
81
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(email_send_request)
|
|
82
|
+
|
|
83
|
+
# return_type
|
|
84
|
+
return_type = opts[:debug_return_type] || 'SendSuccessResponse'
|
|
85
|
+
|
|
86
|
+
# auth_names
|
|
87
|
+
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
88
|
+
|
|
89
|
+
new_options = opts.merge(
|
|
90
|
+
:operation => :"EmailsApi.sending_send_email",
|
|
91
|
+
:header_params => header_params,
|
|
92
|
+
:query_params => query_params,
|
|
93
|
+
:form_params => form_params,
|
|
94
|
+
:body => post_body,
|
|
95
|
+
:auth_names => auth_names,
|
|
96
|
+
:return_type => return_type
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
100
|
+
if @api_client.config.debugging
|
|
101
|
+
@api_client.config.logger.debug "API called: EmailsApi#sending_send_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
102
|
+
end
|
|
103
|
+
return data, status_code, headers
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Send a batch of emails
|
|
107
|
+
# Queue up to 100 emails for delivery in a single request. Uses partial success model — individual message failures do not fail the entire batch. Requires `email.send` permission.
|
|
108
|
+
# @param batch_send_request [BatchSendRequest]
|
|
109
|
+
# @param [Hash] opts the optional parameters
|
|
110
|
+
# @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.
|
|
111
|
+
# @return [BatchSendSuccessResponse]
|
|
112
|
+
def sending_send_email_batch(batch_send_request, opts = {})
|
|
113
|
+
data, _status_code, _headers = sending_send_email_batch_with_http_info(batch_send_request, opts)
|
|
114
|
+
data
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Send a batch of emails
|
|
118
|
+
# Queue up to 100 emails for delivery in a single request. Uses partial success model — individual message failures do not fail the entire batch. Requires `email.send` permission.
|
|
119
|
+
# @param batch_send_request [BatchSendRequest]
|
|
120
|
+
# @param [Hash] opts the optional parameters
|
|
121
|
+
# @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.
|
|
122
|
+
# @return [Array<(BatchSendSuccessResponse, Integer, Hash)>] BatchSendSuccessResponse data, response status code and response headers
|
|
123
|
+
def sending_send_email_batch_with_http_info(batch_send_request, opts = {})
|
|
124
|
+
if @api_client.config.debugging
|
|
125
|
+
@api_client.config.logger.debug 'Calling API: EmailsApi.sending_send_email_batch ...'
|
|
126
|
+
end
|
|
127
|
+
# verify the required parameter 'batch_send_request' is set
|
|
128
|
+
if @api_client.config.client_side_validation && batch_send_request.nil?
|
|
129
|
+
fail ArgumentError, "Missing the required parameter 'batch_send_request' when calling EmailsApi.sending_send_email_batch"
|
|
130
|
+
end
|
|
131
|
+
if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
|
|
132
|
+
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
|
+
end
|
|
134
|
+
|
|
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
|
+
# resource path
|
|
145
|
+
local_var_path = '/emails/send/batch'
|
|
146
|
+
|
|
147
|
+
# query parameters
|
|
148
|
+
query_params = opts[:query_params] || {}
|
|
149
|
+
|
|
150
|
+
# header parameters
|
|
151
|
+
header_params = opts[:header_params] || {}
|
|
152
|
+
# HTTP header 'Accept' (if needed)
|
|
153
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
154
|
+
# HTTP header 'Content-Type'
|
|
155
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
156
|
+
if !content_type.nil?
|
|
157
|
+
header_params['Content-Type'] = content_type
|
|
158
|
+
end
|
|
159
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
160
|
+
|
|
161
|
+
# form parameters
|
|
162
|
+
form_params = opts[:form_params] || {}
|
|
163
|
+
|
|
164
|
+
# http body (model)
|
|
165
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_send_request)
|
|
166
|
+
|
|
167
|
+
# return_type
|
|
168
|
+
return_type = opts[:debug_return_type] || 'BatchSendSuccessResponse'
|
|
169
|
+
|
|
170
|
+
# auth_names
|
|
171
|
+
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
172
|
+
|
|
173
|
+
new_options = opts.merge(
|
|
174
|
+
:operation => :"EmailsApi.sending_send_email_batch",
|
|
175
|
+
:header_params => header_params,
|
|
176
|
+
:query_params => query_params,
|
|
177
|
+
:form_params => form_params,
|
|
178
|
+
:body => post_body,
|
|
179
|
+
:auth_names => auth_names,
|
|
180
|
+
:return_type => return_type
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
184
|
+
if @api_client.config.debugging
|
|
185
|
+
@api_client.config.logger.debug "API called: EmailsApi#sending_send_email_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
186
|
+
end
|
|
187
|
+
return data, status_code, headers
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|