qubrics-management 3.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.
Files changed (161) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +100 -0
  3. data/LICENSE +21 -0
  4. data/README.md +157 -0
  5. data/lib/qubrics/management/client.rb +99 -0
  6. data/lib/qubrics/management/version.rb +7 -0
  7. data/lib/qubrics/management.rb +12 -0
  8. data/lib/qubrics_management_generated/api/billing_api.rb +221 -0
  9. data/lib/qubrics_management_generated/api/connection_api.rb +82 -0
  10. data/lib/qubrics_management_generated/api/domain_filters_api.rb +161 -0
  11. data/lib/qubrics_management_generated/api/domains_api.rb +492 -0
  12. data/lib/qubrics_management_generated/api/emails_api.rb +258 -0
  13. data/lib/qubrics_management_generated/api/inboxes_api.rb +175 -0
  14. data/lib/qubrics_management_generated/api/mailbox_filters_api.rb +161 -0
  15. data/lib/qubrics_management_generated/api/mailboxes_api.rb +996 -0
  16. data/lib/qubrics_management_generated/api/sending_accounts_api.rb +1009 -0
  17. data/lib/qubrics_management_generated/api/webhooks_api.rb +666 -0
  18. data/lib/qubrics_management_generated/api_client.rb +447 -0
  19. data/lib/qubrics_management_generated/api_error.rb +58 -0
  20. data/lib/qubrics_management_generated/api_model_base.rb +95 -0
  21. data/lib/qubrics_management_generated/configuration.rb +400 -0
  22. data/lib/qubrics_management_generated/models/api_error_detail.rb +219 -0
  23. data/lib/qubrics_management_generated/models/api_error_error.rb +275 -0
  24. data/lib/qubrics_management_generated/models/api_error_meta.rb +164 -0
  25. data/lib/qubrics_management_generated/models/api_error_response.rb +216 -0
  26. data/lib/qubrics_management_generated/models/balance.rb +293 -0
  27. data/lib/qubrics_management_generated/models/balance_auto_topup.rb +226 -0
  28. data/lib/qubrics_management_generated/models/balance_response.rb +223 -0
  29. data/lib/qubrics_management_generated/models/connection.rb +273 -0
  30. data/lib/qubrics_management_generated/models/connection_credential.rb +226 -0
  31. data/lib/qubrics_management_generated/models/connection_mailboxes_inner.rb +190 -0
  32. data/lib/qubrics_management_generated/models/connection_response.rb +223 -0
  33. data/lib/qubrics_management_generated/models/connection_team.rb +190 -0
  34. data/lib/qubrics_management_generated/models/cursor_pagination.rb +173 -0
  35. data/lib/qubrics_management_generated/models/delivery_log_detail.rb +573 -0
  36. data/lib/qubrics_management_generated/models/delivery_log_item.rb +543 -0
  37. data/lib/qubrics_management_generated/models/delivery_log_item_cursor_list_response.rb +251 -0
  38. data/lib/qubrics_management_generated/models/delivery_log_item_response.rb +223 -0
  39. data/lib/qubrics_management_generated/models/delivery_log_recipient.rb +254 -0
  40. data/lib/qubrics_management_generated/models/domain_deleted_response.rb +223 -0
  41. data/lib/qubrics_management_generated/models/domain_deleted_response_all_of_data.rb +190 -0
  42. data/lib/qubrics_management_generated/models/domain_item_cursor_list_response.rb +251 -0
  43. data/lib/qubrics_management_generated/models/domain_item_response.rb +223 -0
  44. data/lib/qubrics_management_generated/models/domain_verify_response.rb +223 -0
  45. data/lib/qubrics_management_generated/models/email_metrics.rb +218 -0
  46. data/lib/qubrics_management_generated/models/email_metrics_comparison.rb +294 -0
  47. data/lib/qubrics_management_generated/models/email_metrics_comparison_change_pct.rb +268 -0
  48. data/lib/qubrics_management_generated/models/email_metrics_response.rb +223 -0
  49. data/lib/qubrics_management_generated/models/email_metrics_summary.rb +268 -0
  50. data/lib/qubrics_management_generated/models/email_metrics_timeseries_inner.rb +294 -0
  51. data/lib/qubrics_management_generated/models/filter_rule.rb +242 -0
  52. data/lib/qubrics_management_generated/models/filter_state.rb +218 -0
  53. data/lib/qubrics_management_generated/models/filter_state_response.rb +223 -0
  54. data/lib/qubrics_management_generated/models/incoming_log_item.rb +465 -0
  55. data/lib/qubrics_management_generated/models/incoming_log_item_cursor_list_response.rb +251 -0
  56. data/lib/qubrics_management_generated/models/incoming_log_item_response.rb +223 -0
  57. data/lib/qubrics_management_generated/models/mail_webhook_event_payload.rb +296 -0
  58. data/lib/qubrics_management_generated/models/mailbox.rb +284 -0
  59. data/lib/qubrics_management_generated/models/mailbox_app_password_result.rb +164 -0
  60. data/lib/qubrics_management_generated/models/mailbox_app_password_result_response.rb +223 -0
  61. data/lib/qubrics_management_generated/models/mailbox_availability_reason.rb +45 -0
  62. data/lib/qubrics_management_generated/models/mailbox_availability_response.rb +223 -0
  63. data/lib/qubrics_management_generated/models/mailbox_availability_result.rb +240 -0
  64. data/lib/qubrics_management_generated/models/mailbox_cost_usage.rb +409 -0
  65. data/lib/qubrics_management_generated/models/mailbox_cost_usage_incoming.rb +422 -0
  66. data/lib/qubrics_management_generated/models/mailbox_cost_usage_response.rb +223 -0
  67. data/lib/qubrics_management_generated/models/mailbox_cost_usage_storage.rb +299 -0
  68. data/lib/qubrics_management_generated/models/mailbox_create_result.rb +190 -0
  69. data/lib/qubrics_management_generated/models/mailbox_create_result_response.rb +223 -0
  70. data/lib/qubrics_management_generated/models/mailbox_credential.rb +352 -0
  71. data/lib/qubrics_management_generated/models/mailbox_deleted_response.rb +223 -0
  72. data/lib/qubrics_management_generated/models/mailbox_domain.rb +452 -0
  73. data/lib/qubrics_management_generated/models/mailbox_domain_dns_records.rb +303 -0
  74. data/lib/qubrics_management_generated/models/mailbox_domain_mail_from_records.rb +191 -0
  75. data/lib/qubrics_management_generated/models/mailbox_domain_mx_record.rb +190 -0
  76. data/lib/qubrics_management_generated/models/mailbox_domain_name_value_record.rb +191 -0
  77. data/lib/qubrics_management_generated/models/mailbox_domain_named_mx_record.rb +217 -0
  78. data/lib/qubrics_management_generated/models/mailbox_domain_verify_checks.rb +300 -0
  79. data/lib/qubrics_management_generated/models/mailbox_domain_verify_result.rb +377 -0
  80. data/lib/qubrics_management_generated/models/mailbox_item_cursor_list_response.rb +251 -0
  81. data/lib/qubrics_management_generated/models/mailbox_item_response.rb +223 -0
  82. data/lib/qubrics_management_generated/models/mailbox_key_deleted_response.rb +223 -0
  83. data/lib/qubrics_management_generated/models/mailbox_send_policy.rb +196 -0
  84. data/lib/qubrics_management_generated/models/mailbox_send_policy_allowed_from.rb +213 -0
  85. data/lib/qubrics_management_generated/models/mailbox_send_policy_allowed_reply_to.rb +213 -0
  86. data/lib/qubrics_management_generated/models/mailbox_send_policy_recipients.rb +158 -0
  87. data/lib/qubrics_management_generated/models/mailbox_send_policy_recipients_allow.rb +201 -0
  88. data/lib/qubrics_management_generated/models/mailbox_send_policy_recipients_deny.rb +201 -0
  89. data/lib/qubrics_management_generated/models/mailbox_send_policy_response.rb +223 -0
  90. data/lib/qubrics_management_generated/models/mailbox_send_policy_snapshot.rb +202 -0
  91. data/lib/qubrics_management_generated/models/mailbox_send_scope.rb +213 -0
  92. data/lib/qubrics_management_generated/models/management_create_domain_request.rb +209 -0
  93. data/lib/qubrics_management_generated/models/management_create_mailbox_key_request.rb +183 -0
  94. data/lib/qubrics_management_generated/models/management_create_mailbox_request.rb +270 -0
  95. data/lib/qubrics_management_generated/models/management_create_mailbox_request_send_scope.rb +214 -0
  96. data/lib/qubrics_management_generated/models/management_test_webhook200_response.rb +223 -0
  97. data/lib/qubrics_management_generated/models/management_update_domain_request.rb +189 -0
  98. data/lib/qubrics_management_generated/models/provider_allowed_actions.rb +294 -0
  99. data/lib/qubrics_management_generated/models/provider_create_body.rb +611 -0
  100. data/lib/qubrics_management_generated/models/provider_create_body_quotas.rb +174 -0
  101. data/lib/qubrics_management_generated/models/provider_create_body_quotas_per_day.rb +104 -0
  102. data/lib/qubrics_management_generated/models/provider_deleted.rb +190 -0
  103. data/lib/qubrics_management_generated/models/provider_deleted_response.rb +223 -0
  104. data/lib/qubrics_management_generated/models/provider_item.rb +733 -0
  105. data/lib/qubrics_management_generated/models/provider_item_cursor_list_response.rb +251 -0
  106. data/lib/qubrics_management_generated/models/provider_item_response.rb +223 -0
  107. data/lib/qubrics_management_generated/models/provider_limits.rb +190 -0
  108. data/lib/qubrics_management_generated/models/provider_limits_response.rb +223 -0
  109. data/lib/qubrics_management_generated/models/provider_list_item.rb +695 -0
  110. data/lib/qubrics_management_generated/models/provider_quota_range.rb +208 -0
  111. data/lib/qubrics_management_generated/models/provider_quotas.rb +186 -0
  112. data/lib/qubrics_management_generated/models/provider_stats.rb +325 -0
  113. data/lib/qubrics_management_generated/models/provider_stats_response.rb +223 -0
  114. data/lib/qubrics_management_generated/models/provider_status_counts.rb +242 -0
  115. data/lib/qubrics_management_generated/models/provider_test_result.rb +251 -0
  116. data/lib/qubrics_management_generated/models/provider_test_result_response.rb +223 -0
  117. data/lib/qubrics_management_generated/models/provider_type_counts.rb +246 -0
  118. data/lib/qubrics_management_generated/models/provider_update_body.rb +569 -0
  119. data/lib/qubrics_management_generated/models/provider_usage.rb +216 -0
  120. data/lib/qubrics_management_generated/models/provider_usage_item.rb +374 -0
  121. data/lib/qubrics_management_generated/models/provider_usage_response.rb +223 -0
  122. data/lib/qubrics_management_generated/models/replace_mailbox_send_policy.rb +165 -0
  123. data/lib/qubrics_management_generated/models/resource_limit_snapshot.rb +420 -0
  124. data/lib/qubrics_management_generated/models/response_meta.rb +164 -0
  125. data/lib/qubrics_management_generated/models/sending_account_limit_request.rb +190 -0
  126. data/lib/qubrics_management_generated/models/sending_account_limit_request_response.rb +223 -0
  127. data/lib/qubrics_management_generated/models/set_filter_state_body.rb +226 -0
  128. data/lib/qubrics_management_generated/models/shared_amazon_ses_limit.rb +315 -0
  129. data/lib/qubrics_management_generated/models/shared_amazon_ses_limit_request.rb +361 -0
  130. data/lib/qubrics_management_generated/models/shared_amazon_ses_limit_request_cancel.rb +190 -0
  131. data/lib/qubrics_management_generated/models/shared_amazon_ses_limit_request_cancel_response.rb +223 -0
  132. data/lib/qubrics_management_generated/models/shared_amazon_ses_limit_request_create.rb +190 -0
  133. data/lib/qubrics_management_generated/models/shared_amazon_ses_limit_request_create_response.rb +223 -0
  134. data/lib/qubrics_management_generated/models/shared_amazon_ses_limit_request_page.rb +176 -0
  135. data/lib/qubrics_management_generated/models/shared_amazon_ses_limit_request_page_response.rb +223 -0
  136. data/lib/qubrics_management_generated/models/spend_summary.rb +292 -0
  137. data/lib/qubrics_management_generated/models/spend_summary_response.rb +223 -0
  138. data/lib/qubrics_management_generated/models/success_envelope.rb +192 -0
  139. data/lib/qubrics_management_generated/models/transaction.rb +332 -0
  140. data/lib/qubrics_management_generated/models/transaction_cursor_list_response.rb +251 -0
  141. data/lib/qubrics_management_generated/models/update_mailbox_body.rb +211 -0
  142. data/lib/qubrics_management_generated/models/update_mailbox_body_send_scope.rb +214 -0
  143. data/lib/qubrics_management_generated/models/webhook_create_body.rb +269 -0
  144. data/lib/qubrics_management_generated/models/webhook_deleted_response.rb +223 -0
  145. data/lib/qubrics_management_generated/models/webhook_delivery_attempt.rb +560 -0
  146. data/lib/qubrics_management_generated/models/webhook_delivery_attempt_cursor_list_response.rb +251 -0
  147. data/lib/qubrics_management_generated/models/webhook_delivery_payload.rb +337 -0
  148. data/lib/qubrics_management_generated/models/webhook_delivery_payload_response.rb +223 -0
  149. data/lib/qubrics_management_generated/models/webhook_event_data.rb +406 -0
  150. data/lib/qubrics_management_generated/models/webhook_event_payload.rb +304 -0
  151. data/lib/qubrics_management_generated/models/webhook_filters.rb +168 -0
  152. data/lib/qubrics_management_generated/models/webhook_subscription.rb +368 -0
  153. data/lib/qubrics_management_generated/models/webhook_subscription_cursor_list_response.rb +251 -0
  154. data/lib/qubrics_management_generated/models/webhook_subscription_response.rb +223 -0
  155. data/lib/qubrics_management_generated/models/webhook_subscription_with_secret.rb +395 -0
  156. data/lib/qubrics_management_generated/models/webhook_subscription_with_secret_response.rb +223 -0
  157. data/lib/qubrics_management_generated/models/webhook_test_response.rb +165 -0
  158. data/lib/qubrics_management_generated/models/webhook_update_body.rb +233 -0
  159. data/lib/qubrics_management_generated/version.rb +15 -0
  160. data/lib/qubrics_management_generated.rb +195 -0
  161. metadata +283 -0
@@ -0,0 +1,996 @@
1
+ =begin
2
+ #Qubrics API
3
+
4
+ #Programmatic access to your Qubrics email infrastructure.
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 Qubrics::Management::Generated
16
+ class MailboxesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Check mailbox address availability
23
+ # 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.
24
+ # @param email [String]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [MailboxAvailabilityResponse]
27
+ def management_check_mailbox_availability(email, opts = {})
28
+ data, _status_code, _headers = management_check_mailbox_availability_with_http_info(email, opts)
29
+ data
30
+ end
31
+
32
+ # Check mailbox address availability
33
+ # 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.
34
+ # @param email [String]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(MailboxAvailabilityResponse, Integer, Hash)>] MailboxAvailabilityResponse data, response status code and response headers
37
+ def management_check_mailbox_availability_with_http_info(email, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_check_mailbox_availability ...'
40
+ end
41
+ # verify the required parameter 'email' is set
42
+ if @api_client.config.client_side_validation && email.nil?
43
+ fail ArgumentError, "Missing the required parameter 'email' when calling MailboxesApi.management_check_mailbox_availability"
44
+ end
45
+ # resource path
46
+ local_var_path = '/mailboxes/availability'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+ query_params[:'email'] = email
51
+
52
+ # header parameters
53
+ header_params = opts[:header_params] || {}
54
+ # HTTP header 'Accept' (if needed)
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
56
+
57
+ # form parameters
58
+ form_params = opts[:form_params] || {}
59
+
60
+ # http body (model)
61
+ post_body = opts[:debug_body]
62
+
63
+ # return_type
64
+ return_type = opts[:debug_return_type] || 'MailboxAvailabilityResponse'
65
+
66
+ # auth_names
67
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
68
+
69
+ new_options = opts.merge(
70
+ :operation => :"MailboxesApi.management_check_mailbox_availability",
71
+ :header_params => header_params,
72
+ :query_params => query_params,
73
+ :form_params => form_params,
74
+ :body => post_body,
75
+ :auth_names => auth_names,
76
+ :return_type => return_type
77
+ )
78
+
79
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
80
+ if @api_client.config.debugging
81
+ @api_client.config.logger.debug "API called: MailboxesApi#management_check_mailbox_availability\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
+ end
83
+ return data, status_code, headers
84
+ end
85
+
86
+ # Create a mailbox
87
+ # 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`.
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [String] :idempotency_key
90
+ # @option opts [ManagementCreateMailboxRequest] :management_create_mailbox_request
91
+ # @return [MailboxCreateResultResponse]
92
+ def management_create_mailbox(opts = {})
93
+ data, _status_code, _headers = management_create_mailbox_with_http_info(opts)
94
+ data
95
+ end
96
+
97
+ # Create a mailbox
98
+ # 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, &#x60;quota_bytes&#x60; 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 &#x60;@myagent.mx&#x60; addresses, on Amazon SES — any failure rolls the partial state back automatically. 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;.
99
+ # @param [Hash] opts the optional parameters
100
+ # @option opts [String] :idempotency_key
101
+ # @option opts [ManagementCreateMailboxRequest] :management_create_mailbox_request
102
+ # @return [Array<(MailboxCreateResultResponse, Integer, Hash)>] MailboxCreateResultResponse data, response status code and response headers
103
+ def management_create_mailbox_with_http_info(opts = {})
104
+ if @api_client.config.debugging
105
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_create_mailbox ...'
106
+ end
107
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
108
+ 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.'
109
+ end
110
+
111
+ # resource path
112
+ local_var_path = '/mailboxes'
113
+
114
+ # query parameters
115
+ query_params = opts[:query_params] || {}
116
+
117
+ # header parameters
118
+ header_params = opts[:header_params] || {}
119
+ # HTTP header 'Accept' (if needed)
120
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
121
+ # HTTP header 'Content-Type'
122
+ content_type = @api_client.select_header_content_type(['application/json'])
123
+ if !content_type.nil?
124
+ header_params['Content-Type'] = content_type
125
+ end
126
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
127
+
128
+ # form parameters
129
+ form_params = opts[:form_params] || {}
130
+
131
+ # http body (model)
132
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'management_create_mailbox_request'])
133
+
134
+ # return_type
135
+ return_type = opts[:debug_return_type] || 'MailboxCreateResultResponse'
136
+
137
+ # auth_names
138
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
139
+
140
+ new_options = opts.merge(
141
+ :operation => :"MailboxesApi.management_create_mailbox",
142
+ :header_params => header_params,
143
+ :query_params => query_params,
144
+ :form_params => form_params,
145
+ :body => post_body,
146
+ :auth_names => auth_names,
147
+ :return_type => return_type
148
+ )
149
+
150
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
151
+ if @api_client.config.debugging
152
+ @api_client.config.logger.debug "API called: MailboxesApi#management_create_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
153
+ end
154
+ return data, status_code, headers
155
+ end
156
+
157
+ # Create a mailbox API key
158
+ # 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`.
159
+ # @param public_id [String]
160
+ # @param [Hash] opts the optional parameters
161
+ # @option opts [String] :idempotency_key
162
+ # @option opts [ManagementCreateMailboxKeyRequest] :management_create_mailbox_key_request
163
+ # @return [MailboxAppPasswordResultResponse]
164
+ def management_create_mailbox_key(public_id, opts = {})
165
+ data, _status_code, _headers = management_create_mailbox_key_with_http_info(public_id, opts)
166
+ data
167
+ end
168
+
169
+ # Create a mailbox API key
170
+ # 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 &#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;.
171
+ # @param public_id [String]
172
+ # @param [Hash] opts the optional parameters
173
+ # @option opts [String] :idempotency_key
174
+ # @option opts [ManagementCreateMailboxKeyRequest] :management_create_mailbox_key_request
175
+ # @return [Array<(MailboxAppPasswordResultResponse, Integer, Hash)>] MailboxAppPasswordResultResponse data, response status code and response headers
176
+ def management_create_mailbox_key_with_http_info(public_id, opts = {})
177
+ if @api_client.config.debugging
178
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_create_mailbox_key ...'
179
+ end
180
+ # verify the required parameter 'public_id' is set
181
+ if @api_client.config.client_side_validation && public_id.nil?
182
+ fail ArgumentError, "Missing the required parameter 'public_id' when calling MailboxesApi.management_create_mailbox_key"
183
+ end
184
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
185
+ 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.'
186
+ end
187
+
188
+ # resource path
189
+ local_var_path = '/mailboxes/{public_id}/keys'.sub('{public_id}', CGI.escape(public_id.to_s))
190
+
191
+ # query parameters
192
+ query_params = opts[:query_params] || {}
193
+
194
+ # header parameters
195
+ header_params = opts[:header_params] || {}
196
+ # HTTP header 'Accept' (if needed)
197
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
198
+ # HTTP header 'Content-Type'
199
+ content_type = @api_client.select_header_content_type(['application/json'])
200
+ if !content_type.nil?
201
+ header_params['Content-Type'] = content_type
202
+ end
203
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
204
+
205
+ # form parameters
206
+ form_params = opts[:form_params] || {}
207
+
208
+ # http body (model)
209
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'management_create_mailbox_key_request'])
210
+
211
+ # return_type
212
+ return_type = opts[:debug_return_type] || 'MailboxAppPasswordResultResponse'
213
+
214
+ # auth_names
215
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
216
+
217
+ new_options = opts.merge(
218
+ :operation => :"MailboxesApi.management_create_mailbox_key",
219
+ :header_params => header_params,
220
+ :query_params => query_params,
221
+ :form_params => form_params,
222
+ :body => post_body,
223
+ :auth_names => auth_names,
224
+ :return_type => return_type
225
+ )
226
+
227
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
228
+ if @api_client.config.debugging
229
+ @api_client.config.logger.debug "API called: MailboxesApi#management_create_mailbox_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
230
+ end
231
+ return data, status_code, headers
232
+ end
233
+
234
+ # Delete a mailbox
235
+ # Removes a mailbox from our mail platform, Amazon SES (for `@myagent.mx` addresses), and Qubrics. All associated API keys are revoked.
236
+ # @param public_id [String]
237
+ # @param [Hash] opts the optional parameters
238
+ # @return [MailboxDeletedResponse]
239
+ def management_delete_mailbox(public_id, opts = {})
240
+ data, _status_code, _headers = management_delete_mailbox_with_http_info(public_id, opts)
241
+ data
242
+ end
243
+
244
+ # Delete a mailbox
245
+ # Removes a mailbox from our mail platform, Amazon SES (for &#x60;@myagent.mx&#x60; addresses), and Qubrics. All associated API keys are revoked.
246
+ # @param public_id [String]
247
+ # @param [Hash] opts the optional parameters
248
+ # @return [Array<(MailboxDeletedResponse, Integer, Hash)>] MailboxDeletedResponse data, response status code and response headers
249
+ def management_delete_mailbox_with_http_info(public_id, opts = {})
250
+ if @api_client.config.debugging
251
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_delete_mailbox ...'
252
+ end
253
+ # verify the required parameter 'public_id' is set
254
+ if @api_client.config.client_side_validation && public_id.nil?
255
+ fail ArgumentError, "Missing the required parameter 'public_id' when calling MailboxesApi.management_delete_mailbox"
256
+ end
257
+ # resource path
258
+ local_var_path = '/mailboxes/{public_id}'.sub('{public_id}', CGI.escape(public_id.to_s))
259
+
260
+ # query parameters
261
+ query_params = opts[:query_params] || {}
262
+
263
+ # header parameters
264
+ header_params = opts[:header_params] || {}
265
+ # HTTP header 'Accept' (if needed)
266
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
267
+
268
+ # form parameters
269
+ form_params = opts[:form_params] || {}
270
+
271
+ # http body (model)
272
+ post_body = opts[:debug_body]
273
+
274
+ # return_type
275
+ return_type = opts[:debug_return_type] || 'MailboxDeletedResponse'
276
+
277
+ # auth_names
278
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
279
+
280
+ new_options = opts.merge(
281
+ :operation => :"MailboxesApi.management_delete_mailbox",
282
+ :header_params => header_params,
283
+ :query_params => query_params,
284
+ :form_params => form_params,
285
+ :body => post_body,
286
+ :auth_names => auth_names,
287
+ :return_type => return_type
288
+ )
289
+
290
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
291
+ if @api_client.config.debugging
292
+ @api_client.config.logger.debug "API called: MailboxesApi#management_delete_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
293
+ end
294
+ return data, status_code, headers
295
+ end
296
+
297
+ # Revoke a mailbox API key
298
+ # Revokes a specific bearer token + matching mailbox password. Idempotent on already-revoked keys.
299
+ # @param public_id [String]
300
+ # @param key_id [String]
301
+ # @param [Hash] opts the optional parameters
302
+ # @return [MailboxKeyDeletedResponse]
303
+ def management_delete_mailbox_key(public_id, key_id, opts = {})
304
+ data, _status_code, _headers = management_delete_mailbox_key_with_http_info(public_id, key_id, opts)
305
+ data
306
+ end
307
+
308
+ # Revoke a mailbox API key
309
+ # Revokes a specific bearer token + matching mailbox password. Idempotent on already-revoked keys.
310
+ # @param public_id [String]
311
+ # @param key_id [String]
312
+ # @param [Hash] opts the optional parameters
313
+ # @return [Array<(MailboxKeyDeletedResponse, Integer, Hash)>] MailboxKeyDeletedResponse data, response status code and response headers
314
+ def management_delete_mailbox_key_with_http_info(public_id, key_id, opts = {})
315
+ if @api_client.config.debugging
316
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_delete_mailbox_key ...'
317
+ end
318
+ # verify the required parameter 'public_id' is set
319
+ if @api_client.config.client_side_validation && public_id.nil?
320
+ fail ArgumentError, "Missing the required parameter 'public_id' when calling MailboxesApi.management_delete_mailbox_key"
321
+ end
322
+ # verify the required parameter 'key_id' is set
323
+ if @api_client.config.client_side_validation && key_id.nil?
324
+ fail ArgumentError, "Missing the required parameter 'key_id' when calling MailboxesApi.management_delete_mailbox_key"
325
+ end
326
+ # resource path
327
+ 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))
328
+
329
+ # query parameters
330
+ query_params = opts[:query_params] || {}
331
+
332
+ # header parameters
333
+ header_params = opts[:header_params] || {}
334
+ # HTTP header 'Accept' (if needed)
335
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
336
+
337
+ # form parameters
338
+ form_params = opts[:form_params] || {}
339
+
340
+ # http body (model)
341
+ post_body = opts[:debug_body]
342
+
343
+ # return_type
344
+ return_type = opts[:debug_return_type] || 'MailboxKeyDeletedResponse'
345
+
346
+ # auth_names
347
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
348
+
349
+ new_options = opts.merge(
350
+ :operation => :"MailboxesApi.management_delete_mailbox_key",
351
+ :header_params => header_params,
352
+ :query_params => query_params,
353
+ :form_params => form_params,
354
+ :body => post_body,
355
+ :auth_names => auth_names,
356
+ :return_type => return_type
357
+ )
358
+
359
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
360
+ if @api_client.config.debugging
361
+ @api_client.config.logger.debug "API called: MailboxesApi#management_delete_mailbox_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
362
+ end
363
+ return data, status_code, headers
364
+ end
365
+
366
+ # Get a mailbox
367
+ # 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.
368
+ # @param public_id [String]
369
+ # @param [Hash] opts the optional parameters
370
+ # @option opts [String] :if_none_match
371
+ # @return [MailboxItemResponse]
372
+ def management_get_mailbox(public_id, opts = {})
373
+ data, _status_code, _headers = management_get_mailbox_with_http_info(public_id, opts)
374
+ data
375
+ end
376
+
377
+ # Get a mailbox
378
+ # Returns a single mailbox, tenant-scoped to the caller&#39;s team. 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. The same ETag is the value to use in &#x60;If-Match&#x60; on PATCH for optimistic concurrency.
379
+ # @param public_id [String]
380
+ # @param [Hash] opts the optional parameters
381
+ # @option opts [String] :if_none_match
382
+ # @return [Array<(MailboxItemResponse, Integer, Hash)>] MailboxItemResponse data, response status code and response headers
383
+ def management_get_mailbox_with_http_info(public_id, opts = {})
384
+ if @api_client.config.debugging
385
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_get_mailbox ...'
386
+ end
387
+ # verify the required parameter 'public_id' is set
388
+ if @api_client.config.client_side_validation && public_id.nil?
389
+ fail ArgumentError, "Missing the required parameter 'public_id' when calling MailboxesApi.management_get_mailbox"
390
+ end
391
+ # resource path
392
+ local_var_path = '/mailboxes/{public_id}'.sub('{public_id}', CGI.escape(public_id.to_s))
393
+
394
+ # query parameters
395
+ query_params = opts[:query_params] || {}
396
+
397
+ # header parameters
398
+ header_params = opts[:header_params] || {}
399
+ # HTTP header 'Accept' (if needed)
400
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
401
+ header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?
402
+
403
+ # form parameters
404
+ form_params = opts[:form_params] || {}
405
+
406
+ # http body (model)
407
+ post_body = opts[:debug_body]
408
+
409
+ # return_type
410
+ return_type = opts[:debug_return_type] || 'MailboxItemResponse'
411
+
412
+ # auth_names
413
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
414
+
415
+ new_options = opts.merge(
416
+ :operation => :"MailboxesApi.management_get_mailbox",
417
+ :header_params => header_params,
418
+ :query_params => query_params,
419
+ :form_params => form_params,
420
+ :body => post_body,
421
+ :auth_names => auth_names,
422
+ :return_type => return_type
423
+ )
424
+
425
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
426
+ if @api_client.config.debugging
427
+ @api_client.config.logger.debug "API called: MailboxesApi#management_get_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
428
+ end
429
+ return data, status_code, headers
430
+ end
431
+
432
+ # Read mailbox costs
433
+ # Read cumulative mailbox costs for a half-open window: start is included and end is excluded. Requires mailbox.admin.read and team-wide mailbox access. Retained usage remains readable after mailbox deletion while the team and credential remain active. Quantities and USD amounts are decimal strings. posted_amount includes only posted charges; incurred and unbillable amounts are reported separately. A pending result can change. Settle a window only when its state is final. This read does not start or complete settlement.
434
+ # @param public_id [String] Mailbox public ID.
435
+ # @param start [Time] Inclusive start. At most millisecond precision.
436
+ # @param _end [Time] Exclusive end. Must be at or after start and at most 366 days later. At most millisecond precision.
437
+ # @param [Hash] opts the optional parameters
438
+ # @option opts [String] :if_none_match Return 304 when the authorised response is unchanged.
439
+ # @return [MailboxCostUsageResponse]
440
+ def management_get_mailbox_cost_usage(public_id, start, _end, opts = {})
441
+ data, _status_code, _headers = management_get_mailbox_cost_usage_with_http_info(public_id, start, _end, opts)
442
+ data
443
+ end
444
+
445
+ # Read mailbox costs
446
+ # Read cumulative mailbox costs for a half-open window: start is included and end is excluded. Requires mailbox.admin.read and team-wide mailbox access. Retained usage remains readable after mailbox deletion while the team and credential remain active. Quantities and USD amounts are decimal strings. posted_amount includes only posted charges; incurred and unbillable amounts are reported separately. A pending result can change. Settle a window only when its state is final. This read does not start or complete settlement.
447
+ # @param public_id [String] Mailbox public ID.
448
+ # @param start [Time] Inclusive start. At most millisecond precision.
449
+ # @param _end [Time] Exclusive end. Must be at or after start and at most 366 days later. At most millisecond precision.
450
+ # @param [Hash] opts the optional parameters
451
+ # @option opts [String] :if_none_match Return 304 when the authorised response is unchanged.
452
+ # @return [Array<(MailboxCostUsageResponse, Integer, Hash)>] MailboxCostUsageResponse data, response status code and response headers
453
+ def management_get_mailbox_cost_usage_with_http_info(public_id, start, _end, opts = {})
454
+ if @api_client.config.debugging
455
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_get_mailbox_cost_usage ...'
456
+ end
457
+ # verify the required parameter 'public_id' is set
458
+ if @api_client.config.client_side_validation && public_id.nil?
459
+ fail ArgumentError, "Missing the required parameter 'public_id' when calling MailboxesApi.management_get_mailbox_cost_usage"
460
+ end
461
+ # verify the required parameter 'start' is set
462
+ if @api_client.config.client_side_validation && start.nil?
463
+ fail ArgumentError, "Missing the required parameter 'start' when calling MailboxesApi.management_get_mailbox_cost_usage"
464
+ end
465
+ # verify the required parameter '_end' is set
466
+ if @api_client.config.client_side_validation && _end.nil?
467
+ fail ArgumentError, "Missing the required parameter '_end' when calling MailboxesApi.management_get_mailbox_cost_usage"
468
+ end
469
+ # resource path
470
+ local_var_path = '/mailboxes/{public_id}/usage'.sub('{public_id}', CGI.escape(public_id.to_s))
471
+
472
+ # query parameters
473
+ query_params = opts[:query_params] || {}
474
+ [['start', start], ['end', _end]].each do |name, value|
475
+ if value.is_a?(Time) && (value.subsec * 1000).denominator != 1
476
+ raise ArgumentError, "#{name} must use at most millisecond precision"
477
+ end
478
+ end
479
+ query_params[:'start'] = start.is_a?(Time) ? start.getutc.iso8601(3) : start
480
+ query_params[:'end'] = _end.is_a?(Time) ? _end.getutc.iso8601(3) : _end
481
+
482
+ # header parameters
483
+ header_params = opts[:header_params] || {}
484
+ # HTTP header 'Accept' (if needed)
485
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
486
+ header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?
487
+
488
+ # form parameters
489
+ form_params = opts[:form_params] || {}
490
+
491
+ # http body (model)
492
+ post_body = opts[:debug_body]
493
+
494
+ # return_type
495
+ return_type = opts[:debug_return_type] || 'MailboxCostUsageResponse'
496
+
497
+ # auth_names
498
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
499
+
500
+ new_options = opts.merge(
501
+ :operation => :"MailboxesApi.management_get_mailbox_cost_usage",
502
+ :header_params => header_params,
503
+ :query_params => query_params,
504
+ :form_params => form_params,
505
+ :body => post_body,
506
+ :auth_names => auth_names,
507
+ :return_type => return_type
508
+ )
509
+
510
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
511
+ if @api_client.config.debugging
512
+ @api_client.config.logger.debug "API called: MailboxesApi#management_get_mailbox_cost_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
513
+ end
514
+ return data, status_code, headers
515
+ end
516
+
517
+ # Get a sending policy
518
+ # Sender, Reply-To and recipient restrictions intersect across team, inbox and credential policies. Requires an administrative connection: team.read/team.update for team policies, mailbox.admin.read/mailbox.admin.manage for inbox policies, or key.read/key.* for credential policies. Integration and mailbox keys cannot manage these policies.
519
+ # @param scope [String] Policy level to read or replace.
520
+ # @param public_id [String] Public ID of the team, inbox, API key, connected-app grant or agent registration.
521
+ # @param [Hash] opts the optional parameters
522
+ # @option opts [String] :if_none_match Return 304 when this ETag still matches.
523
+ # @return [MailboxSendPolicyResponse]
524
+ def management_get_mailbox_send_policy(scope, public_id, opts = {})
525
+ data, _status_code, _headers = management_get_mailbox_send_policy_with_http_info(scope, public_id, opts)
526
+ data
527
+ end
528
+
529
+ # Get a sending policy
530
+ # Sender, Reply-To and recipient restrictions intersect across team, inbox and credential policies. Requires an administrative connection: team.read/team.update for team policies, mailbox.admin.read/mailbox.admin.manage for inbox policies, or key.read/key.* for credential policies. Integration and mailbox keys cannot manage these policies.
531
+ # @param scope [String] Policy level to read or replace.
532
+ # @param public_id [String] Public ID of the team, inbox, API key, connected-app grant or agent registration.
533
+ # @param [Hash] opts the optional parameters
534
+ # @option opts [String] :if_none_match Return 304 when this ETag still matches.
535
+ # @return [Array<(MailboxSendPolicyResponse, Integer, Hash)>] MailboxSendPolicyResponse data, response status code and response headers
536
+ def management_get_mailbox_send_policy_with_http_info(scope, public_id, opts = {})
537
+ if @api_client.config.debugging
538
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_get_mailbox_send_policy ...'
539
+ end
540
+ # verify the required parameter 'scope' is set
541
+ if @api_client.config.client_side_validation && scope.nil?
542
+ fail ArgumentError, "Missing the required parameter 'scope' when calling MailboxesApi.management_get_mailbox_send_policy"
543
+ end
544
+ # verify enum value
545
+ allowable_values = ["team", "mailbox", "api_key", "oauth_grant", "agent_registration", "unknown_default_open_api"]
546
+ if @api_client.config.client_side_validation && !allowable_values.include?(scope)
547
+ fail ArgumentError, "invalid value for \"scope\", must be one of #{allowable_values}"
548
+ end
549
+ # verify the required parameter 'public_id' is set
550
+ if @api_client.config.client_side_validation && public_id.nil?
551
+ fail ArgumentError, "Missing the required parameter 'public_id' when calling MailboxesApi.management_get_mailbox_send_policy"
552
+ end
553
+ if @api_client.config.client_side_validation && public_id.to_s.length > 128
554
+ fail ArgumentError, 'invalid value for "public_id" when calling MailboxesApi.management_get_mailbox_send_policy, the character length must be smaller than or equal to 128.'
555
+ end
556
+
557
+ if @api_client.config.client_side_validation && public_id.to_s.length < 1
558
+ fail ArgumentError, 'invalid value for "public_id" when calling MailboxesApi.management_get_mailbox_send_policy, the character length must be greater than or equal to 1.'
559
+ end
560
+
561
+ # resource path
562
+ local_var_path = '/mailbox-send-policies/{scope}/{public_id}'.sub('{scope}', CGI.escape(scope.to_s)).sub('{public_id}', CGI.escape(public_id.to_s))
563
+
564
+ # query parameters
565
+ query_params = opts[:query_params] || {}
566
+
567
+ # header parameters
568
+ header_params = opts[:header_params] || {}
569
+ # HTTP header 'Accept' (if needed)
570
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
571
+ header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?
572
+
573
+ # form parameters
574
+ form_params = opts[:form_params] || {}
575
+
576
+ # http body (model)
577
+ post_body = opts[:debug_body]
578
+
579
+ # return_type
580
+ return_type = opts[:debug_return_type] || 'MailboxSendPolicyResponse'
581
+
582
+ # auth_names
583
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
584
+
585
+ new_options = opts.merge(
586
+ :operation => :"MailboxesApi.management_get_mailbox_send_policy",
587
+ :header_params => header_params,
588
+ :query_params => query_params,
589
+ :form_params => form_params,
590
+ :body => post_body,
591
+ :auth_names => auth_names,
592
+ :return_type => return_type
593
+ )
594
+
595
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
596
+ if @api_client.config.debugging
597
+ @api_client.config.logger.debug "API called: MailboxesApi#management_get_mailbox_send_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
598
+ end
599
+ return data, status_code, headers
600
+ end
601
+
602
+ # List mailboxes
603
+ # 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.
604
+ # @param [Hash] opts the optional parameters
605
+ # @option opts [String] :cursor
606
+ # @option opts [Integer] :limit
607
+ # @option opts [String] :include_deleted
608
+ # @return [MailboxItemCursorListResponse]
609
+ def management_list_mailboxes(opts = {})
610
+ data, _status_code, _headers = management_list_mailboxes_with_http_info(opts)
611
+ data
612
+ end
613
+
614
+ # List mailboxes
615
+ # Returns a cursor-paginated list of mailboxes configured for the team, ordered by &#x60;created_at&#x60; descending. Pass &#x60;cursor&#x3D;&lt;next_cursor&gt;&#x60; from the previous response to fetch the next page.
616
+ # @param [Hash] opts the optional parameters
617
+ # @option opts [String] :cursor
618
+ # @option opts [Integer] :limit
619
+ # @option opts [String] :include_deleted
620
+ # @return [Array<(MailboxItemCursorListResponse, Integer, Hash)>] MailboxItemCursorListResponse data, response status code and response headers
621
+ def management_list_mailboxes_with_http_info(opts = {})
622
+ if @api_client.config.debugging
623
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_list_mailboxes ...'
624
+ end
625
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
626
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MailboxesApi.management_list_mailboxes, must be smaller than or equal to 100.'
627
+ end
628
+
629
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
630
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MailboxesApi.management_list_mailboxes, must be greater than or equal to 1.'
631
+ end
632
+
633
+ allowable_values = ["true", "unknown_default_open_api"]
634
+ if @api_client.config.client_side_validation && opts[:'include_deleted'] && !allowable_values.include?(opts[:'include_deleted'])
635
+ fail ArgumentError, "invalid value for \"include_deleted\", must be one of #{allowable_values}"
636
+ end
637
+ # resource path
638
+ local_var_path = '/mailboxes'
639
+
640
+ # query parameters
641
+ query_params = opts[:query_params] || {}
642
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
643
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
644
+ query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil?
645
+
646
+ # header parameters
647
+ header_params = opts[:header_params] || {}
648
+ # HTTP header 'Accept' (if needed)
649
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
650
+
651
+ # form parameters
652
+ form_params = opts[:form_params] || {}
653
+
654
+ # http body (model)
655
+ post_body = opts[:debug_body]
656
+
657
+ # return_type
658
+ return_type = opts[:debug_return_type] || 'MailboxItemCursorListResponse'
659
+
660
+ # auth_names
661
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
662
+
663
+ new_options = opts.merge(
664
+ :operation => :"MailboxesApi.management_list_mailboxes",
665
+ :header_params => header_params,
666
+ :query_params => query_params,
667
+ :form_params => form_params,
668
+ :body => post_body,
669
+ :auth_names => auth_names,
670
+ :return_type => return_type
671
+ )
672
+
673
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
674
+ if @api_client.config.debugging
675
+ @api_client.config.logger.debug "API called: MailboxesApi#management_list_mailboxes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
676
+ end
677
+ return data, status_code, headers
678
+ end
679
+
680
+ # Replace a sending policy
681
+ # Sender, Reply-To and recipient restrictions intersect across team, inbox and credential policies. Requires an administrative connection: team.read/team.update for team policies, mailbox.admin.read/mailbox.admin.manage for inbox policies, or key.read/key.* for credential policies. Integration and mailbox keys cannot manage these policies.
682
+ # @param scope [String] Policy level to read or replace.
683
+ # @param public_id [String] Public ID of the team, inbox, API key, connected-app grant or agent registration.
684
+ # @param if_match [String] Required exact ETag from the current policy. Wildcards are not accepted.
685
+ # @param replace_mailbox_send_policy [ReplaceMailboxSendPolicy]
686
+ # @param [Hash] opts the optional parameters
687
+ # @option opts [String] :idempotency_key Reuse with the same policy and ETag to replay a successful replacement.
688
+ # @return [MailboxSendPolicyResponse]
689
+ def management_replace_mailbox_send_policy(scope, public_id, if_match, replace_mailbox_send_policy, opts = {})
690
+ data, _status_code, _headers = management_replace_mailbox_send_policy_with_http_info(scope, public_id, if_match, replace_mailbox_send_policy, opts)
691
+ data
692
+ end
693
+
694
+ # Replace a sending policy
695
+ # Sender, Reply-To and recipient restrictions intersect across team, inbox and credential policies. Requires an administrative connection: team.read/team.update for team policies, mailbox.admin.read/mailbox.admin.manage for inbox policies, or key.read/key.* for credential policies. Integration and mailbox keys cannot manage these policies.
696
+ # @param scope [String] Policy level to read or replace.
697
+ # @param public_id [String] Public ID of the team, inbox, API key, connected-app grant or agent registration.
698
+ # @param if_match [String] Required exact ETag from the current policy. Wildcards are not accepted.
699
+ # @param replace_mailbox_send_policy [ReplaceMailboxSendPolicy]
700
+ # @param [Hash] opts the optional parameters
701
+ # @option opts [String] :idempotency_key Reuse with the same policy and ETag to replay a successful replacement.
702
+ # @return [Array<(MailboxSendPolicyResponse, Integer, Hash)>] MailboxSendPolicyResponse data, response status code and response headers
703
+ def management_replace_mailbox_send_policy_with_http_info(scope, public_id, if_match, replace_mailbox_send_policy, opts = {})
704
+ if @api_client.config.debugging
705
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_replace_mailbox_send_policy ...'
706
+ end
707
+ # verify the required parameter 'scope' is set
708
+ if @api_client.config.client_side_validation && scope.nil?
709
+ fail ArgumentError, "Missing the required parameter 'scope' when calling MailboxesApi.management_replace_mailbox_send_policy"
710
+ end
711
+ # verify enum value
712
+ allowable_values = ["team", "mailbox", "api_key", "oauth_grant", "agent_registration", "unknown_default_open_api"]
713
+ if @api_client.config.client_side_validation && !allowable_values.include?(scope)
714
+ fail ArgumentError, "invalid value for \"scope\", must be one of #{allowable_values}"
715
+ end
716
+ # verify the required parameter 'public_id' is set
717
+ if @api_client.config.client_side_validation && public_id.nil?
718
+ fail ArgumentError, "Missing the required parameter 'public_id' when calling MailboxesApi.management_replace_mailbox_send_policy"
719
+ end
720
+ if @api_client.config.client_side_validation && public_id.to_s.length > 128
721
+ fail ArgumentError, 'invalid value for "public_id" when calling MailboxesApi.management_replace_mailbox_send_policy, the character length must be smaller than or equal to 128.'
722
+ end
723
+
724
+ if @api_client.config.client_side_validation && public_id.to_s.length < 1
725
+ fail ArgumentError, 'invalid value for "public_id" when calling MailboxesApi.management_replace_mailbox_send_policy, the character length must be greater than or equal to 1.'
726
+ end
727
+
728
+ # verify the required parameter 'if_match' is set
729
+ if @api_client.config.client_side_validation && if_match.nil?
730
+ fail ArgumentError, "Missing the required parameter 'if_match' when calling MailboxesApi.management_replace_mailbox_send_policy"
731
+ end
732
+ # verify the required parameter 'replace_mailbox_send_policy' is set
733
+ if @api_client.config.client_side_validation && replace_mailbox_send_policy.nil?
734
+ fail ArgumentError, "Missing the required parameter 'replace_mailbox_send_policy' when calling MailboxesApi.management_replace_mailbox_send_policy"
735
+ end
736
+ # resource path
737
+ local_var_path = '/mailbox-send-policies/{scope}/{public_id}'.sub('{scope}', CGI.escape(scope.to_s)).sub('{public_id}', CGI.escape(public_id.to_s))
738
+
739
+ # query parameters
740
+ query_params = opts[:query_params] || {}
741
+
742
+ # header parameters
743
+ header_params = opts[:header_params] || {}
744
+ # HTTP header 'Accept' (if needed)
745
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
746
+ # HTTP header 'Content-Type'
747
+ content_type = @api_client.select_header_content_type(['application/json'])
748
+ if !content_type.nil?
749
+ header_params['Content-Type'] = content_type
750
+ end
751
+ header_params[:'If-Match'] = if_match
752
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
753
+
754
+ # form parameters
755
+ form_params = opts[:form_params] || {}
756
+
757
+ # http body (model)
758
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(replace_mailbox_send_policy)
759
+
760
+ # return_type
761
+ return_type = opts[:debug_return_type] || 'MailboxSendPolicyResponse'
762
+
763
+ # auth_names
764
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
765
+
766
+ new_options = opts.merge(
767
+ :operation => :"MailboxesApi.management_replace_mailbox_send_policy",
768
+ :header_params => header_params,
769
+ :query_params => query_params,
770
+ :form_params => form_params,
771
+ :body => post_body,
772
+ :auth_names => auth_names,
773
+ :return_type => return_type
774
+ )
775
+
776
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
777
+ if @api_client.config.debugging
778
+ @api_client.config.logger.debug "API called: MailboxesApi#management_replace_mailbox_send_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
779
+ end
780
+ return data, status_code, headers
781
+ end
782
+
783
+ # Resume a mailbox
784
+ # 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.
785
+ # @param public_id [String]
786
+ # @param [Hash] opts the optional parameters
787
+ # @option opts [String] :idempotency_key
788
+ # @return [MailboxItemResponse]
789
+ def management_resume_mailbox(public_id, opts = {})
790
+ data, _status_code, _headers = management_resume_mailbox_with_http_info(public_id, opts)
791
+ data
792
+ end
793
+
794
+ # Resume a mailbox
795
+ # Restores a suspended mailbox so it can authenticate, receive mail, and send from the mailbox address again. The operation is idempotent and accepts &#x60;Idempotency-Key&#x60; for safe retries.
796
+ # @param public_id [String]
797
+ # @param [Hash] opts the optional parameters
798
+ # @option opts [String] :idempotency_key
799
+ # @return [Array<(MailboxItemResponse, Integer, Hash)>] MailboxItemResponse data, response status code and response headers
800
+ def management_resume_mailbox_with_http_info(public_id, opts = {})
801
+ if @api_client.config.debugging
802
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_resume_mailbox ...'
803
+ end
804
+ # verify the required parameter 'public_id' is set
805
+ if @api_client.config.client_side_validation && public_id.nil?
806
+ fail ArgumentError, "Missing the required parameter 'public_id' when calling MailboxesApi.management_resume_mailbox"
807
+ end
808
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
809
+ 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.'
810
+ end
811
+
812
+ # resource path
813
+ local_var_path = '/mailboxes/{public_id}/resume'.sub('{public_id}', CGI.escape(public_id.to_s))
814
+
815
+ # query parameters
816
+ query_params = opts[:query_params] || {}
817
+
818
+ # header parameters
819
+ header_params = opts[:header_params] || {}
820
+ # HTTP header 'Accept' (if needed)
821
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
822
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
823
+
824
+ # form parameters
825
+ form_params = opts[:form_params] || {}
826
+
827
+ # http body (model)
828
+ post_body = opts[:debug_body]
829
+
830
+ # return_type
831
+ return_type = opts[:debug_return_type] || 'MailboxItemResponse'
832
+
833
+ # auth_names
834
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
835
+
836
+ new_options = opts.merge(
837
+ :operation => :"MailboxesApi.management_resume_mailbox",
838
+ :header_params => header_params,
839
+ :query_params => query_params,
840
+ :form_params => form_params,
841
+ :body => post_body,
842
+ :auth_names => auth_names,
843
+ :return_type => return_type
844
+ )
845
+
846
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
847
+ if @api_client.config.debugging
848
+ @api_client.config.logger.debug "API called: MailboxesApi#management_resume_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
849
+ end
850
+ return data, status_code, headers
851
+ end
852
+
853
+ # Suspend a mailbox
854
+ # 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.
855
+ # @param public_id [String]
856
+ # @param [Hash] opts the optional parameters
857
+ # @option opts [String] :idempotency_key
858
+ # @return [MailboxItemResponse]
859
+ def management_suspend_mailbox(public_id, opts = {})
860
+ data, _status_code, _headers = management_suspend_mailbox_with_http_info(public_id, opts)
861
+ data
862
+ end
863
+
864
+ # Suspend a mailbox
865
+ # 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 &#x60;Idempotency-Key&#x60; for safe retries.
866
+ # @param public_id [String]
867
+ # @param [Hash] opts the optional parameters
868
+ # @option opts [String] :idempotency_key
869
+ # @return [Array<(MailboxItemResponse, Integer, Hash)>] MailboxItemResponse data, response status code and response headers
870
+ def management_suspend_mailbox_with_http_info(public_id, opts = {})
871
+ if @api_client.config.debugging
872
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_suspend_mailbox ...'
873
+ end
874
+ # verify the required parameter 'public_id' is set
875
+ if @api_client.config.client_side_validation && public_id.nil?
876
+ fail ArgumentError, "Missing the required parameter 'public_id' when calling MailboxesApi.management_suspend_mailbox"
877
+ end
878
+ if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
879
+ 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.'
880
+ end
881
+
882
+ # resource path
883
+ local_var_path = '/mailboxes/{public_id}/suspend'.sub('{public_id}', CGI.escape(public_id.to_s))
884
+
885
+ # query parameters
886
+ query_params = opts[:query_params] || {}
887
+
888
+ # header parameters
889
+ header_params = opts[:header_params] || {}
890
+ # HTTP header 'Accept' (if needed)
891
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
892
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
893
+
894
+ # form parameters
895
+ form_params = opts[:form_params] || {}
896
+
897
+ # http body (model)
898
+ post_body = opts[:debug_body]
899
+
900
+ # return_type
901
+ return_type = opts[:debug_return_type] || 'MailboxItemResponse'
902
+
903
+ # auth_names
904
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
905
+
906
+ new_options = opts.merge(
907
+ :operation => :"MailboxesApi.management_suspend_mailbox",
908
+ :header_params => header_params,
909
+ :query_params => query_params,
910
+ :form_params => form_params,
911
+ :body => post_body,
912
+ :auth_names => auth_names,
913
+ :return_type => return_type
914
+ )
915
+
916
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
917
+ if @api_client.config.debugging
918
+ @api_client.config.logger.debug "API called: MailboxesApi#management_suspend_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
919
+ end
920
+ return data, status_code, headers
921
+ end
922
+
923
+ # Update a mailbox
924
+ # 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.
925
+ # @param public_id [String]
926
+ # @param [Hash] opts the optional parameters
927
+ # @option opts [String] :if_match
928
+ # @option opts [UpdateMailboxBody] :update_mailbox_body
929
+ # @return [MailboxItemResponse]
930
+ def management_update_mailbox(public_id, opts = {})
931
+ data, _status_code, _headers = management_update_mailbox_with_http_info(public_id, opts)
932
+ data
933
+ end
934
+
935
+ # Update a mailbox
936
+ # 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&#39;s current usage. For optimistic concurrency, send &#x60;If-Match: &lt;etag&gt;&#x60; using the ETag from a prior GET. A mismatched &#x60;If-Match&#x60; returns &#x60;409 conflict&#x60; (the server&#39;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.
937
+ # @param public_id [String]
938
+ # @param [Hash] opts the optional parameters
939
+ # @option opts [String] :if_match
940
+ # @option opts [UpdateMailboxBody] :update_mailbox_body
941
+ # @return [Array<(MailboxItemResponse, Integer, Hash)>] MailboxItemResponse data, response status code and response headers
942
+ def management_update_mailbox_with_http_info(public_id, opts = {})
943
+ if @api_client.config.debugging
944
+ @api_client.config.logger.debug 'Calling API: MailboxesApi.management_update_mailbox ...'
945
+ end
946
+ # verify the required parameter 'public_id' is set
947
+ if @api_client.config.client_side_validation && public_id.nil?
948
+ fail ArgumentError, "Missing the required parameter 'public_id' when calling MailboxesApi.management_update_mailbox"
949
+ end
950
+ # resource path
951
+ local_var_path = '/mailboxes/{public_id}'.sub('{public_id}', CGI.escape(public_id.to_s))
952
+
953
+ # query parameters
954
+ query_params = opts[:query_params] || {}
955
+
956
+ # header parameters
957
+ header_params = opts[:header_params] || {}
958
+ # HTTP header 'Accept' (if needed)
959
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
960
+ # HTTP header 'Content-Type'
961
+ content_type = @api_client.select_header_content_type(['application/json'])
962
+ if !content_type.nil?
963
+ header_params['Content-Type'] = content_type
964
+ end
965
+ header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?
966
+
967
+ # form parameters
968
+ form_params = opts[:form_params] || {}
969
+
970
+ # http body (model)
971
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_mailbox_body'])
972
+
973
+ # return_type
974
+ return_type = opts[:debug_return_type] || 'MailboxItemResponse'
975
+
976
+ # auth_names
977
+ auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
978
+
979
+ new_options = opts.merge(
980
+ :operation => :"MailboxesApi.management_update_mailbox",
981
+ :header_params => header_params,
982
+ :query_params => query_params,
983
+ :form_params => form_params,
984
+ :body => post_body,
985
+ :auth_names => auth_names,
986
+ :return_type => return_type
987
+ )
988
+
989
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
990
+ if @api_client.config.debugging
991
+ @api_client.config.logger.debug "API called: MailboxesApi#management_update_mailbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
992
+ end
993
+ return data, status_code, headers
994
+ end
995
+ end
996
+ end