hearth 1.0.0.pre1 → 1.0.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -4
  3. data/VERSION +1 -1
  4. data/lib/hearth/anonymous_auth_resolver.rb +11 -0
  5. data/lib/hearth/api_error.rb +15 -1
  6. data/lib/hearth/auth_option.rb +21 -0
  7. data/lib/hearth/auth_schemes/anonymous.rb +21 -0
  8. data/lib/hearth/auth_schemes/http_api_key.rb +16 -0
  9. data/lib/hearth/auth_schemes/http_basic.rb +16 -0
  10. data/lib/hearth/auth_schemes/http_bearer.rb +16 -0
  11. data/lib/hearth/auth_schemes/http_digest.rb +16 -0
  12. data/lib/hearth/auth_schemes.rb +32 -0
  13. data/lib/hearth/checksums.rb +31 -0
  14. data/lib/hearth/client.rb +66 -0
  15. data/lib/hearth/client_stubs.rb +128 -0
  16. data/lib/hearth/config/env_provider.rb +53 -0
  17. data/lib/hearth/config/resolver.rb +53 -0
  18. data/lib/hearth/configuration.rb +15 -0
  19. data/lib/hearth/connection_pool.rb +77 -0
  20. data/lib/hearth/context.rb +29 -4
  21. data/lib/hearth/dns/host_address.rb +27 -0
  22. data/lib/hearth/dns/host_resolver.rb +92 -0
  23. data/lib/hearth/dns.rb +48 -0
  24. data/lib/hearth/endpoint_rules.rb +154 -0
  25. data/lib/hearth/http/api_error.rb +4 -8
  26. data/lib/hearth/http/client.rb +206 -59
  27. data/lib/hearth/http/error_inspector.rb +85 -0
  28. data/lib/hearth/http/error_parser.rb +18 -20
  29. data/lib/hearth/http/field.rb +49 -0
  30. data/lib/hearth/http/fields.rb +117 -0
  31. data/lib/hearth/http/header_list_builder.rb +42 -0
  32. data/lib/hearth/http/header_list_parser.rb +92 -0
  33. data/lib/hearth/http/middleware/content_length.rb +7 -4
  34. data/lib/hearth/http/middleware/content_md5.rb +30 -0
  35. data/lib/hearth/http/middleware/request_compression.rb +154 -0
  36. data/lib/hearth/http/middleware.rb +12 -0
  37. data/lib/hearth/http/networking_error.rb +1 -14
  38. data/lib/hearth/http/request.rb +83 -56
  39. data/lib/hearth/http/response.rb +42 -13
  40. data/lib/hearth/http.rb +16 -5
  41. data/lib/hearth/identities/anonymous.rb +8 -0
  42. data/lib/hearth/identities/http_api_key.rb +16 -0
  43. data/lib/hearth/identities/http_bearer.rb +16 -0
  44. data/lib/hearth/identities/http_login.rb +20 -0
  45. data/lib/hearth/identities.rb +21 -0
  46. data/lib/hearth/identity_provider.rb +17 -0
  47. data/lib/hearth/interceptor.rb +506 -0
  48. data/lib/hearth/interceptor_context.rb +40 -0
  49. data/lib/hearth/interceptor_list.rb +48 -0
  50. data/lib/hearth/interceptors.rb +76 -0
  51. data/lib/hearth/json.rb +4 -4
  52. data/lib/hearth/middleware/auth.rb +103 -0
  53. data/lib/hearth/middleware/build.rb +32 -1
  54. data/lib/hearth/middleware/endpoint.rb +79 -0
  55. data/lib/hearth/middleware/host_prefix.rb +11 -8
  56. data/lib/hearth/middleware/initialize.rb +57 -0
  57. data/lib/hearth/middleware/parse.rb +45 -7
  58. data/lib/hearth/middleware/retry.rb +105 -24
  59. data/lib/hearth/middleware/send.rb +137 -26
  60. data/lib/hearth/middleware/sign.rb +65 -0
  61. data/lib/hearth/middleware/validate.rb +11 -1
  62. data/lib/hearth/middleware.rb +20 -8
  63. data/lib/hearth/middleware_stack.rb +2 -44
  64. data/lib/hearth/networking_error.rb +18 -0
  65. data/lib/hearth/number_helper.rb +3 -3
  66. data/lib/hearth/output.rb +8 -4
  67. data/lib/hearth/plugin_list.rb +53 -0
  68. data/lib/hearth/query/param.rb +56 -0
  69. data/lib/hearth/query/param_list.rb +54 -0
  70. data/lib/hearth/query/param_matcher.rb +31 -0
  71. data/lib/hearth/refreshing_identity_provider.rb +63 -0
  72. data/lib/hearth/request.rb +22 -0
  73. data/lib/hearth/response.rb +36 -0
  74. data/lib/hearth/retry/adaptive.rb +60 -0
  75. data/lib/hearth/retry/capacity_not_available_error.rb +9 -0
  76. data/lib/hearth/retry/client_rate_limiter.rb +145 -0
  77. data/lib/hearth/retry/exponential_backoff.rb +15 -0
  78. data/lib/hearth/retry/retry_quota.rb +56 -0
  79. data/lib/hearth/retry/standard.rb +46 -0
  80. data/lib/hearth/retry.rb +29 -0
  81. data/lib/hearth/signers/anonymous.rb +16 -0
  82. data/lib/hearth/signers/http_api_key.rb +29 -0
  83. data/lib/hearth/signers/http_basic.rb +23 -0
  84. data/lib/hearth/signers/http_bearer.rb +19 -0
  85. data/lib/hearth/signers/http_digest.rb +19 -0
  86. data/lib/hearth/signers.rb +23 -0
  87. data/lib/hearth/structure.rb +7 -3
  88. data/lib/hearth/stubs.rb +38 -0
  89. data/lib/hearth/time_helper.rb +6 -5
  90. data/lib/hearth/validator.rb +60 -5
  91. data/lib/hearth/waiters/poller.rb +10 -9
  92. data/lib/hearth/waiters/waiter.rb +23 -9
  93. data/lib/hearth/xml/formatter.rb +11 -2
  94. data/lib/hearth/xml/node.rb +2 -3
  95. data/lib/hearth/xml/node_matcher.rb +0 -1
  96. data/lib/hearth.rb +37 -6
  97. data/sig/lib/hearth/aliases.rbs +6 -0
  98. data/sig/lib/hearth/anonymous_auth_resolver.rbs +5 -0
  99. data/sig/lib/hearth/api_error.rbs +13 -0
  100. data/sig/lib/hearth/auth_option.rbs +11 -0
  101. data/sig/lib/hearth/auth_schemes/anonymous.rbs +7 -0
  102. data/sig/lib/hearth/auth_schemes/http_api_key.rbs +7 -0
  103. data/sig/lib/hearth/auth_schemes/http_basic.rbs +7 -0
  104. data/sig/lib/hearth/auth_schemes/http_bearer.rbs +7 -0
  105. data/sig/lib/hearth/auth_schemes/http_digest.rbs +7 -0
  106. data/sig/lib/hearth/auth_schemes.rbs +13 -0
  107. data/sig/lib/hearth/block_io.rbs +9 -0
  108. data/sig/lib/hearth/client.rbs +9 -0
  109. data/sig/lib/hearth/client_stubs.rbs +5 -0
  110. data/sig/lib/hearth/configuration.rbs +7 -0
  111. data/sig/lib/hearth/dns/host_address.rbs +11 -0
  112. data/sig/lib/hearth/dns/host_resolver.rbs +19 -0
  113. data/sig/lib/hearth/endpoint_rules.rbs +17 -0
  114. data/sig/lib/hearth/http/api_error.rbs +13 -0
  115. data/sig/lib/hearth/http/client.rbs +9 -0
  116. data/sig/lib/hearth/http/field.rbs +19 -0
  117. data/sig/lib/hearth/http/fields.rbs +43 -0
  118. data/sig/lib/hearth/http/header_list_builder.rbs +15 -0
  119. data/sig/lib/hearth/http/header_list_parser.rbs +19 -0
  120. data/sig/lib/hearth/http/networking_error.rbs +6 -0
  121. data/sig/lib/hearth/http/request.rbs +25 -0
  122. data/sig/lib/hearth/http/response.rbs +21 -0
  123. data/sig/lib/hearth/identities/anonymous.rbs +6 -0
  124. data/sig/lib/hearth/identities/http_api_key.rbs +9 -0
  125. data/sig/lib/hearth/identities/http_bearer.rbs +9 -0
  126. data/sig/lib/hearth/identities/http_login.rbs +11 -0
  127. data/sig/lib/hearth/identities.rbs +9 -0
  128. data/sig/lib/hearth/identity_provider.rbs +7 -0
  129. data/sig/lib/hearth/interceptor.rbs +9 -0
  130. data/sig/lib/hearth/interceptor_context.rbs +17 -0
  131. data/sig/lib/hearth/interceptor_list.rbs +16 -0
  132. data/sig/lib/hearth/interfaces.rbs +87 -0
  133. data/sig/lib/hearth/json/parse_error.rbs +9 -0
  134. data/sig/lib/hearth/networking_error.rbs +7 -0
  135. data/sig/lib/hearth/output.rbs +11 -0
  136. data/sig/lib/hearth/plugin_list.rbs +13 -0
  137. data/sig/lib/hearth/query/param.rbs +17 -0
  138. data/sig/lib/hearth/query/param_list.rbs +25 -0
  139. data/sig/lib/hearth/refreshing_identity_provider.rbs +10 -0
  140. data/sig/lib/hearth/request.rbs +9 -0
  141. data/sig/lib/hearth/response.rbs +11 -0
  142. data/sig/lib/hearth/retry/adaptive.rbs +13 -0
  143. data/sig/lib/hearth/retry/exponential_backoff.rbs +7 -0
  144. data/sig/lib/hearth/retry/standard.rbs +13 -0
  145. data/sig/lib/hearth/retry/strategy.rbs +11 -0
  146. data/sig/lib/hearth/retry.rbs +9 -0
  147. data/sig/lib/hearth/signers/anonymous.rbs +9 -0
  148. data/sig/lib/hearth/signers/http_api_key.rbs +9 -0
  149. data/sig/lib/hearth/signers/http_basic.rbs +9 -0
  150. data/sig/lib/hearth/signers/http_bearer.rbs +9 -0
  151. data/sig/lib/hearth/signers/http_digest.rbs +9 -0
  152. data/sig/lib/hearth/signers.rbs +9 -0
  153. data/sig/lib/hearth/structure.rbs +6 -0
  154. data/sig/lib/hearth/stubs.rbs +9 -0
  155. data/sig/lib/hearth/union.rbs +5 -0
  156. data/sig/lib/hearth/waiters/waiter.rbs +17 -0
  157. data/sig/lib/hearth/xml/parse_error.rbs +9 -0
  158. metadata +151 -25
  159. data/lib/hearth/http/headers.rb +0 -70
  160. data/lib/hearth/middleware/around_handler.rb +0 -24
  161. data/lib/hearth/middleware/request_handler.rb +0 -24
  162. data/lib/hearth/middleware/response_handler.rb +0 -25
  163. data/lib/hearth/middleware_builder.rb +0 -246
  164. data/lib/hearth/stubbing/client_stubs.rb +0 -115
  165. data/lib/hearth/stubbing/stubs.rb +0 -32
  166. data/lib/hearth/waiters/errors.rb +0 -15
  167. data/sig/lib/seahorse/api_error.rbs +0 -10
  168. data/sig/lib/seahorse/document.rbs +0 -2
  169. data/sig/lib/seahorse/http/api_error.rbs +0 -21
  170. data/sig/lib/seahorse/http/headers.rbs +0 -47
  171. data/sig/lib/seahorse/http/response.rbs +0 -21
  172. data/sig/lib/seahorse/simple_delegator.rbs +0 -3
  173. data/sig/lib/seahorse/structure.rbs +0 -18
  174. data/sig/lib/seahorse/stubbing/client_stubs.rbs +0 -103
  175. data/sig/lib/seahorse/stubbing/stubs.rbs +0 -14
  176. data/sig/lib/seahorse/union.rbs +0 -6
@@ -0,0 +1,17 @@
1
+ module Hearth
2
+ module EndpointRules
3
+ class AuthScheme < Struct[untyped]
4
+ attr_accessor scheme_id: String
5
+
6
+ attr_accessor properties: Hash[String, untyped]
7
+ end
8
+
9
+ class Endpoint < Struct[untyped]
10
+ attr_accessor uri: String
11
+
12
+ attr_accessor auth_schemes: Array[AuthScheme]
13
+
14
+ attr_accessor headers: Hash[String, String | Array[String]]
15
+ end
16
+ end
17
+ 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,9 @@
1
+ module Hearth
2
+ module HTTP
3
+ class Client
4
+ def initialize: (?::Hash[Symbol, untyped] options) -> void
5
+
6
+ def transmit: (request: HTTP::Request, response: HTTP::Response, ?logger: Logger?) -> void
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ module Hearth
2
+ module HTTP
3
+ class Field
4
+ def initialize: (String name, ?(_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) -> Field
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,15 @@
1
+ module Hearth
2
+ module HTTP
3
+ module HeaderListBuilder
4
+ def self.build_list: (Array[untyped] value) -> String
5
+
6
+ def self.build_string_list: (Array[String] value ) -> String
7
+
8
+ def self.build_http_date_list: (Array[Time] value) -> String
9
+
10
+ def self.build_date_time_list: (Array[Time] value) -> String
11
+
12
+ def self.build_epoch_seconds_list: (Array[Time] value) -> String
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module Hearth
2
+ module HTTP
3
+ module HeaderListParser
4
+ def self.parse_boolean_list: (String value) -> Array[bool]
5
+
6
+ def self.parse_integer_list: (String value) -> Array[Integer]
7
+
8
+ def self.parse_float_list: (String value) -> Array[Float]
9
+
10
+ def self.build_string_list: (String value ) -> Array[String]
11
+
12
+ def self.build_http_date_list: (String value ) -> Array[Time]
13
+
14
+ def self.build_date_time_list: (String value ) -> Array[Time]
15
+
16
+ def self.build_epoch_seconds_list: (String value ) -> Array[Time]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,6 @@
1
+ module Hearth
2
+ module HTTP
3
+ class NetworkingError < Hearth::NetworkingError
4
+ end
5
+ end
6
+ 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: _WritableIO) -> 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,6 @@
1
+ module Hearth
2
+ module Identities
3
+ class Anonymous < Identities::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ module Identities
3
+ class HTTPApiKey < Identities::Base
4
+ def initialize: (key: String, ?expiration: Time?) -> void
5
+
6
+ attr_reader key: String
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ module Identities
3
+ class HTTPBearer < Identities::Base
4
+ def initialize: (token: String, ?expiration: Time?) -> void
5
+
6
+ attr_reader token: String
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Hearth
2
+ module Identities
3
+ class HTTPLogin < Identities::Base
4
+ def initialize: (username: String, password: String, ?expiration: Time?) -> void
5
+
6
+ attr_reader username: String
7
+
8
+ attr_reader password: String
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ module Identities
3
+ class Base
4
+ def initialize: (?expiration: Time?) -> void
5
+
6
+ attr_reader expiration: Time?
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Hearth
2
+ class IdentityProvider
3
+ def initialize: (Proc) -> void
4
+
5
+ def identity: (?Hash[Symbol, untyped] properties) -> Identities::Base
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ class Interceptor
3
+ def initialize: (?Hash[Symbol, Proc] callbacks) -> void
4
+
5
+ attr_reader callbacks: Hash[Symbol, Proc]
6
+
7
+ attr_reader self.hooks: Array[Symbol]
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ module Hearth
2
+ class InterceptorContext
3
+ def initialize: (input: Structure, request: Request, response: Response, output: Output[Structure], logger: Logger) -> void
4
+
5
+ attr_reader input: Structure
6
+
7
+ attr_reader request: Request
8
+
9
+ attr_reader response: Response
10
+
11
+ attr_reader output: Output[Structure]
12
+
13
+ attr_reader logger: Logger
14
+
15
+ attr_reader attributes: Hash[Symbol, untyped]
16
+ end
17
+ 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,87 @@
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
+ module Hearth
14
+ interface _Plugin[ServiceConfig]
15
+ def call: (ServiceConfig) -> void
16
+ end
17
+
18
+ interface _Interceptor
19
+ def read_before_execution: (InterceptorContext) -> void
20
+
21
+ def modify_before_serialization: (InterceptorContext) -> void
22
+
23
+ def read_before_serialization: (InterceptorContext) -> void
24
+
25
+ def read_after_serialization: (InterceptorContext) -> void
26
+
27
+ def modify_before_retry_loop: (InterceptorContext) -> void
28
+
29
+ def read_before_attempt: (InterceptorContext) -> void
30
+
31
+ def modify_before_signing: (InterceptorContext) -> void
32
+
33
+ def read_before_signing: (InterceptorContext) -> void
34
+
35
+ def read_after_signing: (InterceptorContext) -> void
36
+
37
+ def modify_before_transmit: (InterceptorContext) -> void
38
+
39
+ def read_before_transmit: (InterceptorContext) -> void
40
+
41
+ def read_after_transmit: (InterceptorContext) -> void
42
+
43
+ def modify_before_deserialization: (InterceptorContext) -> void
44
+
45
+ def read_before_deserialization: (InterceptorContext) -> void
46
+
47
+ def read_after_deserialization: (InterceptorContext) -> void
48
+
49
+ def modify_before_attempt_completion: (InterceptorContext) -> void
50
+
51
+ def read_after_attempt: (InterceptorContext) -> void
52
+
53
+ def modify_before_completion: (InterceptorContext) -> void
54
+
55
+ def read_after_execution: (InterceptorContext) -> void
56
+ end
57
+
58
+ interface _ErrorInspector
59
+ def initialize: (ApiError, Response) -> void
60
+
61
+ def retryable?: () -> bool
62
+
63
+ def error_type: () -> String
64
+
65
+ def hints: () -> Hash[Symbol, untyped]
66
+ end
67
+
68
+ interface _RetryStrategy
69
+ def acquire_initial_retry_token: (?String? _token_scope) -> Retry::Token
70
+
71
+ def refresh_retry_token: (Retry::Token _retry_token, _ErrorInspector _error_info) -> Retry::Token?
72
+
73
+ def record_success: (Retry::Token _retry_token) -> Retry::Token
74
+ end
75
+
76
+ interface _AuthResolver[Params]
77
+ def resolve: (Params) -> AuthSchemes::Base
78
+ end
79
+
80
+ interface _EndpointResolver[Params]
81
+ def resolve: (Params) -> EndpointRules::Endpoint
82
+ end
83
+
84
+ interface _WritableIO
85
+ def write: (*_ToS) -> Integer
86
+ end
87
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ module JSON
3
+ class ParseError < StandardError
4
+ def initialize: (StandardError original_error) -> void
5
+
6
+ attr_reader original_error: StandardError
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Hearth
2
+ class NetworkingError < StandardError
3
+ def initialize: (StandardError original_error) -> void
4
+
5
+ attr_reader original_error: StandardError
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module Hearth
2
+ class Output[DATA]
3
+ def initialize: (?error: ApiError?, ?data: Structure?, ?metadata: Hash[Symbol, untyped]) -> void
4
+
5
+ attr_accessor error: ApiError?
6
+
7
+ attr_accessor data: DATA?
8
+
9
+ attr_accessor metadata: Hash[Symbol, untyped]
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ module Hearth
2
+ class PluginList[ServiceConfig]
3
+ def initialize: (?Array[_Plugin[ServiceConfig]] plugins) -> void
4
+
5
+ def add: (_Plugin[ServiceConfig] plugin) -> void
6
+
7
+ alias << add
8
+
9
+ def apply: (ServiceConfig) -> void
10
+
11
+ def each: () ?{ (_Plugin[ServiceConfig]) -> void } -> void
12
+ end
13
+ 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) -> Integer
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,10 @@
1
+ module Hearth
2
+ module RefreshingIdentityProvider
3
+ ASYNC_EXPIRATION_LENGTH: Integer
4
+ SYNC_EXPIRATION_LENGTH: Integer
5
+
6
+ def initialize: -> void
7
+
8
+ def identity: (?Hash[Symbol, untyped] properties) -> Identities::Base
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ class Request
3
+ def initialize: (?uri: URI, ?body: (IO | StringIO)) -> void
4
+
5
+ attr_accessor uri: URI
6
+
7
+ attr_accessor body: (IO | StringIO)
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Hearth
2
+ class Response
3
+ def initialize: (?body: (IO | StringIO)) -> void
4
+
5
+ attr_accessor body: (IO | StringIO)
6
+
7
+ def replace: (Response other) -> self
8
+
9
+ def reset: () -> self
10
+ end
11
+ 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,7 @@
1
+ module Hearth
2
+ module Retry
3
+ class ExponentialBackoff
4
+ def call: (Integer attempts) -> Numeric
5
+ end
6
+ end
7
+ 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
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ module Retry
3
+ class Token < Struct[untyped]
4
+ attr_accessor retry_count (): Integer
5
+
6
+ attr_accessor retry_delay (): Numeric
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ module Signers
3
+ class Anonymous < Signers::Base
4
+ def sign: (request: Request, identity: Identities::Anonymous, ?properties: Hash[Symbol, untyped]) -> void
5
+
6
+ def reset: (request: Request, ?properties: Hash[Symbol, untyped]) -> void
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ module Signers
3
+ class HTTPApiKey < Signers::Base
4
+ def sign: (request: HTTP::Request, identity: Identities::HTTPApiKey, ?properties: Hash[Symbol, untyped]) -> void
5
+
6
+ def reset: (request: HTTP::Request, ?properties: Hash[Symbol, untyped]) -> void
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ module Signers
3
+ class HTTPBasic < Signers::Base
4
+ def sign: (request: HTTP::Request, identity: Identities::HTTPLogin, ?properties: Hash[Symbol, untyped]) -> void
5
+
6
+ def reset: (request: HTTP::Request, ?properties: Hash[Symbol, untyped]) -> void
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ module Signers
3
+ class HTTPBearer < Signers::Base
4
+ def sign: (request: HTTP::Request, identity: Identities::HTTPBearer, ?properties: Hash[Symbol, untyped]) -> void
5
+
6
+ def reset: (request: HTTP::Request, ?properties: Hash[Symbol, untyped]) -> void
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ module Signers
3
+ class HTTPDigest < Signers::Base
4
+ def sign: (request: HTTP::Request, identity: Identities::HTTPLogin, ?properties: Hash[Symbol, untyped]) -> void
5
+
6
+ def reset: (request: HTTP::Request, ?properties: Hash[Symbol, untyped]) -> void
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ module Signers
3
+ class Base
4
+ def sign: (request: Request, identity: Identities::Base, ?properties: Hash[Symbol, untyped]) -> void
5
+
6
+ def reset: (request: Request, ?properties: Hash[Symbol, untyped]) -> void
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ module Hearth
2
+ module Structure
3
+ def to_h: (self) -> (Hash[Symbol, untyped] | self)
4
+ alias to_hash to_h
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ module Hearth
2
+ class Stubs
3
+ def initialize: (?Hash[Symbol, Array[stub]]) -> void
4
+
5
+ def set_stubs: (Symbol, Array[stub]) -> void
6
+
7
+ def next: (Symbol) -> stub?
8
+ end
9
+ end