Class: Mudbase::EmailApi

Inherits:
Object
  • Object
show all
Defined in:
lib/mudbase/api/email_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EmailApi

Returns a new instance of EmailApi.



19
20
21
# File 'lib/mudbase/api/email_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/mudbase/api/email_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#enqueue_project_email(project_id, project_email_send_request, opts = {}) ⇒ EnqueueProjectEmail202Response

Enqueue project email (worker delivery) Queues a transactional email for sending through the email worker and configured provider (platform or per-project SMTP). Provide either template (with data) or both subject and html. Returns 202 with jobId when accepted.

Parameters:

  • project_id (String)
  • project_email_send_request (ProjectEmailSendRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/mudbase/api/email_api.rb', line 28

def enqueue_project_email(project_id, project_email_send_request, opts = {})
  data, _status_code, _headers = enqueue_project_email_with_http_info(project_id, project_email_send_request, opts)
  data
end

#enqueue_project_email_with_http_info(project_id, project_email_send_request, opts = {}) ⇒ Array<(EnqueueProjectEmail202Response, Integer, Hash)>

Enqueue project email (worker delivery) Queues a transactional email for sending through the email worker and configured provider (platform or per-project SMTP). Provide either `template` (with `data`) or both `subject` and `html`. Returns 202 with `jobId` when accepted.

Parameters:

  • project_id (String)
  • project_email_send_request (ProjectEmailSendRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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

def enqueue_project_email_with_http_info(project_id, project_email_send_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailApi.enqueue_project_email ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling EmailApi.enqueue_project_email"
  end
  # verify the required parameter 'project_email_send_request' is set
  if @api_client.config.client_side_validation && project_email_send_request.nil?
    fail ArgumentError, "Missing the required parameter 'project_email_send_request' when calling EmailApi.enqueue_project_email"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/email/send'.sub('{' + 'projectId' + '}', CGI.escape(project_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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

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

#get_project_email_analytics(project_id, opts = {}) ⇒ GetProjectEmailAnalytics200Response

Email analytics for a project Aggregated email log stats for the project. Optional from and to query params filter by date range (ISO 8601).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :from (Time)
  • :to (Time)

Returns:



103
104
105
106
# File 'lib/mudbase/api/email_api.rb', line 103

def get_project_email_analytics(project_id, opts = {})
  data, _status_code, _headers = get_project_email_analytics_with_http_info(project_id, opts)
  data
end

#get_project_email_analytics_with_http_info(project_id, opts = {}) ⇒ Array<(GetProjectEmailAnalytics200Response, Integer, Hash)>

Email analytics for a project Aggregated email log stats for the project. Optional `from` and `to` query params filter by date range (ISO 8601).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :from (Time)
  • :to (Time)

Returns:



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
156
157
158
159
160
161
162
163
# File 'lib/mudbase/api/email_api.rb', line 115

def get_project_email_analytics_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailApi.get_project_email_analytics ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling EmailApi.get_project_email_analytics"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/analytics/email'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].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] || 'GetProjectEmailAnalytics200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

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

#get_project_email_smtp(project_id, opts = {}) ⇒ GetProjectEmailSmtp200Response

Get project SMTP settings (masked)

Parameters:

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

    the optional parameters

Returns:



169
170
171
172
# File 'lib/mudbase/api/email_api.rb', line 169

def get_project_email_smtp(project_id, opts = {})
  data, _status_code, _headers = get_project_email_smtp_with_http_info(project_id, opts)
  data
end

#get_project_email_smtp_with_http_info(project_id, opts = {}) ⇒ Array<(GetProjectEmailSmtp200Response, Integer, Hash)>

Get project SMTP settings (masked)

Parameters:

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

    the optional parameters

Returns:



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
# File 'lib/mudbase/api/email_api.rb', line 178

def get_project_email_smtp_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailApi.get_project_email_smtp ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling EmailApi.get_project_email_smtp"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/email/smtp'.sub('{' + 'projectId' + '}', CGI.escape(project_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] || 'GetProjectEmailSmtp200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

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

#get_project_email_template(project_id, name, opts = {}) ⇒ GetProjectEmailTemplate200Response

Get one email template (effective content) Returns the template body that would be used when sending: project override if present, else global default, else built-in fallback. isProjectOverride is true only when this project has a stored row; effectiveSource is project, global, or builtin.

Parameters:

  • project_id (String)
  • name (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



232
233
234
235
# File 'lib/mudbase/api/email_api.rb', line 232

def get_project_email_template(project_id, name, opts = {})
  data, _status_code, _headers = get_project_email_template_with_http_info(project_id, name, opts)
  data
end

#get_project_email_template_with_http_info(project_id, name, opts = {}) ⇒ Array<(GetProjectEmailTemplate200Response, Integer, Hash)>

Get one email template (effective content) Returns the template body that would be used when sending: project override if present, else global default, else built-in fallback. `isProjectOverride` is true only when this project has a stored row; `effectiveSource` is `project`, `global`, or `builtin`.

Parameters:

  • project_id (String)
  • name (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/mudbase/api/email_api.rb', line 243

def get_project_email_template_with_http_info(project_id, name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailApi.get_project_email_template ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling EmailApi.get_project_email_template"
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling EmailApi.get_project_email_template"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/email/templates/{name}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.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] || 'GetProjectEmailTemplate200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

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

#list_project_email_templates(project_id, opts = {}) ⇒ ListProjectEmailTemplates200Response

List email templates (full catalog for the project) Returns every template name the worker can resolve for this project: built-in defaults, global platform rows (project: null in DB), and project overrides. Use isCustomized to see if this project has its own stored copy; effectiveSource shows which layer would be used at send time (project wins over global over builtin).

Parameters:

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

    the optional parameters

Returns:



300
301
302
303
# File 'lib/mudbase/api/email_api.rb', line 300

def list_project_email_templates(project_id, opts = {})
  data, _status_code, _headers = list_project_email_templates_with_http_info(project_id, opts)
  data
end

#list_project_email_templates_with_http_info(project_id, opts = {}) ⇒ Array<(ListProjectEmailTemplates200Response, Integer, Hash)>

List email templates (full catalog for the project) Returns every template name the worker can resolve for this project: built-in defaults, global platform rows (`project: null` in DB), and project overrides. Use `isCustomized` to see if this project has its own stored copy; `effectiveSource` shows which layer would be used at send time (`project` wins over `global` over `builtin`).

Parameters:

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

    the optional parameters

Returns:



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/mudbase/api/email_api.rb', line 310

def list_project_email_templates_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailApi.list_project_email_templates ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling EmailApi.list_project_email_templates"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/email/templates'.sub('{' + 'projectId' + '}', CGI.escape(project_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] || 'ListProjectEmailTemplates200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

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

#patch_project_email_smtp(project_id, project_smtp_patch_request, opts = {}) ⇒ GetProjectEmailSmtp200Response

Update project SMTP relay (BYO) Set authPass in the body to store an encrypted password (never returned on GET). Validates host/user when enabling.

Parameters:

  • project_id (String)
  • project_smtp_patch_request (ProjectSmtpPatchRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



364
365
366
367
# File 'lib/mudbase/api/email_api.rb', line 364

def patch_project_email_smtp(project_id, project_smtp_patch_request, opts = {})
  data, _status_code, _headers = patch_project_email_smtp_with_http_info(project_id, project_smtp_patch_request, opts)
  data
end

#patch_project_email_smtp_with_http_info(project_id, project_smtp_patch_request, opts = {}) ⇒ Array<(GetProjectEmailSmtp200Response, Integer, Hash)>

Update project SMTP relay (BYO) Set `authPass` in the body to store an encrypted password (never returned on GET). Validates host/user when enabling.

Parameters:

  • project_id (String)
  • project_smtp_patch_request (ProjectSmtpPatchRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/mudbase/api/email_api.rb', line 375

def patch_project_email_smtp_with_http_info(project_id, project_smtp_patch_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailApi.patch_project_email_smtp ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling EmailApi.patch_project_email_smtp"
  end
  # verify the required parameter 'project_smtp_patch_request' is set
  if @api_client.config.client_side_validation && project_smtp_patch_request.nil?
    fail ArgumentError, "Missing the required parameter 'project_smtp_patch_request' when calling EmailApi.patch_project_email_smtp"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/email/smtp'.sub('{' + 'projectId' + '}', CGI.escape(project_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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

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

#preview_project_email_template(project_id, name, opts = {}) ⇒ nil

Render template preview (sanitized HTML, no send) Body sampleData is merged with layout defaults; keys should match {{placeholders}} in the template (see Email tag for the catalog).

Parameters:

  • project_id (String)
  • name (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (nil)


439
440
441
442
# File 'lib/mudbase/api/email_api.rb', line 439

def preview_project_email_template(project_id, name, opts = {})
  preview_project_email_template_with_http_info(project_id, name, opts)
  nil
end

#preview_project_email_template_with_http_info(project_id, name, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Render template preview (sanitized HTML, no send) Body `sampleData` is merged with layout defaults; keys should match `{placeholders}` in the template (see Email tag for the catalog).

Parameters:

  • project_id (String)
  • name (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

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

    nil, response status code and response headers



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
# File 'lib/mudbase/api/email_api.rb', line 451

def preview_project_email_template_with_http_info(project_id, name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailApi.preview_project_email_template ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling EmailApi.preview_project_email_template"
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling EmailApi.preview_project_email_template"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/email/templates/{name}/preview'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # 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

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

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

#restore_default_project_email_template(project_id, name, opts = {}) ⇒ nil

Restore from platform global default or remove project override

Parameters:

  • project_id (String)
  • name (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


511
512
513
514
# File 'lib/mudbase/api/email_api.rb', line 511

def restore_default_project_email_template(project_id, name, opts = {})
  restore_default_project_email_template_with_http_info(project_id, name, opts)
  nil
end

#restore_default_project_email_template_with_http_info(project_id, name, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Restore from platform global default or remove project override

Parameters:

  • project_id (String)
  • name (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



521
522
523
524
525
526
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
# File 'lib/mudbase/api/email_api.rb', line 521

def restore_default_project_email_template_with_http_info(project_id, name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailApi.restore_default_project_email_template ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling EmailApi.restore_default_project_email_template"
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling EmailApi.restore_default_project_email_template"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/email/templates/{name}/restore-default'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

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

#test_project_email_smtp(project_id, project_smtp_test_request, opts = {}) ⇒ DeleteFunction200Response

Verify SMTP and send a test message Rate-limited. With useSaved: true (default), uses stored credentials; otherwise pass host, authUser, authPass, etc.

Parameters:

  • project_id (String)
  • project_smtp_test_request (ProjectSmtpTestRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



577
578
579
580
# File 'lib/mudbase/api/email_api.rb', line 577

def test_project_email_smtp(project_id, project_smtp_test_request, opts = {})
  data, _status_code, _headers = test_project_email_smtp_with_http_info(project_id, project_smtp_test_request, opts)
  data
end

#test_project_email_smtp_with_http_info(project_id, project_smtp_test_request, opts = {}) ⇒ Array<(DeleteFunction200Response, Integer, Hash)>

Verify SMTP and send a test message Rate-limited. With `useSaved: true` (default), uses stored credentials; otherwise pass `host`, `authUser`, `authPass`, etc.

Parameters:

  • project_id (String)
  • project_smtp_test_request (ProjectSmtpTestRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    DeleteFunction200Response data, response status code and response headers



588
589
590
591
592
593
594
595
596
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
# File 'lib/mudbase/api/email_api.rb', line 588

def test_project_email_smtp_with_http_info(project_id, project_smtp_test_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailApi.test_project_email_smtp ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling EmailApi.test_project_email_smtp"
  end
  # verify the required parameter 'project_smtp_test_request' is set
  if @api_client.config.client_side_validation && project_smtp_test_request.nil?
    fail ArgumentError, "Missing the required parameter 'project_smtp_test_request' when calling EmailApi.test_project_email_smtp"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/email/smtp/test'.sub('{' + 'projectId' + '}', CGI.escape(project_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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

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

#upsert_project_email_template(project_id, name, upsert_project_email_template_request, opts = {}) ⇒ nil

Upsert project email template (HTML sanitized; variables must cover {placeholders}) Saves a project override for name. HTML is sanitized. variables must list every {{token}} used in subject, htmlBody, and textBody (see Email tag description for the full placeholder catalog).

Parameters:

  • project_id (String)
  • name (String)
  • upsert_project_email_template_request (UpsertProjectEmailTemplateRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


652
653
654
655
# File 'lib/mudbase/api/email_api.rb', line 652

def upsert_project_email_template(project_id, name, upsert_project_email_template_request, opts = {})
  upsert_project_email_template_with_http_info(project_id, name, upsert_project_email_template_request, opts)
  nil
end

#upsert_project_email_template_with_http_info(project_id, name, upsert_project_email_template_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Upsert project email template (HTML sanitized; variables must cover {placeholders}) Saves a project override for `name`. HTML is sanitized. `variables` must list every `{token}` used in `subject`, `htmlBody`, and `textBody` (see Email tag description for the full placeholder catalog).

Parameters:

  • project_id (String)
  • name (String)
  • upsert_project_email_template_request (UpsertProjectEmailTemplateRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



664
665
666
667
668
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
722
723
# File 'lib/mudbase/api/email_api.rb', line 664

def upsert_project_email_template_with_http_info(project_id, name, upsert_project_email_template_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailApi.upsert_project_email_template ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling EmailApi.upsert_project_email_template"
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling EmailApi.upsert_project_email_template"
  end
  # verify the required parameter 'upsert_project_email_template_request' is set
  if @api_client.config.client_side_validation && upsert_project_email_template_request.nil?
    fail ArgumentError, "Missing the required parameter 'upsert_project_email_template_request' when calling EmailApi.upsert_project_email_template"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/email/templates/{name}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'name' + '}', CGI.escape(name.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

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

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

#verify_project_email_smtp_domain(project_id, opts = {}) ⇒ nil

Check DNS (MX + SPF) for sending domain Resolves the domain from domain, fromEmail, or saved emailSmtp.fromEmail. Returns whether MX and SPF TXT exist. With persist: true and checks passed, sets emailSmtp.domainVerifiedAt.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (nil)


731
732
733
734
# File 'lib/mudbase/api/email_api.rb', line 731

def verify_project_email_smtp_domain(project_id, opts = {})
  verify_project_email_smtp_domain_with_http_info(project_id, opts)
  nil
end

#verify_project_email_smtp_domain_with_http_info(project_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Check DNS (MX + SPF) for sending domain Resolves the domain from `domain`, `fromEmail`, or saved `emailSmtp.fromEmail`. Returns whether MX and SPF TXT exist. With `persist: true` and checks passed, sets `emailSmtp.domainVerifiedAt`.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

    nil, response status code and response headers



742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
# File 'lib/mudbase/api/email_api.rb', line 742

def verify_project_email_smtp_domain_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailApi.verify_project_email_smtp_domain ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling EmailApi.verify_project_email_smtp_domain"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/email/smtp/verify-domain'.sub('{' + 'projectId' + '}', CGI.escape(project_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

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

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

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