Class: Mudbase::MessagingApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MessagingApi

Returns a new instance of MessagingApi.



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

def api_client
  @api_client
end

Instance Method Details

#get_message_history(project_id, opts = {}) ⇒ MessageHistoryResponse

Get message history Get message history (push, email, SMS) with filtering and pagination. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :type (String)
  • :page (Integer) — default: default to 1
  • :limit (Integer) — default: default to 20
  • :status (String)

Returns:



31
32
33
34
# File 'lib/mudbase/api/messaging_api.rb', line 31

def get_message_history(project_id, opts = {})
  data, _status_code, _headers = get_message_history_with_http_info(project_id, opts)
  data
end

#get_message_history_with_http_info(project_id, opts = {}) ⇒ Array<(MessageHistoryResponse, Integer, Hash)>

Get message history Get message history (push, email, SMS) with filtering and pagination. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :type (String)
  • :page (Integer) — default: default to 1
  • :limit (Integer) — default: default to 20
  • :status (String)

Returns:

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

    MessageHistoryResponse data, response status code and response headers



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
95
96
97
98
99
100
101
102
103
# File 'lib/mudbase/api/messaging_api.rb', line 45

def get_message_history_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.get_message_history ...'
  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 MessagingApi.get_message_history"
  end
  allowable_values = ["push", "email", "sms"]
  if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
    fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
  end
  allowable_values = ["sent", "failed", "pending"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/messaging/projects/{projectId}/messaging/history'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].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] || 'MessageHistoryResponse'

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

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

#get_message_stats(project_id, opts = {}) ⇒ MessageStatsResponse

Get message statistics Get messaging statistics including total messages, success rates, and breakdown by type (push, email, SMS). Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :start_date (Time)
  • :end_date (Time)

Returns:



112
113
114
115
# File 'lib/mudbase/api/messaging_api.rb', line 112

def get_message_stats(project_id, opts = {})
  data, _status_code, _headers = get_message_stats_with_http_info(project_id, opts)
  data
end

#get_message_stats_with_http_info(project_id, opts = {}) ⇒ Array<(MessageStatsResponse, Integer, Hash)>

Get message statistics Get messaging statistics including total messages, success rates, and breakdown by type (push, email, SMS). Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :start_date (Time)
  • :end_date (Time)

Returns:

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

    MessageStatsResponse data, response status code and response headers



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
164
165
166
167
168
169
170
171
172
# File 'lib/mudbase/api/messaging_api.rb', line 124

def get_message_stats_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.get_message_stats ...'
  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 MessagingApi.get_message_stats"
  end
  # resource path
  local_var_path = '/api/messaging/projects/{projectId}/messaging/stats'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].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] || 'MessageStatsResponse'

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

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

#get_project_fcm_config(project_id, opts = {}) ⇒ GetProjectFcmConfig200Response

Get BYO FCM configuration (masked) Returns whether a per-project Firebase service account JSON is stored (encrypted). Falls back to platform FCM_SERVICE_ACCOUNT_JSON when unset.

Parameters:

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

    the optional parameters

Returns:



179
180
181
182
# File 'lib/mudbase/api/messaging_api.rb', line 179

def get_project_fcm_config(project_id, opts = {})
  data, _status_code, _headers = get_project_fcm_config_with_http_info(project_id, opts)
  data
end

#get_project_fcm_config_with_http_info(project_id, opts = {}) ⇒ Array<(GetProjectFcmConfig200Response, Integer, Hash)>

Get BYO FCM configuration (masked) Returns whether a per-project Firebase service account JSON is stored (encrypted). Falls back to platform `FCM_SERVICE_ACCOUNT_JSON` when unset.

Parameters:

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

    the optional parameters

Returns:



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/mudbase/api/messaging_api.rb', line 189

def get_project_fcm_config_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.get_project_fcm_config ...'
  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 MessagingApi.get_project_fcm_config"
  end
  # resource path
  local_var_path = '/api/messaging/projects/{projectId}/messaging/push-config'.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] || 'GetProjectFcmConfig200Response'

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

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

#get_project_sms_byo(project_id, opts = {}) ⇒ GetProjectSmsByo200Response

Get BYO SMS provider configuration (masked) Returns enabled flag, provider kind, default sender, and whether credentials are stored. Secrets are never returned.

Parameters:

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

    the optional parameters

Returns:



242
243
244
245
# File 'lib/mudbase/api/messaging_api.rb', line 242

def get_project_sms_byo(project_id, opts = {})
  data, _status_code, _headers = get_project_sms_byo_with_http_info(project_id, opts)
  data
end

#get_project_sms_byo_with_http_info(project_id, opts = {}) ⇒ Array<(GetProjectSmsByo200Response, Integer, Hash)>

Get BYO SMS provider configuration (masked) Returns enabled flag, provider kind, default sender, and whether credentials are stored. Secrets are never returned.

Parameters:

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

    the optional parameters

Returns:

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

    GetProjectSmsByo200Response data, response status code and response headers



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/mudbase/api/messaging_api.rb', line 252

def get_project_sms_byo_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.get_project_sms_byo ...'
  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 MessagingApi.get_project_sms_byo"
  end
  # resource path
  local_var_path = '/api/messaging/projects/{projectId}/messaging/sms-provider'.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] || 'GetProjectSmsByo200Response'

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

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

#patch_project_fcm_config(project_id, patch_project_fcm_config_request, opts = {}) ⇒ nil

Set or clear per-project FCM service account Body serviceAccountJson is the Firebase service account object (stored encrypted). Send clear: true to remove and use platform FCM only.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


306
307
308
309
# File 'lib/mudbase/api/messaging_api.rb', line 306

def patch_project_fcm_config(project_id, patch_project_fcm_config_request, opts = {})
  patch_project_fcm_config_with_http_info(project_id, patch_project_fcm_config_request, opts)
  nil
end

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

Set or clear per-project FCM service account Body `serviceAccountJson` is the Firebase service account object (stored encrypted). Send `clear: true` to remove and use platform FCM only.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/mudbase/api/messaging_api.rb', line 317

def patch_project_fcm_config_with_http_info(project_id, patch_project_fcm_config_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.patch_project_fcm_config ...'
  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 MessagingApi.patch_project_fcm_config"
  end
  # verify the required parameter 'patch_project_fcm_config_request' is set
  if @api_client.config.client_side_validation && patch_project_fcm_config_request.nil?
    fail ArgumentError, "Missing the required parameter 'patch_project_fcm_config_request' when calling MessagingApi.patch_project_fcm_config"
  end
  # resource path
  local_var_path = '/api/messaging/projects/{projectId}/messaging/push-config'.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(patch_project_fcm_config_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 => :"MessagingApi.patch_project_fcm_config",
    :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: MessagingApi#patch_project_fcm_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_project_sms_byo(project_id, project_sms_byo_patch_request, opts = {}) ⇒ GetProjectSmsByo200Response

Update BYO SMS provider credentials Body config is provider-specific JSON stored encrypted per organization: - twilioaccountSid, authToken (required). Optional from sender override used if the send request does not specify from and defaultFrom is empty. - termiiapiKey (required). Optional from sender name (e.g. brand label). - africastalkingusername, apiKey (both required). Optional from shortcode or sender ID. On enable, the API validates credentials with a lightweight ping (no SMS sent). See request body Examples for sample payloads.

Parameters:

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

    the optional parameters

Returns:



380
381
382
383
# File 'lib/mudbase/api/messaging_api.rb', line 380

def patch_project_sms_byo(project_id, project_sms_byo_patch_request, opts = {})
  data, _status_code, _headers = patch_project_sms_byo_with_http_info(project_id, project_sms_byo_patch_request, opts)
  data
end

#patch_project_sms_byo_with_http_info(project_id, project_sms_byo_patch_request, opts = {}) ⇒ Array<(GetProjectSmsByo200Response, Integer, Hash)>

Update BYO SMS provider credentials Body `config` is provider-specific JSON stored encrypted per organization: - twilio — `accountSid`, `authToken` (required). Optional `from` sender override used if the send request does not specify `from` and `defaultFrom` is empty. - termii — `apiKey` (required). Optional `from` sender name (e.g. brand label). - africastalking — `username`, `apiKey` (both required). Optional `from` shortcode or sender ID. On enable, the API validates credentials with a lightweight ping (no SMS sent). See request body Examples for sample payloads.

Parameters:

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

    the optional parameters

Returns:

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

    GetProjectSmsByo200Response data, response status code and response headers



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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/mudbase/api/messaging_api.rb', line 391

def patch_project_sms_byo_with_http_info(project_id, project_sms_byo_patch_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.patch_project_sms_byo ...'
  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 MessagingApi.patch_project_sms_byo"
  end
  # verify the required parameter 'project_sms_byo_patch_request' is set
  if @api_client.config.client_side_validation && project_sms_byo_patch_request.nil?
    fail ArgumentError, "Missing the required parameter 'project_sms_byo_patch_request' when calling MessagingApi.patch_project_sms_byo"
  end
  # resource path
  local_var_path = '/api/messaging/projects/{projectId}/messaging/sms-provider'.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_sms_byo_patch_request)

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

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

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

#send_email(project_id, email_request, opts = {}) ⇒ MessageSentResponse

Send email Send an email message to one or more recipients. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.

Parameters:

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

    the optional parameters

Returns:



454
455
456
457
# File 'lib/mudbase/api/messaging_api.rb', line 454

def send_email(project_id, email_request, opts = {})
  data, _status_code, _headers = send_email_with_http_info(project_id, email_request, opts)
  data
end

#send_email_with_http_info(project_id, email_request, opts = {}) ⇒ Array<(MessageSentResponse, Integer, Hash)>

Send email Send an email message to one or more recipients. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.

Parameters:

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

    the optional parameters

Returns:

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

    MessageSentResponse data, response status code and response headers



465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
# File 'lib/mudbase/api/messaging_api.rb', line 465

def send_email_with_http_info(project_id, email_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.send_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 MessagingApi.send_email"
  end
  # verify the required parameter 'email_request' is set
  if @api_client.config.client_side_validation && email_request.nil?
    fail ArgumentError, "Missing the required parameter 'email_request' when calling MessagingApi.send_email"
  end
  # resource path
  local_var_path = '/api/messaging/projects/{projectId}/messaging/email'.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(email_request)

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

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

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

#send_push_notification(project_id, push_notification_request, opts = {}) ⇒ MessageSentResponse

Send push notification Send a push notification to one or more devices. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.

Parameters:

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

    the optional parameters

Returns:



528
529
530
531
# File 'lib/mudbase/api/messaging_api.rb', line 528

def send_push_notification(project_id, push_notification_request, opts = {})
  data, _status_code, _headers = send_push_notification_with_http_info(project_id, push_notification_request, opts)
  data
end

#send_push_notification_with_http_info(project_id, push_notification_request, opts = {}) ⇒ Array<(MessageSentResponse, Integer, Hash)>

Send push notification Send a push notification to one or more devices. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.

Parameters:

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

    the optional parameters

Returns:

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

    MessageSentResponse data, response status code and response headers



539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
# File 'lib/mudbase/api/messaging_api.rb', line 539

def send_push_notification_with_http_info(project_id, push_notification_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.send_push_notification ...'
  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 MessagingApi.send_push_notification"
  end
  # verify the required parameter 'push_notification_request' is set
  if @api_client.config.client_side_validation && push_notification_request.nil?
    fail ArgumentError, "Missing the required parameter 'push_notification_request' when calling MessagingApi.send_push_notification"
  end
  # resource path
  local_var_path = '/api/messaging/projects/{projectId}/messaging/push'.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(push_notification_request)

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

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

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

#send_sms(project_id, sms_request, opts = {}) ⇒ MessageSentResponse

Send SMS Send an SMS message to one or more phone numbers. Uses project BYO SMS when configured; otherwise platform Twilio env if set. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.

Parameters:

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

    the optional parameters

Returns:



602
603
604
605
# File 'lib/mudbase/api/messaging_api.rb', line 602

def send_sms(project_id, sms_request, opts = {})
  data, _status_code, _headers = send_sms_with_http_info(project_id, sms_request, opts)
  data
end

#send_sms_with_http_info(project_id, sms_request, opts = {}) ⇒ Array<(MessageSentResponse, Integer, Hash)>

Send SMS Send an SMS message to one or more phone numbers. Uses project BYO SMS when configured; otherwise platform Twilio env if set. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.

Parameters:

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

    the optional parameters

Returns:

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

    MessageSentResponse data, response status code and response headers



613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
# File 'lib/mudbase/api/messaging_api.rb', line 613

def send_sms_with_http_info(project_id, sms_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.send_sms ...'
  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 MessagingApi.send_sms"
  end
  # verify the required parameter 'sms_request' is set
  if @api_client.config.client_side_validation && sms_request.nil?
    fail ArgumentError, "Missing the required parameter 'sms_request' when calling MessagingApi.send_sms"
  end
  # resource path
  local_var_path = '/api/messaging/projects/{projectId}/messaging/sms'.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(sms_request)

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

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

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