svix 0.85.1 → 1.4.12
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/broadcast_api.rb +90 -0
- data/lib/svix/api/message_api.rb +109 -0
- data/lib/svix/api/message_attempt_api.rb +3 -0
- data/lib/svix/background_tasks_api.rb +17 -0
- data/lib/svix/endpoint_api.rb +2 -2
- data/lib/svix/models/background_task_type.rb +1 -0
- data/lib/svix/models/message_broadcast_in.rb +386 -0
- data/lib/svix/models/message_broadcast_out.rb +251 -0
- data/lib/svix/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0078884804b0032414b58570050441eabb2122593d71a6974c92ccca0e4e966
|
4
|
+
data.tar.gz: 9b3227ffff55d88bc3792557d70fbd30c243d16848c2cf7da95f1adde5e23f27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff430dfcc1aed28fb83a384b9eadd95c827f6f100a13f50e873a133c88424f456799a8c5f369f2fdf0294ebc61a54d6c105182185324801f8d25c0aec23a8e65
|
7
|
+
data.tar.gz: 48cdaf7229c8627bf7b3da7bb84fdf6b3c1baf9d108cb779c090820967d43f8f693709aa484fd95618c5dc1295641e044c50ae43d27e44c5f3d5571366965687
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,90 @@
|
|
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}`. For more information on authentication, please refer to the [authentication token docs](https://docs.svix.com/api-keys). <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.1
|
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 BroadcastApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Create Broadcast Message
|
23
|
+
# Creates a background task to send the same message to each application in your organization
|
24
|
+
# @param message_broadcast_in [MessageBroadcastIn]
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @option opts [String] :idempotency_key The request's idempotency key
|
27
|
+
# @return [MessageBroadcastOut]
|
28
|
+
def create_broadcast_message(message_broadcast_in, opts = {})
|
29
|
+
data, _status_code, _headers = create_broadcast_message_with_http_info(message_broadcast_in, opts)
|
30
|
+
data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Create Broadcast Message
|
34
|
+
# Creates a background task to send the same message to each application in your organization
|
35
|
+
# @param message_broadcast_in [MessageBroadcastIn]
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @option opts [String] :idempotency_key The request's idempotency key
|
38
|
+
# @return [Array<(MessageBroadcastOut, Integer, Hash)>] MessageBroadcastOut data, response status code and response headers
|
39
|
+
def create_broadcast_message_with_http_info(message_broadcast_in, opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug 'Calling API: BroadcastApi.create_broadcast_message ...'
|
42
|
+
end
|
43
|
+
# verify the required parameter 'message_broadcast_in' is set
|
44
|
+
if @api_client.config.client_side_validation && message_broadcast_in.nil?
|
45
|
+
fail ArgumentError, "Missing the required parameter 'message_broadcast_in' when calling BroadcastApi.create_broadcast_message"
|
46
|
+
end
|
47
|
+
# resource path
|
48
|
+
local_var_path = '/api/v1/msg/broadcast/'
|
49
|
+
|
50
|
+
# query parameters
|
51
|
+
query_params = opts[:query_params] || {}
|
52
|
+
|
53
|
+
# header parameters
|
54
|
+
header_params = opts[:header_params] || {}
|
55
|
+
# HTTP header 'Accept' (if needed)
|
56
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
57
|
+
# HTTP header 'Content-Type'
|
58
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
59
|
+
header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
60
|
+
|
61
|
+
# form parameters
|
62
|
+
form_params = opts[:form_params] || {}
|
63
|
+
|
64
|
+
# http body (model)
|
65
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(message_broadcast_in)
|
66
|
+
|
67
|
+
# return_type
|
68
|
+
return_type = opts[:debug_return_type] || 'MessageBroadcastOut'
|
69
|
+
|
70
|
+
# auth_names
|
71
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
72
|
+
|
73
|
+
new_options = opts.merge(
|
74
|
+
:operation => :"BroadcastApi.create_broadcast_message",
|
75
|
+
:header_params => header_params,
|
76
|
+
:query_params => query_params,
|
77
|
+
:form_params => form_params,
|
78
|
+
:body => post_body,
|
79
|
+
:auth_names => auth_names,
|
80
|
+
:return_type => return_type
|
81
|
+
)
|
82
|
+
|
83
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
84
|
+
if @api_client.config.debugging
|
85
|
+
@api_client.config.logger.debug "API called: BroadcastApi#create_broadcast_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
86
|
+
end
|
87
|
+
return data, status_code, headers
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/lib/svix/api/message_api.rb
CHANGED
@@ -19,6 +19,112 @@ module Svix
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
+
# Create Message Attempt For Endpoint
|
23
|
+
# Creates and sends a message to the specified endpoint. The message attempt and response from the endpoint is returned. FIXME: use MessageIn for expediency, even though the `application` parameter is unused. Since this endpoint isn't publicly documented anyway, it should be fine
|
24
|
+
# @param app_id [String] The app's ID or UID
|
25
|
+
# @param endpoint_id [String] The ep's ID or UID
|
26
|
+
# @param message_in [MessageIn]
|
27
|
+
# @param [Hash] opts the optional parameters
|
28
|
+
# @option opts [String] :idempotency_key The request's idempotency key
|
29
|
+
# @return [MessageAttemptOut]
|
30
|
+
def create_message_attempt_for_endpoint(app_id, endpoint_id, message_in, opts = {})
|
31
|
+
data, _status_code, _headers = create_message_attempt_for_endpoint_with_http_info(app_id, endpoint_id, message_in, opts)
|
32
|
+
data
|
33
|
+
end
|
34
|
+
|
35
|
+
# Create Message Attempt For Endpoint
|
36
|
+
# Creates and sends a message to the specified endpoint. The message attempt and response from the endpoint is returned. FIXME: use MessageIn for expediency, even though the `application` parameter is unused. Since this endpoint isn't publicly documented anyway, it should be fine
|
37
|
+
# @param app_id [String] The app's ID or UID
|
38
|
+
# @param endpoint_id [String] The ep's ID or UID
|
39
|
+
# @param message_in [MessageIn]
|
40
|
+
# @param [Hash] opts the optional parameters
|
41
|
+
# @option opts [String] :idempotency_key The request's idempotency key
|
42
|
+
# @return [Array<(MessageAttemptOut, Integer, Hash)>] MessageAttemptOut data, response status code and response headers
|
43
|
+
def create_message_attempt_for_endpoint_with_http_info(app_id, endpoint_id, message_in, opts = {})
|
44
|
+
if @api_client.config.debugging
|
45
|
+
@api_client.config.logger.debug 'Calling API: MessageApi.create_message_attempt_for_endpoint ...'
|
46
|
+
end
|
47
|
+
# verify the required parameter 'app_id' is set
|
48
|
+
if @api_client.config.client_side_validation && app_id.nil?
|
49
|
+
fail ArgumentError, "Missing the required parameter 'app_id' when calling MessageApi.create_message_attempt_for_endpoint"
|
50
|
+
end
|
51
|
+
if @api_client.config.client_side_validation && app_id.to_s.length > 256
|
52
|
+
fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.create_message_attempt_for_endpoint, the character length must be smaller than or equal to 256.'
|
53
|
+
end
|
54
|
+
|
55
|
+
if @api_client.config.client_side_validation && app_id.to_s.length < 1
|
56
|
+
fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.create_message_attempt_for_endpoint, the character length must be great than or equal to 1.'
|
57
|
+
end
|
58
|
+
|
59
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
60
|
+
if @api_client.config.client_side_validation && app_id !~ pattern
|
61
|
+
fail ArgumentError, "invalid value for 'app_id' when calling MessageApi.create_message_attempt_for_endpoint, must conform to the pattern #{pattern}."
|
62
|
+
end
|
63
|
+
|
64
|
+
# verify the required parameter 'endpoint_id' is set
|
65
|
+
if @api_client.config.client_side_validation && endpoint_id.nil?
|
66
|
+
fail ArgumentError, "Missing the required parameter 'endpoint_id' when calling MessageApi.create_message_attempt_for_endpoint"
|
67
|
+
end
|
68
|
+
if @api_client.config.client_side_validation && endpoint_id.to_s.length > 256
|
69
|
+
fail ArgumentError, 'invalid value for "endpoint_id" when calling MessageApi.create_message_attempt_for_endpoint, the character length must be smaller than or equal to 256.'
|
70
|
+
end
|
71
|
+
|
72
|
+
if @api_client.config.client_side_validation && endpoint_id.to_s.length < 1
|
73
|
+
fail ArgumentError, 'invalid value for "endpoint_id" when calling MessageApi.create_message_attempt_for_endpoint, the character length must be great than or equal to 1.'
|
74
|
+
end
|
75
|
+
|
76
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
77
|
+
if @api_client.config.client_side_validation && endpoint_id !~ pattern
|
78
|
+
fail ArgumentError, "invalid value for 'endpoint_id' when calling MessageApi.create_message_attempt_for_endpoint, must conform to the pattern #{pattern}."
|
79
|
+
end
|
80
|
+
|
81
|
+
# verify the required parameter 'message_in' is set
|
82
|
+
if @api_client.config.client_side_validation && message_in.nil?
|
83
|
+
fail ArgumentError, "Missing the required parameter 'message_in' when calling MessageApi.create_message_attempt_for_endpoint"
|
84
|
+
end
|
85
|
+
# resource path
|
86
|
+
local_var_path = '/api/v1/app/{app_id}/endpoint/{endpoint_id}/msg/test-attempt/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'endpoint_id' + '}', CGI.escape(endpoint_id.to_s))
|
87
|
+
|
88
|
+
# query parameters
|
89
|
+
query_params = opts[:query_params] || {}
|
90
|
+
|
91
|
+
# header parameters
|
92
|
+
header_params = opts[:header_params] || {}
|
93
|
+
# HTTP header 'Accept' (if needed)
|
94
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
95
|
+
# HTTP header 'Content-Type'
|
96
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
97
|
+
header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
98
|
+
|
99
|
+
# form parameters
|
100
|
+
form_params = opts[:form_params] || {}
|
101
|
+
|
102
|
+
# http body (model)
|
103
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(message_in)
|
104
|
+
|
105
|
+
# return_type
|
106
|
+
return_type = opts[:debug_return_type] || 'MessageAttemptOut'
|
107
|
+
|
108
|
+
# auth_names
|
109
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
110
|
+
|
111
|
+
new_options = opts.merge(
|
112
|
+
:operation => :"MessageApi.create_message_attempt_for_endpoint",
|
113
|
+
:header_params => header_params,
|
114
|
+
:query_params => query_params,
|
115
|
+
:form_params => form_params,
|
116
|
+
:body => post_body,
|
117
|
+
:auth_names => auth_names,
|
118
|
+
:return_type => return_type
|
119
|
+
)
|
120
|
+
|
121
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
122
|
+
if @api_client.config.debugging
|
123
|
+
@api_client.config.logger.debug "API called: MessageApi#create_message_attempt_for_endpoint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
124
|
+
end
|
125
|
+
return data, status_code, headers
|
126
|
+
end
|
127
|
+
|
22
128
|
# Create Message
|
23
129
|
# Creates a new message and dispatches it to all of the application's endpoints. The `eventId` is an optional custom unique ID. It's verified to be unique only up to a day, after that no verification will be made. If a message with the same `eventId` already exists for any application in your environment, a 409 conflict error will be returned. The `eventType` indicates the type and schema of the event. All messages of a certain `eventType` are expected to have the same schema. Endpoints can choose to only listen to specific event types. Messages can also have `channels`, which similar to event types let endpoints filter by them. Unlike event types, messages can have multiple channels, and channels don't imply a specific message content or schema. The `payload` property is the webhook's body (the actual webhook message). Svix supports payload sizes of up to ~350kb, though it's generally a good idea to keep webhook payloads small, probably no larger than 40kb.
|
24
130
|
# @param app_id [String] The app's ID or UID
|
@@ -311,6 +417,7 @@ module Svix
|
|
311
417
|
# @option opts [String] :channel
|
312
418
|
# @option opts [Time] :before
|
313
419
|
# @option opts [Time] :after
|
420
|
+
# @option opts [Boolean] :with_content (default to false)
|
314
421
|
# @option opts [Array<String>] :event_types
|
315
422
|
# @return [ListResponseMessageOut]
|
316
423
|
def v1_message_list(app_id, opts = {})
|
@@ -327,6 +434,7 @@ module Svix
|
|
327
434
|
# @option opts [String] :channel
|
328
435
|
# @option opts [Time] :before
|
329
436
|
# @option opts [Time] :after
|
437
|
+
# @option opts [Boolean] :with_content
|
330
438
|
# @option opts [Array<String>] :event_types
|
331
439
|
# @return [Array<(ListResponseMessageOut, Integer, Hash)>] ListResponseMessageOut data, response status code and response headers
|
332
440
|
def v1_message_list_with_http_info(app_id, opts = {})
|
@@ -377,6 +485,7 @@ module Svix
|
|
377
485
|
query_params[:'channel'] = opts[:'channel'] if !opts[:'channel'].nil?
|
378
486
|
query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
|
379
487
|
query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
|
488
|
+
query_params[:'with_content'] = opts[:'with_content'] if !opts[:'with_content'].nil?
|
380
489
|
query_params[:'event_types'] = @api_client.build_collection_param(opts[:'event_types'], :multi) if !opts[:'event_types'].nil?
|
381
490
|
|
382
491
|
# header parameters
|
@@ -442,6 +442,7 @@ module Svix
|
|
442
442
|
# @option opts [MessageStatus] :status
|
443
443
|
# @option opts [Time] :before
|
444
444
|
# @option opts [Time] :after
|
445
|
+
# @option opts [Boolean] :with_content (default to false)
|
445
446
|
# @return [ListResponseEndpointMessageOut]
|
446
447
|
def v1_message_attempt_list_attempted_messages(app_id, endpoint_id, opts = {})
|
447
448
|
data, _status_code, _headers = v1_message_attempt_list_attempted_messages_with_http_info(app_id, endpoint_id, opts)
|
@@ -459,6 +460,7 @@ module Svix
|
|
459
460
|
# @option opts [MessageStatus] :status
|
460
461
|
# @option opts [Time] :before
|
461
462
|
# @option opts [Time] :after
|
463
|
+
# @option opts [Boolean] :with_content
|
462
464
|
# @return [Array<(ListResponseEndpointMessageOut, Integer, Hash)>] ListResponseEndpointMessageOut data, response status code and response headers
|
463
465
|
def v1_message_attempt_list_attempted_messages_with_http_info(app_id, endpoint_id, opts = {})
|
464
466
|
if @api_client.config.debugging
|
@@ -526,6 +528,7 @@ module Svix
|
|
526
528
|
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
527
529
|
query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
|
528
530
|
query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
|
531
|
+
query_params[:'with_content'] = opts[:'with_content'] if !opts[:'with_content'].nil?
|
529
532
|
|
530
533
|
# header parameters
|
531
534
|
header_params = opts[:header_params] || {}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Svix
|
4
|
+
class BackgroundTasksAPI
|
5
|
+
def initialize(api_client)
|
6
|
+
@api = BackgroundTasksApi.new(api_client)
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(options = {})
|
10
|
+
return @api.list_background_tasks(options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def get(task_id, options = {})
|
14
|
+
return @api.get_background_task(task_id, options)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/svix/endpoint_api.rb
CHANGED
@@ -51,8 +51,8 @@ module Svix
|
|
51
51
|
return @api.v1_endpoint_patch_headers(app_id, endpoint_id, endpoint_headers_in)
|
52
52
|
end
|
53
53
|
|
54
|
-
def get_stats(app_id, endpoint_id)
|
55
|
-
return @api.v1_endpoint_get_stats(app_id, endpoint_id)
|
54
|
+
def get_stats(app_id, endpoint_id, options = {})
|
55
|
+
return @api.v1_endpoint_get_stats(app_id, endpoint_id, options)
|
56
56
|
end
|
57
57
|
|
58
58
|
def replay_missing(app_id, endpoint_id, replay_in, options = {})
|
@@ -18,6 +18,7 @@ module Svix
|
|
18
18
|
ENDPOINT_REPLAY = "endpoint.replay".freeze
|
19
19
|
ENDPOINT_RECOVER = "endpoint.recover".freeze
|
20
20
|
APPLICATION_STATS = "application.stats".freeze
|
21
|
+
MESSAGE_BROADCAST = "message.broadcast".freeze
|
21
22
|
|
22
23
|
# Builds the enum from string
|
23
24
|
# @param [String] The enum value in the form of the string
|
@@ -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 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}`. For more information on authentication, please refer to the [authentication token docs](https://docs.svix.com/api-keys). <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.1
|
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 MessageBroadcastIn
|
18
|
+
# List of free-form identifiers that endpoints can filter by
|
19
|
+
attr_accessor :channels
|
20
|
+
|
21
|
+
# Optional unique identifier for the message
|
22
|
+
attr_accessor :event_id
|
23
|
+
|
24
|
+
# The event type's name
|
25
|
+
attr_accessor :event_type
|
26
|
+
|
27
|
+
attr_accessor :payload
|
28
|
+
|
29
|
+
attr_accessor :payload_retention_period
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'channels' => :'channels',
|
35
|
+
:'event_id' => :'eventId',
|
36
|
+
:'event_type' => :'eventType',
|
37
|
+
:'payload' => :'payload',
|
38
|
+
:'payload_retention_period' => :'payloadRetentionPeriod'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns all the JSON keys this model knows about
|
43
|
+
def self.acceptable_attributes
|
44
|
+
attribute_map.values
|
45
|
+
end
|
46
|
+
|
47
|
+
# Attribute type mapping.
|
48
|
+
def self.openapi_types
|
49
|
+
{
|
50
|
+
:'channels' => :'Array<String>',
|
51
|
+
:'event_id' => :'String',
|
52
|
+
:'event_type' => :'String',
|
53
|
+
:'payload' => :'Object',
|
54
|
+
:'payload_retention_period' => :'Integer'
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
# List of attributes with nullable: true
|
59
|
+
def self.openapi_nullable
|
60
|
+
Set.new([
|
61
|
+
:'channels',
|
62
|
+
:'event_id',
|
63
|
+
])
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
if (!attributes.is_a?(Hash))
|
70
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::MessageBroadcastIn` initialize method"
|
71
|
+
end
|
72
|
+
|
73
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
74
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
75
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
76
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::MessageBroadcastIn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
77
|
+
end
|
78
|
+
h[k.to_sym] = v
|
79
|
+
}
|
80
|
+
|
81
|
+
if attributes.key?(:'channels')
|
82
|
+
if (value = attributes[:'channels']).is_a?(Array)
|
83
|
+
self.channels = value
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'event_id')
|
88
|
+
self.event_id = attributes[:'event_id']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'event_type')
|
92
|
+
self.event_type = attributes[:'event_type']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'payload')
|
96
|
+
self.payload = attributes[:'payload']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'payload_retention_period')
|
100
|
+
self.payload_retention_period = attributes[:'payload_retention_period']
|
101
|
+
else
|
102
|
+
self.payload_retention_period = 90
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
107
|
+
# @return Array for valid properties with the reasons
|
108
|
+
def list_invalid_properties
|
109
|
+
invalid_properties = Array.new
|
110
|
+
if !@channels.nil? && @channels.length > 5
|
111
|
+
invalid_properties.push('invalid value for "channels", number of items must be less than or equal to 5.')
|
112
|
+
end
|
113
|
+
|
114
|
+
if !@channels.nil? && @channels.length < 1
|
115
|
+
invalid_properties.push('invalid value for "channels", number of items must be greater than or equal to 1.')
|
116
|
+
end
|
117
|
+
|
118
|
+
if !@event_id.nil? && @event_id.to_s.length > 256
|
119
|
+
invalid_properties.push('invalid value for "event_id", the character length must be smaller than or equal to 256.')
|
120
|
+
end
|
121
|
+
|
122
|
+
if !@event_id.nil? && @event_id.to_s.length < 1
|
123
|
+
invalid_properties.push('invalid value for "event_id", the character length must be great than or equal to 1.')
|
124
|
+
end
|
125
|
+
|
126
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
127
|
+
if !@event_id.nil? && @event_id !~ pattern
|
128
|
+
invalid_properties.push("invalid value for \"event_id\", must conform to the pattern #{pattern}.")
|
129
|
+
end
|
130
|
+
|
131
|
+
if @event_type.nil?
|
132
|
+
invalid_properties.push('invalid value for "event_type", event_type cannot be nil.')
|
133
|
+
end
|
134
|
+
|
135
|
+
if @event_type.to_s.length > 256
|
136
|
+
invalid_properties.push('invalid value for "event_type", the character length must be smaller than or equal to 256.')
|
137
|
+
end
|
138
|
+
|
139
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
140
|
+
if @event_type !~ pattern
|
141
|
+
invalid_properties.push("invalid value for \"event_type\", must conform to the pattern #{pattern}.")
|
142
|
+
end
|
143
|
+
|
144
|
+
if @payload.nil?
|
145
|
+
invalid_properties.push('invalid value for "payload", payload cannot be nil.')
|
146
|
+
end
|
147
|
+
|
148
|
+
if !@payload_retention_period.nil? && @payload_retention_period > 90
|
149
|
+
invalid_properties.push('invalid value for "payload_retention_period", must be smaller than or equal to 90.')
|
150
|
+
end
|
151
|
+
|
152
|
+
if !@payload_retention_period.nil? && @payload_retention_period < 5
|
153
|
+
invalid_properties.push('invalid value for "payload_retention_period", must be greater than or equal to 5.')
|
154
|
+
end
|
155
|
+
|
156
|
+
invalid_properties
|
157
|
+
end
|
158
|
+
|
159
|
+
# Check to see if the all the properties in the model are valid
|
160
|
+
# @return true if the model is valid
|
161
|
+
def valid?
|
162
|
+
return false if !@channels.nil? && @channels.length > 5
|
163
|
+
return false if !@channels.nil? && @channels.length < 1
|
164
|
+
return false if !@event_id.nil? && @event_id.to_s.length > 256
|
165
|
+
return false if !@event_id.nil? && @event_id.to_s.length < 1
|
166
|
+
return false if !@event_id.nil? && @event_id !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
167
|
+
return false if @event_type.nil?
|
168
|
+
return false if @event_type.to_s.length > 256
|
169
|
+
return false if @event_type !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
170
|
+
return false if @payload.nil?
|
171
|
+
return false if !@payload_retention_period.nil? && @payload_retention_period > 90
|
172
|
+
return false if !@payload_retention_period.nil? && @payload_retention_period < 5
|
173
|
+
true
|
174
|
+
end
|
175
|
+
|
176
|
+
# Custom attribute writer method with validation
|
177
|
+
# @param [Object] channels Value to be assigned
|
178
|
+
def channels=(channels)
|
179
|
+
if !channels.nil? && channels.length > 5
|
180
|
+
fail ArgumentError, 'invalid value for "channels", number of items must be less than or equal to 5.'
|
181
|
+
end
|
182
|
+
|
183
|
+
if !channels.nil? && channels.length < 1
|
184
|
+
fail ArgumentError, 'invalid value for "channels", number of items must be greater than or equal to 1.'
|
185
|
+
end
|
186
|
+
|
187
|
+
@channels = channels
|
188
|
+
end
|
189
|
+
|
190
|
+
# Custom attribute writer method with validation
|
191
|
+
# @param [Object] event_id Value to be assigned
|
192
|
+
def event_id=(event_id)
|
193
|
+
if !event_id.nil? && event_id.to_s.length > 256
|
194
|
+
fail ArgumentError, 'invalid value for "event_id", the character length must be smaller than or equal to 256.'
|
195
|
+
end
|
196
|
+
|
197
|
+
if !event_id.nil? && event_id.to_s.length < 1
|
198
|
+
fail ArgumentError, 'invalid value for "event_id", the character length must be great than or equal to 1.'
|
199
|
+
end
|
200
|
+
|
201
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
202
|
+
if !event_id.nil? && event_id !~ pattern
|
203
|
+
fail ArgumentError, "invalid value for \"event_id\", must conform to the pattern #{pattern}."
|
204
|
+
end
|
205
|
+
|
206
|
+
@event_id = event_id
|
207
|
+
end
|
208
|
+
|
209
|
+
# Custom attribute writer method with validation
|
210
|
+
# @param [Object] event_type Value to be assigned
|
211
|
+
def event_type=(event_type)
|
212
|
+
if event_type.nil?
|
213
|
+
fail ArgumentError, 'event_type cannot be nil'
|
214
|
+
end
|
215
|
+
|
216
|
+
if event_type.to_s.length > 256
|
217
|
+
fail ArgumentError, 'invalid value for "event_type", the character length must be smaller than or equal to 256.'
|
218
|
+
end
|
219
|
+
|
220
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
221
|
+
if event_type !~ pattern
|
222
|
+
fail ArgumentError, "invalid value for \"event_type\", must conform to the pattern #{pattern}."
|
223
|
+
end
|
224
|
+
|
225
|
+
@event_type = event_type
|
226
|
+
end
|
227
|
+
|
228
|
+
# Custom attribute writer method with validation
|
229
|
+
# @param [Object] payload_retention_period Value to be assigned
|
230
|
+
def payload_retention_period=(payload_retention_period)
|
231
|
+
if !payload_retention_period.nil? && payload_retention_period > 90
|
232
|
+
fail ArgumentError, 'invalid value for "payload_retention_period", must be smaller than or equal to 90.'
|
233
|
+
end
|
234
|
+
|
235
|
+
if !payload_retention_period.nil? && payload_retention_period < 5
|
236
|
+
fail ArgumentError, 'invalid value for "payload_retention_period", must be greater than or equal to 5.'
|
237
|
+
end
|
238
|
+
|
239
|
+
@payload_retention_period = payload_retention_period
|
240
|
+
end
|
241
|
+
|
242
|
+
# Checks equality by comparing each attribute.
|
243
|
+
# @param [Object] Object to be compared
|
244
|
+
def ==(o)
|
245
|
+
return true if self.equal?(o)
|
246
|
+
self.class == o.class &&
|
247
|
+
channels == o.channels &&
|
248
|
+
event_id == o.event_id &&
|
249
|
+
event_type == o.event_type &&
|
250
|
+
payload == o.payload &&
|
251
|
+
payload_retention_period == o.payload_retention_period
|
252
|
+
end
|
253
|
+
|
254
|
+
# @see the `==` method
|
255
|
+
# @param [Object] Object to be compared
|
256
|
+
def eql?(o)
|
257
|
+
self == o
|
258
|
+
end
|
259
|
+
|
260
|
+
# Calculates hash code according to all attributes.
|
261
|
+
# @return [Integer] Hash code
|
262
|
+
def hash
|
263
|
+
[channels, event_id, event_type, payload, payload_retention_period].hash
|
264
|
+
end
|
265
|
+
|
266
|
+
# Builds the object from hash
|
267
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
268
|
+
# @return [Object] Returns the model itself
|
269
|
+
def self.build_from_hash(attributes)
|
270
|
+
new.build_from_hash(attributes)
|
271
|
+
end
|
272
|
+
|
273
|
+
# Builds the object from hash
|
274
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
275
|
+
# @return [Object] Returns the model itself
|
276
|
+
def build_from_hash(attributes)
|
277
|
+
return nil unless attributes.is_a?(Hash)
|
278
|
+
self.class.openapi_types.each_pair do |key, type|
|
279
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
280
|
+
self.send("#{key}=", nil)
|
281
|
+
elsif type =~ /\AArray<(.*)>/i
|
282
|
+
# check to ensure the input is an array given that the attribute
|
283
|
+
# is documented as an array but the input is not
|
284
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
285
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
286
|
+
end
|
287
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
288
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
self
|
293
|
+
end
|
294
|
+
|
295
|
+
# Deserializes the data based on type
|
296
|
+
# @param string type Data type
|
297
|
+
# @param string value Value to be deserialized
|
298
|
+
# @return [Object] Deserialized data
|
299
|
+
def _deserialize(type, value)
|
300
|
+
case type.to_sym
|
301
|
+
when :Time
|
302
|
+
Time.parse(value)
|
303
|
+
when :Date
|
304
|
+
Date.parse(value)
|
305
|
+
when :String
|
306
|
+
value.to_s
|
307
|
+
when :Integer
|
308
|
+
value.to_i
|
309
|
+
when :Float
|
310
|
+
value.to_f
|
311
|
+
when :Boolean
|
312
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
313
|
+
true
|
314
|
+
else
|
315
|
+
false
|
316
|
+
end
|
317
|
+
when :Object
|
318
|
+
# generic object (usually a Hash), return directly
|
319
|
+
value
|
320
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
321
|
+
inner_type = Regexp.last_match[:inner_type]
|
322
|
+
value.map { |v| _deserialize(inner_type, v) }
|
323
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
324
|
+
k_type = Regexp.last_match[:k_type]
|
325
|
+
v_type = Regexp.last_match[:v_type]
|
326
|
+
{}.tap do |hash|
|
327
|
+
value.each do |k, v|
|
328
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
329
|
+
end
|
330
|
+
end
|
331
|
+
else # model
|
332
|
+
# models (e.g. Pet) or oneOf
|
333
|
+
klass = Svix.const_get(type)
|
334
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
# Returns the string representation of the object
|
339
|
+
# @return [String] String presentation of the object
|
340
|
+
def to_s
|
341
|
+
to_hash.to_s
|
342
|
+
end
|
343
|
+
|
344
|
+
# to_body is an alias to to_hash (backward compatibility)
|
345
|
+
# @return [Hash] Returns the object in the form of hash
|
346
|
+
def to_body
|
347
|
+
to_hash
|
348
|
+
end
|
349
|
+
|
350
|
+
# Returns the object in the form of hash
|
351
|
+
# @return [Hash] Returns the object in the form of hash
|
352
|
+
def to_hash
|
353
|
+
hash = {}
|
354
|
+
self.class.attribute_map.each_pair do |attr, param|
|
355
|
+
value = self.send(attr)
|
356
|
+
if value.nil?
|
357
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
358
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
359
|
+
end
|
360
|
+
|
361
|
+
hash[param] = _to_hash(value)
|
362
|
+
end
|
363
|
+
hash
|
364
|
+
end
|
365
|
+
|
366
|
+
# Outputs non-array value in the form of hash
|
367
|
+
# For object, use to_hash. Otherwise, just return the value
|
368
|
+
# @param [Object] value Any valid value
|
369
|
+
# @return [Hash] Returns the value in the form of hash
|
370
|
+
def _to_hash(value)
|
371
|
+
if value.is_a?(Array)
|
372
|
+
value.compact.map { |v| _to_hash(v) }
|
373
|
+
elsif value.is_a?(Hash)
|
374
|
+
{}.tap do |hash|
|
375
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
376
|
+
end
|
377
|
+
elsif value.respond_to? :to_hash
|
378
|
+
value.to_hash
|
379
|
+
else
|
380
|
+
value
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
end
|
385
|
+
|
386
|
+
end
|
@@ -0,0 +1,251 @@
|
|
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}`. For more information on authentication, please refer to the [authentication token docs](https://docs.svix.com/api-keys). <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.1
|
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 MessageBroadcastOut
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
attr_accessor :status
|
21
|
+
|
22
|
+
attr_accessor :task
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'id' => :'id',
|
28
|
+
:'status' => :'status',
|
29
|
+
:'task' => :'task'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'id' => :'String',
|
42
|
+
:'status' => :'BackgroundTaskStatus',
|
43
|
+
:'task' => :'BackgroundTaskType'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
])
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initializes the object
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
+
def initialize(attributes = {})
|
56
|
+
if (!attributes.is_a?(Hash))
|
57
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::MessageBroadcastOut` initialize method"
|
58
|
+
end
|
59
|
+
|
60
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
62
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
63
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::MessageBroadcastOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
64
|
+
end
|
65
|
+
h[k.to_sym] = v
|
66
|
+
}
|
67
|
+
|
68
|
+
if attributes.key?(:'id')
|
69
|
+
self.id = attributes[:'id']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'status')
|
73
|
+
self.status = attributes[:'status']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.key?(:'task')
|
77
|
+
self.task = attributes[:'task']
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
82
|
+
# @return Array for valid properties with the reasons
|
83
|
+
def list_invalid_properties
|
84
|
+
invalid_properties = Array.new
|
85
|
+
if @id.nil?
|
86
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
87
|
+
end
|
88
|
+
|
89
|
+
if @status.nil?
|
90
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
91
|
+
end
|
92
|
+
|
93
|
+
if @task.nil?
|
94
|
+
invalid_properties.push('invalid value for "task", task cannot be nil.')
|
95
|
+
end
|
96
|
+
|
97
|
+
invalid_properties
|
98
|
+
end
|
99
|
+
|
100
|
+
# Check to see if the all the properties in the model are valid
|
101
|
+
# @return true if the model is valid
|
102
|
+
def valid?
|
103
|
+
return false if @id.nil?
|
104
|
+
return false if @status.nil?
|
105
|
+
return false if @task.nil?
|
106
|
+
true
|
107
|
+
end
|
108
|
+
|
109
|
+
# Checks equality by comparing each attribute.
|
110
|
+
# @param [Object] Object to be compared
|
111
|
+
def ==(o)
|
112
|
+
return true if self.equal?(o)
|
113
|
+
self.class == o.class &&
|
114
|
+
id == o.id &&
|
115
|
+
status == o.status &&
|
116
|
+
task == o.task
|
117
|
+
end
|
118
|
+
|
119
|
+
# @see the `==` method
|
120
|
+
# @param [Object] Object to be compared
|
121
|
+
def eql?(o)
|
122
|
+
self == o
|
123
|
+
end
|
124
|
+
|
125
|
+
# Calculates hash code according to all attributes.
|
126
|
+
# @return [Integer] Hash code
|
127
|
+
def hash
|
128
|
+
[id, status, task].hash
|
129
|
+
end
|
130
|
+
|
131
|
+
# Builds the object from hash
|
132
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
133
|
+
# @return [Object] Returns the model itself
|
134
|
+
def self.build_from_hash(attributes)
|
135
|
+
new.build_from_hash(attributes)
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def build_from_hash(attributes)
|
142
|
+
return nil unless attributes.is_a?(Hash)
|
143
|
+
self.class.openapi_types.each_pair do |key, type|
|
144
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
145
|
+
self.send("#{key}=", nil)
|
146
|
+
elsif type =~ /\AArray<(.*)>/i
|
147
|
+
# check to ensure the input is an array given that the attribute
|
148
|
+
# is documented as an array but the input is not
|
149
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
150
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
151
|
+
end
|
152
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
153
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
self
|
158
|
+
end
|
159
|
+
|
160
|
+
# Deserializes the data based on type
|
161
|
+
# @param string type Data type
|
162
|
+
# @param string value Value to be deserialized
|
163
|
+
# @return [Object] Deserialized data
|
164
|
+
def _deserialize(type, value)
|
165
|
+
case type.to_sym
|
166
|
+
when :Time
|
167
|
+
Time.parse(value)
|
168
|
+
when :Date
|
169
|
+
Date.parse(value)
|
170
|
+
when :String
|
171
|
+
value.to_s
|
172
|
+
when :Integer
|
173
|
+
value.to_i
|
174
|
+
when :Float
|
175
|
+
value.to_f
|
176
|
+
when :Boolean
|
177
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
178
|
+
true
|
179
|
+
else
|
180
|
+
false
|
181
|
+
end
|
182
|
+
when :Object
|
183
|
+
# generic object (usually a Hash), return directly
|
184
|
+
value
|
185
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
186
|
+
inner_type = Regexp.last_match[:inner_type]
|
187
|
+
value.map { |v| _deserialize(inner_type, v) }
|
188
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
189
|
+
k_type = Regexp.last_match[:k_type]
|
190
|
+
v_type = Regexp.last_match[:v_type]
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each do |k, v|
|
193
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
else # model
|
197
|
+
# models (e.g. Pet) or oneOf
|
198
|
+
klass = Svix.const_get(type)
|
199
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
# Returns the string representation of the object
|
204
|
+
# @return [String] String presentation of the object
|
205
|
+
def to_s
|
206
|
+
to_hash.to_s
|
207
|
+
end
|
208
|
+
|
209
|
+
# to_body is an alias to to_hash (backward compatibility)
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
211
|
+
def to_body
|
212
|
+
to_hash
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns the object in the form of hash
|
216
|
+
# @return [Hash] Returns the object in the form of hash
|
217
|
+
def to_hash
|
218
|
+
hash = {}
|
219
|
+
self.class.attribute_map.each_pair do |attr, param|
|
220
|
+
value = self.send(attr)
|
221
|
+
if value.nil?
|
222
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
223
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
224
|
+
end
|
225
|
+
|
226
|
+
hash[param] = _to_hash(value)
|
227
|
+
end
|
228
|
+
hash
|
229
|
+
end
|
230
|
+
|
231
|
+
# Outputs non-array value in the form of hash
|
232
|
+
# For object, use to_hash. Otherwise, just return the value
|
233
|
+
# @param [Object] value Any valid value
|
234
|
+
# @return [Hash] Returns the value in the form of hash
|
235
|
+
def _to_hash(value)
|
236
|
+
if value.is_a?(Array)
|
237
|
+
value.compact.map { |v| _to_hash(v) }
|
238
|
+
elsif value.is_a?(Hash)
|
239
|
+
{}.tap do |hash|
|
240
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
241
|
+
end
|
242
|
+
elsif value.respond_to? :to_hash
|
243
|
+
value.to_hash
|
244
|
+
else
|
245
|
+
value
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|
data/lib/svix/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.4.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Svix
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- lib/svix/api/application_api.rb
|
88
88
|
- lib/svix/api/authentication_api.rb
|
89
89
|
- lib/svix/api/background_tasks_api.rb
|
90
|
+
- lib/svix/api/broadcast_api.rb
|
90
91
|
- lib/svix/api/endpoint_api.rb
|
91
92
|
- lib/svix/api/environment_api.rb
|
92
93
|
- lib/svix/api/environment_settings_api.rb
|
@@ -100,6 +101,7 @@ files:
|
|
100
101
|
- lib/svix/api_error.rb
|
101
102
|
- lib/svix/application_api.rb
|
102
103
|
- lib/svix/authentication_api.rb
|
104
|
+
- lib/svix/background_tasks_api.rb
|
103
105
|
- lib/svix/configuration.rb
|
104
106
|
- lib/svix/endpoint_api.rb
|
105
107
|
- lib/svix/errors.rb
|
@@ -187,6 +189,8 @@ files:
|
|
187
189
|
- lib/svix/models/message_attempt_headers_out.rb
|
188
190
|
- lib/svix/models/message_attempt_out.rb
|
189
191
|
- lib/svix/models/message_attempt_trigger_type.rb
|
192
|
+
- lib/svix/models/message_broadcast_in.rb
|
193
|
+
- lib/svix/models/message_broadcast_out.rb
|
190
194
|
- lib/svix/models/message_endpoint_out.rb
|
191
195
|
- lib/svix/models/message_in.rb
|
192
196
|
- lib/svix/models/message_out.rb
|