Class: Svix::EventType

Inherits:
Object
  • Object
show all
Defined in:
lib/svix/api/event_type.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ EventType

Returns a new instance of EventType.



8
9
10
# File 'lib/svix/api/event_type.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#create(event_type_in, options = {}) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/svix/api/event_type.rb', line 28

def create(event_type_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/event-type",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: event_type_in
  )
  EventTypeOut.deserialize(res)
end

#delete(event_type_name, options = {}) ⇒ Object



71
72
73
74
75
76
77
78
79
80
# File 'lib/svix/api/event_type.rb', line 71

def delete(event_type_name, options = {})
  options = options.transform_keys(&:to_s)
  @client.execute_request(
    "DELETE",
    "/api/v1/event-type/#{event_type_name}",
    query_params: {
      "expunge" => options["expunge"]
    }
  )
end

#get(event_type_name) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/svix/api/event_type.rb', line 54

def get(event_type_name)
  res = @client.execute_request(
    "GET",
    "/api/v1/event-type/#{event_type_name}"
  )
  EventTypeOut.deserialize(res)
end

#import_openapi(event_type_import_open_api_in, options = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/svix/api/event_type.rb', line 41

def import_openapi(event_type_import_open_api_in, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/event-type/import/openapi",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    },
    body: event_type_import_open_api_in
  )
  EventTypeImportOpenApiOut.deserialize(res)
end

#list(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/svix/api/event_type.rb', line 12

def list(options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "GET",
    "/api/v1/event-type",
    query_params: {
      "limit" => options["limit"],
      "iterator" => options["iterator"],
      "order" => options["order"],
      "include_archived" => options["include_archived"],
      "with_content" => options["with_content"]
    }
  )
  ListResponseEventTypeOut.deserialize(res)
end

#patch(event_type_name, event_type_patch) ⇒ Object



82
83
84
85
86
87
88
89
# File 'lib/svix/api/event_type.rb', line 82

def patch(event_type_name, event_type_patch)
  res = @client.execute_request(
    "PATCH",
    "/api/v1/event-type/#{event_type_name}",
    body: event_type_patch
  )
  EventTypeOut.deserialize(res)
end

#update(event_type_name, event_type_update) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/svix/api/event_type.rb', line 62

def update(event_type_name, event_type_update)
  res = @client.execute_request(
    "PUT",
    "/api/v1/event-type/#{event_type_name}",
    body: event_type_update
  )
  EventTypeOut.deserialize(res)
end