noresponse 2.1.6 → 2.1.8
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/lib/no_response/late_results.rb +31 -0
- data/lib/no_response/models/operations/listwebhookdeliveries_request.rb +45 -0
- data/lib/no_response/models/operations/listwebhookdeliveries_request.rbi +26 -0
- data/lib/no_response/models/operations/listwebhookdeliveries_response.rb +44 -0
- data/lib/no_response/models/operations/listwebhookdeliveries_response.rbi +20 -0
- data/lib/no_response/models/operations/replaywebhookdelivery_request.rb +37 -0
- data/lib/no_response/models/operations/replaywebhookdelivery_request.rbi +26 -0
- data/lib/no_response/models/operations/replaywebhookdelivery_response.rb +32 -0
- data/lib/no_response/models/operations/replaywebhookdelivery_response.rbi +20 -0
- data/lib/no_response/models/operations.rb +4 -0
- data/lib/no_response/models/shared/eventtype.rb +18 -0
- data/lib/no_response/models/shared/eventtype.rbi +9 -0
- data/lib/no_response/models/shared/failure.rb +24 -0
- data/lib/no_response/models/shared/failure.rbi +9 -0
- data/lib/no_response/models/shared/webhookdeliveryattempt.rb +137 -0
- data/lib/no_response/models/shared/webhookdeliveryattempt.rbi +62 -0
- data/lib/no_response/models/shared/webhookdeliveryattemptstatus.rb +19 -0
- data/lib/no_response/models/shared/webhookdeliveryattemptstatus.rbi +9 -0
- data/lib/no_response/models/shared/webhookdeliverylist.rb +56 -0
- data/lib/no_response/models/shared/webhookdeliverylist.rbi +26 -0
- data/lib/no_response/models/shared/webhookreplay.rb +55 -0
- data/lib/no_response/models/shared/webhookreplay.rbi +26 -0
- data/lib/no_response/models/shared/webhookreplayrequest.rb +23 -0
- data/lib/no_response/models/shared/webhookreplayrequest.rbi +9 -0
- data/lib/no_response/models/shared.rb +7 -0
- data/lib/no_response/sdkconfiguration.rb +2 -2
- data/lib/no_response/webhookendpoints.rb +605 -0
- metadata +23 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 23eb30fbb62a49330cd9e5db69140d6ccfeb408d7a44937d594f54e4b8482761
|
|
4
|
+
data.tar.gz: 7d11e9e140129264da5d4a897096a10e15a01c68d6bd991a0645357cac0b6058
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 30f786d6011a91db0826d647bd31a7a987c46a4ccc4bef38f0b08c537a29aac412ecde15e3a53241135ae9508a727489cc9071460f04a47f0ea2bf3575f79595
|
|
7
|
+
data.tar.gz: a0150b0114a84e97d0ccb31aeb56bfe1500f9664e6e139912c9eb258bda05b9df1500facc100b5a0734aeaa7fa817f04d6b292b84c4476604a119a5379f329bf
|
|
@@ -156,6 +156,17 @@ module NoResponse
|
|
|
156
156
|
|
|
157
157
|
Auth0.new(Caller.new('auth0', base, "Bearer #{token}", http_client))
|
|
158
158
|
end
|
|
159
|
+
|
|
160
|
+
# A provider for an app with its own login, or for trying the handler
|
|
161
|
+
# before you wire up a real one. revoke_sessions and ban each log one
|
|
162
|
+
# line saying what they would do and call nothing: no request leaves
|
|
163
|
+
# your process. log is any callable that takes the line; the default
|
|
164
|
+
# writes it to standard error with Kernel#warn. Replace it with your own
|
|
165
|
+
# provider (name, revoke_sessions and ban) once you know what revoking
|
|
166
|
+
# and banning mean in your app.
|
|
167
|
+
def log_only(log: nil)
|
|
168
|
+
LogOnly.new(log || ->(line) { Kernel.warn(line) })
|
|
169
|
+
end
|
|
159
170
|
end
|
|
160
171
|
|
|
161
172
|
# One provider HTTP client: base URL, Authorization header, error mapping.
|
|
@@ -303,5 +314,25 @@ module NoResponse
|
|
|
303
314
|
revoke_sessions(user_id)
|
|
304
315
|
end
|
|
305
316
|
end
|
|
317
|
+
|
|
318
|
+
class LogOnly
|
|
319
|
+
def initialize(log)
|
|
320
|
+
@log = log
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def name = 'log_only'
|
|
324
|
+
|
|
325
|
+
def revoke_sessions(user_id)
|
|
326
|
+
Segment.encode(user_id)
|
|
327
|
+
@log.call("NoResponse late result (log only): would revoke every session of user #{user_id}")
|
|
328
|
+
nil
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
def ban(user_id)
|
|
332
|
+
Segment.encode(user_id)
|
|
333
|
+
@log.call("NoResponse late result (log only): would ban user #{user_id} and end their sessions")
|
|
334
|
+
nil
|
|
335
|
+
end
|
|
336
|
+
end
|
|
306
337
|
end
|
|
307
338
|
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Operations
|
|
7
|
+
|
|
8
|
+
class ListWebhookDeliveriesRequest
|
|
9
|
+
extend T::Sig
|
|
10
|
+
include Crystalline::MetadataFields
|
|
11
|
+
|
|
12
|
+
# The endpoint's whe_ id. An id that is unknown, malformed or another tenant's answers 404.
|
|
13
|
+
field :endpoint_id, ::String, {'path_param': {'field_name': "endpoint_id", 'style': "simple", 'explode': false}}
|
|
14
|
+
# next_cursor from the previous page, unchanged.
|
|
15
|
+
field(
|
|
16
|
+
:cursor,
|
|
17
|
+
Crystalline::Nilable.new(::String),
|
|
18
|
+
{'query_param': {'field_name': "cursor", 'style': "form", 'explode': true}}
|
|
19
|
+
)
|
|
20
|
+
# Attempts per page.
|
|
21
|
+
field(
|
|
22
|
+
:limit,
|
|
23
|
+
Crystalline::Nilable.new(::Integer),
|
|
24
|
+
{'query_param': {'field_name': "limit", 'style': "form", 'explode': true}}
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
sig { params(endpoint_id: ::String, cursor: T.nilable(::String), limit: T.nilable(::Integer)).void }
|
|
28
|
+
def initialize(endpoint_id:, cursor: nil, limit: 20)
|
|
29
|
+
@endpoint_id = endpoint_id
|
|
30
|
+
@cursor = cursor
|
|
31
|
+
@limit = limit
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
35
|
+
def ==(other)
|
|
36
|
+
return false unless other.is_a?(self.class)
|
|
37
|
+
return false unless @endpoint_id == other.endpoint_id
|
|
38
|
+
return false unless @cursor == other.cursor
|
|
39
|
+
return false unless @limit == other.limit
|
|
40
|
+
true
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
class NoResponse::Models::Operations::ListWebhookDeliveriesRequest
|
|
5
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class NoResponse::Models::Operations::ListWebhookDeliveriesRequest
|
|
9
|
+
def endpoint_id
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def endpoint_id=(str_)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def cursor
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def cursor=(str_)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def limit
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def limit=(str_)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Operations
|
|
7
|
+
|
|
8
|
+
class ListWebhookDeliveriesResponse
|
|
9
|
+
extend T::Sig
|
|
10
|
+
include Crystalline::MetadataFields
|
|
11
|
+
sig { returns(T.proc.returns(T.nilable(ListWebhookDeliveriesResponse))) }
|
|
12
|
+
attr_accessor :next_page
|
|
13
|
+
|
|
14
|
+
field :headers, Crystalline::Hash.new(Symbol, Crystalline::Array.new(::String))
|
|
15
|
+
|
|
16
|
+
field :result, Models::Shared::WebhookDeliveryList, {}
|
|
17
|
+
|
|
18
|
+
sig { params(headers: T::Hash[Symbol, T::Array[::String]], result: Models::Shared::WebhookDeliveryList).void }
|
|
19
|
+
def initialize(headers:, result:)
|
|
20
|
+
@headers = headers
|
|
21
|
+
@result = result
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
25
|
+
def ==(other)
|
|
26
|
+
return false unless other.is_a?(self.class)
|
|
27
|
+
return false unless @headers == other.headers
|
|
28
|
+
return false unless @result == other.result
|
|
29
|
+
true
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def each
|
|
33
|
+
page = self
|
|
34
|
+
loop do
|
|
35
|
+
yield page
|
|
36
|
+
next_page = page.next_page.call if page.next_page
|
|
37
|
+
break if next_page.nil?
|
|
38
|
+
page = T.must(next_page)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
class NoResponse::Models::Operations::ListWebhookDeliveriesResponse
|
|
5
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class NoResponse::Models::Operations::ListWebhookDeliveriesResponse
|
|
9
|
+
def headers
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def headers=(str_)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def result
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def result=(str_)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Operations
|
|
7
|
+
|
|
8
|
+
class ReplayWebhookDeliveryRequest
|
|
9
|
+
extend T::Sig
|
|
10
|
+
include Crystalline::MetadataFields
|
|
11
|
+
|
|
12
|
+
# The endpoint's whe_ id. An id that is unknown, malformed or another tenant's answers 404.
|
|
13
|
+
field :endpoint_id, ::String, {'path_param': {'field_name': "endpoint_id", 'style': "simple", 'explode': false}}
|
|
14
|
+
# The evt_ id of a delivery the endpoint's log holds, as GET /v1/webhooks/{endpoint_id}/deliveries lists it. An id that is malformed, not sent to this endpoint, past the log's retention or another tenant's answers 404.
|
|
15
|
+
field :event_id, ::String, {'path_param': {'field_name': "event_id", 'style': "simple", 'explode': false}}
|
|
16
|
+
|
|
17
|
+
field :body, Models::Shared::WebhookReplayRequest, {'request': {'media_type': "application/json"}}
|
|
18
|
+
|
|
19
|
+
sig { params(endpoint_id: ::String, event_id: ::String, body: Models::Shared::WebhookReplayRequest).void }
|
|
20
|
+
def initialize(endpoint_id:, event_id:, body:)
|
|
21
|
+
@endpoint_id = endpoint_id
|
|
22
|
+
@event_id = event_id
|
|
23
|
+
@body = body
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
27
|
+
def ==(other)
|
|
28
|
+
return false unless other.is_a?(self.class)
|
|
29
|
+
return false unless @endpoint_id == other.endpoint_id
|
|
30
|
+
return false unless @event_id == other.event_id
|
|
31
|
+
return false unless @body == other.body
|
|
32
|
+
true
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
class NoResponse::Models::Operations::ReplayWebhookDeliveryRequest
|
|
5
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class NoResponse::Models::Operations::ReplayWebhookDeliveryRequest
|
|
9
|
+
def endpoint_id
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def endpoint_id=(str_)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def event_id
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def event_id=(str_)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def body
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def body=(str_)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Operations
|
|
7
|
+
|
|
8
|
+
class ReplayWebhookDeliveryResponse
|
|
9
|
+
extend T::Sig
|
|
10
|
+
include Crystalline::MetadataFields
|
|
11
|
+
|
|
12
|
+
field :headers, Crystalline::Hash.new(Symbol, Crystalline::Array.new(::String))
|
|
13
|
+
|
|
14
|
+
field :result, Models::Shared::WebhookReplay, {}
|
|
15
|
+
|
|
16
|
+
sig { params(headers: T::Hash[Symbol, T::Array[::String]], result: Models::Shared::WebhookReplay).void }
|
|
17
|
+
def initialize(headers:, result:)
|
|
18
|
+
@headers = headers
|
|
19
|
+
@result = result
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
23
|
+
def ==(other)
|
|
24
|
+
return false unless other.is_a?(self.class)
|
|
25
|
+
return false unless @headers == other.headers
|
|
26
|
+
return false unless @result == other.result
|
|
27
|
+
true
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
class NoResponse::Models::Operations::ReplayWebhookDeliveryResponse
|
|
5
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class NoResponse::Models::Operations::ReplayWebhookDeliveryResponse
|
|
9
|
+
def headers
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def headers=(str_)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def result
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def result=(str_)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -19,10 +19,14 @@ module NoResponse
|
|
|
19
19
|
autoload :ListAccountAssessmentsRequest, "no_response/models/operations/listaccountassessments_request.rb"
|
|
20
20
|
autoload :ListAccountAssessmentsResponse, "no_response/models/operations/listaccountassessments_response.rb"
|
|
21
21
|
autoload :ListIntegrationsResponse, "no_response/models/operations/listintegrations_response.rb"
|
|
22
|
+
autoload :ListWebhookDeliveriesRequest, "no_response/models/operations/listwebhookdeliveries_request.rb"
|
|
23
|
+
autoload :ListWebhookDeliveriesResponse, "no_response/models/operations/listwebhookdeliveries_response.rb"
|
|
22
24
|
autoload :ListWebhookEndpointsResponse, "no_response/models/operations/listwebhookendpoints_response.rb"
|
|
23
25
|
autoload :QueryAccountAssessmentsResponse, "no_response/models/operations/queryaccountassessments_response.rb"
|
|
24
26
|
autoload :RecordAssessmentOutcomeRequest, "no_response/models/operations/recordassessmentoutcome_request.rb"
|
|
25
27
|
autoload :RecordAssessmentOutcomeResponse, "no_response/models/operations/recordassessmentoutcome_response.rb"
|
|
28
|
+
autoload :ReplayWebhookDeliveryRequest, "no_response/models/operations/replaywebhookdelivery_request.rb"
|
|
29
|
+
autoload :ReplayWebhookDeliveryResponse, "no_response/models/operations/replaywebhookdelivery_response.rb"
|
|
26
30
|
autoload :RotateApiKeyResponse, "no_response/models/operations/rotateapikey_response.rb"
|
|
27
31
|
autoload :RotateIntegrationSecretRequest, "no_response/models/operations/rotateintegrationsecret_request.rb"
|
|
28
32
|
autoload :RotateIntegrationSecretResponse, "no_response/models/operations/rotateintegrationsecret_response.rb"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Shared
|
|
7
|
+
|
|
8
|
+
class EventType
|
|
9
|
+
include ::Crystalline::Enum
|
|
10
|
+
enums do
|
|
11
|
+
ASSESSMENT_UPDATED = new("assessment.updated")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
open!
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Shared
|
|
7
|
+
# Failure - Why the attempt failed: the URL is no longer valid, the host did not resolve, it resolved to an address that is not public, no answer within 5 seconds, the connection failed, a 3xx (redirects are not followed) or another non-2xx status. Absent for a delivered attempt.
|
|
8
|
+
class Failure
|
|
9
|
+
include ::Crystalline::Enum
|
|
10
|
+
enums do
|
|
11
|
+
INVALID_URL = new("invalid_url")
|
|
12
|
+
RESOLVE_FAILED = new("resolve_failed")
|
|
13
|
+
ADDRESS_REFUSED = new("address_refused")
|
|
14
|
+
TIMEOUT = new("timeout")
|
|
15
|
+
CONNECTION_FAILED = new("connection_failed")
|
|
16
|
+
REDIRECT = new("redirect")
|
|
17
|
+
NON_2XX = new("non_2xx")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
open!
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Shared
|
|
7
|
+
|
|
8
|
+
class WebhookDeliveryAttempt
|
|
9
|
+
extend T::Sig
|
|
10
|
+
include Crystalline::MetadataFields
|
|
11
|
+
|
|
12
|
+
# The event id the receiver saw as NR-Webhook-Id and as the body's id. Replay it with POST /v1/webhooks/{endpoint_id}/deliveries/{event_id}/replay.
|
|
13
|
+
field(
|
|
14
|
+
:event_id,
|
|
15
|
+
::String,
|
|
16
|
+
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("event_id"), required: true}}
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
field(
|
|
20
|
+
:event_type,
|
|
21
|
+
Models::Shared::EventType,
|
|
22
|
+
{
|
|
23
|
+
'format_json': {
|
|
24
|
+
'letter_case': ::NoResponse::Utils.field_name("event_type"),
|
|
25
|
+
required: true,
|
|
26
|
+
'decoder': ::NoResponse::Utils.open_enum_from_string(Models::Shared::EventType, false)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
# Which attempt of this delivery this was: 1 for the first send, up to 9 with retries. A replay counts its own attempts from 1.
|
|
31
|
+
field(
|
|
32
|
+
:attempt,
|
|
33
|
+
::Integer,
|
|
34
|
+
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("attempt"), required: true}}
|
|
35
|
+
)
|
|
36
|
+
# true for an attempt of a replay you asked for.
|
|
37
|
+
field(
|
|
38
|
+
:replay,
|
|
39
|
+
Crystalline::Boolean.new,
|
|
40
|
+
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("replay"), required: true}}
|
|
41
|
+
)
|
|
42
|
+
# delivered when the endpoint answered 2xx; failed otherwise, with failure naming why.
|
|
43
|
+
field(
|
|
44
|
+
:status,
|
|
45
|
+
Models::Shared::WebhookDeliveryAttemptStatus,
|
|
46
|
+
{
|
|
47
|
+
'format_json': {
|
|
48
|
+
'letter_case': ::NoResponse::Utils.field_name("status"),
|
|
49
|
+
required: true,
|
|
50
|
+
'decoder': ::NoResponse::Utils.open_enum_from_string(Models::Shared::WebhookDeliveryAttemptStatus, false)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
# Milliseconds from sending the request to the answer or the failure.
|
|
55
|
+
field(
|
|
56
|
+
:latency_ms,
|
|
57
|
+
::Integer,
|
|
58
|
+
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("latency_ms"), required: true}}
|
|
59
|
+
)
|
|
60
|
+
# When the request was sent. Its NR-Webhook-Timestamp is this time in Unix seconds.
|
|
61
|
+
field(
|
|
62
|
+
:attempted_at,
|
|
63
|
+
::String,
|
|
64
|
+
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("attempted_at"), required: true}}
|
|
65
|
+
)
|
|
66
|
+
# The HTTP status the endpoint answered. Absent when no response was read.
|
|
67
|
+
field(
|
|
68
|
+
:response_code,
|
|
69
|
+
Crystalline::Nilable.new(::Integer),
|
|
70
|
+
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("response_code")}}
|
|
71
|
+
)
|
|
72
|
+
# Why the attempt failed: the URL is no longer valid, the host did not resolve, it resolved to an address that is not public, no answer within 5 seconds, the connection failed, a 3xx (redirects are not followed) or another non-2xx status. Absent for a delivered attempt.
|
|
73
|
+
field(
|
|
74
|
+
:failure,
|
|
75
|
+
Crystalline::Nilable.new(Models::Shared::Failure),
|
|
76
|
+
{
|
|
77
|
+
'format_json': {
|
|
78
|
+
'letter_case': ::NoResponse::Utils.field_name("failure"),
|
|
79
|
+
'decoder': ::NoResponse::Utils.open_enum_from_string(Models::Shared::Failure, true)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
sig {
|
|
85
|
+
params(
|
|
86
|
+
event_id: ::String,
|
|
87
|
+
event_type: Models::Shared::EventType,
|
|
88
|
+
attempt: ::Integer,
|
|
89
|
+
replay: T::Boolean,
|
|
90
|
+
status: Models::Shared::WebhookDeliveryAttemptStatus,
|
|
91
|
+
latency_ms: ::Integer,
|
|
92
|
+
attempted_at: ::String,
|
|
93
|
+
response_code: T.nilable(::Integer),
|
|
94
|
+
failure: T.nilable(Models::Shared::Failure)
|
|
95
|
+
)
|
|
96
|
+
.void
|
|
97
|
+
}
|
|
98
|
+
def initialize(
|
|
99
|
+
event_id:,
|
|
100
|
+
event_type:,
|
|
101
|
+
attempt:,
|
|
102
|
+
replay:,
|
|
103
|
+
status:,
|
|
104
|
+
latency_ms:,
|
|
105
|
+
attempted_at:,
|
|
106
|
+
response_code: nil,
|
|
107
|
+
failure: nil
|
|
108
|
+
)
|
|
109
|
+
@event_id = event_id
|
|
110
|
+
@event_type = event_type
|
|
111
|
+
@attempt = attempt
|
|
112
|
+
@replay = replay
|
|
113
|
+
@status = status
|
|
114
|
+
@latency_ms = latency_ms
|
|
115
|
+
@attempted_at = attempted_at
|
|
116
|
+
@response_code = response_code
|
|
117
|
+
@failure = failure
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
121
|
+
def ==(other)
|
|
122
|
+
return false unless other.is_a?(self.class)
|
|
123
|
+
return false unless @event_id == other.event_id
|
|
124
|
+
return false unless @event_type == other.event_type
|
|
125
|
+
return false unless @attempt == other.attempt
|
|
126
|
+
return false unless @replay == other.replay
|
|
127
|
+
return false unless @status == other.status
|
|
128
|
+
return false unless @latency_ms == other.latency_ms
|
|
129
|
+
return false unless @attempted_at == other.attempted_at
|
|
130
|
+
return false unless @response_code == other.response_code
|
|
131
|
+
return false unless @failure == other.failure
|
|
132
|
+
true
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
class NoResponse::Models::Shared::WebhookDeliveryAttempt
|
|
5
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class NoResponse::Models::Shared::WebhookDeliveryAttempt
|
|
9
|
+
def event_id
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def event_id=(str_)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def event_type
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def event_type=(str_)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def attempt
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def attempt=(str_)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def replay
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def replay=(str_)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def status
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def status=(str_)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def latency_ms
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def latency_ms=(str_)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def attempted_at
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def attempted_at=(str_)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def response_code
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def response_code=(str_)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def failure
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def failure=(str_)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Shared
|
|
7
|
+
# WebhookDeliveryAttemptStatus - delivered when the endpoint answered 2xx; failed otherwise, with failure naming why.
|
|
8
|
+
class WebhookDeliveryAttemptStatus
|
|
9
|
+
include ::Crystalline::Enum
|
|
10
|
+
enums do
|
|
11
|
+
DELIVERED = new("delivered")
|
|
12
|
+
FAILED = new("failed")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
open!
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Shared
|
|
7
|
+
# The 200 answer of GET /v1/webhooks/{endpoint_id}/deliveries: one page of the endpoint's delivery attempts, newest first. Each item is one POST to the endpoint. Attempts are kept for 30 days, or the tenant's retention_days when that is shorter, and are deleted with the assessment they carried. next_cursor is present only when another page exists.
|
|
8
|
+
class WebhookDeliveryList
|
|
9
|
+
extend T::Sig
|
|
10
|
+
include Crystalline::MetadataFields
|
|
11
|
+
|
|
12
|
+
# Opaque id of the endpoint registration.
|
|
13
|
+
field(
|
|
14
|
+
:endpoint_id,
|
|
15
|
+
::String,
|
|
16
|
+
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("endpoint_id"), required: true}}
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
field(
|
|
20
|
+
:items,
|
|
21
|
+
Crystalline::Array.new(Models::Shared::WebhookDeliveryAttempt),
|
|
22
|
+
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("items"), required: true}}
|
|
23
|
+
)
|
|
24
|
+
# Opaque cursor for the next page, MAC'd by the server and bound to the tenant and endpoint it was issued for. Pass it back unchanged as cursor; a tampered, foreign or expired cursor answers 400 invalid_cursor.
|
|
25
|
+
field(
|
|
26
|
+
:next_cursor,
|
|
27
|
+
Crystalline::Nilable.new(::String),
|
|
28
|
+
{'format_json': {'letter_case': ::NoResponse::Utils.field_name("next_cursor")}}
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
sig {
|
|
32
|
+
params(
|
|
33
|
+
endpoint_id: ::String,
|
|
34
|
+
items: T::Array[Models::Shared::WebhookDeliveryAttempt],
|
|
35
|
+
next_cursor: T.nilable(::String)
|
|
36
|
+
)
|
|
37
|
+
.void
|
|
38
|
+
}
|
|
39
|
+
def initialize(endpoint_id:, items:, next_cursor: nil)
|
|
40
|
+
@endpoint_id = endpoint_id
|
|
41
|
+
@items = items
|
|
42
|
+
@next_cursor = next_cursor
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
46
|
+
def ==(other)
|
|
47
|
+
return false unless other.is_a?(self.class)
|
|
48
|
+
return false unless @endpoint_id == other.endpoint_id
|
|
49
|
+
return false unless @items == other.items
|
|
50
|
+
return false unless @next_cursor == other.next_cursor
|
|
51
|
+
true
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|