svix 1.95.2 → 1.96.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/svix/api_internal/message.rb +42 -0
- data/lib/svix/api_internal/message_pollerv2.rb +39 -0
- data/lib/svix/autoconfig_consumer.rb +50 -0
- data/lib/svix/internal.rb +1 -0
- data/lib/svix/models/auto_config_sink_type.rb +89 -0
- data/lib/svix/models/poller_v2_commit_in.rb +46 -0
- data/lib/svix/models/poller_v2_message_out.rb +89 -0
- data/lib/svix/models/poller_v2_poll_out.rb +49 -0
- data/lib/svix/models/sink_in_common.rb +90 -0
- data/lib/svix/models/starting_position.rb +29 -0
- data/lib/svix/models/stream_event_type_patch.rb +1 -5
- data/lib/svix/models/subscribe_in.rb +5 -2
- data/lib/svix/version.rb +1 -1
- metadata +11 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f88b9dba2b90d5ac2e689004858d024bc019de4138461fbb4fc1b72a7ba07df
|
|
4
|
+
data.tar.gz: 620ac703acdf65160739abebf27a428cda0d6798f1c1676dfbea58674e8fdd97
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '058639bd8271ef8ccaad109e94f50e51a95e628788b85feddab16700d0f6b30a8f50750c29241fd1bc70a6abc54b3a245e817bb2037bd548a8b57b6ba7734722'
|
|
7
|
+
data.tar.gz: 2b1ad2b44397a24d94adf61b28d7b9db900c557e1596de04c0d9272ee0f6d2110097eee50cdef1e2010d3c89278c466cb2ae716926db934ca7f8766d6e4a389c
|
data/Gemfile.lock
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
|
|
4
|
+
require "net/http"
|
|
5
|
+
|
|
6
|
+
module Svix
|
|
7
|
+
module_function
|
|
8
|
+
# Creates a [`MessageIn`] with a raw string payload.
|
|
9
|
+
#
|
|
10
|
+
# The payload is not normalized on the server. Normally, payloads are required
|
|
11
|
+
# to be JSON, and Svix will minify the payload before sending the webhook
|
|
12
|
+
# (for example, by removing extraneous whitespace or unnecessarily escaped
|
|
13
|
+
# characters in strings). With this function, the payload will be sent
|
|
14
|
+
# "as is", without any minification or other processing.
|
|
15
|
+
#
|
|
16
|
+
# `attributes[:payload]` must be a string. An extra attribute `content_type`
|
|
17
|
+
# is accepted that sets the `content-type` header of the webhook sent by Svix,
|
|
18
|
+
# overwriting the default of `application/json` if specified. Other than that,
|
|
19
|
+
# the attributes are forwarded [`MessageIn.new`], so all the same ones are
|
|
20
|
+
# accepted.
|
|
21
|
+
def message_in_raw(attributes = {})
|
|
22
|
+
attributes[:transformations_params] ||= {}
|
|
23
|
+
attributes[:transformations_params][:rawPayload] = attributes[:payload]
|
|
24
|
+
attributes[:payload] = {}
|
|
25
|
+
|
|
26
|
+
content_type = attributes.delete(:content_type)
|
|
27
|
+
if content_type != nil
|
|
28
|
+
attributes[:transformations_params][:headers] ||= {}
|
|
29
|
+
attributes[:transformations_params][:headers][:"content-type"] = content_type
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
MessageIn.new(attributes)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class Message
|
|
36
|
+
attr_accessor :pollerv2
|
|
37
|
+
def initialize(client)
|
|
38
|
+
@client = client
|
|
39
|
+
@pollerv2 = MessagePollerv2.new(client)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
|
|
4
|
+
require "net/http"
|
|
5
|
+
|
|
6
|
+
module Svix
|
|
7
|
+
class MessagePollerv2
|
|
8
|
+
def initialize(client)
|
|
9
|
+
@client = client
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def consumer_poll(app_id, sink_id, consumer_id, options = {})
|
|
13
|
+
options = options.transform_keys(&:to_s)
|
|
14
|
+
res = @client.execute_request(
|
|
15
|
+
"GET",
|
|
16
|
+
"/api/v1/app/#{app_id}/polling-endpoint/#{sink_id}/consumer/#{consumer_id}",
|
|
17
|
+
query_params: {
|
|
18
|
+
"limit" => options["limit"],
|
|
19
|
+
"lease_duration_ms" => options["lease_duration_ms"],
|
|
20
|
+
"starting_position" => options["starting_position"]
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
PollerV2PollOut.deserialize(res)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def consumer_commit(app_id, sink_id, consumer_id, poller_v2_commit_in, options = {})
|
|
27
|
+
options = options.transform_keys(&:to_s)
|
|
28
|
+
@client.execute_request(
|
|
29
|
+
"POST",
|
|
30
|
+
"/api/v1/app/#{app_id}/polling-endpoint/#{sink_id}/consumer/#{consumer_id}/commit",
|
|
31
|
+
headers: {
|
|
32
|
+
"idempotency-key" => options["idempotency-key"]
|
|
33
|
+
},
|
|
34
|
+
body: poller_v2_commit_in
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "svix/models/auto_config_sink_type"
|
|
4
|
+
require "svix/models/poller_v2_commit_in"
|
|
5
|
+
require "svix/models/sink_in_common"
|
|
6
|
+
require "svix/models/subscribe_in"
|
|
7
|
+
require "svix/api_internal/endpoint_auto_config"
|
|
8
|
+
require "svix/api_internal/message_pollerv2"
|
|
9
|
+
|
|
10
|
+
module Svix
|
|
11
|
+
class AutoConfigConsumer
|
|
12
|
+
def initialize(token, sink_in)
|
|
13
|
+
content = AutoConfig.decode_token!(token)
|
|
14
|
+
@app_id = content.fetch("app_id")
|
|
15
|
+
@sink_id = content.fetch("endpoint_id")
|
|
16
|
+
@sink_in = sink_in
|
|
17
|
+
@client = SvixHttpClient.new(
|
|
18
|
+
content.fetch("token_plaintext"),
|
|
19
|
+
URI(content.fetch("server_url"))
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def subscribe
|
|
24
|
+
poller = AutoConfigSinkTypeConfig::Poller.new(@sink_in.serialize)
|
|
25
|
+
subscribe_in = SubscribeIn.new(
|
|
26
|
+
"sink" => AutoConfigSinkType.new("config" => poller)
|
|
27
|
+
)
|
|
28
|
+
EndpointAutoConfig.new(@client).update(@app_id, @sink_id, subscribe_in)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def receive(consumer_id, options = {})
|
|
32
|
+
MessagePollerv2.new(@client).consumer_poll(
|
|
33
|
+
@app_id,
|
|
34
|
+
@sink_id,
|
|
35
|
+
consumer_id,
|
|
36
|
+
options
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def commit(consumer_id, offset, options = {})
|
|
41
|
+
MessagePollerv2.new(@client).consumer_commit(
|
|
42
|
+
@app_id,
|
|
43
|
+
@sink_id,
|
|
44
|
+
consumer_id,
|
|
45
|
+
PollerV2CommitIn.new("offset" => offset),
|
|
46
|
+
options
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
data/lib/svix/internal.rb
CHANGED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
require_relative "./endpoint_in"
|
|
6
|
+
require_relative "./sink_in_common"
|
|
7
|
+
|
|
8
|
+
module Svix
|
|
9
|
+
class AutoConfigSinkTypeConfig
|
|
10
|
+
class Poller < SinkInCommon
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class Http < EndpointIn
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class AutoConfigSinkType
|
|
18
|
+
attr_accessor :config
|
|
19
|
+
|
|
20
|
+
ALL_FIELD ||= ["config"].freeze
|
|
21
|
+
private_constant :ALL_FIELD
|
|
22
|
+
TYPE_TO_NAME = {
|
|
23
|
+
AutoConfigSinkTypeConfig::Poller => "poller",
|
|
24
|
+
AutoConfigSinkTypeConfig::Http => "http"
|
|
25
|
+
}
|
|
26
|
+
private_constant :TYPE_TO_NAME
|
|
27
|
+
NAME_TO_TYPE = TYPE_TO_NAME.invert
|
|
28
|
+
private_constant :NAME_TO_TYPE
|
|
29
|
+
|
|
30
|
+
def initialize(attributes = {})
|
|
31
|
+
unless attributes.is_a?(Hash)
|
|
32
|
+
fail(
|
|
33
|
+
ArgumentError,
|
|
34
|
+
"The input argument (attributes) must be a hash in `Svix::AutoConfigSinkType` new method"
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
attributes.each do |k, v|
|
|
39
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
40
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::AutoConfigSinkType")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
if k == "config"
|
|
44
|
+
unless TYPE_TO_NAME.key?(v.class)
|
|
45
|
+
fail(ArgumentError, "The field #{k} can't be a `#{v.class}` expected one of #{TYPE_TO_NAME.keys}")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
instance_variable_set("@__enum_discriminator", TYPE_TO_NAME[v.class])
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
instance_variable_set("@#{k}", v)
|
|
52
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
if @__enum_discriminator.nil?
|
|
56
|
+
fail(ArgumentError, "Required config field was not set")
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def self.deserialize(attributes = {})
|
|
61
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
62
|
+
attrs = Hash.new
|
|
63
|
+
unless NAME_TO_TYPE.key?(attributes["type"])
|
|
64
|
+
fail(ArgumentError, "Invalid type `#{attributes["type"]}` expected on of #{NAME_TO_TYPE.keys}")
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
unless attributes.key?("config")
|
|
68
|
+
fail(ArgumentError, "Missing required field config")
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
attrs["config"] = NAME_TO_TYPE[attributes["type"]].deserialize(attributes["config"])
|
|
72
|
+
new(attrs)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def serialize
|
|
76
|
+
out = Hash.new
|
|
77
|
+
out["type"] = @__enum_discriminator
|
|
78
|
+
out["config"] = @config.serialize
|
|
79
|
+
out
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Serializes the object to a json string
|
|
83
|
+
# @return String
|
|
84
|
+
def to_json
|
|
85
|
+
JSON.dump(serialize)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Svix
|
|
6
|
+
class PollerV2CommitIn
|
|
7
|
+
attr_accessor :offset
|
|
8
|
+
|
|
9
|
+
ALL_FIELD ||= ["offset"].freeze
|
|
10
|
+
private_constant :ALL_FIELD
|
|
11
|
+
|
|
12
|
+
def initialize(attributes = {})
|
|
13
|
+
unless attributes.is_a?(Hash)
|
|
14
|
+
fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::PollerV2CommitIn` new method")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
attributes.each do |k, v|
|
|
18
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
19
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::PollerV2CommitIn")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
instance_variable_set("@#{k}", v)
|
|
23
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.deserialize(attributes = {})
|
|
28
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
29
|
+
attrs = Hash.new
|
|
30
|
+
attrs["offset"] = attributes["offset"]
|
|
31
|
+
new(attrs)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def serialize
|
|
35
|
+
out = Hash.new
|
|
36
|
+
out["offset"] = Svix::serialize_primitive(@offset) if @offset
|
|
37
|
+
out
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Serializes the object to a json string
|
|
41
|
+
# @return String
|
|
42
|
+
def to_json
|
|
43
|
+
JSON.dump(serialize)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Svix
|
|
6
|
+
# The MessageOut equivalent of polling endpoint
|
|
7
|
+
class PollerV2MessageOut
|
|
8
|
+
# List of free-form identifiers that endpoints can filter by
|
|
9
|
+
attr_accessor :channels
|
|
10
|
+
attr_accessor :deliver_at
|
|
11
|
+
# Optional unique identifier for the message
|
|
12
|
+
attr_accessor :event_id
|
|
13
|
+
# The event type's name
|
|
14
|
+
attr_accessor :event_type
|
|
15
|
+
attr_accessor :headers
|
|
16
|
+
# The Message's ID.
|
|
17
|
+
attr_accessor :id
|
|
18
|
+
attr_accessor :offset
|
|
19
|
+
attr_accessor :payload
|
|
20
|
+
attr_accessor :tags
|
|
21
|
+
attr_accessor :timestamp
|
|
22
|
+
|
|
23
|
+
ALL_FIELD ||= [
|
|
24
|
+
"channels",
|
|
25
|
+
"deliver_at",
|
|
26
|
+
"event_id",
|
|
27
|
+
"event_type",
|
|
28
|
+
"headers",
|
|
29
|
+
"id",
|
|
30
|
+
"offset",
|
|
31
|
+
"payload",
|
|
32
|
+
"tags",
|
|
33
|
+
"timestamp"
|
|
34
|
+
].freeze
|
|
35
|
+
private_constant :ALL_FIELD
|
|
36
|
+
|
|
37
|
+
def initialize(attributes = {})
|
|
38
|
+
unless attributes.is_a?(Hash)
|
|
39
|
+
fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::PollerV2MessageOut` new method")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
attributes.each do |k, v|
|
|
43
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
44
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::PollerV2MessageOut")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
instance_variable_set("@#{k}", v)
|
|
48
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.deserialize(attributes = {})
|
|
53
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
54
|
+
attrs = Hash.new
|
|
55
|
+
attrs["channels"] = attributes["channels"]
|
|
56
|
+
attrs["deliver_at"] = DateTime.rfc3339(attributes["deliverAt"]).to_time if attributes["deliverAt"]
|
|
57
|
+
attrs["event_id"] = attributes["eventId"]
|
|
58
|
+
attrs["event_type"] = attributes["eventType"]
|
|
59
|
+
attrs["headers"] = attributes["headers"]
|
|
60
|
+
attrs["id"] = attributes["id"]
|
|
61
|
+
attrs["offset"] = attributes["offset"]
|
|
62
|
+
attrs["payload"] = attributes["payload"]
|
|
63
|
+
attrs["tags"] = attributes["tags"]
|
|
64
|
+
attrs["timestamp"] = DateTime.rfc3339(attributes["timestamp"]).to_time
|
|
65
|
+
new(attrs)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def serialize
|
|
69
|
+
out = Hash.new
|
|
70
|
+
out["channels"] = Svix::serialize_primitive(@channels) if @channels
|
|
71
|
+
out["deliverAt"] = Svix::serialize_primitive(@deliver_at) if @deliver_at
|
|
72
|
+
out["eventId"] = Svix::serialize_primitive(@event_id) if @event_id
|
|
73
|
+
out["eventType"] = Svix::serialize_primitive(@event_type) if @event_type
|
|
74
|
+
out["headers"] = Svix::serialize_primitive(@headers) if @headers
|
|
75
|
+
out["id"] = Svix::serialize_primitive(@id) if @id
|
|
76
|
+
out["offset"] = Svix::serialize_primitive(@offset) if @offset
|
|
77
|
+
out["payload"] = Svix::serialize_primitive(@payload) if @payload
|
|
78
|
+
out["tags"] = Svix::serialize_primitive(@tags) if @tags
|
|
79
|
+
out["timestamp"] = Svix::serialize_primitive(@timestamp) if @timestamp
|
|
80
|
+
out
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Serializes the object to a json string
|
|
84
|
+
# @return String
|
|
85
|
+
def to_json
|
|
86
|
+
JSON.dump(serialize)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Svix
|
|
6
|
+
class PollerV2PollOut
|
|
7
|
+
attr_accessor :data
|
|
8
|
+
attr_accessor :done
|
|
9
|
+
|
|
10
|
+
ALL_FIELD ||= ["data", "done"].freeze
|
|
11
|
+
private_constant :ALL_FIELD
|
|
12
|
+
|
|
13
|
+
def initialize(attributes = {})
|
|
14
|
+
unless attributes.is_a?(Hash)
|
|
15
|
+
fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::PollerV2PollOut` new method")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
attributes.each do |k, v|
|
|
19
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
20
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::PollerV2PollOut")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
instance_variable_set("@#{k}", v)
|
|
24
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.deserialize(attributes = {})
|
|
29
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
30
|
+
attrs = Hash.new
|
|
31
|
+
attrs["data"] = attributes["data"].map { |v| Svix::PollerV2MessageOut.deserialize(v) }
|
|
32
|
+
attrs["done"] = attributes["done"]
|
|
33
|
+
new(attrs)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def serialize
|
|
37
|
+
out = Hash.new
|
|
38
|
+
out["data"] = @data.map { |v| v.serialize } if @data
|
|
39
|
+
out["done"] = Svix::serialize_primitive(@done) if @done
|
|
40
|
+
out
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Serializes the object to a json string
|
|
44
|
+
# @return String
|
|
45
|
+
def to_json
|
|
46
|
+
JSON.dump(serialize)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Svix
|
|
6
|
+
class SinkInCommon
|
|
7
|
+
# List of message channels this sink listens to (omit for all).
|
|
8
|
+
attr_accessor :channels
|
|
9
|
+
attr_accessor :description
|
|
10
|
+
attr_accessor :disabled
|
|
11
|
+
attr_accessor :filter_types
|
|
12
|
+
attr_accessor :metadata
|
|
13
|
+
# Deprecated, use `throttleRate` instead.
|
|
14
|
+
attr_accessor :rate_limit
|
|
15
|
+
# The endpoint's verification secret.
|
|
16
|
+
#
|
|
17
|
+
# Format: `base64` encoded random bytes optionally prefixed with `whsec_`.
|
|
18
|
+
# It is recommended to not set this and let the server generate the secret.
|
|
19
|
+
attr_accessor :secret
|
|
20
|
+
# Maximum messages per second to send to this endpoint.
|
|
21
|
+
#
|
|
22
|
+
# Outgoing messages will be throttled to this rate.
|
|
23
|
+
attr_accessor :throttle_rate
|
|
24
|
+
# Optional unique identifier for the sink.
|
|
25
|
+
attr_accessor :uid
|
|
26
|
+
|
|
27
|
+
ALL_FIELD ||= [
|
|
28
|
+
"channels",
|
|
29
|
+
"description",
|
|
30
|
+
"disabled",
|
|
31
|
+
"filter_types",
|
|
32
|
+
"metadata",
|
|
33
|
+
"rate_limit",
|
|
34
|
+
"secret",
|
|
35
|
+
"throttle_rate",
|
|
36
|
+
"uid"
|
|
37
|
+
].freeze
|
|
38
|
+
private_constant :ALL_FIELD
|
|
39
|
+
|
|
40
|
+
def initialize(attributes = {})
|
|
41
|
+
unless attributes.is_a?(Hash)
|
|
42
|
+
fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::SinkInCommon` new method")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
attributes.each do |k, v|
|
|
46
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
47
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::SinkInCommon")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
instance_variable_set("@#{k}", v)
|
|
51
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def self.deserialize(attributes = {})
|
|
56
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
57
|
+
attrs = Hash.new
|
|
58
|
+
attrs["channels"] = attributes["channels"]
|
|
59
|
+
attrs["description"] = attributes["description"]
|
|
60
|
+
attrs["disabled"] = attributes["disabled"]
|
|
61
|
+
attrs["filter_types"] = attributes["filterTypes"]
|
|
62
|
+
attrs["metadata"] = attributes["metadata"]
|
|
63
|
+
attrs["rate_limit"] = attributes["rateLimit"]
|
|
64
|
+
attrs["secret"] = attributes["secret"]
|
|
65
|
+
attrs["throttle_rate"] = attributes["throttleRate"]
|
|
66
|
+
attrs["uid"] = attributes["uid"]
|
|
67
|
+
new(attrs)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def serialize
|
|
71
|
+
out = Hash.new
|
|
72
|
+
out["channels"] = Svix::serialize_primitive(@channels) if @channels
|
|
73
|
+
out["description"] = Svix::serialize_primitive(@description) if @description
|
|
74
|
+
out["disabled"] = Svix::serialize_primitive(@disabled) if @disabled
|
|
75
|
+
out["filterTypes"] = Svix::serialize_primitive(@filter_types) if @filter_types
|
|
76
|
+
out["metadata"] = Svix::serialize_primitive(@metadata) if @metadata
|
|
77
|
+
out["rateLimit"] = Svix::serialize_primitive(@rate_limit) if @rate_limit
|
|
78
|
+
out["secret"] = Svix::serialize_primitive(@secret) if @secret
|
|
79
|
+
out["throttleRate"] = Svix::serialize_primitive(@throttle_rate) if @throttle_rate
|
|
80
|
+
out["uid"] = Svix::serialize_primitive(@uid) if @uid
|
|
81
|
+
out
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Serializes the object to a json string
|
|
85
|
+
# @return String
|
|
86
|
+
def to_json
|
|
87
|
+
JSON.dump(serialize)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module Svix
|
|
4
|
+
class StartingPosition
|
|
5
|
+
EARLIEST = "earliest".freeze
|
|
6
|
+
LATEST = "latest".freeze
|
|
7
|
+
|
|
8
|
+
def self.all_vars
|
|
9
|
+
@all_vars ||= [EARLIEST, LATEST].freeze
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def initialize(value)
|
|
13
|
+
unless StartingPosition.all_vars.include?(value)
|
|
14
|
+
raise "Invalid ENUM value '#{value}' for class #StartingPosition"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
@value = value
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.deserialize(value)
|
|
21
|
+
return value if StartingPosition.all_vars.include?(value)
|
|
22
|
+
raise "Invalid ENUM value '#{value}' for class #StartingPosition"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def serialize
|
|
26
|
+
@value
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -8,10 +8,8 @@ module Svix
|
|
|
8
8
|
attr_accessor :deprecated
|
|
9
9
|
attr_accessor :description
|
|
10
10
|
attr_accessor :feature_flags
|
|
11
|
-
# The event type's name
|
|
12
|
-
attr_accessor :name
|
|
13
11
|
|
|
14
|
-
ALL_FIELD ||= ["archived", "deprecated", "description", "feature_flags"
|
|
12
|
+
ALL_FIELD ||= ["archived", "deprecated", "description", "feature_flags"].freeze
|
|
15
13
|
private_constant :ALL_FIELD
|
|
16
14
|
|
|
17
15
|
def initialize(attributes = {})
|
|
@@ -36,7 +34,6 @@ module Svix
|
|
|
36
34
|
attrs["deprecated"] = attributes["deprecated"]
|
|
37
35
|
attrs["description"] = attributes["description"]
|
|
38
36
|
attrs["feature_flags"] = attributes["featureFlags"]
|
|
39
|
-
attrs["name"] = attributes["name"]
|
|
40
37
|
new(attrs)
|
|
41
38
|
end
|
|
42
39
|
|
|
@@ -46,7 +43,6 @@ module Svix
|
|
|
46
43
|
out["deprecated"] = Svix::serialize_primitive(@deprecated) if @deprecated
|
|
47
44
|
out["description"] = Svix::serialize_primitive(@description) if @__description_is_defined
|
|
48
45
|
out["featureFlags"] = Svix::serialize_primitive(@feature_flags) if @__feature_flags_is_defined
|
|
49
|
-
out["name"] = Svix::serialize_primitive(@name) if @__name_is_defined
|
|
50
46
|
out
|
|
51
47
|
end
|
|
52
48
|
|
|
@@ -5,8 +5,9 @@ require "json"
|
|
|
5
5
|
module Svix
|
|
6
6
|
class SubscribeIn
|
|
7
7
|
attr_accessor :endpoint
|
|
8
|
+
attr_accessor :sink
|
|
8
9
|
|
|
9
|
-
ALL_FIELD ||= ["endpoint"].freeze
|
|
10
|
+
ALL_FIELD ||= ["endpoint", "sink"].freeze
|
|
10
11
|
private_constant :ALL_FIELD
|
|
11
12
|
|
|
12
13
|
def initialize(attributes = {})
|
|
@@ -27,13 +28,15 @@ module Svix
|
|
|
27
28
|
def self.deserialize(attributes = {})
|
|
28
29
|
attributes = attributes.transform_keys(&:to_s)
|
|
29
30
|
attrs = Hash.new
|
|
30
|
-
attrs["endpoint"] = Svix::EndpointIn.deserialize(attributes["endpoint"])
|
|
31
|
+
attrs["endpoint"] = Svix::EndpointIn.deserialize(attributes["endpoint"]) if attributes["endpoint"]
|
|
32
|
+
attrs["sink"] = Svix::AutoConfigSinkType.deserialize(attributes["sink"]) if attributes["sink"]
|
|
31
33
|
new(attrs)
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
def serialize
|
|
35
37
|
out = Hash.new
|
|
36
38
|
out["endpoint"] = Svix::serialize_schema_ref(@endpoint) if @endpoint
|
|
39
|
+
out["sink"] = Svix::serialize_schema_ref(@sink) if @sink
|
|
37
40
|
out
|
|
38
41
|
end
|
|
39
42
|
|
data/lib/svix/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: svix
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.96.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Svix
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-06-
|
|
10
|
+
date: 2026-06-18 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: base64
|
|
@@ -117,7 +117,10 @@ files:
|
|
|
117
117
|
- lib/svix/api_error.rb
|
|
118
118
|
- lib/svix/api_internal/endpoint.rb
|
|
119
119
|
- lib/svix/api_internal/endpoint_auto_config.rb
|
|
120
|
+
- lib/svix/api_internal/message.rb
|
|
121
|
+
- lib/svix/api_internal/message_pollerv2.rb
|
|
120
122
|
- lib/svix/autoconfig.rb
|
|
123
|
+
- lib/svix/autoconfig_consumer.rb
|
|
121
124
|
- lib/svix/errors.rb
|
|
122
125
|
- lib/svix/http_error_out.rb
|
|
123
126
|
- lib/svix/http_validation_error.rb
|
|
@@ -138,6 +141,7 @@ files:
|
|
|
138
141
|
- lib/svix/models/application_out.rb
|
|
139
142
|
- lib/svix/models/application_patch.rb
|
|
140
143
|
- lib/svix/models/application_token_expire_in.rb
|
|
144
|
+
- lib/svix/models/auto_config_sink_type.rb
|
|
141
145
|
- lib/svix/models/azure_blob_storage_config.rb
|
|
142
146
|
- lib/svix/models/azure_blob_storage_patch_config.rb
|
|
143
147
|
- lib/svix/models/background_task_finished_event.rb
|
|
@@ -293,6 +297,9 @@ files:
|
|
|
293
297
|
- lib/svix/models/otel_tracing_patch_config.rb
|
|
294
298
|
- lib/svix/models/panda_doc_config.rb
|
|
295
299
|
- lib/svix/models/panda_doc_config_out.rb
|
|
300
|
+
- lib/svix/models/poller_v2_commit_in.rb
|
|
301
|
+
- lib/svix/models/poller_v2_message_out.rb
|
|
302
|
+
- lib/svix/models/poller_v2_poll_out.rb
|
|
296
303
|
- lib/svix/models/polling_endpoint_consumer_seek_in.rb
|
|
297
304
|
- lib/svix/models/polling_endpoint_consumer_seek_out.rb
|
|
298
305
|
- lib/svix/models/polling_endpoint_message_out.rb
|
|
@@ -317,6 +324,7 @@ files:
|
|
|
317
324
|
- lib/svix/models/shopify_config.rb
|
|
318
325
|
- lib/svix/models/shopify_config_out.rb
|
|
319
326
|
- lib/svix/models/sink_http_config.rb
|
|
327
|
+
- lib/svix/models/sink_in_common.rb
|
|
320
328
|
- lib/svix/models/sink_otel_v1_config.rb
|
|
321
329
|
- lib/svix/models/sink_secret_out.rb
|
|
322
330
|
- lib/svix/models/sink_status.rb
|
|
@@ -331,6 +339,7 @@ files:
|
|
|
331
339
|
- lib/svix/models/sns_patch_config.rb
|
|
332
340
|
- lib/svix/models/sqs_config.rb
|
|
333
341
|
- lib/svix/models/sqs_patch_config.rb
|
|
342
|
+
- lib/svix/models/starting_position.rb
|
|
334
343
|
- lib/svix/models/status_code_class.rb
|
|
335
344
|
- lib/svix/models/stream_event_type_in.rb
|
|
336
345
|
- lib/svix/models/stream_event_type_out.rb
|