svix 0.52.0 → 0.53.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,297 +0,0 @@
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 user on your platform. - `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/). ## Idempotency Svix supports [idempotency](https://en.wikipedia.org/wiki/Idempotence) for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. To perform an idempotent request, pass the idempotency key in the `Idempotency-Key` header to the request. The idempotency key should be a unique value generated by the client. You can create the key in however way you like, though we suggest using UUID v4, or any other string with enough entropy to avoid collisions. Svix's idempotency works by saving the resulting status code and body of the first request made for any given idempotency key for any successful request. Subsequent requests with the same key return the same result. Please note that idempotency is only supported for `POST` requests. ## 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 PortalSettingsOut
18
- attr_accessor :custom_color
19
-
20
- attr_accessor :custom_font_family
21
-
22
- attr_accessor :custom_logo_url
23
-
24
- attr_accessor :custom_theme_override
25
-
26
- attr_accessor :enable_channels
27
-
28
- # Attribute mapping from ruby-style variable name to JSON key.
29
- def self.attribute_map
30
- {
31
- :'custom_color' => :'customColor',
32
- :'custom_font_family' => :'customFontFamily',
33
- :'custom_logo_url' => :'customLogoUrl',
34
- :'custom_theme_override' => :'customThemeOverride',
35
- :'enable_channels' => :'enableChannels'
36
- }
37
- end
38
-
39
- # Returns all the JSON keys this model knows about
40
- def self.acceptable_attributes
41
- attribute_map.values
42
- end
43
-
44
- # Attribute type mapping.
45
- def self.openapi_types
46
- {
47
- :'custom_color' => :'String',
48
- :'custom_font_family' => :'String',
49
- :'custom_logo_url' => :'String',
50
- :'custom_theme_override' => :'CustomThemeOverride',
51
- :'enable_channels' => :'Boolean'
52
- }
53
- end
54
-
55
- # List of attributes with nullable: true
56
- def self.openapi_nullable
57
- Set.new([
58
- ])
59
- end
60
-
61
- # Initializes the object
62
- # @param [Hash] attributes Model attributes in the form of hash
63
- def initialize(attributes = {})
64
- if (!attributes.is_a?(Hash))
65
- fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::PortalSettingsOut` initialize method"
66
- end
67
-
68
- # check to see if the attribute exists and convert string to symbol for hash key
69
- attributes = attributes.each_with_object({}) { |(k, v), h|
70
- if (!self.class.attribute_map.key?(k.to_sym))
71
- fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::PortalSettingsOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
- end
73
- h[k.to_sym] = v
74
- }
75
-
76
- if attributes.key?(:'custom_color')
77
- self.custom_color = attributes[:'custom_color']
78
- end
79
-
80
- if attributes.key?(:'custom_font_family')
81
- self.custom_font_family = attributes[:'custom_font_family']
82
- end
83
-
84
- if attributes.key?(:'custom_logo_url')
85
- self.custom_logo_url = attributes[:'custom_logo_url']
86
- end
87
-
88
- if attributes.key?(:'custom_theme_override')
89
- self.custom_theme_override = attributes[:'custom_theme_override']
90
- end
91
-
92
- if attributes.key?(:'enable_channels')
93
- self.enable_channels = attributes[:'enable_channels']
94
- else
95
- self.enable_channels = false
96
- end
97
- end
98
-
99
- # Show invalid properties with the reasons. Usually used together with valid?
100
- # @return Array for valid properties with the reasons
101
- def list_invalid_properties
102
- invalid_properties = Array.new
103
- pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
104
- if !@custom_font_family.nil? && @custom_font_family !~ pattern
105
- invalid_properties.push("invalid value for \"custom_font_family\", must conform to the pattern #{pattern}.")
106
- end
107
-
108
- if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
109
- invalid_properties.push('invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.')
110
- end
111
-
112
- if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
113
- invalid_properties.push('invalid value for "custom_logo_url", the character length must be great than or equal to 1.')
114
- end
115
-
116
- invalid_properties
117
- end
118
-
119
- # Check to see if the all the properties in the model are valid
120
- # @return true if the model is valid
121
- def valid?
122
- return false if !@custom_font_family.nil? && @custom_font_family !~ Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
123
- return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
124
- return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
125
- true
126
- end
127
-
128
- # Custom attribute writer method with validation
129
- # @param [Object] custom_font_family Value to be assigned
130
- def custom_font_family=(custom_font_family)
131
- pattern = Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
132
- if !custom_font_family.nil? && custom_font_family !~ pattern
133
- fail ArgumentError, "invalid value for \"custom_font_family\", must conform to the pattern #{pattern}."
134
- end
135
-
136
- @custom_font_family = custom_font_family
137
- end
138
-
139
- # Custom attribute writer method with validation
140
- # @param [Object] custom_logo_url Value to be assigned
141
- def custom_logo_url=(custom_logo_url)
142
- if !custom_logo_url.nil? && custom_logo_url.to_s.length > 65536
143
- fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.'
144
- end
145
-
146
- if !custom_logo_url.nil? && custom_logo_url.to_s.length < 1
147
- fail ArgumentError, 'invalid value for "custom_logo_url", the character length must be great than or equal to 1.'
148
- end
149
-
150
- @custom_logo_url = custom_logo_url
151
- end
152
-
153
- # Checks equality by comparing each attribute.
154
- # @param [Object] Object to be compared
155
- def ==(o)
156
- return true if self.equal?(o)
157
- self.class == o.class &&
158
- custom_color == o.custom_color &&
159
- custom_font_family == o.custom_font_family &&
160
- custom_logo_url == o.custom_logo_url &&
161
- custom_theme_override == o.custom_theme_override &&
162
- enable_channels == o.enable_channels
163
- end
164
-
165
- # @see the `==` method
166
- # @param [Object] Object to be compared
167
- def eql?(o)
168
- self == o
169
- end
170
-
171
- # Calculates hash code according to all attributes.
172
- # @return [Integer] Hash code
173
- def hash
174
- [custom_color, custom_font_family, custom_logo_url, custom_theme_override, enable_channels].hash
175
- end
176
-
177
- # Builds the object from hash
178
- # @param [Hash] attributes Model attributes in the form of hash
179
- # @return [Object] Returns the model itself
180
- def self.build_from_hash(attributes)
181
- new.build_from_hash(attributes)
182
- end
183
-
184
- # Builds the object from hash
185
- # @param [Hash] attributes Model attributes in the form of hash
186
- # @return [Object] Returns the model itself
187
- def build_from_hash(attributes)
188
- return nil unless attributes.is_a?(Hash)
189
- self.class.openapi_types.each_pair do |key, type|
190
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
191
- self.send("#{key}=", nil)
192
- elsif type =~ /\AArray<(.*)>/i
193
- # check to ensure the input is an array given that the attribute
194
- # is documented as an array but the input is not
195
- if attributes[self.class.attribute_map[key]].is_a?(Array)
196
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
197
- end
198
- elsif !attributes[self.class.attribute_map[key]].nil?
199
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
200
- end
201
- end
202
-
203
- self
204
- end
205
-
206
- # Deserializes the data based on type
207
- # @param string type Data type
208
- # @param string value Value to be deserialized
209
- # @return [Object] Deserialized data
210
- def _deserialize(type, value)
211
- case type.to_sym
212
- when :Time
213
- Time.parse(value)
214
- when :Date
215
- Date.parse(value)
216
- when :String
217
- value.to_s
218
- when :Integer
219
- value.to_i
220
- when :Float
221
- value.to_f
222
- when :Boolean
223
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
224
- true
225
- else
226
- false
227
- end
228
- when :Object
229
- # generic object (usually a Hash), return directly
230
- value
231
- when /\AArray<(?<inner_type>.+)>\z/
232
- inner_type = Regexp.last_match[:inner_type]
233
- value.map { |v| _deserialize(inner_type, v) }
234
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
235
- k_type = Regexp.last_match[:k_type]
236
- v_type = Regexp.last_match[:v_type]
237
- {}.tap do |hash|
238
- value.each do |k, v|
239
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
240
- end
241
- end
242
- else # model
243
- # models (e.g. Pet) or oneOf
244
- klass = Svix.const_get(type)
245
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
246
- end
247
- end
248
-
249
- # Returns the string representation of the object
250
- # @return [String] String presentation of the object
251
- def to_s
252
- to_hash.to_s
253
- end
254
-
255
- # to_body is an alias to to_hash (backward compatibility)
256
- # @return [Hash] Returns the object in the form of hash
257
- def to_body
258
- to_hash
259
- end
260
-
261
- # Returns the object in the form of hash
262
- # @return [Hash] Returns the object in the form of hash
263
- def to_hash
264
- hash = {}
265
- self.class.attribute_map.each_pair do |attr, param|
266
- value = self.send(attr)
267
- if value.nil?
268
- is_nullable = self.class.openapi_nullable.include?(attr)
269
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
270
- end
271
-
272
- hash[param] = _to_hash(value)
273
- end
274
- hash
275
- end
276
-
277
- # Outputs non-array value in the form of hash
278
- # For object, use to_hash. Otherwise, just return the value
279
- # @param [Object] value Any valid value
280
- # @return [Hash] Returns the value in the form of hash
281
- def _to_hash(value)
282
- if value.is_a?(Array)
283
- value.compact.map { |v| _to_hash(v) }
284
- elsif value.is_a?(Hash)
285
- {}.tap do |hash|
286
- value.each { |k, v| hash[k] = _to_hash(v) }
287
- end
288
- elsif value.respond_to? :to_hash
289
- value.to_hash
290
- else
291
- value
292
- end
293
- end
294
-
295
- end
296
-
297
- end