svix 0.28.0 → 0.32.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +7 -1
  3. data/README.md +16 -3
  4. data/lib/svix/api/application_api.rb +386 -0
  5. data/lib/svix/api/authentication_api.rb +155 -0
  6. data/lib/svix/api/endpoint_api.rb +774 -0
  7. data/lib/svix/api/event_type_api.rb +377 -0
  8. data/lib/svix/api/health_api.rb +77 -0
  9. data/lib/svix/api/message_api.rb +289 -0
  10. data/lib/svix/api/message_attempt_api.rb +678 -0
  11. data/lib/svix/api_client.rb +399 -0
  12. data/lib/svix/api_error.rb +57 -0
  13. data/lib/svix/application_api.rb +29 -0
  14. data/lib/svix/authentication_api.rb +17 -0
  15. data/lib/svix/configuration.rb +277 -0
  16. data/lib/svix/endpoint_api.rb +34 -0
  17. data/{src → lib}/svix/errors.rb +0 -0
  18. data/lib/svix/event_type_api.rb +25 -0
  19. data/lib/svix/internal.rb +16 -0
  20. data/lib/svix/message_api.rb +21 -0
  21. data/lib/svix/message_attempt_api.rb +33 -0
  22. data/lib/svix/models/application_in.rb +277 -0
  23. data/lib/svix/models/application_out.rb +305 -0
  24. data/lib/svix/models/dashboard_access_out.rb +265 -0
  25. data/lib/svix/models/endpoint_created_event.rb +269 -0
  26. data/lib/svix/models/endpoint_created_event_data.rb +246 -0
  27. data/lib/svix/models/endpoint_deleted_event.rb +269 -0
  28. data/lib/svix/models/endpoint_deleted_event_data.rb +246 -0
  29. data/lib/svix/models/endpoint_disabled_event.rb +269 -0
  30. data/lib/svix/models/endpoint_disabled_event_data.rb +260 -0
  31. data/lib/svix/models/endpoint_in.rb +368 -0
  32. data/lib/svix/models/endpoint_message_out.rb +363 -0
  33. data/lib/svix/models/endpoint_out.rb +386 -0
  34. data/lib/svix/models/endpoint_secret_out.rb +224 -0
  35. data/lib/svix/models/endpoint_stats.rb +265 -0
  36. data/lib/svix/models/endpoint_update.rb +358 -0
  37. data/lib/svix/models/endpoint_updated_event_data.rb +246 -0
  38. data/lib/svix/models/endpointd_updated_event.rb +269 -0
  39. data/lib/svix/models/event_example_in.rb +253 -0
  40. data/lib/svix/models/event_type_in.rb +279 -0
  41. data/lib/svix/models/event_type_out.rb +279 -0
  42. data/lib/svix/models/event_type_update.rb +235 -0
  43. data/lib/svix/models/http_error_out.rb +237 -0
  44. data/lib/svix/models/http_validation_error.rb +220 -0
  45. data/lib/svix/models/list_response_application_out.rb +248 -0
  46. data/lib/svix/models/list_response_endpoint_message_out.rb +248 -0
  47. data/lib/svix/models/list_response_endpoint_out.rb +248 -0
  48. data/lib/svix/models/list_response_event_type_out.rb +248 -0
  49. data/lib/svix/models/list_response_message_attempt_endpoint_out.rb +248 -0
  50. data/lib/svix/models/list_response_message_attempt_out.rb +248 -0
  51. data/lib/svix/models/list_response_message_endpoint_out.rb +248 -0
  52. data/lib/svix/models/list_response_message_out.rb +248 -0
  53. data/lib/svix/models/message_attempt_endpoint_out.rb +293 -0
  54. data/lib/svix/models/message_attempt_exhausted_event.rb +269 -0
  55. data/lib/svix/models/message_attempt_exhausted_event_data.rb +274 -0
  56. data/lib/svix/models/message_attempt_failed_event.rb +251 -0
  57. data/lib/svix/models/message_attempt_out.rb +307 -0
  58. data/lib/svix/models/message_attempt_trigger_type.rb +37 -0
  59. data/lib/svix/models/message_endpoint_out.rb +409 -0
  60. data/lib/svix/models/message_in.rb +312 -0
  61. data/lib/svix/models/message_out.rb +340 -0
  62. data/lib/svix/models/message_status.rb +39 -0
  63. data/lib/svix/models/validation_error.rb +253 -0
  64. data/lib/svix/models/webhook_types.rb +280 -0
  65. data/lib/svix/svix.rb +43 -0
  66. data/{src → lib}/svix/util.rb +1 -1
  67. data/{src → lib}/svix/version.rb +1 -1
  68. data/{src → lib}/svix/webhook.rb +1 -1
  69. data/lib/svix.rb +76 -0
  70. data/svix.gemspec +16 -6
  71. metadata +89 -9
  72. data/.gitignore +0 -9
  73. data/src/svix.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 678d37ab7968ba481866659694b8bdb2e46a2cdc9689cecafcf0979323e81c41
4
- data.tar.gz: e5856df563e26ac787b2ab9c970cb32be1f4490b4f76ba19980832bb1533d2e8
3
+ metadata.gz: a210df8b731ebbd7bea933aed77ac1dc20bbb5edb06a001c97de2c9968d313ed
4
+ data.tar.gz: e3091f5f1dd80ec0c4bd8b34626984a07da56b79800e225ea42d73840c2ffe90
5
5
  SHA512:
6
- metadata.gz: 3876947817dc4c62b11dd31958e62e852249473cb8b126400c5f32f6b4fe469298df4c32324f3d09d778bf731a45aa52677fabd9e89bec9bdb67ae6f82a15af9
7
- data.tar.gz: e2e83593dff53725a42df124845bcb6a38cac685b44fcb246a4aa643015c1c82e30143fb9eb45fe3b4632e16be920599f1200acc7a9896a2093a14a783b887b3
6
+ metadata.gz: f0a11b6bcec7276a99c2d2eb2219482c05b14011a800fe99baf79795f574ece30db59d6ddd3e85bb5594299cc27d2c9859e9065224d558fbdaab447b9fc801e2
7
+ data.tar.gz: 0d0fa846b68b2fd04b22ba7e5d45d1d87baf390a7e41e961181f11397ee402bd03c1e71e73e0ea79e8d87ad3c000bb7bbb8462772d555a19c3e234dc450c55a1
data/Gemfile.lock CHANGED
@@ -1,12 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- svix (0.28.0)
4
+ svix (0.32.0)
5
+ typhoeus (~> 1.0, >= 1.0.1)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
9
10
  diff-lcs (1.4.4)
11
+ ethon (0.14.0)
12
+ ffi (>= 1.15.0)
13
+ ffi (1.15.1)
10
14
  rake (13.0.6)
11
15
  rspec (3.10.0)
12
16
  rspec-core (~> 3.10.0)
@@ -21,6 +25,8 @@ GEM
21
25
  diff-lcs (>= 1.2.0, < 2.0)
22
26
  rspec-support (~> 3.10.0)
23
27
  rspec-support (3.10.2)
28
+ typhoeus (1.4.0)
29
+ ethon (>= 0.9.0)
24
30
 
25
31
  PLATFORMS
26
32
  ruby
data/README.md CHANGED
@@ -12,11 +12,15 @@ gem 'svix'
12
12
 
13
13
  And then execute:
14
14
 
15
- $ bundle
15
+ ```sh
16
+ bundle
17
+ ```
16
18
 
17
19
  Or install it yourself as:
18
20
 
19
- $ gem install svix
21
+ ```sh
22
+ gem install svix
23
+ ```
20
24
 
21
25
  ## Development
22
26
 
@@ -27,4 +31,13 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
27
31
 
28
32
  ### Run Tests
29
33
 
30
- bundle exec rspec spec
34
+ bundle exec rspec spec
35
+
36
+
37
+ ### Build & Upload
38
+
39
+ ```sh
40
+ gem build svix.gemspec
41
+
42
+ gem push pkg/svix-<VERSION>.gem
43
+ ```
@@ -0,0 +1,386 @@
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 'cgi'
14
+
15
+ module Svix
16
+ class ApplicationApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create Application
23
+ # Create a new application.
24
+ # @param application_in [ApplicationIn]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [ApplicationOut]
27
+ def create_application_api_v1_app_post(application_in, opts = {})
28
+ data, _status_code, _headers = create_application_api_v1_app_post_with_http_info(application_in, opts)
29
+ data
30
+ end
31
+
32
+ # Create Application
33
+ # Create a new application.
34
+ # @param application_in [ApplicationIn]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(ApplicationOut, Integer, Hash)>] ApplicationOut data, response status code and response headers
37
+ def create_application_api_v1_app_post_with_http_info(application_in, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: ApplicationApi.create_application_api_v1_app_post ...'
40
+ end
41
+ # verify the required parameter 'application_in' is set
42
+ if @api_client.config.client_side_validation && application_in.nil?
43
+ fail ArgumentError, "Missing the required parameter 'application_in' when calling ApplicationApi.create_application_api_v1_app_post"
44
+ end
45
+ # resource path
46
+ local_var_path = '/api/v1/app/'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
55
+ # HTTP header 'Content-Type'
56
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
57
+
58
+ # form parameters
59
+ form_params = opts[:form_params] || {}
60
+
61
+ # http body (model)
62
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(application_in)
63
+
64
+ # return_type
65
+ return_type = opts[:debug_return_type] || 'ApplicationOut'
66
+
67
+ # auth_names
68
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
69
+
70
+ new_options = opts.merge(
71
+ :operation => :"ApplicationApi.create_application_api_v1_app_post",
72
+ :header_params => header_params,
73
+ :query_params => query_params,
74
+ :form_params => form_params,
75
+ :body => post_body,
76
+ :auth_names => auth_names,
77
+ :return_type => return_type
78
+ )
79
+
80
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
81
+ if @api_client.config.debugging
82
+ @api_client.config.logger.debug "API called: ApplicationApi#create_application_api_v1_app_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
83
+ end
84
+ return data, status_code, headers
85
+ end
86
+
87
+ # Delete Application
88
+ # Delete an application.
89
+ # @param app_id [String]
90
+ # @param [Hash] opts the optional parameters
91
+ # @return [nil]
92
+ def delete_application_api_v1_app_app_id_delete(app_id, opts = {})
93
+ delete_application_api_v1_app_app_id_delete_with_http_info(app_id, opts)
94
+ nil
95
+ end
96
+
97
+ # Delete Application
98
+ # Delete an application.
99
+ # @param app_id [String]
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
102
+ def delete_application_api_v1_app_app_id_delete_with_http_info(app_id, opts = {})
103
+ if @api_client.config.debugging
104
+ @api_client.config.logger.debug 'Calling API: ApplicationApi.delete_application_api_v1_app_app_id_delete ...'
105
+ end
106
+ # verify the required parameter 'app_id' is set
107
+ if @api_client.config.client_side_validation && app_id.nil?
108
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling ApplicationApi.delete_application_api_v1_app_app_id_delete"
109
+ end
110
+ if @api_client.config.client_side_validation && app_id.to_s.length > 256
111
+ fail ArgumentError, 'invalid value for "app_id" when calling ApplicationApi.delete_application_api_v1_app_app_id_delete, the character length must be smaller than or equal to 256.'
112
+ end
113
+
114
+ if @api_client.config.client_side_validation && app_id.to_s.length < 1
115
+ fail ArgumentError, 'invalid value for "app_id" when calling ApplicationApi.delete_application_api_v1_app_app_id_delete, the character length must be great than or equal to 1.'
116
+ end
117
+
118
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
119
+ if @api_client.config.client_side_validation && app_id !~ pattern
120
+ fail ArgumentError, "invalid value for 'app_id' when calling ApplicationApi.delete_application_api_v1_app_app_id_delete, must conform to the pattern #{pattern}."
121
+ end
122
+
123
+ # resource path
124
+ local_var_path = '/api/v1/app/{app_id}/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
125
+
126
+ # query parameters
127
+ query_params = opts[:query_params] || {}
128
+
129
+ # header parameters
130
+ header_params = opts[:header_params] || {}
131
+ # HTTP header 'Accept' (if needed)
132
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
133
+
134
+ # form parameters
135
+ form_params = opts[:form_params] || {}
136
+
137
+ # http body (model)
138
+ post_body = opts[:debug_body]
139
+
140
+ # return_type
141
+ return_type = opts[:debug_return_type]
142
+
143
+ # auth_names
144
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
145
+
146
+ new_options = opts.merge(
147
+ :operation => :"ApplicationApi.delete_application_api_v1_app_app_id_delete",
148
+ :header_params => header_params,
149
+ :query_params => query_params,
150
+ :form_params => form_params,
151
+ :body => post_body,
152
+ :auth_names => auth_names,
153
+ :return_type => return_type
154
+ )
155
+
156
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
157
+ if @api_client.config.debugging
158
+ @api_client.config.logger.debug "API called: ApplicationApi#delete_application_api_v1_app_app_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
159
+ end
160
+ return data, status_code, headers
161
+ end
162
+
163
+ # Get Application
164
+ # Get an application.
165
+ # @param app_id [String]
166
+ # @param [Hash] opts the optional parameters
167
+ # @return [ApplicationOut]
168
+ def get_application_api_v1_app_app_id_get(app_id, opts = {})
169
+ data, _status_code, _headers = get_application_api_v1_app_app_id_get_with_http_info(app_id, opts)
170
+ data
171
+ end
172
+
173
+ # Get Application
174
+ # Get an application.
175
+ # @param app_id [String]
176
+ # @param [Hash] opts the optional parameters
177
+ # @return [Array<(ApplicationOut, Integer, Hash)>] ApplicationOut data, response status code and response headers
178
+ def get_application_api_v1_app_app_id_get_with_http_info(app_id, opts = {})
179
+ if @api_client.config.debugging
180
+ @api_client.config.logger.debug 'Calling API: ApplicationApi.get_application_api_v1_app_app_id_get ...'
181
+ end
182
+ # verify the required parameter 'app_id' is set
183
+ if @api_client.config.client_side_validation && app_id.nil?
184
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling ApplicationApi.get_application_api_v1_app_app_id_get"
185
+ end
186
+ if @api_client.config.client_side_validation && app_id.to_s.length > 256
187
+ fail ArgumentError, 'invalid value for "app_id" when calling ApplicationApi.get_application_api_v1_app_app_id_get, the character length must be smaller than or equal to 256.'
188
+ end
189
+
190
+ if @api_client.config.client_side_validation && app_id.to_s.length < 1
191
+ fail ArgumentError, 'invalid value for "app_id" when calling ApplicationApi.get_application_api_v1_app_app_id_get, the character length must be great than or equal to 1.'
192
+ end
193
+
194
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
195
+ if @api_client.config.client_side_validation && app_id !~ pattern
196
+ fail ArgumentError, "invalid value for 'app_id' when calling ApplicationApi.get_application_api_v1_app_app_id_get, must conform to the pattern #{pattern}."
197
+ end
198
+
199
+ # resource path
200
+ local_var_path = '/api/v1/app/{app_id}/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
201
+
202
+ # query parameters
203
+ query_params = opts[:query_params] || {}
204
+
205
+ # header parameters
206
+ header_params = opts[:header_params] || {}
207
+ # HTTP header 'Accept' (if needed)
208
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
209
+
210
+ # form parameters
211
+ form_params = opts[:form_params] || {}
212
+
213
+ # http body (model)
214
+ post_body = opts[:debug_body]
215
+
216
+ # return_type
217
+ return_type = opts[:debug_return_type] || 'ApplicationOut'
218
+
219
+ # auth_names
220
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
221
+
222
+ new_options = opts.merge(
223
+ :operation => :"ApplicationApi.get_application_api_v1_app_app_id_get",
224
+ :header_params => header_params,
225
+ :query_params => query_params,
226
+ :form_params => form_params,
227
+ :body => post_body,
228
+ :auth_names => auth_names,
229
+ :return_type => return_type
230
+ )
231
+
232
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
233
+ if @api_client.config.debugging
234
+ @api_client.config.logger.debug "API called: ApplicationApi#get_application_api_v1_app_app_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
235
+ end
236
+ return data, status_code, headers
237
+ end
238
+
239
+ # List Applications
240
+ # List of all the organization's applications.
241
+ # @param [Hash] opts the optional parameters
242
+ # @option opts [String] :iterator
243
+ # @option opts [Integer] :limit (default to 50)
244
+ # @return [ListResponseApplicationOut]
245
+ def list_applications_api_v1_app_get(opts = {})
246
+ data, _status_code, _headers = list_applications_api_v1_app_get_with_http_info(opts)
247
+ data
248
+ end
249
+
250
+ # List Applications
251
+ # List of all the organization&#39;s applications.
252
+ # @param [Hash] opts the optional parameters
253
+ # @option opts [String] :iterator
254
+ # @option opts [Integer] :limit
255
+ # @return [Array<(ListResponseApplicationOut, Integer, Hash)>] ListResponseApplicationOut data, response status code and response headers
256
+ def list_applications_api_v1_app_get_with_http_info(opts = {})
257
+ if @api_client.config.debugging
258
+ @api_client.config.logger.debug 'Calling API: ApplicationApi.list_applications_api_v1_app_get ...'
259
+ end
260
+ # resource path
261
+ local_var_path = '/api/v1/app/'
262
+
263
+ # query parameters
264
+ query_params = opts[:query_params] || {}
265
+ query_params[:'iterator'] = opts[:'iterator'] if !opts[:'iterator'].nil?
266
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
267
+
268
+ # header parameters
269
+ header_params = opts[:header_params] || {}
270
+ # HTTP header 'Accept' (if needed)
271
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
272
+
273
+ # form parameters
274
+ form_params = opts[:form_params] || {}
275
+
276
+ # http body (model)
277
+ post_body = opts[:debug_body]
278
+
279
+ # return_type
280
+ return_type = opts[:debug_return_type] || 'ListResponseApplicationOut'
281
+
282
+ # auth_names
283
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
284
+
285
+ new_options = opts.merge(
286
+ :operation => :"ApplicationApi.list_applications_api_v1_app_get",
287
+ :header_params => header_params,
288
+ :query_params => query_params,
289
+ :form_params => form_params,
290
+ :body => post_body,
291
+ :auth_names => auth_names,
292
+ :return_type => return_type
293
+ )
294
+
295
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
296
+ if @api_client.config.debugging
297
+ @api_client.config.logger.debug "API called: ApplicationApi#list_applications_api_v1_app_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
298
+ end
299
+ return data, status_code, headers
300
+ end
301
+
302
+ # Update Application
303
+ # Update an application.
304
+ # @param app_id [String]
305
+ # @param application_in [ApplicationIn]
306
+ # @param [Hash] opts the optional parameters
307
+ # @return [ApplicationOut]
308
+ def update_application_api_v1_app_app_id_put(app_id, application_in, opts = {})
309
+ data, _status_code, _headers = update_application_api_v1_app_app_id_put_with_http_info(app_id, application_in, opts)
310
+ data
311
+ end
312
+
313
+ # Update Application
314
+ # Update an application.
315
+ # @param app_id [String]
316
+ # @param application_in [ApplicationIn]
317
+ # @param [Hash] opts the optional parameters
318
+ # @return [Array<(ApplicationOut, Integer, Hash)>] ApplicationOut data, response status code and response headers
319
+ def update_application_api_v1_app_app_id_put_with_http_info(app_id, application_in, opts = {})
320
+ if @api_client.config.debugging
321
+ @api_client.config.logger.debug 'Calling API: ApplicationApi.update_application_api_v1_app_app_id_put ...'
322
+ end
323
+ # verify the required parameter 'app_id' is set
324
+ if @api_client.config.client_side_validation && app_id.nil?
325
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling ApplicationApi.update_application_api_v1_app_app_id_put"
326
+ end
327
+ if @api_client.config.client_side_validation && app_id.to_s.length > 256
328
+ fail ArgumentError, 'invalid value for "app_id" when calling ApplicationApi.update_application_api_v1_app_app_id_put, the character length must be smaller than or equal to 256.'
329
+ end
330
+
331
+ if @api_client.config.client_side_validation && app_id.to_s.length < 1
332
+ fail ArgumentError, 'invalid value for "app_id" when calling ApplicationApi.update_application_api_v1_app_app_id_put, the character length must be great than or equal to 1.'
333
+ end
334
+
335
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
336
+ if @api_client.config.client_side_validation && app_id !~ pattern
337
+ fail ArgumentError, "invalid value for 'app_id' when calling ApplicationApi.update_application_api_v1_app_app_id_put, must conform to the pattern #{pattern}."
338
+ end
339
+
340
+ # verify the required parameter 'application_in' is set
341
+ if @api_client.config.client_side_validation && application_in.nil?
342
+ fail ArgumentError, "Missing the required parameter 'application_in' when calling ApplicationApi.update_application_api_v1_app_app_id_put"
343
+ end
344
+ # resource path
345
+ local_var_path = '/api/v1/app/{app_id}/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
346
+
347
+ # query parameters
348
+ query_params = opts[:query_params] || {}
349
+
350
+ # header parameters
351
+ header_params = opts[:header_params] || {}
352
+ # HTTP header 'Accept' (if needed)
353
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
354
+ # HTTP header 'Content-Type'
355
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
356
+
357
+ # form parameters
358
+ form_params = opts[:form_params] || {}
359
+
360
+ # http body (model)
361
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(application_in)
362
+
363
+ # return_type
364
+ return_type = opts[:debug_return_type] || 'ApplicationOut'
365
+
366
+ # auth_names
367
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
368
+
369
+ new_options = opts.merge(
370
+ :operation => :"ApplicationApi.update_application_api_v1_app_app_id_put",
371
+ :header_params => header_params,
372
+ :query_params => query_params,
373
+ :form_params => form_params,
374
+ :body => post_body,
375
+ :auth_names => auth_names,
376
+ :return_type => return_type
377
+ )
378
+
379
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
380
+ if @api_client.config.debugging
381
+ @api_client.config.logger.debug "API called: ApplicationApi#update_application_api_v1_app_app_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
382
+ end
383
+ return data, status_code, headers
384
+ end
385
+ end
386
+ end
@@ -0,0 +1,155 @@
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 'cgi'
14
+
15
+ module Svix
16
+ class AuthenticationApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get Dashboard Access
23
+ # Use this function to get magic links (and authentication codes) for connecting your users to the management UIs.
24
+ # @param app_id [String]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [DashboardAccessOut]
27
+ def get_dashboard_access_api_v1_auth_dashboard_access_app_id_post(app_id, opts = {})
28
+ data, _status_code, _headers = get_dashboard_access_api_v1_auth_dashboard_access_app_id_post_with_http_info(app_id, opts)
29
+ data
30
+ end
31
+
32
+ # Get Dashboard Access
33
+ # Use this function to get magic links (and authentication codes) for connecting your users to the management UIs.
34
+ # @param app_id [String]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(DashboardAccessOut, Integer, Hash)>] DashboardAccessOut data, response status code and response headers
37
+ def get_dashboard_access_api_v1_auth_dashboard_access_app_id_post_with_http_info(app_id, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: AuthenticationApi.get_dashboard_access_api_v1_auth_dashboard_access_app_id_post ...'
40
+ end
41
+ # verify the required parameter 'app_id' is set
42
+ if @api_client.config.client_side_validation && app_id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling AuthenticationApi.get_dashboard_access_api_v1_auth_dashboard_access_app_id_post"
44
+ end
45
+ if @api_client.config.client_side_validation && app_id.to_s.length > 256
46
+ fail ArgumentError, 'invalid value for "app_id" when calling AuthenticationApi.get_dashboard_access_api_v1_auth_dashboard_access_app_id_post, the character length must be smaller than or equal to 256.'
47
+ end
48
+
49
+ if @api_client.config.client_side_validation && app_id.to_s.length < 1
50
+ fail ArgumentError, 'invalid value for "app_id" when calling AuthenticationApi.get_dashboard_access_api_v1_auth_dashboard_access_app_id_post, the character length must be great than or equal to 1.'
51
+ end
52
+
53
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
54
+ if @api_client.config.client_side_validation && app_id !~ pattern
55
+ fail ArgumentError, "invalid value for 'app_id' when calling AuthenticationApi.get_dashboard_access_api_v1_auth_dashboard_access_app_id_post, must conform to the pattern #{pattern}."
56
+ end
57
+
58
+ # resource path
59
+ local_var_path = '/api/v1/auth/dashboard-access/{app_id}/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
60
+
61
+ # query parameters
62
+ query_params = opts[:query_params] || {}
63
+
64
+ # header parameters
65
+ header_params = opts[:header_params] || {}
66
+ # HTTP header 'Accept' (if needed)
67
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
68
+
69
+ # form parameters
70
+ form_params = opts[:form_params] || {}
71
+
72
+ # http body (model)
73
+ post_body = opts[:debug_body]
74
+
75
+ # return_type
76
+ return_type = opts[:debug_return_type] || 'DashboardAccessOut'
77
+
78
+ # auth_names
79
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
80
+
81
+ new_options = opts.merge(
82
+ :operation => :"AuthenticationApi.get_dashboard_access_api_v1_auth_dashboard_access_app_id_post",
83
+ :header_params => header_params,
84
+ :query_params => query_params,
85
+ :form_params => form_params,
86
+ :body => post_body,
87
+ :auth_names => auth_names,
88
+ :return_type => return_type
89
+ )
90
+
91
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
92
+ if @api_client.config.debugging
93
+ @api_client.config.logger.debug "API called: AuthenticationApi#get_dashboard_access_api_v1_auth_dashboard_access_app_id_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
94
+ end
95
+ return data, status_code, headers
96
+ end
97
+
98
+ # Logout
99
+ # Logout an app token. Trying to log out other tokens will fail.
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [nil]
102
+ def logout_api_v1_auth_logout_post(opts = {})
103
+ logout_api_v1_auth_logout_post_with_http_info(opts)
104
+ nil
105
+ end
106
+
107
+ # Logout
108
+ # Logout an app token. Trying to log out other tokens will fail.
109
+ # @param [Hash] opts the optional parameters
110
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
111
+ def logout_api_v1_auth_logout_post_with_http_info(opts = {})
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug 'Calling API: AuthenticationApi.logout_api_v1_auth_logout_post ...'
114
+ end
115
+ # resource path
116
+ local_var_path = '/api/v1/auth/logout/'
117
+
118
+ # query parameters
119
+ query_params = opts[:query_params] || {}
120
+
121
+ # header parameters
122
+ header_params = opts[:header_params] || {}
123
+ # HTTP header 'Accept' (if needed)
124
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
125
+
126
+ # form parameters
127
+ form_params = opts[:form_params] || {}
128
+
129
+ # http body (model)
130
+ post_body = opts[:debug_body]
131
+
132
+ # return_type
133
+ return_type = opts[:debug_return_type]
134
+
135
+ # auth_names
136
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
137
+
138
+ new_options = opts.merge(
139
+ :operation => :"AuthenticationApi.logout_api_v1_auth_logout_post",
140
+ :header_params => header_params,
141
+ :query_params => query_params,
142
+ :form_params => form_params,
143
+ :body => post_body,
144
+ :auth_names => auth_names,
145
+ :return_type => return_type
146
+ )
147
+
148
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
149
+ if @api_client.config.debugging
150
+ @api_client.config.logger.debug "API called: AuthenticationApi#logout_api_v1_auth_logout_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
151
+ end
152
+ return data, status_code, headers
153
+ end
154
+ end
155
+ end