Class: Mudbase::WebhooksApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WebhooksApi

Returns a new instance of WebhooksApi.



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

def api_client
  @api_client
end

Instance Method Details

#configure_webhook(project_id, opts = {}) ⇒ ConfigureWebhook200Response

Create or update project webhook Set or update the project webhook URL and options. This is how you add or create a webhook for a project: provide webhookUrl to enable delivery; omit or set to null to disable. Optionally set webhookSecret, webhookEvents, webhookVersion, and transformations. Plan limits (webhooks per project) apply when adding a new URL. Requires ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key) with project update access.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:



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

def configure_webhook(project_id, opts = {})
  data, _status_code, _headers = configure_webhook_with_http_info(project_id, opts)
  data
end

#configure_webhook_with_http_info(project_id, opts = {}) ⇒ Array<(ConfigureWebhook200Response, Integer, Hash)>

Create or update project webhook Set or update the project webhook URL and options. This is how you add or create a webhook for a project: provide webhookUrl to enable delivery; omit or set to null to disable. Optionally set webhookSecret, webhookEvents, webhookVersion, and transformations. Plan limits (webhooks per project) apply when adding a new URL. Requires ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key) with project update access.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

    ConfigureWebhook200Response data, response status code and response headers



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

def configure_webhook_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.configure_webhook ...'
  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 WebhooksApi.configure_webhook"
  end
  # resource path
  local_var_path = '/api/webhooks/projects/{projectId}/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(opts[:'configure_webhook_request'])

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

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

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

#get_webhook_config(project_id, opts = {}) ⇒ GetWebhookConfig200Response

Get project webhook configuration Get the current webhook URL, events, version, and transformations for a project. This is where Mudbase POSTs event payloads; it does not return a webhookId. Delivery ids (WebhookLog._id) come from POST /api/webhooks/trigger or automatic deliveries, and from list logs endpoints. Requires ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key) with project read access.

Parameters:

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

    the optional parameters

Returns:



97
98
99
100
# File 'lib/mudbase/api/webhooks_api.rb', line 97

def get_webhook_config(project_id, opts = {})
  data, _status_code, _headers = get_webhook_config_with_http_info(project_id, opts)
  data
end

#get_webhook_config_with_http_info(project_id, opts = {}) ⇒ Array<(GetWebhookConfig200Response, Integer, Hash)>

Get project webhook configuration Get the current webhook URL, events, version, and transformations for a project. This is where Mudbase POSTs event payloads; it does not return a `webhookId`. Delivery ids (`WebhookLog._id`) come from `POST /api/webhooks/trigger` or automatic deliveries, and from list logs endpoints. Requires ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key) with project read access.

Parameters:

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

    the optional parameters

Returns:

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

    GetWebhookConfig200Response data, response status code and response headers



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

def get_webhook_config_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhook_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 WebhooksApi.get_webhook_config"
  end
  # resource path
  local_var_path = '/api/webhooks/projects/{projectId}/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] || 'GetWebhookConfig200Response'

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

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

#get_webhook_stats(opts = {}) ⇒ WebhookStatsResponse

Get webhook delivery statistics Aggregates WebhookLog rows for your organization over the last days (default 7). Optional projectId filters to a project in your org. Returns statusStats (counts and average duration per delivery status) and eventStats (counts and success rate per event name). Auth: Organization JWT only (authRequired).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :project_id (String)

    Optional; limit stats to this project.

  • :days (Integer) — default: default to 7

Returns:



161
162
163
164
# File 'lib/mudbase/api/webhooks_api.rb', line 161

def get_webhook_stats(opts = {})
  data, _status_code, _headers = get_webhook_stats_with_http_info(opts)
  data
end

#get_webhook_stats_with_http_info(opts = {}) ⇒ Array<(WebhookStatsResponse, Integer, Hash)>

Get webhook delivery statistics Aggregates `WebhookLog` rows for your organization over the last `days` (default 7). Optional `projectId` filters to a project in your org. Returns `statusStats` (counts and average duration per delivery status) and `eventStats` (counts and success rate per event name). Auth: Organization JWT only (`authRequired`).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :project_id (String)

    Optional; limit stats to this project.

  • :days (Integer) — default: default to 7

Returns:

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

    WebhookStatsResponse data, response status code and response headers



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

def get_webhook_stats_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhook_stats ...'
  end
  # resource path
  local_var_path = '/api/webhooks/stats'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'projectId'] = opts[:'project_id'] if !opts[:'project_id'].nil?
  query_params[:'days'] = opts[:'days'] if !opts[:'days'].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] || 'WebhookStatsResponse'

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

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

#list_project_webhook_logs(project_id, opts = {}) ⇒ WebhookListResponse

List webhook delivery logs (project) Same WebhookLog documents as GET /api/webhooks, scoped to projectId in the path. Accepts org JWT, project JWT, or project API key with project read access. Each item’s _id is the id returned as webhookId from POST /api/webhooks/trigger and used in POST /api/webhooks/retry/{webhookId}.

Parameters:

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

    the optional parameters

Options Hash (opts):

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

Returns:



227
228
229
230
# File 'lib/mudbase/api/webhooks_api.rb', line 227

def list_project_webhook_logs(project_id, opts = {})
  data, _status_code, _headers = list_project_webhook_logs_with_http_info(project_id, opts)
  data
end

#list_project_webhook_logs_with_http_info(project_id, opts = {}) ⇒ Array<(WebhookListResponse, Integer, Hash)>

List webhook delivery logs (project) Same `WebhookLog` documents as `GET /api/webhooks`, scoped to `projectId` in the path. Accepts org JWT, project JWT, or project API key with project read access. Each item’s `_id` is the id returned as `webhookId` from `POST /api/webhooks/trigger` and used in `POST /api/webhooks/retry/webhookId`.

Parameters:

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

    the optional parameters

Options Hash (opts):

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

Returns:

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

    WebhookListResponse data, response status code and response headers



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

def list_project_webhook_logs_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.list_project_webhook_logs ...'
  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 WebhooksApi.list_project_webhook_logs"
  end
  allowable_values = ["pending", "success", "failed", "retrying"]
  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/webhooks/projects/{projectId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))

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

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

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

#list_webhooks(opts = {}) ⇒ WebhookListResponse

List webhook delivery logs (organization) Paginated webhook delivery logs for your organization (each row is one outbound HTTP attempt). Optional projectId query filters to a project that belongs to your org. Use each log document’s _id (MongoDB ObjectId) as webhookId when calling POST /api/webhooks/retry/{webhookId} after a failed delivery. Organization JWT only (OrgBearerAuth); project API keys are not accepted on this route.

Parameters:

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

    the optional parameters

Options Hash (opts):

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

    Optional; restrict logs to this project (must belong to your org).

Returns:



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

def list_webhooks(opts = {})
  data, _status_code, _headers = list_webhooks_with_http_info(opts)
  data
end

#list_webhooks_with_http_info(opts = {}) ⇒ Array<(WebhookListResponse, Integer, Hash)>

List webhook delivery logs (organization) Paginated webhook delivery logs for your organization (each row is one outbound HTTP attempt). Optional `projectId` query filters to a project that belongs to your org. Use each log document’s `_id` (MongoDB ObjectId) as `webhookId` when calling `POST /api/webhooks/retry/webhookId` after a failed delivery. Organization JWT only (`OrgBearerAuth`); project API keys are not accepted on this route.

Parameters:

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

    the optional parameters

Options Hash (opts):

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

    Optional; restrict logs to this project (must belong to your org).

Returns:

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

    WebhookListResponse data, response status code and response headers



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

def list_webhooks_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhooks ...'
  end
  allowable_values = ["pending", "success", "failed", "retrying"]
  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/webhooks'

  # query parameters
  query_params = opts[:query_params] || {}
  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?
  query_params[:'event'] = opts[:'event'] if !opts[:'event'].nil?
  query_params[:'projectId'] = opts[:'project_id'] if !opts[:'project_id'].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] || 'WebhookListResponse'

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

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

#retry_webhook(webhook_id, opts = {}) ⇒ RetryWebhookResponse

Retry a failed webhook delivery webhookId (path) = WebhookLog._id (MongoDB ObjectId)—the same value returned as webhookId from POST /api/webhooks/trigger and as _id on GET /api/webhooks / GET /api/webhooks/projects/{projectId}. Not the string webhookId field stored on the log document (e.g. manual-173…); use the document _id for this path. Resets a non-success log to pending and re-delivers. 400 if status is already success. Auth: Organization JWT only; project API keys are not accepted.

Parameters:

  • webhook_id (String)

    WebhookLog document `_id` (delivery log id).

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

    the optional parameters

Returns:



378
379
380
381
# File 'lib/mudbase/api/webhooks_api.rb', line 378

def retry_webhook(webhook_id, opts = {})
  data, _status_code, _headers = retry_webhook_with_http_info(webhook_id, opts)
  data
end

#retry_webhook_with_http_info(webhook_id, opts = {}) ⇒ Array<(RetryWebhookResponse, Integer, Hash)>

Retry a failed webhook delivery `webhookId` (path) = `WebhookLog._id` (MongoDB ObjectId)—the same value returned as `webhookId` from `POST /api/webhooks/trigger` and as `_id` on `GET /api/webhooks` / `GET /api/webhooks/projects/projectId`. Not the string `webhookId` field stored on the log document (e.g. `manual-173…`); use the document `_id` for this path. Resets a non-success log to pending and re-delivers. 400 if status is already `success`. Auth: Organization JWT only; project API keys are not accepted.

Parameters:

  • webhook_id (String)

    WebhookLog document `_id` (delivery log id).

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

    the optional parameters

Returns:

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

    RetryWebhookResponse data, response status code and response headers



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
431
432
433
434
# File 'lib/mudbase/api/webhooks_api.rb', line 388

def retry_webhook_with_http_info(webhook_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.retry_webhook ...'
  end
  # verify the required parameter 'webhook_id' is set
  if @api_client.config.client_side_validation && webhook_id.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.retry_webhook"
  end
  # resource path
  local_var_path = '/api/webhooks/retry/{webhookId}'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_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] || 'RetryWebhookResponse'

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

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

#test_webhook_transformation(project_id, test_webhook_transformation_request, opts = {}) ⇒ TestWebhookTransformation200Response

Test webhook transformation Apply transformation rules to a sample payload and return original and transformed payloads. Requires ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key) with project update access.

Parameters:

Returns:



442
443
444
445
# File 'lib/mudbase/api/webhooks_api.rb', line 442

def test_webhook_transformation(project_id, test_webhook_transformation_request, opts = {})
  data, _status_code, _headers = test_webhook_transformation_with_http_info(project_id, test_webhook_transformation_request, opts)
  data
end

#test_webhook_transformation_with_http_info(project_id, test_webhook_transformation_request, opts = {}) ⇒ Array<(TestWebhookTransformation200Response, Integer, Hash)>

Test webhook transformation Apply transformation rules to a sample payload and return original and transformed payloads. Requires ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key) with project update access.

Parameters:

Returns:



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

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

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

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

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

#trigger_webhook(trigger_webhook_request, opts = {}) ⇒ TriggerWebhookResponse

Manually trigger an outbound webhook Queues an HTTP delivery to url for projectId (must belong to your org). Creates a WebhookLog row, runs delivery, and returns the new log’s _id. Response field webhookId: This is the MongoDB _id of the delivery log (same as the log’s _id in list endpoints). It is not part of the request body and is not the project webhookSecret from PUT .../config. Auth: Org JWT, project JWT, or project API key with project update permission.

Parameters:

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

    the optional parameters

Returns:



515
516
517
518
# File 'lib/mudbase/api/webhooks_api.rb', line 515

def trigger_webhook(trigger_webhook_request, opts = {})
  data, _status_code, _headers = trigger_webhook_with_http_info(trigger_webhook_request, opts)
  data
end

#trigger_webhook_with_http_info(trigger_webhook_request, opts = {}) ⇒ Array<(TriggerWebhookResponse, Integer, Hash)>

Manually trigger an outbound webhook Queues an HTTP delivery to `url` for `projectId` (must belong to your org). Creates a `WebhookLog` row, runs delivery, and returns the new log’s `_id`. Response field `webhookId`: This is the MongoDB `_id` of the delivery log (same as the log’s `_id` in list endpoints). It is not part of the request body and is not the project `webhookSecret` from `PUT .../config`. Auth: Org JWT, project JWT, or project API key with project `update` permission.

Parameters:

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

    the optional parameters

Returns:

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

    TriggerWebhookResponse data, response status code and response headers



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
570
571
572
573
574
575
576
# File 'lib/mudbase/api/webhooks_api.rb', line 525

def trigger_webhook_with_http_info(trigger_webhook_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.trigger_webhook ...'
  end
  # verify the required parameter 'trigger_webhook_request' is set
  if @api_client.config.client_side_validation && trigger_webhook_request.nil?
    fail ArgumentError, "Missing the required parameter 'trigger_webhook_request' when calling WebhooksApi.trigger_webhook"
  end
  # resource path
  local_var_path = '/api/webhooks/trigger'

  # 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(trigger_webhook_request)

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

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

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