svix 0.15.0 → 0.32.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 +9 -3
- data/README.md +16 -3
- data/lib/svix/api/application_api.rb +386 -0
- data/lib/svix/api/authentication_api.rb +155 -0
- data/lib/svix/api/endpoint_api.rb +774 -0
- data/lib/svix/api/event_type_api.rb +377 -0
- data/lib/svix/api/health_api.rb +77 -0
- data/lib/svix/api/message_api.rb +289 -0
- data/lib/svix/api/message_attempt_api.rb +678 -0
- data/lib/svix/api_client.rb +399 -0
- data/lib/svix/api_error.rb +57 -0
- data/lib/svix/application_api.rb +29 -0
- data/lib/svix/authentication_api.rb +17 -0
- data/lib/svix/configuration.rb +277 -0
- data/lib/svix/endpoint_api.rb +34 -0
- data/{src → lib}/svix/errors.rb +4 -1
- data/lib/svix/event_type_api.rb +25 -0
- data/lib/svix/internal.rb +16 -0
- data/lib/svix/message_api.rb +21 -0
- data/lib/svix/message_attempt_api.rb +33 -0
- data/lib/svix/models/application_in.rb +277 -0
- data/lib/svix/models/application_out.rb +305 -0
- data/lib/svix/models/dashboard_access_out.rb +265 -0
- data/lib/svix/models/endpoint_created_event.rb +269 -0
- data/lib/svix/models/endpoint_created_event_data.rb +246 -0
- data/lib/svix/models/endpoint_deleted_event.rb +269 -0
- data/lib/svix/models/endpoint_deleted_event_data.rb +246 -0
- data/lib/svix/models/endpoint_disabled_event.rb +269 -0
- data/lib/svix/models/endpoint_disabled_event_data.rb +260 -0
- data/lib/svix/models/endpoint_in.rb +368 -0
- data/lib/svix/models/endpoint_message_out.rb +363 -0
- data/lib/svix/models/endpoint_out.rb +386 -0
- data/lib/svix/models/endpoint_secret_out.rb +224 -0
- data/lib/svix/models/endpoint_stats.rb +265 -0
- data/lib/svix/models/endpoint_update.rb +358 -0
- data/lib/svix/models/endpoint_updated_event_data.rb +246 -0
- data/lib/svix/models/endpointd_updated_event.rb +269 -0
- data/lib/svix/models/event_example_in.rb +253 -0
- data/lib/svix/models/event_type_in.rb +279 -0
- data/lib/svix/models/event_type_out.rb +279 -0
- data/lib/svix/models/event_type_update.rb +235 -0
- data/lib/svix/models/http_error_out.rb +237 -0
- data/lib/svix/models/http_validation_error.rb +220 -0
- data/lib/svix/models/list_response_application_out.rb +248 -0
- data/lib/svix/models/list_response_endpoint_message_out.rb +248 -0
- data/lib/svix/models/list_response_endpoint_out.rb +248 -0
- data/lib/svix/models/list_response_event_type_out.rb +248 -0
- data/lib/svix/models/list_response_message_attempt_endpoint_out.rb +248 -0
- data/lib/svix/models/list_response_message_attempt_out.rb +248 -0
- data/lib/svix/models/list_response_message_endpoint_out.rb +248 -0
- data/lib/svix/models/list_response_message_out.rb +248 -0
- data/lib/svix/models/message_attempt_endpoint_out.rb +293 -0
- data/lib/svix/models/message_attempt_exhausted_event.rb +269 -0
- data/lib/svix/models/message_attempt_exhausted_event_data.rb +274 -0
- data/lib/svix/models/message_attempt_failed_event.rb +251 -0
- data/lib/svix/models/message_attempt_out.rb +307 -0
- data/lib/svix/models/message_attempt_trigger_type.rb +37 -0
- data/lib/svix/models/message_endpoint_out.rb +409 -0
- data/lib/svix/models/message_in.rb +312 -0
- data/lib/svix/models/message_out.rb +340 -0
- data/lib/svix/models/message_status.rb +39 -0
- data/lib/svix/models/validation_error.rb +253 -0
- data/lib/svix/models/webhook_types.rb +280 -0
- data/lib/svix/svix.rb +43 -0
- data/{src → lib}/svix/util.rb +1 -1
- data/lib/svix/version.rb +5 -0
- data/lib/svix/webhook.rb +75 -0
- data/lib/svix.rb +76 -0
- data/svix.gemspec +19 -9
- metadata +93 -13
- data/.gitignore +0 -9
- data/src/svix/version.rb +0 -3
- data/src/svix/webhook.rb +0 -33
- data/src/svix.rb +0 -8
@@ -0,0 +1,277 @@
|
|
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
|
+
module Svix
|
14
|
+
class Configuration
|
15
|
+
# Defines url scheme
|
16
|
+
attr_accessor :scheme
|
17
|
+
|
18
|
+
# Defines url host
|
19
|
+
attr_accessor :host
|
20
|
+
|
21
|
+
# Defines url base path
|
22
|
+
attr_accessor :base_path
|
23
|
+
|
24
|
+
# Define server configuration index
|
25
|
+
attr_accessor :server_index
|
26
|
+
|
27
|
+
# Define server operation configuration index
|
28
|
+
attr_accessor :server_operation_index
|
29
|
+
|
30
|
+
# Default server variables
|
31
|
+
attr_accessor :server_variables
|
32
|
+
|
33
|
+
# Default server operation variables
|
34
|
+
attr_accessor :server_operation_variables
|
35
|
+
|
36
|
+
# Defines API keys used with API Key authentications.
|
37
|
+
#
|
38
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
39
|
+
#
|
40
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
41
|
+
# config.api_key['api_key'] = 'xxx'
|
42
|
+
attr_accessor :api_key
|
43
|
+
|
44
|
+
# Defines API key prefixes used with API Key authentications.
|
45
|
+
#
|
46
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
47
|
+
#
|
48
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
49
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
50
|
+
attr_accessor :api_key_prefix
|
51
|
+
|
52
|
+
# Defines the username used with HTTP basic authentication.
|
53
|
+
#
|
54
|
+
# @return [String]
|
55
|
+
attr_accessor :username
|
56
|
+
|
57
|
+
# Defines the password used with HTTP basic authentication.
|
58
|
+
#
|
59
|
+
# @return [String]
|
60
|
+
attr_accessor :password
|
61
|
+
|
62
|
+
# Defines the access token (Bearer) used with OAuth2.
|
63
|
+
attr_accessor :access_token
|
64
|
+
|
65
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
66
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
67
|
+
# Default to false.
|
68
|
+
#
|
69
|
+
# @return [true, false]
|
70
|
+
attr_accessor :debugging
|
71
|
+
|
72
|
+
# Defines the logger used for debugging.
|
73
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
74
|
+
#
|
75
|
+
# @return [#debug]
|
76
|
+
attr_accessor :logger
|
77
|
+
|
78
|
+
# Defines the temporary folder to store downloaded files
|
79
|
+
# (for API endpoints that have file response).
|
80
|
+
# Default to use `Tempfile`.
|
81
|
+
#
|
82
|
+
# @return [String]
|
83
|
+
attr_accessor :temp_folder_path
|
84
|
+
|
85
|
+
# The time limit for HTTP request in seconds.
|
86
|
+
# Default to 0 (never times out).
|
87
|
+
attr_accessor :timeout
|
88
|
+
|
89
|
+
# Set this to false to skip client side validation in the operation.
|
90
|
+
# Default to true.
|
91
|
+
# @return [true, false]
|
92
|
+
attr_accessor :client_side_validation
|
93
|
+
|
94
|
+
### TLS/SSL setting
|
95
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
96
|
+
# Default to true.
|
97
|
+
#
|
98
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
99
|
+
#
|
100
|
+
# @return [true, false]
|
101
|
+
attr_accessor :verify_ssl
|
102
|
+
|
103
|
+
### TLS/SSL setting
|
104
|
+
# Set this to false to skip verifying SSL host name
|
105
|
+
# Default to true.
|
106
|
+
#
|
107
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
108
|
+
#
|
109
|
+
# @return [true, false]
|
110
|
+
attr_accessor :verify_ssl_host
|
111
|
+
|
112
|
+
### TLS/SSL setting
|
113
|
+
# Set this to customize the certificate file to verify the peer.
|
114
|
+
#
|
115
|
+
# @return [String] the path to the certificate file
|
116
|
+
#
|
117
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
118
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
119
|
+
attr_accessor :ssl_ca_cert
|
120
|
+
|
121
|
+
### TLS/SSL setting
|
122
|
+
# Client certificate file (for client certificate)
|
123
|
+
attr_accessor :cert_file
|
124
|
+
|
125
|
+
### TLS/SSL setting
|
126
|
+
# Client private key file (for client certificate)
|
127
|
+
attr_accessor :key_file
|
128
|
+
|
129
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
130
|
+
# Default to nil.
|
131
|
+
#
|
132
|
+
# @see The params_encoding option of Ethon. Related source code:
|
133
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
134
|
+
attr_accessor :params_encoding
|
135
|
+
|
136
|
+
attr_accessor :inject_format
|
137
|
+
|
138
|
+
attr_accessor :force_ending_format
|
139
|
+
|
140
|
+
def initialize
|
141
|
+
@scheme = 'http'
|
142
|
+
@host = 'localhost'
|
143
|
+
@base_path = ''
|
144
|
+
@server_index = 0
|
145
|
+
@server_operation_index = {}
|
146
|
+
@server_variables = {}
|
147
|
+
@server_operation_variables = {}
|
148
|
+
@api_key = {}
|
149
|
+
@api_key_prefix = {}
|
150
|
+
@timeout = 0
|
151
|
+
@client_side_validation = true
|
152
|
+
@verify_ssl = true
|
153
|
+
@verify_ssl_host = true
|
154
|
+
@params_encoding = nil
|
155
|
+
@cert_file = nil
|
156
|
+
@key_file = nil
|
157
|
+
@debugging = false
|
158
|
+
@inject_format = false
|
159
|
+
@force_ending_format = false
|
160
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
161
|
+
|
162
|
+
yield(self) if block_given?
|
163
|
+
end
|
164
|
+
|
165
|
+
# The default Configuration object.
|
166
|
+
def self.default
|
167
|
+
@@default ||= Configuration.new
|
168
|
+
end
|
169
|
+
|
170
|
+
def configure
|
171
|
+
yield(self) if block_given?
|
172
|
+
end
|
173
|
+
|
174
|
+
def scheme=(scheme)
|
175
|
+
# remove :// from scheme
|
176
|
+
@scheme = scheme.sub(/:\/\//, '')
|
177
|
+
end
|
178
|
+
|
179
|
+
def host=(host)
|
180
|
+
# remove http(s):// and anything after a slash
|
181
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
182
|
+
end
|
183
|
+
|
184
|
+
def base_path=(base_path)
|
185
|
+
# Add leading and trailing slashes to base_path
|
186
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
187
|
+
@base_path = '' if @base_path == '/'
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns base URL for specified operation based on server settings
|
191
|
+
def base_url(operation = nil)
|
192
|
+
index = server_operation_index.fetch(operation, server_index)
|
193
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
|
194
|
+
|
195
|
+
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
196
|
+
end
|
197
|
+
|
198
|
+
# Gets API key (with prefix if set).
|
199
|
+
# @param [String] param_name the parameter name of API key auth
|
200
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
201
|
+
key = @api_key[param_name]
|
202
|
+
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
203
|
+
if @api_key_prefix[param_name]
|
204
|
+
"#{@api_key_prefix[param_name]} #{key}"
|
205
|
+
else
|
206
|
+
key
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
# Gets Basic Auth token string
|
211
|
+
def basic_auth_token
|
212
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns Auth Settings hash for api client.
|
216
|
+
def auth_settings
|
217
|
+
{
|
218
|
+
'HTTPBearer' =>
|
219
|
+
{
|
220
|
+
type: 'bearer',
|
221
|
+
in: 'header',
|
222
|
+
key: 'Authorization',
|
223
|
+
value: "Bearer #{access_token}"
|
224
|
+
},
|
225
|
+
}
|
226
|
+
end
|
227
|
+
|
228
|
+
# Returns an array of Server setting
|
229
|
+
def server_settings
|
230
|
+
[
|
231
|
+
{
|
232
|
+
url: "",
|
233
|
+
description: "No description provided",
|
234
|
+
}
|
235
|
+
]
|
236
|
+
end
|
237
|
+
|
238
|
+
def operation_server_settings
|
239
|
+
{
|
240
|
+
}
|
241
|
+
end
|
242
|
+
|
243
|
+
# Returns URL based on server settings
|
244
|
+
#
|
245
|
+
# @param index array index of the server settings
|
246
|
+
# @param variables hash of variable and the corresponding value
|
247
|
+
def server_url(index, variables = {}, servers = nil)
|
248
|
+
servers = server_settings if servers == nil
|
249
|
+
|
250
|
+
# check array index out of bound
|
251
|
+
if (index < 0 || index >= servers.size)
|
252
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
253
|
+
end
|
254
|
+
|
255
|
+
server = servers[index]
|
256
|
+
url = server[:url]
|
257
|
+
|
258
|
+
return url unless server.key? :variables
|
259
|
+
|
260
|
+
# go through variable and assign a value
|
261
|
+
server[:variables].each do |name, variable|
|
262
|
+
if variables.key?(name)
|
263
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
264
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
265
|
+
else
|
266
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
267
|
+
end
|
268
|
+
else
|
269
|
+
# use default value
|
270
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
url
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Svix
|
4
|
+
class EndpointAPI
|
5
|
+
def initialize(api_client)
|
6
|
+
@api = EndpointApi.new(api_client)
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(str, options = {})
|
10
|
+
return @api.list_endpoints_api_v1_app_app_id_endpoint_get(app_id, options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(app_id, endpoint_in)
|
14
|
+
return @api.create_endpoint_api_v1_app_app_id_endpoint_post(app_id, endpoint_in)
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(app_id, endpoint_id)
|
18
|
+
return @api.get_endpoint_api_v1_app_app_id_endpoint_endpoint_id_get(endpoint_id, app_id)
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(app_id, endpoint_id, endpoint_in)
|
22
|
+
return @api.update_endpoint_api_v1_app_app_id_endpoint_endpoint_id_put(endpoint_id, app_id, endpoint_update)
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete(app_id, endpoint_id)
|
26
|
+
return @api.delete_endpoint_api_v1_app_app_id_endpoint_endpoint_id_delete(endpoint_id, app_id)
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_secret(app_id, endpoint_id)
|
30
|
+
return @api.get_endpoint_secret_api_v1_app_app_id_endpoint_endpoint_id_secret_get(endpoint_id, app_id)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/{src → lib}/svix/errors.rb
RENAMED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Svix
|
4
|
+
class EventTypeAPI
|
5
|
+
def initialize(api_client)
|
6
|
+
@api = EventTypeApi.new(api_client)
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
return @api.list_event_types_api_v1_event_type_get(options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(event_type_in)
|
14
|
+
return @api.create_event_type_api_v1_event_type_post(event_type_in)
|
15
|
+
end
|
16
|
+
|
17
|
+
def update(event_type_name, event_type_update)
|
18
|
+
return @api.update_event_type_api_v1_event_type_event_type_name_put(event_type_name, event_type_update)
|
19
|
+
end
|
20
|
+
|
21
|
+
def delete(event_type_name)
|
22
|
+
return @api.delete_event_type_api_v1_event_type_event_type_name_delete(event_type_name)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Svix
|
4
|
+
private_constant :ApiClient
|
5
|
+
private_constant :Configuration
|
6
|
+
private_constant :ApplicationApi
|
7
|
+
private_constant :AuthenticationApi
|
8
|
+
private_constant :EndpointApi
|
9
|
+
private_constant :HealthApi
|
10
|
+
private_constant :MessageApi
|
11
|
+
private_constant :MessageAttemptApi
|
12
|
+
private_constant :WebhookTypes
|
13
|
+
private_constant :HttpErrorOut
|
14
|
+
private_constant :HTTPValidationError
|
15
|
+
private_constant :ValidationError
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Svix
|
4
|
+
class MessageAPI
|
5
|
+
def initialize(api_client)
|
6
|
+
@api = MessageApi.new(api_client)
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(app_id, options = {})
|
10
|
+
return @api.list_messages_api_v1_app_app_id_msg_get(app_id, options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(app_id, message_in)
|
14
|
+
return @api.create_message_api_v1_app_app_id_msg_post(app_id, message_in)
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(app_id, msg_id)
|
18
|
+
return @api.get_message_api_v1_app_app_id_msg_msg_id_get(msg_id, app_id)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Svix
|
4
|
+
class MessageAttemptAPI
|
5
|
+
def initialize(api_client)
|
6
|
+
@api = MessageAttemptApi.new(api_client)
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(app_id, msg_id, options = {})
|
10
|
+
return @api.list_attempts_api_v1_app_app_id_msg_msg_id_attempt_get(app_id, msg_id, options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def get(app_id, msg_id, attempt_id)
|
14
|
+
return @api.get_attempt_api_v1_app_app_id_msg_msg_id_attempt_attempt_id_get(attempt_id, msg_id, app_id)
|
15
|
+
end
|
16
|
+
|
17
|
+
def resend(app_id, msg_id, endpoint_id)
|
18
|
+
return @api.resend_webhook_api_v1_app_app_id_msg_msg_id_endpoint_endpoint_id_resend_post(endpoint_id, msg_id, app_id)
|
19
|
+
end
|
20
|
+
|
21
|
+
def list_attempted_messages(app_id, endpoint_id, options = {})
|
22
|
+
return @api.list_attempted_messages_api_v1_app_app_id_endpoint_endpoint_id_msg_get(endpoint_id, app_id, options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def list_attempted_destinations(app_id, msg_id, options = {})
|
26
|
+
return @api.list_attempted_destinations_api_v1_app_app_id_msg_msg_id_endpoint_get(msg_id, app_id, options)
|
27
|
+
end
|
28
|
+
|
29
|
+
def list_attempts_for_endpoint(app_id, endpoint_id, msg_id, options = {})
|
30
|
+
return @api.list_attempts_for_endpoint_api_v1_app_app_id_msg_msg_id_endpoint_endpoint_id_attempt_get(msg_id, app_id, endpoint_id, options)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,277 @@
|
|
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 ApplicationIn
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
attr_accessor :rate_limit
|
21
|
+
|
22
|
+
# Optional unique identifier for the application
|
23
|
+
attr_accessor :uid
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'name' => :'name',
|
29
|
+
:'rate_limit' => :'rateLimit',
|
30
|
+
:'uid' => :'uid'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns all the JSON keys this model knows about
|
35
|
+
def self.acceptable_attributes
|
36
|
+
attribute_map.values
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.openapi_types
|
41
|
+
{
|
42
|
+
:'name' => :'String',
|
43
|
+
:'rate_limit' => :'Integer',
|
44
|
+
:'uid' => :'String'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# List of attributes with nullable: true
|
49
|
+
def self.openapi_nullable
|
50
|
+
Set.new([
|
51
|
+
])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Initializes the object
|
55
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
56
|
+
def initialize(attributes = {})
|
57
|
+
if (!attributes.is_a?(Hash))
|
58
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::ApplicationIn` initialize method"
|
59
|
+
end
|
60
|
+
|
61
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
63
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
64
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::ApplicationIn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
65
|
+
end
|
66
|
+
h[k.to_sym] = v
|
67
|
+
}
|
68
|
+
|
69
|
+
if attributes.key?(:'name')
|
70
|
+
self.name = attributes[:'name']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'rate_limit')
|
74
|
+
self.rate_limit = attributes[:'rate_limit']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:'uid')
|
78
|
+
self.uid = attributes[:'uid']
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
83
|
+
# @return Array for valid properties with the reasons
|
84
|
+
def list_invalid_properties
|
85
|
+
invalid_properties = Array.new
|
86
|
+
if @name.nil?
|
87
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
88
|
+
end
|
89
|
+
|
90
|
+
if !@uid.nil? && @uid.to_s.length > 256
|
91
|
+
invalid_properties.push('invalid value for "uid", the character length must be smaller than or equal to 256.')
|
92
|
+
end
|
93
|
+
|
94
|
+
if !@uid.nil? && @uid.to_s.length < 1
|
95
|
+
invalid_properties.push('invalid value for "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 !@uid.nil? && @uid !~ pattern
|
100
|
+
invalid_properties.push("invalid value for \"uid\", must conform to the pattern #{pattern}.")
|
101
|
+
end
|
102
|
+
|
103
|
+
invalid_properties
|
104
|
+
end
|
105
|
+
|
106
|
+
# Check to see if the all the properties in the model are valid
|
107
|
+
# @return true if the model is valid
|
108
|
+
def valid?
|
109
|
+
return false if @name.nil?
|
110
|
+
return false if !@uid.nil? && @uid.to_s.length > 256
|
111
|
+
return false if !@uid.nil? && @uid.to_s.length < 1
|
112
|
+
return false if !@uid.nil? && @uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
113
|
+
true
|
114
|
+
end
|
115
|
+
|
116
|
+
# Custom attribute writer method with validation
|
117
|
+
# @param [Object] uid Value to be assigned
|
118
|
+
def uid=(uid)
|
119
|
+
if !uid.nil? && uid.to_s.length > 256
|
120
|
+
fail ArgumentError, 'invalid value for "uid", the character length must be smaller than or equal to 256.'
|
121
|
+
end
|
122
|
+
|
123
|
+
if !uid.nil? && uid.to_s.length < 1
|
124
|
+
fail ArgumentError, 'invalid value for "uid", the character length must be great than or equal to 1.'
|
125
|
+
end
|
126
|
+
|
127
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
128
|
+
if !uid.nil? && uid !~ pattern
|
129
|
+
fail ArgumentError, "invalid value for \"uid\", must conform to the pattern #{pattern}."
|
130
|
+
end
|
131
|
+
|
132
|
+
@uid = uid
|
133
|
+
end
|
134
|
+
|
135
|
+
# Checks equality by comparing each attribute.
|
136
|
+
# @param [Object] Object to be compared
|
137
|
+
def ==(o)
|
138
|
+
return true if self.equal?(o)
|
139
|
+
self.class == o.class &&
|
140
|
+
name == o.name &&
|
141
|
+
rate_limit == o.rate_limit &&
|
142
|
+
uid == o.uid
|
143
|
+
end
|
144
|
+
|
145
|
+
# @see the `==` method
|
146
|
+
# @param [Object] Object to be compared
|
147
|
+
def eql?(o)
|
148
|
+
self == o
|
149
|
+
end
|
150
|
+
|
151
|
+
# Calculates hash code according to all attributes.
|
152
|
+
# @return [Integer] Hash code
|
153
|
+
def hash
|
154
|
+
[name, rate_limit, uid].hash
|
155
|
+
end
|
156
|
+
|
157
|
+
# Builds the object from hash
|
158
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
159
|
+
# @return [Object] Returns the model itself
|
160
|
+
def self.build_from_hash(attributes)
|
161
|
+
new.build_from_hash(attributes)
|
162
|
+
end
|
163
|
+
|
164
|
+
# Builds the object from hash
|
165
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
166
|
+
# @return [Object] Returns the model itself
|
167
|
+
def build_from_hash(attributes)
|
168
|
+
return nil unless attributes.is_a?(Hash)
|
169
|
+
self.class.openapi_types.each_pair do |key, type|
|
170
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
171
|
+
self.send("#{key}=", nil)
|
172
|
+
elsif type =~ /\AArray<(.*)>/i
|
173
|
+
# check to ensure the input is an array given that the attribute
|
174
|
+
# is documented as an array but the input is not
|
175
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
176
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
177
|
+
end
|
178
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
179
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
self
|
184
|
+
end
|
185
|
+
|
186
|
+
# Deserializes the data based on type
|
187
|
+
# @param string type Data type
|
188
|
+
# @param string value Value to be deserialized
|
189
|
+
# @return [Object] Deserialized data
|
190
|
+
def _deserialize(type, value)
|
191
|
+
case type.to_sym
|
192
|
+
when :Time
|
193
|
+
Time.parse(value)
|
194
|
+
when :Date
|
195
|
+
Date.parse(value)
|
196
|
+
when :String
|
197
|
+
value.to_s
|
198
|
+
when :Integer
|
199
|
+
value.to_i
|
200
|
+
when :Float
|
201
|
+
value.to_f
|
202
|
+
when :Boolean
|
203
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
204
|
+
true
|
205
|
+
else
|
206
|
+
false
|
207
|
+
end
|
208
|
+
when :Object
|
209
|
+
# generic object (usually a Hash), return directly
|
210
|
+
value
|
211
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
212
|
+
inner_type = Regexp.last_match[:inner_type]
|
213
|
+
value.map { |v| _deserialize(inner_type, v) }
|
214
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
215
|
+
k_type = Regexp.last_match[:k_type]
|
216
|
+
v_type = Regexp.last_match[:v_type]
|
217
|
+
{}.tap do |hash|
|
218
|
+
value.each do |k, v|
|
219
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
else # model
|
223
|
+
# models (e.g. Pet) or oneOf
|
224
|
+
klass = Svix.const_get(type)
|
225
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
# Returns the string representation of the object
|
230
|
+
# @return [String] String presentation of the object
|
231
|
+
def to_s
|
232
|
+
to_hash.to_s
|
233
|
+
end
|
234
|
+
|
235
|
+
# to_body is an alias to to_hash (backward compatibility)
|
236
|
+
# @return [Hash] Returns the object in the form of hash
|
237
|
+
def to_body
|
238
|
+
to_hash
|
239
|
+
end
|
240
|
+
|
241
|
+
# Returns the object in the form of hash
|
242
|
+
# @return [Hash] Returns the object in the form of hash
|
243
|
+
def to_hash
|
244
|
+
hash = {}
|
245
|
+
self.class.attribute_map.each_pair do |attr, param|
|
246
|
+
value = self.send(attr)
|
247
|
+
if value.nil?
|
248
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
249
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
250
|
+
end
|
251
|
+
|
252
|
+
hash[param] = _to_hash(value)
|
253
|
+
end
|
254
|
+
hash
|
255
|
+
end
|
256
|
+
|
257
|
+
# Outputs non-array value in the form of hash
|
258
|
+
# For object, use to_hash. Otherwise, just return the value
|
259
|
+
# @param [Object] value Any valid value
|
260
|
+
# @return [Hash] Returns the value in the form of hash
|
261
|
+
def _to_hash(value)
|
262
|
+
if value.is_a?(Array)
|
263
|
+
value.compact.map { |v| _to_hash(v) }
|
264
|
+
elsif value.is_a?(Hash)
|
265
|
+
{}.tap do |hash|
|
266
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
267
|
+
end
|
268
|
+
elsif value.respond_to? :to_hash
|
269
|
+
value.to_hash
|
270
|
+
else
|
271
|
+
value
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
end
|
276
|
+
|
277
|
+
end
|