Class: AgentPushKit::EventsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/agent_push_kit/api/events_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EventsApi

Returns a new instance of EventsApi.



19
20
21
# File 'lib/agent_push_kit/api/events_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/agent_push_kit/api/events_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_event(organization_id, event_id, opts = {}) ⇒ EventDetail

Get one event including metadata

Parameters:

  • organization_id (String)
  • event_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/agent_push_kit/api/events_api.rb', line 27

def get_event(organization_id, event_id, opts = {})
  data, _status_code, _headers = get_event_with_http_info(organization_id, event_id, opts)
  data
end

#get_event_with_http_info(organization_id, event_id, opts = {}) ⇒ Array<(EventDetail, Integer, Hash)>

Get one event including metadata

Parameters:

  • organization_id (String)
  • event_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    EventDetail data, response status code and response headers



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

def get_event_with_http_info(organization_id, event_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.get_event ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling EventsApi.get_event"
  end
  # verify the required parameter 'event_id' is set
  if @api_client.config.client_side_validation && event_id.nil?
    fail ArgumentError, "Missing the required parameter 'event_id' when calling EventsApi.get_event"
  end
  # resource path
  local_var_path = '/organizations/{organizationId}/events/{eventId}'.sub('{organizationId}', CGI.escape(organization_id.to_s)).sub('{eventId}', CGI.escape(event_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] || 'EventDetail'

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

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

#list_events(organization_id, opts = {}) ⇒ EventPage

List a paginated inbox

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :service (String)
  • :type (String)
  • :search (String)
  • :cursor (String)
  • :limit (Integer) — default: default to 50

Returns:



98
99
100
101
# File 'lib/agent_push_kit/api/events_api.rb', line 98

def list_events(organization_id, opts = {})
  data, _status_code, _headers = list_events_with_http_info(organization_id, opts)
  data
end

#list_events_with_http_info(organization_id, opts = {}) ⇒ Array<(EventPage, Integer, Hash)>

List a paginated inbox

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :service (String)
  • :type (String)
  • :search (String)
  • :cursor (String)
  • :limit (Integer) — default: default to 50

Returns:

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

    EventPage data, response status code and response headers



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/agent_push_kit/api/events_api.rb', line 112

def list_events_with_http_info(organization_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.list_events ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling EventsApi.list_events"
  end
  if @api_client.config.client_side_validation && !opts[:'service'].nil? && opts[:'service'].to_s.length > 120
    fail ArgumentError, 'invalid value for "opts[:"service"]" when calling EventsApi.list_events, the character length must be smaller than or equal to 120.'
  end

  if @api_client.config.client_side_validation && !opts[:'type'].nil? && opts[:'type'].to_s.length > 120
    fail ArgumentError, 'invalid value for "opts[:"type"]" when calling EventsApi.list_events, the character length must be smaller than or equal to 120.'
  end

  if @api_client.config.client_side_validation && !opts[:'search'].nil? && opts[:'search'].to_s.length > 200
    fail ArgumentError, 'invalid value for "opts[:"search"]" when calling EventsApi.list_events, the character length must be smaller than or equal to 200.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EventsApi.list_events, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EventsApi.list_events, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/organizations/{organizationId}/events'.sub('{organizationId}', CGI.escape(organization_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'service'] = opts[:'service'] if !opts[:'service'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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] || 'EventPage'

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

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

#list_notification_types(organization_id, opts = {}) ⇒ Array<String>

List distinct notification types

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :service_id (String)

    Optionally restrict types to one service ID.

Returns:

  • (Array<String>)


190
191
192
193
# File 'lib/agent_push_kit/api/events_api.rb', line 190

def list_notification_types(organization_id, opts = {})
  data, _status_code, _headers = list_notification_types_with_http_info(organization_id, opts)
  data
end

#list_notification_types_with_http_info(organization_id, opts = {}) ⇒ Array<(Array<String>, Integer, Hash)>

List distinct notification types

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :service_id (String)

    Optionally restrict types to one service ID.

Returns:

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

    Array data, response status code and response headers



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
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/agent_push_kit/api/events_api.rb', line 200

def list_notification_types_with_http_info(organization_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.list_notification_types ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling EventsApi.list_notification_types"
  end
  # resource path
  local_var_path = '/organizations/{organizationId}/types'.sub('{organizationId}', CGI.escape(organization_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'serviceId'] = opts[:'service_id'] if !opts[:'service_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] || 'Array<String>'

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

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

#list_services(organization_id, opts = {}) ⇒ Array<Service>

List services discovered from ingested events

Parameters:

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

    the optional parameters

Returns:



253
254
255
256
# File 'lib/agent_push_kit/api/events_api.rb', line 253

def list_services(organization_id, opts = {})
  data, _status_code, _headers = list_services_with_http_info(organization_id, opts)
  data
end

#list_services_with_http_info(organization_id, opts = {}) ⇒ Array<(Array<Service>, Integer, Hash)>

List services discovered from ingested events

Parameters:

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

    the optional parameters

Returns:

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

    Array data, response status code and response headers



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
299
300
301
302
303
304
305
306
307
308
# File 'lib/agent_push_kit/api/events_api.rb', line 262

def list_services_with_http_info(organization_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.list_services ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling EventsApi.list_services"
  end
  # resource path
  local_var_path = '/organizations/{organizationId}/services'.sub('{organizationId}', CGI.escape(organization_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] || 'Array<Service>'

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

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

#search_events(organization_id, search_events_input, opts = {}) ⇒ EventPage

Search events with a validated Boolean filter tree

Parameters:

  • organization_id (String)
  • search_events_input (SearchEventsInput)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



315
316
317
318
# File 'lib/agent_push_kit/api/events_api.rb', line 315

def search_events(organization_id, search_events_input, opts = {})
  data, _status_code, _headers = search_events_with_http_info(organization_id, search_events_input, opts)
  data
end

#search_events_with_http_info(organization_id, search_events_input, opts = {}) ⇒ Array<(EventPage, Integer, Hash)>

Search events with a validated Boolean filter tree

Parameters:

  • organization_id (String)
  • search_events_input (SearchEventsInput)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    EventPage data, response status code and response headers



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
373
374
375
376
377
378
379
380
# File 'lib/agent_push_kit/api/events_api.rb', line 325

def search_events_with_http_info(organization_id, search_events_input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.search_events ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling EventsApi.search_events"
  end
  # verify the required parameter 'search_events_input' is set
  if @api_client.config.client_side_validation && search_events_input.nil?
    fail ArgumentError, "Missing the required parameter 'search_events_input' when calling EventsApi.search_events"
  end
  # resource path
  local_var_path = '/organizations/{organizationId}/events/search'.sub('{organizationId}', CGI.escape(organization_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(search_events_input)

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

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

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

#send_event(send_event_input, opts = {}) ⇒ IngestionResult

Send an event using an application ingestion key

Parameters:

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

    the optional parameters

Returns:



386
387
388
389
# File 'lib/agent_push_kit/api/events_api.rb', line 386

def send_event(send_event_input, opts = {})
  data, _status_code, _headers = send_event_with_http_info(send_event_input, opts)
  data
end

#send_event_as_user(organization_id, send_event_input, opts = {}) ⇒ IngestionResult

Send an event as an authenticated user or agent

Parameters:

  • organization_id (String)
  • send_event_input (SendEventInput)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



453
454
455
456
# File 'lib/agent_push_kit/api/events_api.rb', line 453

def send_event_as_user(organization_id, send_event_input, opts = {})
  data, _status_code, _headers = send_event_as_user_with_http_info(organization_id, send_event_input, opts)
  data
end

#send_event_as_user_with_http_info(organization_id, send_event_input, opts = {}) ⇒ Array<(IngestionResult, Integer, Hash)>

Send an event as an authenticated user or agent

Parameters:

  • organization_id (String)
  • send_event_input (SendEventInput)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    IngestionResult data, response status code and response headers



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
509
510
511
512
513
514
515
516
517
518
# File 'lib/agent_push_kit/api/events_api.rb', line 463

def send_event_as_user_with_http_info(organization_id, send_event_input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.send_event_as_user ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling EventsApi.send_event_as_user"
  end
  # verify the required parameter 'send_event_input' is set
  if @api_client.config.client_side_validation && send_event_input.nil?
    fail ArgumentError, "Missing the required parameter 'send_event_input' when calling EventsApi.send_event_as_user"
  end
  # resource path
  local_var_path = '/organizations/{organizationId}/events'.sub('{organizationId}', CGI.escape(organization_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(send_event_input)

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

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

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

#send_event_with_http_info(send_event_input, opts = {}) ⇒ Array<(IngestionResult, Integer, Hash)>

Send an event using an application ingestion key

Parameters:

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

    the optional parameters

Returns:

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

    IngestionResult data, response status code and response headers



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/agent_push_kit/api/events_api.rb', line 395

def send_event_with_http_info(send_event_input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.send_event ...'
  end
  # verify the required parameter 'send_event_input' is set
  if @api_client.config.client_side_validation && send_event_input.nil?
    fail ArgumentError, "Missing the required parameter 'send_event_input' when calling EventsApi.send_event"
  end
  # resource path
  local_var_path = '/events'

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

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

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

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