Class: Shipeasy::Admin::Generated::EventsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/shipeasy_admin/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/shipeasy_admin/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/shipeasy_admin/api/events_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#approve_event(id, approve_event_request, opts = {}) ⇒ ApproveEventResponse

Approve a pending event Promotes a pending (auto-discovered) event to usable so metrics can query it (pending0). You may optionally declare the event's folder, description, or properties in the same call — the body is the same shape as update, and may be empty. Use case: Clear an auto-discovered event out of the pending queue so metrics defined on it start resolving.

Parameters:

  • id (String)

    Stable opaque event id (`evt_…`) or the event's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



29
30
31
32
# File 'lib/shipeasy_admin/api/events_api.rb', line 29

def approve_event(id, approve_event_request, opts = {})
  data, _status_code, _headers = approve_event_with_http_info(id, approve_event_request, opts)
  data
end

#approve_event_with_http_info(id, approve_event_request, opts = {}) ⇒ Array<(ApproveEventResponse, Integer, Hash)>

Approve a pending event Promotes a pending (auto-discovered) event to usable so metrics can query it (`pending` → `0`). You may optionally declare the event's folder, description, or properties in the same call — the body is the same shape as update, and may be empty. Use case: Clear an auto-discovered event out of the pending queue so metrics defined on it start resolving.

Parameters:

  • id (String)

    Stable opaque event id (`evt_…`) or the event's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

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

    ApproveEventResponse data, response status code and response headers



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
95
96
97
# File 'lib/shipeasy_admin/api/events_api.rb', line 41

def approve_event_with_http_info(id, approve_event_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.approve_event ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.approve_event"
  end
  # verify the required parameter 'approve_event_request' is set
  if @api_client.config.client_side_validation && approve_event_request.nil?
    fail ArgumentError, "Missing the required parameter 'approve_event_request' when calling EventsApi.approve_event"
  end
  # resource path
  local_var_path = '/api/admin/events/{id}/approve'.sub('{id}', CGI.escape(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
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

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

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

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

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

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

#create_event(create_event_request, opts = {}) ⇒ CreateEventResponse

Register an event Registers a new event name and (optionally) its typed properties. Only name is required. If the name matches an existing pending (auto-discovered) row, this approves that row instead of returning a conflict. Otherwise an already-registered name returns 409. Use cases - Register a known event{ \"name\": \"checkout_completed\" } so metrics can reference it. - Declare typed properties — supply properties to document the event's payload shape.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



105
106
107
108
# File 'lib/shipeasy_admin/api/events_api.rb', line 105

def create_event(create_event_request, opts = {})
  data, _status_code, _headers = create_event_with_http_info(create_event_request, opts)
  data
end

#create_event_with_http_info(create_event_request, opts = {}) ⇒ Array<(CreateEventResponse, Integer, Hash)>

Register an event Registers a new event name and (optionally) its typed properties. Only `name` is required. If the name matches an existing pending (auto-discovered) row, this approves that row instead of returning a conflict. Otherwise an already-registered name returns `409`. Use cases - Register a known event — `{ &quot;name&quot;: &quot;checkout_completed&quot; }` so metrics can reference it. - Declare typed properties — supply `properties` to document the event's payload shape.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

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

    CreateEventResponse data, response status code and response headers



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
# File 'lib/shipeasy_admin/api/events_api.rb', line 116

def create_event_with_http_info(create_event_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.create_event ...'
  end
  # verify the required parameter 'create_event_request' is set
  if @api_client.config.client_side_validation && create_event_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_event_request' when calling EventsApi.create_event"
  end
  # resource path
  local_var_path = '/api/admin/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
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

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

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

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

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

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

#delete_event(id, opts = {}) ⇒ DeleteEventResponse

Archive an event Soft-deletes (archives) the event. Returns 409 if any metric still references it — delete those metrics first. Use case: Retire an event from the catalog once no metric depends on it.

Parameters:

  • id (String)

    Stable opaque event id (`evt_…`) or the event's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



176
177
178
179
# File 'lib/shipeasy_admin/api/events_api.rb', line 176

def delete_event(id, opts = {})
  data, _status_code, _headers = delete_event_with_http_info(id, opts)
  data
end

#delete_event_with_http_info(id, opts = {}) ⇒ Array<(DeleteEventResponse, Integer, Hash)>

Archive an event Soft-deletes (archives) the event. Returns `409` if any metric still references it — delete those metrics first. Use case: Retire an event from the catalog once no metric depends on it.

Parameters:

  • id (String)

    Stable opaque event id (`evt_…`) or the event's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

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

    DeleteEventResponse data, response status code and response headers



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
225
226
227
228
229
230
231
232
233
234
# File 'lib/shipeasy_admin/api/events_api.rb', line 187

def delete_event_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.delete_event ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.delete_event"
  end
  # resource path
  local_var_path = '/api/admin/events/{id}'.sub('{id}', CGI.escape(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']
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

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

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

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

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

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

#get_event(id, opts = {}) ⇒ GetEventResponse

Get an event Returns one event's full detail. Resolves by exact id, unique id-prefix, or exact (unique) name. Use case: Inspect one event's declared properties and pending state by id or name.

Parameters:

  • id (String)

    Stable opaque event id (`evt_…`) or the event's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



242
243
244
245
# File 'lib/shipeasy_admin/api/events_api.rb', line 242

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

#get_event_with_http_info(id, opts = {}) ⇒ Array<(GetEventResponse, Integer, Hash)>

Get an event Returns one event's full detail. Resolves by exact id, unique id-prefix, or exact (unique) name. Use case: Inspect one event's declared properties and pending state by id or name.

Parameters:

  • id (String)

    Stable opaque event id (`evt_…`) or the event's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

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

    GetEventResponse data, response status code and response headers



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
# File 'lib/shipeasy_admin/api/events_api.rb', line 253

def get_event_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.get_event ...'
  end
  # resource path
  local_var_path = '/api/admin/events/{id}'.sub('{id}', CGI.escape(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']
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

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

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

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

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

  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(opts = {}) ⇒ Array<ListEventsResponseInner>

List events Returns every catalogued event in the project, including pending auto-discovered names. Pass ?pending=true to return only the unapproved queue. Use case: Snapshot the event catalog — for example to review the pending auto-discovery queue (?pending=true) before approving names, or to confirm which events your metrics can reference.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

  • :pending (Boolean)

    When `true`, return only pending (auto-discovered, unapproved) events. Omit to return the full catalog.

Returns:



304
305
306
307
# File 'lib/shipeasy_admin/api/events_api.rb', line 304

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

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

List events Returns every catalogued event in the project, including pending auto-discovered names. Pass `?pending=true` to return only the unapproved queue. Use case: Snapshot the event catalog — for example to review the `pending` auto-discovery queue (`?pending=true`) before approving names, or to confirm which events your metrics can reference.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

  • :pending (Boolean)

    When `true`, return only pending (auto-discovered, unapproved) events. Omit to return the full catalog.

Returns:

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

    Array data, response status code and response headers



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
357
358
359
# File 'lib/shipeasy_admin/api/events_api.rb', line 315

def list_events_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.list_events ...'
  end
  # resource path
  local_var_path = '/api/admin/events'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'pending'] = opts[:'pending'] if !opts[:'pending'].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']
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Array<ListEventsResponseInner>'

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

  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

#update_event(id, update_event_request, opts = {}) ⇒ UpdateEventResponse

Update an event Partial update of an event's folder, description, or properties. name is immutable. properties replaces the full set (no merge) — omit it to leave properties unchanged. Use case: Refile an event, update its description, or redeclare its typed properties.

Parameters:

  • id (String)

    Stable opaque event id (`evt_…`) or the event's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



368
369
370
371
# File 'lib/shipeasy_admin/api/events_api.rb', line 368

def update_event(id, update_event_request, opts = {})
  data, _status_code, _headers = update_event_with_http_info(id, update_event_request, opts)
  data
end

#update_event_with_http_info(id, update_event_request, opts = {}) ⇒ Array<(UpdateEventResponse, Integer, Hash)>

Update an event Partial update of an event's folder, description, or properties. `name` is immutable. `properties` replaces the full set (no merge) — omit it to leave properties unchanged. Use case: Refile an event, update its description, or redeclare its typed properties.

Parameters:

  • id (String)

    Stable opaque event id (`evt_…`) or the event's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

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

    UpdateEventResponse data, response status code and response headers



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
431
432
433
434
435
436
# File 'lib/shipeasy_admin/api/events_api.rb', line 380

def update_event_with_http_info(id, update_event_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.update_event ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling EventsApi.update_event"
  end
  # verify the required parameter 'update_event_request' is set
  if @api_client.config.client_side_validation && update_event_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_event_request' when calling EventsApi.update_event"
  end
  # resource path
  local_var_path = '/api/admin/events/{id}'.sub('{id}', CGI.escape(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
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

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

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

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

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

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