Class: Sendmux::Management::Generated::DomainsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/sendmux_management_generated/api/domains_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DomainsApi

Returns a new instance of DomainsApi.



19
20
21
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#management_create_domain(opts = {}) ⇒ DomainItemResponse

Add a mailbox domain Creates a new sending domain and returns the DNS records the customer must place before verification can succeed. Provisioning touches both our mail platform and Amazon SES — on any failure the partial state is automatically rolled back. Supply an ‘Idempotency-Key` header (any unique string, max 255 chars) to safely retry on network errors. Replays with the same key return the original response; replays with a different body return `409 idempotency_conflict`.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



28
29
30
31
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 28

def management_create_domain(opts = {})
  data, _status_code, _headers = management_create_domain_with_http_info(opts)
  data
end

#management_create_domain_with_http_info(opts = {}) ⇒ Array<(DomainItemResponse, Integer, Hash)>

Add a mailbox domain Creates a new sending domain and returns the DNS records the customer must place before verification can succeed. Provisioning touches both our mail platform and Amazon SES — on any failure the partial state is automatically rolled back. Supply an &#x60;Idempotency-Key&#x60; header (any unique string, max 255 chars) to safely retry on network errors. Replays with the same key return the original response; replays with a different body return &#x60;409 idempotency_conflict&#x60;.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(DomainItemResponse, Integer, Hash)>)

    DomainItemResponse data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 39

def management_create_domain_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DomainsApi.management_create_domain ...'
  end
  if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
    fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling DomainsApi.management_create_domain, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/domains'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'management_create_domain_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'DomainItemResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DomainsApi.management_create_domain",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DomainsApi#management_create_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_delete_domain(public_id, opts = {}) ⇒ DomainDeletedResponse

Delete a mailbox domain Removes a domain from our mail platform, Amazon SES, and Sendmux. Blocked if any active mailbox still uses the domain — delete those mailboxes first.

Parameters:

  • public_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



98
99
100
101
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 98

def management_delete_domain(public_id, opts = {})
  data, _status_code, _headers = management_delete_domain_with_http_info(public_id, opts)
  data
end

#management_delete_domain_with_http_info(public_id, opts = {}) ⇒ Array<(DomainDeletedResponse, Integer, Hash)>

Delete a mailbox domain Removes a domain from our mail platform, Amazon SES, and Sendmux. Blocked if any active mailbox still uses the domain — delete those mailboxes first.

Parameters:

  • public_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DomainDeletedResponse, Integer, Hash)>)

    DomainDeletedResponse data, response status code and response headers



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 108

def management_delete_domain_with_http_info(public_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DomainsApi.management_delete_domain ...'
  end
  # verify the required parameter 'public_id' is set
  if @api_client.config.client_side_validation && public_id.nil?
    fail ArgumentError, "Missing the required parameter 'public_id' when calling DomainsApi.management_delete_domain"
  end
  # resource path
  local_var_path = '/domains/{public_id}'.sub('{public_id}', CGI.escape(public_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DomainDeletedResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DomainsApi.management_delete_domain",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DomainsApi#management_delete_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_get_domain(public_id, opts = {}) ⇒ DomainItemResponse

Get a mailbox domain Returns a single domain including its DNS records and latest verification state. Responses carry a weak ‘ETag` header — send it back as `If-None-Match` on the next request and the server will return `304 Not Modified` (no body) when the resource has not changed.

Parameters:

  • public_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :if_none_match (String)

Returns:



162
163
164
165
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 162

def management_get_domain(public_id, opts = {})
  data, _status_code, _headers = management_get_domain_with_http_info(public_id, opts)
  data
end

#management_get_domain_with_http_info(public_id, opts = {}) ⇒ Array<(DomainItemResponse, Integer, Hash)>

Get a mailbox domain Returns a single domain including its DNS records and latest verification state. Responses carry a weak &#x60;ETag&#x60; header — send it back as &#x60;If-None-Match&#x60; on the next request and the server will return &#x60;304 Not Modified&#x60; (no body) when the resource has not changed.

Parameters:

  • public_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :if_none_match (String)

Returns:

  • (Array<(DomainItemResponse, Integer, Hash)>)

    DomainItemResponse data, response status code and response headers



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 173

def management_get_domain_with_http_info(public_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DomainsApi.management_get_domain ...'
  end
  # verify the required parameter 'public_id' is set
  if @api_client.config.client_side_validation && public_id.nil?
    fail ArgumentError, "Missing the required parameter 'public_id' when calling DomainsApi.management_get_domain"
  end
  # resource path
  local_var_path = '/domains/{public_id}'.sub('{public_id}', CGI.escape(public_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DomainItemResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DomainsApi.management_get_domain",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DomainsApi#management_get_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_get_domain_zone_file(public_id, opts = {}) ⇒ String

Download a domain as a zone file Returns the domain’s DNS records formatted as a BIND-style zone file fragment. Suitable for direct paste into a DNS provider that accepts zone-file imports.

Parameters:

  • public_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


227
228
229
230
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 227

def management_get_domain_zone_file(public_id, opts = {})
  data, _status_code, _headers = management_get_domain_zone_file_with_http_info(public_id, opts)
  data
end

#management_get_domain_zone_file_with_http_info(public_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Download a domain as a zone file Returns the domain&#39;s DNS records formatted as a BIND-style zone file fragment. Suitable for direct paste into a DNS provider that accepts zone-file imports.

Parameters:

  • public_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 237

def management_get_domain_zone_file_with_http_info(public_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DomainsApi.management_get_domain_zone_file ...'
  end
  # verify the required parameter 'public_id' is set
  if @api_client.config.client_side_validation && public_id.nil?
    fail ArgumentError, "Missing the required parameter 'public_id' when calling DomainsApi.management_get_domain_zone_file"
  end
  # resource path
  local_var_path = '/domains/{public_id}/zone-file'.sub('{public_id}', CGI.escape(public_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'String'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DomainsApi.management_get_domain_zone_file",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DomainsApi#management_get_domain_zone_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_list_domains(opts = {}) ⇒ DomainItemCursorListResponse

List mailbox domains Returns a cursor-paginated list of sending domains configured for the team, ordered by ‘created_at` descending. Each entry includes the DNS records the customer must place, the current verification status, and the SES DKIM state. Pass `cursor=<next_cursor>` from the previous response to fetch the next page.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :cursor (String)
  • :limit (Integer)

Returns:



291
292
293
294
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 291

def management_list_domains(opts = {})
  data, _status_code, _headers = management_list_domains_with_http_info(opts)
  data
end

#management_list_domains_with_http_info(opts = {}) ⇒ Array<(DomainItemCursorListResponse, Integer, Hash)>

List mailbox domains Returns a cursor-paginated list of sending domains configured for the team, ordered by &#x60;created_at&#x60; descending. Each entry includes the DNS records the customer must place, the current verification status, and the SES DKIM state. Pass &#x60;cursor&#x3D;&lt;next_cursor&gt;&#x60; from the previous response to fetch the next page.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :cursor (String)
  • :limit (Integer)

Returns:



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 302

def management_list_domains_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DomainsApi.management_list_domains ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DomainsApi.management_list_domains, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DomainsApi.management_list_domains, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/domains'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DomainItemCursorListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DomainsApi.management_list_domains",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DomainsApi#management_list_domains\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_verify_domain(public_id, opts = {}) ⇒ DomainVerifyResponse

Verify a mailbox domain Runs an immediate DNS-over-HTTPS check of the domain’s MX, SPF, DMARC and ownership TXT records, then asks SES for the latest DKIM status. If every check passes the domain is marked verified. Domains automatically re-verify every 6 hours — this endpoint is only needed to trigger a check on demand.

Parameters:

  • public_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



361
362
363
364
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 361

def management_verify_domain(public_id, opts = {})
  data, _status_code, _headers = management_verify_domain_with_http_info(public_id, opts)
  data
end

#management_verify_domain_with_http_info(public_id, opts = {}) ⇒ Array<(DomainVerifyResponse, Integer, Hash)>

Verify a mailbox domain Runs an immediate DNS-over-HTTPS check of the domain&#39;s MX, SPF, DMARC and ownership TXT records, then asks SES for the latest DKIM status. If every check passes the domain is marked verified. Domains automatically re-verify every 6 hours — this endpoint is only needed to trigger a check on demand.

Parameters:

  • public_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DomainVerifyResponse, Integer, Hash)>)

    DomainVerifyResponse data, response status code and response headers



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/sendmux_management_generated/api/domains_api.rb', line 371

def management_verify_domain_with_http_info(public_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DomainsApi.management_verify_domain ...'
  end
  # verify the required parameter 'public_id' is set
  if @api_client.config.client_side_validation && public_id.nil?
    fail ArgumentError, "Missing the required parameter 'public_id' when calling DomainsApi.management_verify_domain"
  end
  # resource path
  local_var_path = '/domains/{public_id}/verify'.sub('{public_id}', CGI.escape(public_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DomainVerifyResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DomainsApi.management_verify_domain",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DomainsApi#management_verify_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end