hearth 1.0.0.pre1 → 1.0.0.pre2
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/CHANGELOG.md +4 -4
- data/VERSION +1 -1
- data/lib/hearth/api_error.rb +15 -1
- data/lib/hearth/auth_option.rb +21 -0
- data/lib/hearth/auth_schemes/anonymous.rb +21 -0
- data/lib/hearth/auth_schemes/http_api_key.rb +16 -0
- data/lib/hearth/auth_schemes/http_basic.rb +16 -0
- data/lib/hearth/auth_schemes/http_bearer.rb +16 -0
- data/lib/hearth/auth_schemes/http_digest.rb +16 -0
- data/lib/hearth/auth_schemes.rb +32 -0
- data/lib/hearth/checksums.rb +31 -0
- data/lib/hearth/client_stubs.rb +130 -0
- data/lib/hearth/config/env_provider.rb +53 -0
- data/lib/hearth/config/resolver.rb +52 -0
- data/lib/hearth/configuration.rb +15 -0
- data/lib/hearth/connection_pool.rb +77 -0
- data/lib/hearth/context.rb +28 -4
- data/lib/hearth/dns/host_address.rb +23 -0
- data/lib/hearth/dns/host_resolver.rb +92 -0
- data/lib/hearth/dns.rb +48 -0
- data/lib/hearth/http/api_error.rb +4 -8
- data/lib/hearth/http/client.rb +208 -59
- data/lib/hearth/http/error_inspector.rb +85 -0
- data/lib/hearth/http/error_parser.rb +18 -20
- data/lib/hearth/http/field.rb +64 -0
- data/lib/hearth/http/fields.rb +117 -0
- data/lib/hearth/http/middleware/content_length.rb +5 -2
- data/lib/hearth/http/middleware/content_md5.rb +31 -0
- data/lib/hearth/http/middleware/request_compression.rb +157 -0
- data/lib/hearth/http/middleware.rb +12 -0
- data/lib/hearth/http/networking_error.rb +1 -14
- data/lib/hearth/http/request.rb +83 -56
- data/lib/hearth/http/response.rb +42 -13
- data/lib/hearth/http.rb +14 -5
- data/lib/hearth/identities/anonymous.rb +8 -0
- data/lib/hearth/identities/http_api_key.rb +16 -0
- data/lib/hearth/identities/http_bearer.rb +16 -0
- data/lib/hearth/identities/http_login.rb +20 -0
- data/lib/hearth/identities.rb +21 -0
- data/lib/hearth/identity_resolver.rb +17 -0
- data/lib/hearth/interceptor.rb +506 -0
- data/lib/hearth/interceptor_context.rb +36 -0
- data/lib/hearth/interceptor_list.rb +48 -0
- data/lib/hearth/interceptors.rb +75 -0
- data/lib/hearth/middleware/auth.rb +100 -0
- data/lib/hearth/middleware/build.rb +32 -0
- data/lib/hearth/middleware/host_prefix.rb +10 -6
- data/lib/hearth/middleware/initialize.rb +58 -0
- data/lib/hearth/middleware/parse.rb +45 -6
- data/lib/hearth/middleware/retry.rb +97 -23
- data/lib/hearth/middleware/send.rb +137 -25
- data/lib/hearth/middleware/sign.rb +65 -0
- data/lib/hearth/middleware/validate.rb +11 -1
- data/lib/hearth/middleware.rb +19 -8
- data/lib/hearth/middleware_stack.rb +1 -43
- data/lib/hearth/networking_error.rb +18 -0
- data/lib/hearth/number_helper.rb +2 -2
- data/lib/hearth/output.rb +8 -4
- data/lib/hearth/plugin_list.rb +53 -0
- data/lib/hearth/query/param.rb +52 -0
- data/lib/hearth/query/param_list.rb +54 -0
- data/lib/hearth/query/param_matcher.rb +32 -0
- data/lib/hearth/refreshing_identity_resolver.rb +63 -0
- data/lib/hearth/request.rb +22 -0
- data/lib/hearth/response.rb +33 -0
- data/lib/hearth/retry/adaptive.rb +60 -0
- data/lib/hearth/retry/capacity_not_available_error.rb +9 -0
- data/lib/hearth/retry/client_rate_limiter.rb +143 -0
- data/lib/hearth/retry/exponential_backoff.rb +15 -0
- data/lib/hearth/retry/retry_quota.rb +56 -0
- data/lib/hearth/retry/standard.rb +46 -0
- data/lib/hearth/retry/strategy.rb +20 -0
- data/lib/hearth/retry.rb +16 -0
- data/lib/hearth/signers/anonymous.rb +16 -0
- data/lib/hearth/signers/http_api_key.rb +29 -0
- data/lib/hearth/signers/http_basic.rb +23 -0
- data/lib/hearth/signers/http_bearer.rb +19 -0
- data/lib/hearth/signers/http_digest.rb +19 -0
- data/lib/hearth/signers.rb +23 -0
- data/lib/hearth/stubs.rb +30 -0
- data/lib/hearth/time_helper.rb +5 -3
- data/lib/hearth/validator.rb +44 -5
- data/lib/hearth/waiters/poller.rb +6 -7
- data/lib/hearth/waiters/waiter.rb +17 -4
- data/lib/hearth/xml/formatter.rb +11 -2
- data/lib/hearth/xml/node.rb +2 -2
- data/lib/hearth.rb +32 -5
- data/sig/lib/hearth/aliases.rbs +4 -0
- data/sig/lib/hearth/api_error.rbs +13 -0
- data/sig/lib/hearth/auth_option.rbs +11 -0
- data/sig/lib/hearth/auth_schemes/anonymous.rbs +7 -0
- data/sig/lib/hearth/auth_schemes/http_api_key.rbs +7 -0
- data/sig/lib/hearth/auth_schemes/http_basic.rbs +7 -0
- data/sig/lib/hearth/auth_schemes/http_bearer.rbs +7 -0
- data/sig/lib/hearth/auth_schemes/http_digest.rbs +7 -0
- data/sig/lib/hearth/auth_schemes.rbs +13 -0
- data/sig/lib/hearth/block_io.rbs +9 -0
- data/sig/lib/hearth/client_stubs.rbs +5 -0
- data/sig/lib/hearth/configuration.rbs +7 -0
- data/sig/lib/hearth/dns/host_address.rbs +13 -0
- data/sig/lib/hearth/dns/host_resolver.rbs +19 -0
- data/sig/lib/hearth/http/api_error.rbs +13 -0
- data/sig/lib/hearth/http/client.rbs +9 -0
- data/sig/lib/hearth/http/field.rbs +19 -0
- data/sig/lib/hearth/http/fields.rbs +43 -0
- data/sig/lib/hearth/http/request.rbs +25 -0
- data/sig/lib/hearth/http/response.rbs +21 -0
- data/sig/lib/hearth/identities/anonymous.rbs +6 -0
- data/sig/lib/hearth/identities/http_api_key.rbs +9 -0
- data/sig/lib/hearth/identities/http_bearer.rbs +9 -0
- data/sig/lib/hearth/identities/http_login.rbs +11 -0
- data/sig/lib/hearth/identities.rbs +9 -0
- data/sig/lib/hearth/identity_resolver.rbs +7 -0
- data/sig/lib/hearth/interceptor.rbs +9 -0
- data/sig/lib/hearth/interceptor_context.rbs +15 -0
- data/sig/lib/hearth/interceptor_list.rbs +16 -0
- data/sig/lib/hearth/interfaces.rbs +65 -0
- data/sig/lib/hearth/output.rbs +11 -0
- data/sig/lib/hearth/plugin_list.rbs +15 -0
- data/sig/lib/hearth/query/param.rbs +17 -0
- data/sig/lib/hearth/query/param_list.rbs +25 -0
- data/sig/lib/hearth/request.rbs +9 -0
- data/sig/lib/hearth/response.rbs +11 -0
- data/sig/lib/hearth/retry/adaptive.rbs +13 -0
- data/sig/lib/hearth/retry/exponential_backoff.rbs +7 -0
- data/sig/lib/hearth/retry/standard.rbs +13 -0
- data/sig/lib/hearth/retry/strategy.rbs +11 -0
- data/sig/lib/hearth/retry.rbs +9 -0
- data/sig/lib/hearth/signers/anonymous.rbs +9 -0
- data/sig/lib/hearth/signers/http_api_key.rbs +9 -0
- data/sig/lib/hearth/signers/http_basic.rbs +9 -0
- data/sig/lib/hearth/signers/http_bearer.rbs +9 -0
- data/sig/lib/hearth/signers/http_digest.rbs +9 -0
- data/sig/lib/hearth/signers.rbs +9 -0
- data/sig/lib/hearth/structure.rbs +7 -0
- data/sig/lib/hearth/union.rbs +5 -0
- data/sig/lib/hearth/waiters/waiter.rbs +17 -0
- metadata +132 -22
- data/lib/hearth/http/headers.rb +0 -70
- data/lib/hearth/middleware/around_handler.rb +0 -24
- data/lib/hearth/middleware/request_handler.rb +0 -24
- data/lib/hearth/middleware/response_handler.rb +0 -25
- data/lib/hearth/middleware_builder.rb +0 -246
- data/lib/hearth/stubbing/client_stubs.rb +0 -115
- data/lib/hearth/stubbing/stubs.rb +0 -32
- data/lib/hearth/waiters/errors.rb +0 -15
- data/sig/lib/seahorse/api_error.rbs +0 -10
- data/sig/lib/seahorse/document.rbs +0 -2
- data/sig/lib/seahorse/http/api_error.rbs +0 -21
- data/sig/lib/seahorse/http/headers.rbs +0 -47
- data/sig/lib/seahorse/http/response.rbs +0 -21
- data/sig/lib/seahorse/simple_delegator.rbs +0 -3
- data/sig/lib/seahorse/structure.rbs +0 -18
- data/sig/lib/seahorse/stubbing/client_stubs.rbs +0 -103
- data/sig/lib/seahorse/stubbing/stubs.rbs +0 -14
- data/sig/lib/seahorse/union.rbs +0 -6
data/lib/hearth.rb
CHANGED
|
@@ -1,22 +1,49 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative 'hearth/api_error'
|
|
4
|
+
require_relative 'hearth/auth_option'
|
|
5
|
+
|
|
6
|
+
# must be required before auth_schemes
|
|
7
|
+
require_relative 'hearth/identities'
|
|
8
|
+
require_relative 'hearth/auth_schemes'
|
|
9
|
+
|
|
4
10
|
require_relative 'hearth/block_io'
|
|
11
|
+
require_relative 'hearth/checksums'
|
|
12
|
+
require_relative 'hearth/client_stubs'
|
|
13
|
+
require_relative 'hearth/configuration'
|
|
14
|
+
require_relative 'hearth/config/env_provider'
|
|
15
|
+
require_relative 'hearth/config/resolver'
|
|
16
|
+
require_relative 'hearth/connection_pool'
|
|
5
17
|
require_relative 'hearth/context'
|
|
18
|
+
require_relative 'hearth/dns'
|
|
19
|
+
|
|
20
|
+
# must be required before http
|
|
21
|
+
require_relative 'hearth/middleware'
|
|
22
|
+
require_relative 'hearth/networking_error'
|
|
23
|
+
require_relative 'hearth/request'
|
|
24
|
+
require_relative 'hearth/response'
|
|
25
|
+
|
|
6
26
|
require_relative 'hearth/http'
|
|
27
|
+
require_relative 'hearth/identity_resolver'
|
|
28
|
+
require_relative 'hearth/interceptor'
|
|
29
|
+
require_relative 'hearth/interceptors'
|
|
30
|
+
require_relative 'hearth/interceptor_context'
|
|
31
|
+
require_relative 'hearth/interceptor_list'
|
|
7
32
|
require_relative 'hearth/json'
|
|
8
|
-
require_relative 'hearth/
|
|
9
|
-
require_relative 'hearth/middleware_builder'
|
|
33
|
+
require_relative 'hearth/plugin_list'
|
|
10
34
|
require_relative 'hearth/middleware_stack'
|
|
11
35
|
require_relative 'hearth/number_helper'
|
|
12
36
|
require_relative 'hearth/output'
|
|
37
|
+
require_relative 'hearth/query/param'
|
|
38
|
+
require_relative 'hearth/query/param_list'
|
|
39
|
+
require_relative 'hearth/refreshing_identity_resolver'
|
|
40
|
+
require_relative 'hearth/retry'
|
|
41
|
+
require_relative 'hearth/signers'
|
|
13
42
|
require_relative 'hearth/structure'
|
|
14
|
-
require_relative 'hearth/
|
|
15
|
-
require_relative 'hearth/stubbing/stubs'
|
|
43
|
+
require_relative 'hearth/stubs'
|
|
16
44
|
require_relative 'hearth/time_helper'
|
|
17
45
|
require_relative 'hearth/union'
|
|
18
46
|
require_relative 'hearth/validator'
|
|
19
|
-
require_relative 'hearth/waiters/errors'
|
|
20
47
|
require_relative 'hearth/waiters/poller'
|
|
21
48
|
require_relative 'hearth/waiters/waiter'
|
|
22
49
|
require_relative 'hearth/xml'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
class ApiError < StandardError
|
|
3
|
+
def initialize: (error_code: String, ?metadata: Hash[Symbol, untyped], ?message: String?) -> void
|
|
4
|
+
|
|
5
|
+
attr_reader error_code: String
|
|
6
|
+
|
|
7
|
+
attr_reader metadata: Hash[Symbol, untyped]
|
|
8
|
+
|
|
9
|
+
def retryable?: () -> false
|
|
10
|
+
|
|
11
|
+
def throttling?: () -> false
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
class AuthOption
|
|
3
|
+
def initialize: (scheme_id: String, ?identity_properties: Hash[Symbol, untyped], ?signer_properties: Hash[Symbol, untyped]) -> void
|
|
4
|
+
|
|
5
|
+
attr_reader scheme_id: String
|
|
6
|
+
|
|
7
|
+
attr_reader identity_properties: Hash[Symbol, untyped]
|
|
8
|
+
|
|
9
|
+
attr_reader signer_properties: Hash[Symbol, untyped]
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module AuthSchemes
|
|
3
|
+
class Base
|
|
4
|
+
def initialize: (scheme_id: String, signer: Signers::Base, identity_type: Class) -> void
|
|
5
|
+
|
|
6
|
+
attr_reader scheme_id: String
|
|
7
|
+
|
|
8
|
+
def identity_resolver: (?Hash[Symbol, IdentityResolver] identity_resolvers) -> IdentityResolver
|
|
9
|
+
|
|
10
|
+
attr_reader signer: Signers::Base
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module DNS
|
|
3
|
+
class HostResolver
|
|
4
|
+
def initialize: (?service: Integer, ?family: Integer?, ?socktype: Symbol, ?protocol: Integer?, ?flags: Integer?) -> void
|
|
5
|
+
|
|
6
|
+
attr_reader service: Integer
|
|
7
|
+
|
|
8
|
+
attr_reader family: Integer
|
|
9
|
+
|
|
10
|
+
attr_reader socktype: Symbol
|
|
11
|
+
|
|
12
|
+
attr_reader protocol: Integer
|
|
13
|
+
|
|
14
|
+
attr_reader flags: Integer
|
|
15
|
+
|
|
16
|
+
def resolve_address: (nodename: String, ?service: Integer, ?family: Integer?, ?socktype: Symbol, ?protocol: Integer?, ?flags: Integer?) -> Array[HostAddress]
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module HTTP
|
|
3
|
+
class ApiError < Hearth::ApiError
|
|
4
|
+
def initialize: (http_resp: Response, error_code: String, ?metadata: Hash[Symbol, untyped], ?message: String?) -> void
|
|
5
|
+
|
|
6
|
+
attr_reader http_status: Integer
|
|
7
|
+
|
|
8
|
+
attr_reader http_fields: Fields
|
|
9
|
+
|
|
10
|
+
attr_reader http_body: IO
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module HTTP
|
|
3
|
+
class Field
|
|
4
|
+
def initialize: (String name, ?(Array[String] | _ToS)? value, ?kind: Symbol) -> void
|
|
5
|
+
|
|
6
|
+
attr_reader name: String
|
|
7
|
+
|
|
8
|
+
attr_reader kind: Symbol
|
|
9
|
+
|
|
10
|
+
def value: (?String? encoding) -> String
|
|
11
|
+
|
|
12
|
+
def header?: () -> bool
|
|
13
|
+
|
|
14
|
+
def trailer?: () -> bool
|
|
15
|
+
|
|
16
|
+
def to_h: () -> Hash[String, String]
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module HTTP
|
|
3
|
+
class Fields
|
|
4
|
+
include Enumerable[Field]
|
|
5
|
+
|
|
6
|
+
def initialize: (?Array[Field] fields, ?encoding: String) -> void
|
|
7
|
+
|
|
8
|
+
attr_reader encoding: String
|
|
9
|
+
|
|
10
|
+
def []: (String key) -> Field
|
|
11
|
+
|
|
12
|
+
def []=: (String key, Field value) -> Field
|
|
13
|
+
|
|
14
|
+
def key?: (String key) -> bool
|
|
15
|
+
|
|
16
|
+
def delete: (String key) -> (Field | nil)
|
|
17
|
+
|
|
18
|
+
def each: () { (Field) -> void } -> void
|
|
19
|
+
|
|
20
|
+
def size: () -> Integer
|
|
21
|
+
|
|
22
|
+
def clear: () -> void
|
|
23
|
+
|
|
24
|
+
class Proxy
|
|
25
|
+
include Enumerable[Hash[String, String]]
|
|
26
|
+
|
|
27
|
+
def initialize: (Array[Field] fields, Symbol kind) -> void
|
|
28
|
+
|
|
29
|
+
def []: (String key) -> (String | nil)
|
|
30
|
+
|
|
31
|
+
def []=: (String, String) -> String
|
|
32
|
+
|
|
33
|
+
def key?: (String) -> bool
|
|
34
|
+
|
|
35
|
+
def delete: (String key) -> (String | nil)
|
|
36
|
+
|
|
37
|
+
def each: () { (Hash[String, String]) -> void } -> void
|
|
38
|
+
|
|
39
|
+
alias each_pair each
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module HTTP
|
|
3
|
+
class Request < Hearth::Request
|
|
4
|
+
def initialize: (?http_method: Symbol?, ?fields: Fields, ?uri: URI, ?body: IO) -> void
|
|
5
|
+
|
|
6
|
+
attr_accessor http_method: Symbol
|
|
7
|
+
|
|
8
|
+
attr_reader fields: Fields
|
|
9
|
+
|
|
10
|
+
attr_reader headers: Fields::Proxy
|
|
11
|
+
|
|
12
|
+
attr_reader trailers: Fields::Proxy
|
|
13
|
+
|
|
14
|
+
def append_path: (String path) -> void
|
|
15
|
+
|
|
16
|
+
def append_query_param: (String name, String? value) -> void
|
|
17
|
+
|
|
18
|
+
def append_query_param_list: (Query::ParamList param_list) -> void
|
|
19
|
+
|
|
20
|
+
def remove_query_param: (String name) -> void
|
|
21
|
+
|
|
22
|
+
def prefix_host: (String prefix) -> void
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module HTTP
|
|
3
|
+
class Response < Hearth::Response
|
|
4
|
+
def initialize: (?status: Integer, ?reason: String?, ?fields: Fields, ?body: IO) -> void
|
|
5
|
+
|
|
6
|
+
attr_accessor status: Integer
|
|
7
|
+
|
|
8
|
+
attr_accessor reason: (String | nil)
|
|
9
|
+
|
|
10
|
+
attr_reader fields: Fields
|
|
11
|
+
|
|
12
|
+
attr_reader headers: Fields::Proxy
|
|
13
|
+
|
|
14
|
+
attr_reader trailers: Fields::Proxy
|
|
15
|
+
|
|
16
|
+
def replace: (Response other) -> self
|
|
17
|
+
|
|
18
|
+
def reset: () -> void
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
class InterceptorContext
|
|
3
|
+
def initialize: (input: Structure, request: Request, response: Response, output: Structure, ?attributes: Hash[Symbol, untyped]) -> void
|
|
4
|
+
|
|
5
|
+
attr_reader input: Structure
|
|
6
|
+
|
|
7
|
+
attr_reader request: Request
|
|
8
|
+
|
|
9
|
+
attr_reader response: Response
|
|
10
|
+
|
|
11
|
+
attr_reader output: Structure
|
|
12
|
+
|
|
13
|
+
attr_reader attributes: Hash[Symbol, untyped]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
class InterceptorList
|
|
3
|
+
include Enumerable[_Interceptor]
|
|
4
|
+
|
|
5
|
+
def initialize: (?Array[_Interceptor] interceptors) -> void
|
|
6
|
+
|
|
7
|
+
def append: (_Interceptor interceptor) -> void
|
|
8
|
+
alias << append
|
|
9
|
+
|
|
10
|
+
def concat: (InterceptorList other) -> self
|
|
11
|
+
|
|
12
|
+
def dup: () -> InterceptorList
|
|
13
|
+
|
|
14
|
+
def each: () { (_Interceptor) -> untyped } -> untyped
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Hack - https://github.com/ruby/delegate/issues/8
|
|
2
|
+
class SimpleDelegator
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
# Hack - https://github.com/ruby/rbs/issues/1481
|
|
6
|
+
class URI
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Hack - https://github.com/ruby/rbs/issues/1482
|
|
10
|
+
class Logger
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
interface _Plugin
|
|
14
|
+
def call: (Hearth::Configuration) -> void
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
interface _Interceptor
|
|
18
|
+
def read_before_execution: (Hearth::InterceptorContext) -> void
|
|
19
|
+
|
|
20
|
+
def modify_before_serialization: (Hearth::InterceptorContext) -> void
|
|
21
|
+
|
|
22
|
+
def read_before_serialization: (Hearth::InterceptorContext) -> void
|
|
23
|
+
|
|
24
|
+
def read_after_serialization: (Hearth::InterceptorContext) -> void
|
|
25
|
+
|
|
26
|
+
def modify_before_retry_loop: (Hearth::InterceptorContext) -> void
|
|
27
|
+
|
|
28
|
+
def read_before_attempt: (Hearth::InterceptorContext) -> void
|
|
29
|
+
|
|
30
|
+
def modify_before_signing: (Hearth::InterceptorContext) -> void
|
|
31
|
+
|
|
32
|
+
def read_before_signing: (Hearth::InterceptorContext) -> void
|
|
33
|
+
|
|
34
|
+
def read_after_signing: (Hearth::InterceptorContext) -> void
|
|
35
|
+
|
|
36
|
+
def modify_before_transmit: (Hearth::InterceptorContext) -> void
|
|
37
|
+
|
|
38
|
+
def read_before_transmit: (Hearth::InterceptorContext) -> void
|
|
39
|
+
|
|
40
|
+
def read_after_transmit: (Hearth::InterceptorContext) -> void
|
|
41
|
+
|
|
42
|
+
def modify_before_deserialization: (Hearth::InterceptorContext) -> void
|
|
43
|
+
|
|
44
|
+
def read_before_deserialization: (Hearth::InterceptorContext) -> void
|
|
45
|
+
|
|
46
|
+
def read_after_deserialization: (Hearth::InterceptorContext) -> void
|
|
47
|
+
|
|
48
|
+
def modify_before_attempt_completion: (Hearth::InterceptorContext) -> void
|
|
49
|
+
|
|
50
|
+
def read_after_attempt: (Hearth::InterceptorContext) -> void
|
|
51
|
+
|
|
52
|
+
def modify_before_completion: (Hearth::InterceptorContext) -> void
|
|
53
|
+
|
|
54
|
+
def read_after_execution: (Hearth::InterceptorContext) -> void
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
interface _ErrorInspector
|
|
58
|
+
def initialize: (Hearth::ApiError, Hearth::Response) -> void
|
|
59
|
+
|
|
60
|
+
def retryable?: () -> bool
|
|
61
|
+
|
|
62
|
+
def error_type: () -> String
|
|
63
|
+
|
|
64
|
+
def hints: () -> Hash[Symbol, untyped]
|
|
65
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
class Output
|
|
3
|
+
def initialize: (?error: (ApiError)?, ?data: (Structure)?, ?metadata: Hash[Symbol, untyped]) -> void
|
|
4
|
+
|
|
5
|
+
attr_accessor error: (ApiError | nil)
|
|
6
|
+
|
|
7
|
+
attr_accessor data: (Structure | nil)
|
|
8
|
+
|
|
9
|
+
attr_accessor metadata: Hash[Symbol, untyped]
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
class PluginList
|
|
3
|
+
def initialize: (?Array[_Plugin] plugins) -> void
|
|
4
|
+
|
|
5
|
+
def add: (_Plugin plugin) -> void
|
|
6
|
+
|
|
7
|
+
alias << add
|
|
8
|
+
|
|
9
|
+
def apply: (Hearth::Configuration) -> void
|
|
10
|
+
|
|
11
|
+
def dup: () -> PluginList
|
|
12
|
+
|
|
13
|
+
def each: () ?{ (_Plugin) -> void } -> void
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module Query
|
|
3
|
+
class Param
|
|
4
|
+
def initialize: (String name, ?(String | Array[String])? value) -> void
|
|
5
|
+
|
|
6
|
+
attr_reader name: String
|
|
7
|
+
|
|
8
|
+
attr_reader value: (String | Array[String])
|
|
9
|
+
|
|
10
|
+
def to_s: () -> String
|
|
11
|
+
|
|
12
|
+
def ==: (Param other) -> bool
|
|
13
|
+
|
|
14
|
+
def <=>: (Param other) -> bool
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module Query
|
|
3
|
+
class ParamList
|
|
4
|
+
include Enumerable[String]
|
|
5
|
+
|
|
6
|
+
def initialize: () -> void
|
|
7
|
+
|
|
8
|
+
def set: (String param_name, ?String? param_value) -> Param
|
|
9
|
+
|
|
10
|
+
alias []= set
|
|
11
|
+
|
|
12
|
+
def []: (Param param_name) -> (Param | nil)
|
|
13
|
+
|
|
14
|
+
def delete: (Param param_name) -> (Param | nil)
|
|
15
|
+
|
|
16
|
+
def each: () { (String) -> void } -> void
|
|
17
|
+
|
|
18
|
+
def empty?: () -> bool
|
|
19
|
+
|
|
20
|
+
def to_a: () -> Array[Param]
|
|
21
|
+
|
|
22
|
+
def to_s: () -> String
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module Retry
|
|
3
|
+
class Adaptive < Strategy
|
|
4
|
+
def initialize: (?backoff: ExponentialBackoff, ?max_attempts: Integer, ?wait_to_fill: bool) -> void
|
|
5
|
+
|
|
6
|
+
def acquire_initial_retry_token: (?String? _token_scope) -> Token
|
|
7
|
+
|
|
8
|
+
def refresh_retry_token: (Token retry_token, _ErrorInspector error_info) -> (nil | Token)
|
|
9
|
+
|
|
10
|
+
def record_success: (Token retry_token) -> Token
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module Retry
|
|
3
|
+
class Standard < Strategy
|
|
4
|
+
def initialize: (?backoff: ExponentialBackoff, ?max_attempts: Integer) -> void
|
|
5
|
+
|
|
6
|
+
def acquire_initial_retry_token: (?String? _token_scope) -> Token
|
|
7
|
+
|
|
8
|
+
def refresh_retry_token: (Token retry_token, _ErrorInspector error_info) -> (nil | Token)
|
|
9
|
+
|
|
10
|
+
def record_success: (Token retry_token) -> Token
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Hearth
|
|
2
|
+
module Retry
|
|
3
|
+
class Strategy
|
|
4
|
+
def acquire_initial_retry_token: (?String? _token_scope) -> Token
|
|
5
|
+
|
|
6
|
+
def refresh_retry_token: (Token _retry_token, _ErrorInspector _error_info) -> (nil | Token)
|
|
7
|
+
|
|
8
|
+
def record_success: (Token _retry_token) -> Token
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|