Class: Sendmux::Management::Generated::MailboxesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MailboxesApi

Returns a new instance of MailboxesApi.



19
20
21
# File 'lib/sendmux_management_generated/api/mailboxes_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/mailboxes_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#management_check_mailbox_availability(email, opts = {}) ⇒ MailboxAvailabilityResponse

Check mailbox address availability Checks whether an email address can be reserved for mailbox creation. @myagent.mx availability is global across all teams; custom-domain availability is scoped to the caller's team and requires a verified send/receive mailbox domain.

Parameters:

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 27

def management_check_mailbox_availability(email, opts = {})
  data, _status_code, _headers = management_check_mailbox_availability_with_http_info(email, opts)
  data
end

#management_check_mailbox_availability_with_http_info(email, opts = {}) ⇒ Array<(MailboxAvailabilityResponse, Integer, Hash)>

Check mailbox address availability Checks whether an email address can be reserved for mailbox creation. `@myagent.mx` availability is global across all teams; custom-domain availability is scoped to the caller's team and requires a verified send/receive mailbox domain.

Parameters:

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

    the optional parameters

Returns:

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

    MailboxAvailabilityResponse data, response status code and response headers



37
38
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
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 37

def management_check_mailbox_availability_with_http_info(email, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailboxesApi.management_check_mailbox_availability ...'
  end
  # verify the required parameter 'email' is set
  if @api_client.config.client_side_validation && email.nil?
    fail ArgumentError, "Missing the required parameter 'email' when calling MailboxesApi.management_check_mailbox_availability"
  end
  # resource path
  local_var_path = '/mailboxes/availability'

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

  # 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] || 'MailboxAvailabilityResponse'

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

  new_options = opts.merge(
    :operation => :"MailboxesApi.management_check_mailbox_availability",
    :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: MailboxesApi#management_check_mailbox_availability\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_create_mailbox(opts = {}) ⇒ MailboxCreateResultResponse

Create a mailbox Provisions a new mailbox plus an initial bearer token and matching IMAP/SMTP mailbox password. The domain portion of the email must already be verified via POST /domains. If supplied, quota_bytes must be one of the current storage tiers: 1073741824 (1 GB), 5368709120 (5 GB), or 53687091200 (50 GB). Creation provisions resources on our mail platform and, for @myagent.mx addresses, on Amazon SES — any failure rolls the partial state back automatically. 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:



92
93
94
95
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 92

def management_create_mailbox(opts = {})
  data, _status_code, _headers = management_create_mailbox_with_http_info(opts)
  data
end

#management_create_mailbox_key(public_id, opts = {}) ⇒ MailboxAppPasswordResultResponse

Create a mailbox API key Mints an additional bearer token plus IMAP/SMTP mailbox password for an existing mailbox. The plaintext key and password are shown exactly once — store them immediately. 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:

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

    the optional parameters

Options Hash (opts):

Returns:



164
165
166
167
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 164

def management_create_mailbox_key(public_id, opts = {})
  data, _status_code, _headers = management_create_mailbox_key_with_http_info(public_id, opts)
  data
end

#management_create_mailbox_key_with_http_info(public_id, opts = {}) ⇒ Array<(MailboxAppPasswordResultResponse, Integer, Hash)>

Create a mailbox API key Mints an additional bearer token plus IMAP/SMTP mailbox password for an existing mailbox. The plaintext key and password are shown exactly once — store them immediately. 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:

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

    the optional parameters

Options Hash (opts):

Returns:



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
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 176

def management_create_mailbox_key_with_http_info(public_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailboxesApi.management_create_mailbox_key ...'
  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 MailboxesApi.management_create_mailbox_key"
  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 MailboxesApi.management_create_mailbox_key, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/mailboxes/{public_id}/keys'.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']
  # 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_mailbox_key_request'])

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

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

  new_options = opts.merge(
    :operation => :"MailboxesApi.management_create_mailbox_key",
    :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: MailboxesApi#management_create_mailbox_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_create_mailbox_with_http_info(opts = {}) ⇒ Array<(MailboxCreateResultResponse, Integer, Hash)>

Create a mailbox Provisions a new mailbox plus an initial bearer token and matching IMAP/SMTP mailbox password. The domain portion of the email must already be verified via POST /domains. If supplied, `quota_bytes` must be one of the current storage tiers: 1073741824 (1 GB), 5368709120 (5 GB), or 53687091200 (50 GB). Creation provisions resources on our mail platform and, for `@myagent.mx` addresses, on Amazon SES — any failure rolls the partial state back automatically. 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:

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

    MailboxCreateResultResponse data, response status code and response headers



103
104
105
106
107
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
155
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 103

def management_create_mailbox_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailboxesApi.management_create_mailbox ...'
  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 MailboxesApi.management_create_mailbox, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/mailboxes'

  # 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_mailbox_request'])

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

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

  new_options = opts.merge(
    :operation => :"MailboxesApi.management_create_mailbox",
    :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: MailboxesApi#management_create_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_delete_mailbox(public_id, opts = {}) ⇒ MailboxDeletedResponse

Delete a mailbox Removes a mailbox from our mail platform, Amazon SES (for @myagent.mx addresses), and Sendmux. All associated API keys are revoked.

Parameters:

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

    the optional parameters

Returns:



239
240
241
242
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 239

def management_delete_mailbox(public_id, opts = {})
  data, _status_code, _headers = management_delete_mailbox_with_http_info(public_id, opts)
  data
end

#management_delete_mailbox_key(public_id, key_id, opts = {}) ⇒ MailboxKeyDeletedResponse

Revoke a mailbox API key Revokes a specific bearer token + matching mailbox password. Idempotent on already-revoked keys.

Parameters:

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

    the optional parameters

Returns:



303
304
305
306
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 303

def management_delete_mailbox_key(public_id, key_id, opts = {})
  data, _status_code, _headers = management_delete_mailbox_key_with_http_info(public_id, key_id, opts)
  data
end

#management_delete_mailbox_key_with_http_info(public_id, key_id, opts = {}) ⇒ Array<(MailboxKeyDeletedResponse, Integer, Hash)>

Revoke a mailbox API key Revokes a specific bearer token + matching mailbox password. Idempotent on already-revoked keys.

Parameters:

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

    the optional parameters

Returns:

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

    MailboxKeyDeletedResponse data, response status code and response headers



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
355
356
357
358
359
360
361
362
363
364
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 314

def management_delete_mailbox_key_with_http_info(public_id, key_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailboxesApi.management_delete_mailbox_key ...'
  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 MailboxesApi.management_delete_mailbox_key"
  end
  # verify the required parameter 'key_id' is set
  if @api_client.config.client_side_validation && key_id.nil?
    fail ArgumentError, "Missing the required parameter 'key_id' when calling MailboxesApi.management_delete_mailbox_key"
  end
  # resource path
  local_var_path = '/mailboxes/{public_id}/keys/{key_id}'.sub('{public_id}', CGI.escape(public_id.to_s)).sub('{key_id}', CGI.escape(key_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] || 'MailboxKeyDeletedResponse'

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

  new_options = opts.merge(
    :operation => :"MailboxesApi.management_delete_mailbox_key",
    :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: MailboxesApi#management_delete_mailbox_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_delete_mailbox_with_http_info(public_id, opts = {}) ⇒ Array<(MailboxDeletedResponse, Integer, Hash)>

Delete a mailbox Removes a mailbox from our mail platform, Amazon SES (for `@myagent.mx` addresses), and Sendmux. All associated API keys are revoked.

Parameters:

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

    the optional parameters

Returns:

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

    MailboxDeletedResponse data, response status code and response headers



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
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 249

def management_delete_mailbox_with_http_info(public_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailboxesApi.management_delete_mailbox ...'
  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 MailboxesApi.management_delete_mailbox"
  end
  # resource path
  local_var_path = '/mailboxes/{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] || 'MailboxDeletedResponse'

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

  new_options = opts.merge(
    :operation => :"MailboxesApi.management_delete_mailbox",
    :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: MailboxesApi#management_delete_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_get_mailbox(public_id, opts = {}) ⇒ MailboxItemResponse

Get a mailbox Returns a single mailbox, tenant-scoped to the caller's team. 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. The same ETag is the value to use in If-Match on PATCH for optimistic concurrency.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :if_none_match (String)

Returns:



372
373
374
375
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 372

def management_get_mailbox(public_id, opts = {})
  data, _status_code, _headers = management_get_mailbox_with_http_info(public_id, opts)
  data
end

#management_get_mailbox_with_http_info(public_id, opts = {}) ⇒ Array<(MailboxItemResponse, Integer, Hash)>

Get a mailbox Returns a single mailbox, tenant-scoped to the caller's team. 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. The same ETag is the value to use in `If-Match` on PATCH for optimistic concurrency.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :if_none_match (String)

Returns:

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

    MailboxItemResponse data, response status code and response headers



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
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 383

def management_get_mailbox_with_http_info(public_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailboxesApi.management_get_mailbox ...'
  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 MailboxesApi.management_get_mailbox"
  end
  # resource path
  local_var_path = '/mailboxes/{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] || 'MailboxItemResponse'

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

  new_options = opts.merge(
    :operation => :"MailboxesApi.management_get_mailbox",
    :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: MailboxesApi#management_get_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_list_mailboxes(opts = {}) ⇒ MailboxItemCursorListResponse

List mailboxes Returns a cursor-paginated list of mailboxes configured for the team, ordered by created_at descending. 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)
  • :include_deleted (String)

Returns:



439
440
441
442
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 439

def management_list_mailboxes(opts = {})
  data, _status_code, _headers = management_list_mailboxes_with_http_info(opts)
  data
end

#management_list_mailboxes_with_http_info(opts = {}) ⇒ Array<(MailboxItemCursorListResponse, Integer, Hash)>

List mailboxes Returns a cursor-paginated list of mailboxes configured for the team, ordered by `created_at` descending. 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)
  • :include_deleted (String)

Returns:



451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 451

def management_list_mailboxes_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailboxesApi.management_list_mailboxes ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MailboxesApi.management_list_mailboxes, 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 MailboxesApi.management_list_mailboxes, must be greater than or equal to 1.'
  end

  allowable_values = ["true", "unknown_default_open_api"]
  if @api_client.config.client_side_validation && opts[:'include_deleted'] && !allowable_values.include?(opts[:'include_deleted'])
    fail ArgumentError, "invalid value for \"include_deleted\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/mailboxes'

  # 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?
  query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].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] || 'MailboxItemCursorListResponse'

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

  new_options = opts.merge(
    :operation => :"MailboxesApi.management_list_mailboxes",
    :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: MailboxesApi#management_list_mailboxes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_resume_mailbox(public_id, opts = {}) ⇒ MailboxItemResponse

Resume a mailbox Restores a suspended mailbox so it can authenticate, receive mail, and send from the mailbox address again. The operation is idempotent and accepts Idempotency-Key for safe retries.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

Returns:



516
517
518
519
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 516

def management_resume_mailbox(public_id, opts = {})
  data, _status_code, _headers = management_resume_mailbox_with_http_info(public_id, opts)
  data
end

#management_resume_mailbox_with_http_info(public_id, opts = {}) ⇒ Array<(MailboxItemResponse, Integer, Hash)>

Resume a mailbox Restores a suspended mailbox so it can authenticate, receive mail, and send from the mailbox address again. The operation is idempotent and accepts `Idempotency-Key` for safe retries.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

Returns:

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

    MailboxItemResponse data, response status code and response headers



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 527

def management_resume_mailbox_with_http_info(public_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailboxesApi.management_resume_mailbox ...'
  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 MailboxesApi.management_resume_mailbox"
  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 MailboxesApi.management_resume_mailbox, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/mailboxes/{public_id}/resume'.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[:'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]

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

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

  new_options = opts.merge(
    :operation => :"MailboxesApi.management_resume_mailbox",
    :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: MailboxesApi#management_resume_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_suspend_mailbox(public_id, opts = {}) ⇒ MailboxItemResponse

Suspend a mailbox Suspends a mailbox without deleting messages, credentials, or settings. Suspended mailboxes cannot receive mail, authenticate to mailbox protocols, or send from the mailbox address. The operation is idempotent and accepts Idempotency-Key for safe retries.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

Returns:



586
587
588
589
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 586

def management_suspend_mailbox(public_id, opts = {})
  data, _status_code, _headers = management_suspend_mailbox_with_http_info(public_id, opts)
  data
end

#management_suspend_mailbox_with_http_info(public_id, opts = {}) ⇒ Array<(MailboxItemResponse, Integer, Hash)>

Suspend a mailbox Suspends a mailbox without deleting messages, credentials, or settings. Suspended mailboxes cannot receive mail, authenticate to mailbox protocols, or send from the mailbox address. The operation is idempotent and accepts `Idempotency-Key` for safe retries.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

Returns:

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

    MailboxItemResponse data, response status code and response headers



597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 597

def management_suspend_mailbox_with_http_info(public_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailboxesApi.management_suspend_mailbox ...'
  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 MailboxesApi.management_suspend_mailbox"
  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 MailboxesApi.management_suspend_mailbox, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/mailboxes/{public_id}/suspend'.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[:'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]

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

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

  new_options = opts.merge(
    :operation => :"MailboxesApi.management_suspend_mailbox",
    :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: MailboxesApi#management_suspend_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#management_update_mailbox(public_id, opts = {}) ⇒ MailboxItemResponse

Update a mailbox Updates any combination of display_name, quota_bytes, and send_scope on a mailbox. The display_name and send_scope changes land in a single transaction; quota_bytes is applied afterwards because it also updates external state on our mail platform. Quota can only be set to 1073741824 (1 GB), 5368709120 (5 GB), or 53687091200 (50 GB), and cannot be shrunk below the mailbox's current usage. For optimistic concurrency, send If-Match: <etag> using the ETag from a prior GET. A mismatched If-Match returns 409 conflict (the server's ETag is echoed back so you can decide whether to re-fetch). Responses carry the new ETag so chained edits can pipeline without a re-GET.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:



657
658
659
660
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 657

def management_update_mailbox(public_id, opts = {})
  data, _status_code, _headers = management_update_mailbox_with_http_info(public_id, opts)
  data
end

#management_update_mailbox_with_http_info(public_id, opts = {}) ⇒ Array<(MailboxItemResponse, Integer, Hash)>

Update a mailbox Updates any combination of display_name, quota_bytes, and send_scope on a mailbox. The display_name and send_scope changes land in a single transaction; quota_bytes is applied afterwards because it also updates external state on our mail platform. Quota can only be set to 1073741824 (1 GB), 5368709120 (5 GB), or 53687091200 (50 GB), and cannot be shrunk below the mailbox's current usage. For optimistic concurrency, send `If-Match: <etag>` using the ETag from a prior GET. A mismatched `If-Match` returns `409 conflict` (the server's ETag is echoed back so you can decide whether to re-fetch). Responses carry the new ETag so chained edits can pipeline without a re-GET.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

    MailboxItemResponse data, response status code and response headers



669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
# File 'lib/sendmux_management_generated/api/mailboxes_api.rb', line 669

def management_update_mailbox_with_http_info(public_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailboxesApi.management_update_mailbox ...'
  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 MailboxesApi.management_update_mailbox"
  end
  # resource path
  local_var_path = '/mailboxes/{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']
  # 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[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?

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

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

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

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

  new_options = opts.merge(
    :operation => :"MailboxesApi.management_update_mailbox",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MailboxesApi#management_update_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end