svix 0.32.0 → 0.38.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/svix/api/endpoint_api.rb +507 -0
- data/lib/svix/api/event_type_api.rb +83 -6
- data/lib/svix/api/message_api.rb +2 -2
- data/lib/svix/api/message_attempt_api.rb +4 -4
- data/lib/svix/api/organization_settings_api.rb +79 -0
- data/lib/svix/api/statistics_api.rb +205 -0
- data/lib/svix/endpoint_api.rb +22 -1
- data/lib/svix/event_type_api.rb +4 -0
- data/lib/svix/models/application_out.rb +18 -4
- data/lib/svix/models/attempt_statistics_data.rb +231 -0
- data/lib/svix/models/attempt_statistics_response.rb +265 -0
- data/lib/svix/models/border_radii_config.rb +236 -0
- data/lib/svix/models/border_radius_config.rb +236 -0
- data/lib/svix/models/border_radius_enum.rb +40 -0
- data/lib/svix/models/custom_theme_override.rb +227 -0
- data/lib/svix/models/endpoint_created_event_data.rb +36 -0
- data/lib/svix/models/endpoint_deleted_event_data.rb +36 -0
- data/lib/svix/models/endpoint_disabled_event_data.rb +36 -0
- data/lib/svix/models/endpoint_headers_in.rb +225 -0
- data/lib/svix/models/endpoint_headers_out.rb +252 -0
- data/lib/svix/models/endpoint_in.rb +26 -0
- data/lib/svix/models/endpoint_out.rb +24 -1
- data/lib/svix/models/endpoint_secret_out.rb +21 -0
- data/lib/svix/models/endpoint_secret_rotate_in.rb +236 -0
- data/lib/svix/models/endpoint_update.rb +9 -0
- data/lib/svix/models/endpoint_updated_event.rb +269 -0
- data/lib/svix/models/endpoint_updated_event_data.rb +36 -0
- data/lib/svix/models/event_type_example_out.rb +223 -0
- data/lib/svix/models/event_type_in.rb +12 -1
- data/lib/svix/models/event_type_out.rb +43 -4
- data/lib/svix/models/event_type_schema_in.rb +224 -0
- data/lib/svix/models/event_type_update.rb +12 -1
- data/lib/svix/models/font_size_config.rb +218 -0
- data/lib/svix/models/message_attempt_exhausted_event_data.rb +36 -0
- data/lib/svix/models/message_endpoint_out.rb +9 -0
- data/lib/svix/models/portal_settings_out.rb +286 -0
- data/lib/svix/models/radii_enum.rb +39 -0
- data/lib/svix/models/recover_in.rb +223 -0
- data/lib/svix/models/settings_out.rb +323 -0
- data/lib/svix/models/statistics_period.rb +37 -0
- data/lib/svix/models/webhook_types.rb +1 -1
- data/lib/svix/version.rb +1 -1
- data/lib/svix.rb +6 -2
- metadata +22 -2
@@ -0,0 +1,227 @@
|
|
1
|
+
=begin
|
2
|
+
#Svix API
|
3
|
+
|
4
|
+
#Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each of your users. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.4
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Svix
|
17
|
+
class CustomThemeOverride
|
18
|
+
attr_accessor :border_radius
|
19
|
+
|
20
|
+
attr_accessor :font_size
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'border_radius' => :'borderRadius',
|
26
|
+
:'font_size' => :'fontSize'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns all the JSON keys this model knows about
|
31
|
+
def self.acceptable_attributes
|
32
|
+
attribute_map.values
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'border_radius' => :'BorderRadiusConfig',
|
39
|
+
:'font_size' => :'FontSizeConfig'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# List of attributes with nullable: true
|
44
|
+
def self.openapi_nullable
|
45
|
+
Set.new([
|
46
|
+
])
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::CustomThemeOverride` initialize method"
|
54
|
+
end
|
55
|
+
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::CustomThemeOverride`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
+
end
|
61
|
+
h[k.to_sym] = v
|
62
|
+
}
|
63
|
+
|
64
|
+
if attributes.key?(:'border_radius')
|
65
|
+
self.border_radius = attributes[:'border_radius']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'font_size')
|
69
|
+
self.font_size = attributes[:'font_size']
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
74
|
+
# @return Array for valid properties with the reasons
|
75
|
+
def list_invalid_properties
|
76
|
+
invalid_properties = Array.new
|
77
|
+
invalid_properties
|
78
|
+
end
|
79
|
+
|
80
|
+
# Check to see if the all the properties in the model are valid
|
81
|
+
# @return true if the model is valid
|
82
|
+
def valid?
|
83
|
+
true
|
84
|
+
end
|
85
|
+
|
86
|
+
# Checks equality by comparing each attribute.
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def ==(o)
|
89
|
+
return true if self.equal?(o)
|
90
|
+
self.class == o.class &&
|
91
|
+
border_radius == o.border_radius &&
|
92
|
+
font_size == o.font_size
|
93
|
+
end
|
94
|
+
|
95
|
+
# @see the `==` method
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def eql?(o)
|
98
|
+
self == o
|
99
|
+
end
|
100
|
+
|
101
|
+
# Calculates hash code according to all attributes.
|
102
|
+
# @return [Integer] Hash code
|
103
|
+
def hash
|
104
|
+
[border_radius, font_size].hash
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the object from hash
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
# @return [Object] Returns the model itself
|
110
|
+
def self.build_from_hash(attributes)
|
111
|
+
new.build_from_hash(attributes)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def build_from_hash(attributes)
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
119
|
+
self.class.openapi_types.each_pair do |key, type|
|
120
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
121
|
+
self.send("#{key}=", nil)
|
122
|
+
elsif type =~ /\AArray<(.*)>/i
|
123
|
+
# check to ensure the input is an array given that the attribute
|
124
|
+
# is documented as an array but the input is not
|
125
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
126
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
127
|
+
end
|
128
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
129
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
# Deserializes the data based on type
|
137
|
+
# @param string type Data type
|
138
|
+
# @param string value Value to be deserialized
|
139
|
+
# @return [Object] Deserialized data
|
140
|
+
def _deserialize(type, value)
|
141
|
+
case type.to_sym
|
142
|
+
when :Time
|
143
|
+
Time.parse(value)
|
144
|
+
when :Date
|
145
|
+
Date.parse(value)
|
146
|
+
when :String
|
147
|
+
value.to_s
|
148
|
+
when :Integer
|
149
|
+
value.to_i
|
150
|
+
when :Float
|
151
|
+
value.to_f
|
152
|
+
when :Boolean
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
when :Object
|
159
|
+
# generic object (usually a Hash), return directly
|
160
|
+
value
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
# models (e.g. Pet) or oneOf
|
174
|
+
klass = Svix.const_get(type)
|
175
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
# Returns the string representation of the object
|
180
|
+
# @return [String] String presentation of the object
|
181
|
+
def to_s
|
182
|
+
to_hash.to_s
|
183
|
+
end
|
184
|
+
|
185
|
+
# to_body is an alias to to_hash (backward compatibility)
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
187
|
+
def to_body
|
188
|
+
to_hash
|
189
|
+
end
|
190
|
+
|
191
|
+
# Returns the object in the form of hash
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
193
|
+
def to_hash
|
194
|
+
hash = {}
|
195
|
+
self.class.attribute_map.each_pair do |attr, param|
|
196
|
+
value = self.send(attr)
|
197
|
+
if value.nil?
|
198
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
199
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
200
|
+
end
|
201
|
+
|
202
|
+
hash[param] = _to_hash(value)
|
203
|
+
end
|
204
|
+
hash
|
205
|
+
end
|
206
|
+
|
207
|
+
# Outputs non-array value in the form of hash
|
208
|
+
# For object, use to_hash. Otherwise, just return the value
|
209
|
+
# @param [Object] value Any valid value
|
210
|
+
# @return [Hash] Returns the value in the form of hash
|
211
|
+
def _to_hash(value)
|
212
|
+
if value.is_a?(Array)
|
213
|
+
value.compact.map { |v| _to_hash(v) }
|
214
|
+
elsif value.is_a?(Hash)
|
215
|
+
{}.tap do |hash|
|
216
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
217
|
+
end
|
218
|
+
elsif value.respond_to? :to_hash
|
219
|
+
value.to_hash
|
220
|
+
else
|
221
|
+
value
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
@@ -17,6 +17,7 @@ module Svix
|
|
17
17
|
class EndpointCreatedEventData
|
18
18
|
attr_accessor :app_id
|
19
19
|
|
20
|
+
# Optional unique identifier for the application
|
20
21
|
attr_accessor :app_uid
|
21
22
|
|
22
23
|
attr_accessor :endpoint_id
|
@@ -86,6 +87,19 @@ module Svix
|
|
86
87
|
invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
|
87
88
|
end
|
88
89
|
|
90
|
+
if !@app_uid.nil? && @app_uid.to_s.length > 256
|
91
|
+
invalid_properties.push('invalid value for "app_uid", the character length must be smaller than or equal to 256.')
|
92
|
+
end
|
93
|
+
|
94
|
+
if !@app_uid.nil? && @app_uid.to_s.length < 1
|
95
|
+
invalid_properties.push('invalid value for "app_uid", the character length must be great than or equal to 1.')
|
96
|
+
end
|
97
|
+
|
98
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
99
|
+
if !@app_uid.nil? && @app_uid !~ pattern
|
100
|
+
invalid_properties.push("invalid value for \"app_uid\", must conform to the pattern #{pattern}.")
|
101
|
+
end
|
102
|
+
|
89
103
|
if @endpoint_id.nil?
|
90
104
|
invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
|
91
105
|
end
|
@@ -97,10 +111,32 @@ module Svix
|
|
97
111
|
# @return true if the model is valid
|
98
112
|
def valid?
|
99
113
|
return false if @app_id.nil?
|
114
|
+
return false if !@app_uid.nil? && @app_uid.to_s.length > 256
|
115
|
+
return false if !@app_uid.nil? && @app_uid.to_s.length < 1
|
116
|
+
return false if !@app_uid.nil? && @app_uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
100
117
|
return false if @endpoint_id.nil?
|
101
118
|
true
|
102
119
|
end
|
103
120
|
|
121
|
+
# Custom attribute writer method with validation
|
122
|
+
# @param [Object] app_uid Value to be assigned
|
123
|
+
def app_uid=(app_uid)
|
124
|
+
if !app_uid.nil? && app_uid.to_s.length > 256
|
125
|
+
fail ArgumentError, 'invalid value for "app_uid", the character length must be smaller than or equal to 256.'
|
126
|
+
end
|
127
|
+
|
128
|
+
if !app_uid.nil? && app_uid.to_s.length < 1
|
129
|
+
fail ArgumentError, 'invalid value for "app_uid", the character length must be great than or equal to 1.'
|
130
|
+
end
|
131
|
+
|
132
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
133
|
+
if !app_uid.nil? && app_uid !~ pattern
|
134
|
+
fail ArgumentError, "invalid value for \"app_uid\", must conform to the pattern #{pattern}."
|
135
|
+
end
|
136
|
+
|
137
|
+
@app_uid = app_uid
|
138
|
+
end
|
139
|
+
|
104
140
|
# Checks equality by comparing each attribute.
|
105
141
|
# @param [Object] Object to be compared
|
106
142
|
def ==(o)
|
@@ -17,6 +17,7 @@ module Svix
|
|
17
17
|
class EndpointDeletedEventData
|
18
18
|
attr_accessor :app_id
|
19
19
|
|
20
|
+
# Optional unique identifier for the application
|
20
21
|
attr_accessor :app_uid
|
21
22
|
|
22
23
|
attr_accessor :endpoint_id
|
@@ -86,6 +87,19 @@ module Svix
|
|
86
87
|
invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
|
87
88
|
end
|
88
89
|
|
90
|
+
if !@app_uid.nil? && @app_uid.to_s.length > 256
|
91
|
+
invalid_properties.push('invalid value for "app_uid", the character length must be smaller than or equal to 256.')
|
92
|
+
end
|
93
|
+
|
94
|
+
if !@app_uid.nil? && @app_uid.to_s.length < 1
|
95
|
+
invalid_properties.push('invalid value for "app_uid", the character length must be great than or equal to 1.')
|
96
|
+
end
|
97
|
+
|
98
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
99
|
+
if !@app_uid.nil? && @app_uid !~ pattern
|
100
|
+
invalid_properties.push("invalid value for \"app_uid\", must conform to the pattern #{pattern}.")
|
101
|
+
end
|
102
|
+
|
89
103
|
if @endpoint_id.nil?
|
90
104
|
invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
|
91
105
|
end
|
@@ -97,10 +111,32 @@ module Svix
|
|
97
111
|
# @return true if the model is valid
|
98
112
|
def valid?
|
99
113
|
return false if @app_id.nil?
|
114
|
+
return false if !@app_uid.nil? && @app_uid.to_s.length > 256
|
115
|
+
return false if !@app_uid.nil? && @app_uid.to_s.length < 1
|
116
|
+
return false if !@app_uid.nil? && @app_uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
100
117
|
return false if @endpoint_id.nil?
|
101
118
|
true
|
102
119
|
end
|
103
120
|
|
121
|
+
# Custom attribute writer method with validation
|
122
|
+
# @param [Object] app_uid Value to be assigned
|
123
|
+
def app_uid=(app_uid)
|
124
|
+
if !app_uid.nil? && app_uid.to_s.length > 256
|
125
|
+
fail ArgumentError, 'invalid value for "app_uid", the character length must be smaller than or equal to 256.'
|
126
|
+
end
|
127
|
+
|
128
|
+
if !app_uid.nil? && app_uid.to_s.length < 1
|
129
|
+
fail ArgumentError, 'invalid value for "app_uid", the character length must be great than or equal to 1.'
|
130
|
+
end
|
131
|
+
|
132
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
133
|
+
if !app_uid.nil? && app_uid !~ pattern
|
134
|
+
fail ArgumentError, "invalid value for \"app_uid\", must conform to the pattern #{pattern}."
|
135
|
+
end
|
136
|
+
|
137
|
+
@app_uid = app_uid
|
138
|
+
end
|
139
|
+
|
104
140
|
# Checks equality by comparing each attribute.
|
105
141
|
# @param [Object] Object to be compared
|
106
142
|
def ==(o)
|
@@ -17,6 +17,7 @@ module Svix
|
|
17
17
|
class EndpointDisabledEventData
|
18
18
|
attr_accessor :app_id
|
19
19
|
|
20
|
+
# Optional unique identifier for the application
|
20
21
|
attr_accessor :app_uid
|
21
22
|
|
22
23
|
attr_accessor :endpoint_id
|
@@ -94,6 +95,19 @@ module Svix
|
|
94
95
|
invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
|
95
96
|
end
|
96
97
|
|
98
|
+
if !@app_uid.nil? && @app_uid.to_s.length > 256
|
99
|
+
invalid_properties.push('invalid value for "app_uid", the character length must be smaller than or equal to 256.')
|
100
|
+
end
|
101
|
+
|
102
|
+
if !@app_uid.nil? && @app_uid.to_s.length < 1
|
103
|
+
invalid_properties.push('invalid value for "app_uid", the character length must be great than or equal to 1.')
|
104
|
+
end
|
105
|
+
|
106
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
107
|
+
if !@app_uid.nil? && @app_uid !~ pattern
|
108
|
+
invalid_properties.push("invalid value for \"app_uid\", must conform to the pattern #{pattern}.")
|
109
|
+
end
|
110
|
+
|
97
111
|
if @endpoint_id.nil?
|
98
112
|
invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
|
99
113
|
end
|
@@ -109,11 +123,33 @@ module Svix
|
|
109
123
|
# @return true if the model is valid
|
110
124
|
def valid?
|
111
125
|
return false if @app_id.nil?
|
126
|
+
return false if !@app_uid.nil? && @app_uid.to_s.length > 256
|
127
|
+
return false if !@app_uid.nil? && @app_uid.to_s.length < 1
|
128
|
+
return false if !@app_uid.nil? && @app_uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
112
129
|
return false if @endpoint_id.nil?
|
113
130
|
return false if @fail_since.nil?
|
114
131
|
true
|
115
132
|
end
|
116
133
|
|
134
|
+
# Custom attribute writer method with validation
|
135
|
+
# @param [Object] app_uid Value to be assigned
|
136
|
+
def app_uid=(app_uid)
|
137
|
+
if !app_uid.nil? && app_uid.to_s.length > 256
|
138
|
+
fail ArgumentError, 'invalid value for "app_uid", the character length must be smaller than or equal to 256.'
|
139
|
+
end
|
140
|
+
|
141
|
+
if !app_uid.nil? && app_uid.to_s.length < 1
|
142
|
+
fail ArgumentError, 'invalid value for "app_uid", the character length must be great than or equal to 1.'
|
143
|
+
end
|
144
|
+
|
145
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
146
|
+
if !app_uid.nil? && app_uid !~ pattern
|
147
|
+
fail ArgumentError, "invalid value for \"app_uid\", must conform to the pattern #{pattern}."
|
148
|
+
end
|
149
|
+
|
150
|
+
@app_uid = app_uid
|
151
|
+
end
|
152
|
+
|
117
153
|
# Checks equality by comparing each attribute.
|
118
154
|
# @param [Object] Object to be compared
|
119
155
|
def ==(o)
|
@@ -0,0 +1,225 @@
|
|
1
|
+
=begin
|
2
|
+
#Svix API
|
3
|
+
|
4
|
+
#Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each of your users. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.4
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Svix
|
17
|
+
class EndpointHeadersIn
|
18
|
+
attr_accessor :headers
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'headers' => :'headers'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'headers' => :'Hash<String, String>'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::EndpointHeadersIn` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::EndpointHeadersIn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'headers')
|
61
|
+
if (value = attributes[:'headers']).is_a?(Hash)
|
62
|
+
self.headers = value
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
68
|
+
# @return Array for valid properties with the reasons
|
69
|
+
def list_invalid_properties
|
70
|
+
invalid_properties = Array.new
|
71
|
+
if @headers.nil?
|
72
|
+
invalid_properties.push('invalid value for "headers", headers cannot be nil.')
|
73
|
+
end
|
74
|
+
|
75
|
+
invalid_properties
|
76
|
+
end
|
77
|
+
|
78
|
+
# Check to see if the all the properties in the model are valid
|
79
|
+
# @return true if the model is valid
|
80
|
+
def valid?
|
81
|
+
return false if @headers.nil?
|
82
|
+
true
|
83
|
+
end
|
84
|
+
|
85
|
+
# Checks equality by comparing each attribute.
|
86
|
+
# @param [Object] Object to be compared
|
87
|
+
def ==(o)
|
88
|
+
return true if self.equal?(o)
|
89
|
+
self.class == o.class &&
|
90
|
+
headers == o.headers
|
91
|
+
end
|
92
|
+
|
93
|
+
# @see the `==` method
|
94
|
+
# @param [Object] Object to be compared
|
95
|
+
def eql?(o)
|
96
|
+
self == o
|
97
|
+
end
|
98
|
+
|
99
|
+
# Calculates hash code according to all attributes.
|
100
|
+
# @return [Integer] Hash code
|
101
|
+
def hash
|
102
|
+
[headers].hash
|
103
|
+
end
|
104
|
+
|
105
|
+
# Builds the object from hash
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
+
# @return [Object] Returns the model itself
|
108
|
+
def self.build_from_hash(attributes)
|
109
|
+
new.build_from_hash(attributes)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Builds the object from hash
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
+
# @return [Object] Returns the model itself
|
115
|
+
def build_from_hash(attributes)
|
116
|
+
return nil unless attributes.is_a?(Hash)
|
117
|
+
self.class.openapi_types.each_pair do |key, type|
|
118
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
119
|
+
self.send("#{key}=", nil)
|
120
|
+
elsif type =~ /\AArray<(.*)>/i
|
121
|
+
# check to ensure the input is an array given that the attribute
|
122
|
+
# is documented as an array but the input is not
|
123
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
124
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
125
|
+
end
|
126
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
127
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
self
|
132
|
+
end
|
133
|
+
|
134
|
+
# Deserializes the data based on type
|
135
|
+
# @param string type Data type
|
136
|
+
# @param string value Value to be deserialized
|
137
|
+
# @return [Object] Deserialized data
|
138
|
+
def _deserialize(type, value)
|
139
|
+
case type.to_sym
|
140
|
+
when :Time
|
141
|
+
Time.parse(value)
|
142
|
+
when :Date
|
143
|
+
Date.parse(value)
|
144
|
+
when :String
|
145
|
+
value.to_s
|
146
|
+
when :Integer
|
147
|
+
value.to_i
|
148
|
+
when :Float
|
149
|
+
value.to_f
|
150
|
+
when :Boolean
|
151
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
152
|
+
true
|
153
|
+
else
|
154
|
+
false
|
155
|
+
end
|
156
|
+
when :Object
|
157
|
+
# generic object (usually a Hash), return directly
|
158
|
+
value
|
159
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
160
|
+
inner_type = Regexp.last_match[:inner_type]
|
161
|
+
value.map { |v| _deserialize(inner_type, v) }
|
162
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
163
|
+
k_type = Regexp.last_match[:k_type]
|
164
|
+
v_type = Regexp.last_match[:v_type]
|
165
|
+
{}.tap do |hash|
|
166
|
+
value.each do |k, v|
|
167
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
else # model
|
171
|
+
# models (e.g. Pet) or oneOf
|
172
|
+
klass = Svix.const_get(type)
|
173
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the string representation of the object
|
178
|
+
# @return [String] String presentation of the object
|
179
|
+
def to_s
|
180
|
+
to_hash.to_s
|
181
|
+
end
|
182
|
+
|
183
|
+
# to_body is an alias to to_hash (backward compatibility)
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_body
|
186
|
+
to_hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns the object in the form of hash
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_hash
|
192
|
+
hash = {}
|
193
|
+
self.class.attribute_map.each_pair do |attr, param|
|
194
|
+
value = self.send(attr)
|
195
|
+
if value.nil?
|
196
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
197
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
198
|
+
end
|
199
|
+
|
200
|
+
hash[param] = _to_hash(value)
|
201
|
+
end
|
202
|
+
hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Outputs non-array value in the form of hash
|
206
|
+
# For object, use to_hash. Otherwise, just return the value
|
207
|
+
# @param [Object] value Any valid value
|
208
|
+
# @return [Hash] Returns the value in the form of hash
|
209
|
+
def _to_hash(value)
|
210
|
+
if value.is_a?(Array)
|
211
|
+
value.compact.map { |v| _to_hash(v) }
|
212
|
+
elsif value.is_a?(Hash)
|
213
|
+
{}.tap do |hash|
|
214
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
215
|
+
end
|
216
|
+
elsif value.respond_to? :to_hash
|
217
|
+
value.to_hash
|
218
|
+
else
|
219
|
+
value
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|