didit-sdk 1.0.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 +7 -0
- data/CHANGELOG.md +25 -0
- data/LICENSE +21 -0
- data/README.md +277 -0
- data/lib/didit/authentication/base64_url.rb +34 -0
- data/lib/didit/authentication/cache.rb +201 -0
- data/lib/didit/authentication/http.rb +150 -0
- data/lib/didit/authentication/issuer.rb +115 -0
- data/lib/didit/authentication/jws.rb +231 -0
- data/lib/didit/authentication/key_set.rb +89 -0
- data/lib/didit/authentication/pkce.rb +64 -0
- data/lib/didit/authentication/types.rb +175 -0
- data/lib/didit/authentication.rb +546 -0
- data/lib/didit/client.rb +211 -0
- data/lib/didit/errors.rb +153 -0
- data/lib/didit/file_part.rb +85 -0
- data/lib/didit/internal/config.rb +94 -0
- data/lib/didit/internal/errors.rb +83 -0
- data/lib/didit/internal/log.rb +41 -0
- data/lib/didit/internal/multipart.rb +60 -0
- data/lib/didit/internal/request.rb +322 -0
- data/lib/didit/internal/transport.rb +198 -0
- data/lib/didit/internal/util.rb +76 -0
- data/lib/didit/internal.rb +15 -0
- data/lib/didit/model.rb +199 -0
- data/lib/didit/page.rb +130 -0
- data/lib/didit/raw_response.rb +57 -0
- data/lib/didit/resource.rb +15 -0
- data/lib/didit/resources/account.rb +309 -0
- data/lib/didit/resources/address_validation.rb +73 -0
- data/lib/didit/resources/age_estimation.rb +110 -0
- data/lib/didit/resources/aml.rb +166 -0
- data/lib/didit/resources/aml_monitoring.rb +30 -0
- data/lib/didit/resources/analytics.rb +87 -0
- data/lib/didit/resources/bank.rb +65 -0
- data/lib/didit/resources/billing.rb +61 -0
- data/lib/didit/resources/biometric_templates.rb +234 -0
- data/lib/didit/resources/blocklist.rb +130 -0
- data/lib/didit/resources/business_sessions.rb +29 -0
- data/lib/didit/resources/businesses.rb +471 -0
- data/lib/didit/resources/cases.rb +2116 -0
- data/lib/didit/resources/customization.rb +153 -0
- data/lib/didit/resources/database_validation.rb +327 -0
- data/lib/didit/resources/document_ai.rb +145 -0
- data/lib/didit/resources/email.rb +254 -0
- data/lib/didit/resources/face_match.rb +103 -0
- data/lib/didit/resources/face_search.rb +103 -0
- data/lib/didit/resources/fraud_checks.rb +130 -0
- data/lib/didit/resources/id_verification.rb +163 -0
- data/lib/didit/resources/id_wallets.rb +1468 -0
- data/lib/didit/resources/investigator.rb +419 -0
- data/lib/didit/resources/ip.rb +68 -0
- data/lib/didit/resources/kyb.rb +256 -0
- data/lib/didit/resources/lists.rb +332 -0
- data/lib/didit/resources/monitoring_events.rb +466 -0
- data/lib/didit/resources/networks.rb +427 -0
- data/lib/didit/resources/passive_liveness.rb +103 -0
- data/lib/didit/resources/phone.rb +271 -0
- data/lib/didit/resources/pricing.rb +40 -0
- data/lib/didit/resources/proof_of_address.rb +167 -0
- data/lib/didit/resources/questionnaires.rb +170 -0
- data/lib/didit/resources/regulatory_reports.rb +314 -0
- data/lib/didit/resources/report_templates.rb +146 -0
- data/lib/didit/resources/sessions.rb +2820 -0
- data/lib/didit/resources/transactions.rb +981 -0
- data/lib/didit/resources/travel_rule.rb +1202 -0
- data/lib/didit/resources/users.rb +521 -0
- data/lib/didit/resources/wallet_screening.rb +190 -0
- data/lib/didit/resources/webhooks.rb +396 -0
- data/lib/didit/resources/workflows.rb +214 -0
- data/lib/didit/resources.rb +263 -0
- data/lib/didit/types/account.rb +11 -0
- data/lib/didit/types/account_components.rb +105 -0
- data/lib/didit/types/address_validation.rb +8 -0
- data/lib/didit/types/age_estimation.rb +89 -0
- data/lib/didit/types/aml.rb +193 -0
- data/lib/didit/types/aml_monitoring.rb +73 -0
- data/lib/didit/types/analytics.rb +62 -0
- data/lib/didit/types/bank.rb +8 -0
- data/lib/didit/types/billing.rb +18 -0
- data/lib/didit/types/biometric_templates.rb +292 -0
- data/lib/didit/types/blocklist.rb +31 -0
- data/lib/didit/types/businesses.rb +45 -0
- data/lib/didit/types/cases.rb +368 -0
- data/lib/didit/types/components.rb +12206 -0
- data/lib/didit/types/customization.rb +8 -0
- data/lib/didit/types/database_validation.rb +177 -0
- data/lib/didit/types/document_ai.rb +135 -0
- data/lib/didit/types/email.rb +116 -0
- data/lib/didit/types/face_match.rb +93 -0
- data/lib/didit/types/face_search.rb +129 -0
- data/lib/didit/types/fraud_checks.rb +8 -0
- data/lib/didit/types/id_verification.rb +231 -0
- data/lib/didit/types/id_wallets.rb +8 -0
- data/lib/didit/types/investigator.rb +221 -0
- data/lib/didit/types/ip.rb +8 -0
- data/lib/didit/types/kyb.rb +1391 -0
- data/lib/didit/types/lists.rb +111 -0
- data/lib/didit/types/monitoring_events.rb +235 -0
- data/lib/didit/types/networks.rb +120 -0
- data/lib/didit/types/passive_liveness.rb +95 -0
- data/lib/didit/types/phone.rb +69 -0
- data/lib/didit/types/proof_of_address.rb +166 -0
- data/lib/didit/types/questionnaires.rb +29 -0
- data/lib/didit/types/regulatory_reports.rb +100 -0
- data/lib/didit/types/report_templates.rb +41 -0
- data/lib/didit/types/sessions.rb +1441 -0
- data/lib/didit/types/transactions.rb +245 -0
- data/lib/didit/types/travel_rule.rb +168 -0
- data/lib/didit/types/users.rb +180 -0
- data/lib/didit/types/wallet_screening.rb +49 -0
- data/lib/didit/types/webhooks.rb +355 -0
- data/lib/didit/types/workflows.rb +32 -0
- data/lib/didit/types.rb +1681 -0
- data/lib/didit/version.rb +5 -0
- data/lib/didit/webhooks/canonical_json.rb +187 -0
- data/lib/didit/webhooks/client_methods.rb +23 -0
- data/lib/didit/webhooks/events.rb +221 -0
- data/lib/didit/webhooks/headers.rb +83 -0
- data/lib/didit/webhooks/verifier.rb +260 -0
- data/lib/didit/webhooks.rb +99 -0
- data/lib/didit-sdk.rb +4 -0
- data/lib/didit.rb +31 -0
- data/sig/didit/authentication/base64_url.rbs +10 -0
- data/sig/didit/authentication/cache.rbs +60 -0
- data/sig/didit/authentication/http.rbs +37 -0
- data/sig/didit/authentication/issuer.rbs +17 -0
- data/sig/didit/authentication/jws.rbs +41 -0
- data/sig/didit/authentication/jwt.rbs +14 -0
- data/sig/didit/authentication/key_set.rbs +25 -0
- data/sig/didit/authentication/pkce.rbs +20 -0
- data/sig/didit/authentication/types.rbs +114 -0
- data/sig/didit/authentication.rbs +81 -0
- data/sig/didit/client.rbs +61 -0
- data/sig/didit/errors.rbs +80 -0
- data/sig/didit/file_part.rbs +19 -0
- data/sig/didit/internal.rbs +199 -0
- data/sig/didit/model.rbs +42 -0
- data/sig/didit/page.rbs +34 -0
- data/sig/didit/raw_response.rbs +20 -0
- data/sig/didit/resource.rbs +8 -0
- data/sig/didit/resources/account.rbs +23 -0
- data/sig/didit/resources/address_validation.rbs +9 -0
- data/sig/didit/resources/age_estimation.rbs +9 -0
- data/sig/didit/resources/aml.rbs +10 -0
- data/sig/didit/resources/aml_monitoring.rbs +9 -0
- data/sig/didit/resources/analytics.rbs +9 -0
- data/sig/didit/resources/bank.rbs +9 -0
- data/sig/didit/resources/billing.rbs +10 -0
- data/sig/didit/resources/biometric_templates.rbs +13 -0
- data/sig/didit/resources/blocklist.rbs +11 -0
- data/sig/didit/resources/business_sessions.rbs +9 -0
- data/sig/didit/resources/businesses.rbs +22 -0
- data/sig/didit/resources/cases.rbs +103 -0
- data/sig/didit/resources/customization.rbs +10 -0
- data/sig/didit/resources/database_validation.rbs +9 -0
- data/sig/didit/resources/document_ai.rbs +9 -0
- data/sig/didit/resources/email.rbs +11 -0
- data/sig/didit/resources/face_match.rbs +9 -0
- data/sig/didit/resources/face_search.rbs +9 -0
- data/sig/didit/resources/fraud_checks.rbs +11 -0
- data/sig/didit/resources/id_verification.rbs +9 -0
- data/sig/didit/resources/id_wallets.rbs +37 -0
- data/sig/didit/resources/investigator.rbs +23 -0
- data/sig/didit/resources/ip.rbs +9 -0
- data/sig/didit/resources/kyb.rbs +12 -0
- data/sig/didit/resources/lists.rbs +20 -0
- data/sig/didit/resources/monitoring_events.rbs +16 -0
- data/sig/didit/resources/networks.rbs +25 -0
- data/sig/didit/resources/passive_liveness.rbs +9 -0
- data/sig/didit/resources/phone.rbs +11 -0
- data/sig/didit/resources/pricing.rbs +9 -0
- data/sig/didit/resources/proof_of_address.rbs +9 -0
- data/sig/didit/resources/questionnaires.rbs +13 -0
- data/sig/didit/resources/regulatory_reports.rbs +16 -0
- data/sig/didit/resources/report_templates.rbs +13 -0
- data/sig/didit/resources/sessions.rbs +78 -0
- data/sig/didit/resources/transactions.rbs +43 -0
- data/sig/didit/resources/travel_rule.rbs +62 -0
- data/sig/didit/resources/users.rbs +21 -0
- data/sig/didit/resources/wallet_screening.rbs +11 -0
- data/sig/didit/resources/webhooks.rbs +23 -0
- data/sig/didit/resources/workflows.rbs +13 -0
- data/sig/didit/resources.rbs +50 -0
- data/sig/didit/types/account.rbs +22 -0
- data/sig/didit/types/account_components.rbs +94 -0
- data/sig/didit/types/address_validation.rbs +7 -0
- data/sig/didit/types/age_estimation.rbs +80 -0
- data/sig/didit/types/aml.rbs +174 -0
- data/sig/didit/types/aml_monitoring.rbs +67 -0
- data/sig/didit/types/analytics.rbs +57 -0
- data/sig/didit/types/bank.rbs +9 -0
- data/sig/didit/types/billing.rbs +19 -0
- data/sig/didit/types/biometric_templates.rbs +268 -0
- data/sig/didit/types/blocklist.rbs +33 -0
- data/sig/didit/types/businesses.rbs +54 -0
- data/sig/didit/types/cases.rbs +414 -0
- data/sig/didit/types/components.rbs +10920 -0
- data/sig/didit/types/customization.rbs +7 -0
- data/sig/didit/types/database_validation.rbs +152 -0
- data/sig/didit/types/document_ai.rbs +123 -0
- data/sig/didit/types/email.rbs +112 -0
- data/sig/didit/types/face_match.rbs +86 -0
- data/sig/didit/types/face_search.rbs +112 -0
- data/sig/didit/types/fraud_checks.rbs +9 -0
- data/sig/didit/types/id_verification.rbs +196 -0
- data/sig/didit/types/id_wallets.rbs +55 -0
- data/sig/didit/types/investigator.rbs +212 -0
- data/sig/didit/types/ip.rbs +7 -0
- data/sig/didit/types/kyb.rbs +1254 -0
- data/sig/didit/types/lists.rbs +106 -0
- data/sig/didit/types/monitoring_events.rbs +234 -0
- data/sig/didit/types/networks.rbs +113 -0
- data/sig/didit/types/passive_liveness.rbs +87 -0
- data/sig/didit/types/phone.rbs +65 -0
- data/sig/didit/types/proof_of_address.rbs +144 -0
- data/sig/didit/types/questionnaires.rbs +30 -0
- data/sig/didit/types/regulatory_reports.rbs +101 -0
- data/sig/didit/types/report_templates.rbs +42 -0
- data/sig/didit/types/sessions.rbs +1349 -0
- data/sig/didit/types/transactions.rbs +273 -0
- data/sig/didit/types/travel_rule.rbs +188 -0
- data/sig/didit/types/users.rbs +181 -0
- data/sig/didit/types/wallet_screening.rbs +40 -0
- data/sig/didit/types/webhooks.rbs +311 -0
- data/sig/didit/types/workflows.rbs +30 -0
- data/sig/didit/webhooks/canonical_json.rbs +25 -0
- data/sig/didit/webhooks/client_methods.rbs +11 -0
- data/sig/didit/webhooks/events.rbs +125 -0
- data/sig/didit/webhooks/headers.rbs +22 -0
- data/sig/didit/webhooks/verifier.rbs +54 -0
- data/sig/didit/webhooks.rbs +37 -0
- data/sig/didit.rbs +20 -0
- metadata +300 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
module Didit
|
|
2
|
+
class Authentication
|
|
3
|
+
class OrganizationClaim < Didit::Model
|
|
4
|
+
def id: () -> String?
|
|
5
|
+
def role: () -> String?
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class ActorClaim < Didit::Model
|
|
9
|
+
def sub: () -> String?
|
|
10
|
+
def agent: () -> String?
|
|
11
|
+
def scopes: () -> Array[String]?
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class VerifiedClaims < Didit::Model
|
|
15
|
+
def level: () -> String?
|
|
16
|
+
def over_18: () -> bool?
|
|
17
|
+
def over_21: () -> bool?
|
|
18
|
+
def given_name: () -> String?
|
|
19
|
+
def family_name: () -> String?
|
|
20
|
+
def birthdate: () -> String?
|
|
21
|
+
def nationality: () -> String?
|
|
22
|
+
def country: () -> String?
|
|
23
|
+
def document_verified: () -> bool?
|
|
24
|
+
def liveness: () -> bool?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class TokenClaims < Didit::Model
|
|
28
|
+
def iss: () -> String?
|
|
29
|
+
def sub: () -> String?
|
|
30
|
+
def aud: () -> (String | Array[String] | nil)
|
|
31
|
+
def sid: () -> String?
|
|
32
|
+
def jti: () -> String?
|
|
33
|
+
def iat: () -> (Integer | Float | nil)
|
|
34
|
+
def exp: () -> (Integer | Float | nil)
|
|
35
|
+
def nbf: () -> (Integer | Float | nil)
|
|
36
|
+
def vendor_data: () -> String?
|
|
37
|
+
def amr: () -> Array[String]?
|
|
38
|
+
def org: () -> OrganizationClaim?
|
|
39
|
+
def verified: () -> VerifiedClaims?
|
|
40
|
+
def act: () -> ActorClaim?
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class AccessTokenClaims < TokenClaims
|
|
44
|
+
def client_id: () -> String?
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class IdTokenClaims < TokenClaims
|
|
48
|
+
def auth_time: () -> (Integer | Float | nil)
|
|
49
|
+
def nonce: () -> String?
|
|
50
|
+
def email: () -> String?
|
|
51
|
+
def email_verified: () -> bool?
|
|
52
|
+
def name: () -> String?
|
|
53
|
+
def phone_number: () -> String?
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
class TokenResponse < Didit::Model
|
|
57
|
+
SECRET_FIELDS: Array[String]
|
|
58
|
+
|
|
59
|
+
def access_token: () -> String?
|
|
60
|
+
def token_type: () -> String?
|
|
61
|
+
def expires_in: () -> Integer?
|
|
62
|
+
def refresh_token: () -> String?
|
|
63
|
+
def id_token: () -> String?
|
|
64
|
+
def scope: () -> String?
|
|
65
|
+
def session_id: () -> String?
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
class SessionCustomRole < Didit::Model
|
|
69
|
+
def key: () -> String?
|
|
70
|
+
def permissions: () -> Array[String]?
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
class SessionOrganization < Didit::Model
|
|
74
|
+
def organization_id: () -> String?
|
|
75
|
+
def organization_name: () -> String?
|
|
76
|
+
def role: () -> String?
|
|
77
|
+
def custom_role: () -> SessionCustomRole?
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
class Session < Didit::Model
|
|
81
|
+
def sub: () -> String?
|
|
82
|
+
def sid: () -> String?
|
|
83
|
+
def application_id: () -> String?
|
|
84
|
+
def vendor_data: () -> String?
|
|
85
|
+
def amr: () -> Array[String]?
|
|
86
|
+
def mfa_verified: () -> bool?
|
|
87
|
+
def email: () -> String?
|
|
88
|
+
def email_verified: () -> bool?
|
|
89
|
+
def phone: () -> String?
|
|
90
|
+
def verified_identity: () -> Hash[String, untyped]?
|
|
91
|
+
def verified: () -> VerifiedClaims?
|
|
92
|
+
def expires_at: () -> Time?
|
|
93
|
+
def post_logout_redirect_uri: () -> String?
|
|
94
|
+
def organizations: () -> Array[SessionOrganization]?
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
class StepUp < Didit::Model
|
|
98
|
+
def required: () -> bool?
|
|
99
|
+
def id: () -> String?
|
|
100
|
+
def rule: () -> String?
|
|
101
|
+
def verification_method: () -> String?
|
|
102
|
+
def status: () -> String?
|
|
103
|
+
def level: () -> String?
|
|
104
|
+
def amount: () -> String?
|
|
105
|
+
def currency: () -> String?
|
|
106
|
+
def created_at: () -> Time?
|
|
107
|
+
def completed_at: () -> Time?
|
|
108
|
+
def expires_at: () -> Time?
|
|
109
|
+
def verification_url: () -> String?
|
|
110
|
+
def expires_in: () -> Integer?
|
|
111
|
+
def approved?: () -> bool
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
module Didit
|
|
2
|
+
class Authentication
|
|
3
|
+
# One audience (the application id) or several, any of which is accepted.
|
|
4
|
+
type audience = String | Array[String]
|
|
5
|
+
# A money amount (String, Integer, Float or BigDecimal); sent as a decimal string.
|
|
6
|
+
type amount = String | Numeric
|
|
7
|
+
|
|
8
|
+
DEFAULT_TIMEOUT: Integer
|
|
9
|
+
DEFAULT_LEEWAY: Integer
|
|
10
|
+
DISCOVERY_PATH: String
|
|
11
|
+
JWKS_PATH: String
|
|
12
|
+
SESSION_PATH: String
|
|
13
|
+
STEP_UP_PATH: String
|
|
14
|
+
FETCH_ERRORS: Array[singleton(DiditError)]
|
|
15
|
+
UNRESERVED: Regexp
|
|
16
|
+
DECIMAL: Regexp
|
|
17
|
+
NUMBER: Regexp
|
|
18
|
+
|
|
19
|
+
def self.from_publishable_key: (String publishable_key, ?client_id: String?, ?timeout: Numeric, ?leeway: Numeric,
|
|
20
|
+
?http_client: Internal::http_client?, ?clock: (^() -> (Integer | Float))?) -> Authentication
|
|
21
|
+
def self.create_pkce: () -> Pkce
|
|
22
|
+
def self.create_state: () -> String
|
|
23
|
+
def self.create_nonce: () -> String
|
|
24
|
+
|
|
25
|
+
attr_reader issuer: String
|
|
26
|
+
attr_reader client_id: String?
|
|
27
|
+
attr_reader timeout: Float
|
|
28
|
+
attr_reader leeway: Float
|
|
29
|
+
|
|
30
|
+
@clock: ^() -> (Integer | Float)
|
|
31
|
+
@cache: IssuerCache
|
|
32
|
+
@http: Http
|
|
33
|
+
@lock: Thread::Mutex
|
|
34
|
+
@token_issuer: String?
|
|
35
|
+
|
|
36
|
+
def initialize: (String issuer, ?client_id: String?, ?timeout: Numeric, ?leeway: Numeric,
|
|
37
|
+
?http_client: Internal::http_client?, ?clock: (^() -> (Integer | Float))?) -> void
|
|
38
|
+
|
|
39
|
+
def verify_access_token: (untyped token, ?audience: audience?) -> AccessTokenClaims
|
|
40
|
+
def verify_id_token: (untyped token, nonce: String?, ?audience: audience?) -> IdTokenClaims
|
|
41
|
+
def exchange_code: (String code, code_verifier: String, redirect_uri: String) -> TokenResponse
|
|
42
|
+
def refresh: (String refresh_token) -> TokenResponse
|
|
43
|
+
def get_session: (String access_token) -> Session
|
|
44
|
+
def revoke_session: (String access_token) -> nil
|
|
45
|
+
def create_step_up: (String access_token, action: String, ?amount: amount?, ?currency: String?,
|
|
46
|
+
?return_to: String?) -> StepUp
|
|
47
|
+
def retrieve_step_up: (String access_token, String step_up_id) -> StepUp
|
|
48
|
+
def discovery: () -> Hash[String, untyped]
|
|
49
|
+
def jwks: () -> Hash[String, untyped]
|
|
50
|
+
def close: () -> nil
|
|
51
|
+
def inspect: () -> String
|
|
52
|
+
def to_s: () -> String
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
def verify: (untyped token, Symbol kind, Array[String]? audience, String? nonce) -> Hash[String, untyped]
|
|
57
|
+
def token_issuer: () -> String
|
|
58
|
+
def expected_audience: (untyped audience, required: bool) -> Array[String]?
|
|
59
|
+
def current_discovery: () -> Discovery
|
|
60
|
+
def discovery_locked: () -> Discovery
|
|
61
|
+
def key_set: (String? kid) -> KeySet
|
|
62
|
+
def key_set_locked: (String? kid) -> KeySet
|
|
63
|
+
def keys_unavailable: () -> APIConnectionError
|
|
64
|
+
def parse_discovery: (Http::Call call, Internal::Transport::Response response) -> Discovery
|
|
65
|
+
def issuer_endpoint: (Http::Call call, Internal::Transport::Response response, Hash[String, untyped] data,
|
|
66
|
+
String name) -> String
|
|
67
|
+
def endpoint_uri: (untyped value) -> URI::HTTP?
|
|
68
|
+
def token_request: (Hash[String, String] form, Array[String] secrets) -> TokenResponse
|
|
69
|
+
def bearer_call: (String http_method, URI::Generic uri, untyped access_token,
|
|
70
|
+
?json: Hash[String, untyped]?) -> Http::Call
|
|
71
|
+
def send_object: (Http::Call call) -> Hash[String, untyped]
|
|
72
|
+
def issuer_uri: (String path) -> URI::Generic
|
|
73
|
+
def required_text: (untyped value, String name) -> String
|
|
74
|
+
def optional_text: (untyped value, String name) -> String
|
|
75
|
+
def amount_text: (untyped amount) -> String
|
|
76
|
+
def plain_decimal: (String text) -> String?
|
|
77
|
+
def checked_client_id: (untyped client_id) -> String?
|
|
78
|
+
def checked_timeout: (untyped timeout) -> Float
|
|
79
|
+
def checked_leeway: (untyped leeway) -> Float
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module Didit
|
|
2
|
+
class Client
|
|
3
|
+
include Resources::ClientMethods
|
|
4
|
+
|
|
5
|
+
DEFAULT_BASE_URL: String
|
|
6
|
+
DEFAULT_ACCOUNT_BASE_URL: String
|
|
7
|
+
DEFAULT_TIMEOUT: Float
|
|
8
|
+
DEFAULT_MAX_RETRIES: Integer
|
|
9
|
+
|
|
10
|
+
self.@deprecation_lock: Thread::Mutex
|
|
11
|
+
self.@deprecation_warned: Set[String]
|
|
12
|
+
|
|
13
|
+
def self.deprecation_lock: () -> Thread::Mutex
|
|
14
|
+
def self.deprecation_warned: () -> Set[String]
|
|
15
|
+
|
|
16
|
+
@config: Internal::Config
|
|
17
|
+
@transport: Internal::Transport
|
|
18
|
+
@raw: bool
|
|
19
|
+
|
|
20
|
+
def initialize: (?api_key: String?, ?organization_id: String?, ?application_id: String?, ?base_url: String?,
|
|
21
|
+
?account_base_url: String?, ?account_token: String?, ?timeout: Numeric, ?max_retries: Integer,
|
|
22
|
+
?default_headers: Hash[String, String], ?logger: untyped, ?http_client: Internal::http_client?) -> void
|
|
23
|
+
|
|
24
|
+
def base_url: () -> String
|
|
25
|
+
def account_base_url: () -> String
|
|
26
|
+
def organization_id: () -> String?
|
|
27
|
+
def application_id: () -> String?
|
|
28
|
+
def timeout: () -> Float
|
|
29
|
+
def max_retries: () -> Integer
|
|
30
|
+
|
|
31
|
+
def with_options: (?api_key: String?, ?account_token: String?, ?organization_id: String?,
|
|
32
|
+
?application_id: String?, ?base_url: String?, ?account_base_url: String?,
|
|
33
|
+
?timeout: Numeric, ?max_retries: Integer, ?default_headers: Hash[String, String],
|
|
34
|
+
?logger: untyped) -> Client
|
|
35
|
+
def with_raw_response: () -> Client
|
|
36
|
+
def raw_response?: () -> bool
|
|
37
|
+
def close: () -> nil
|
|
38
|
+
def inspect: () -> String
|
|
39
|
+
def to_s: () -> String
|
|
40
|
+
|
|
41
|
+
def request: (Symbol http_method, String path, ?path_params: Hash[String, untyped], ?query: Hash[String, untyped]?,
|
|
42
|
+
?body: untyped, ?encoding: Symbol, ?file_fields: Array[String], ?headers: Hash[String, untyped],
|
|
43
|
+
?auth: Symbol, ?api: Symbol, ?scope: Symbol?, ?response: Didit::type_spec?, ?page: Didit::type_spec?,
|
|
44
|
+
?accept: String, ?request_options: Didit::request_options?) ?{ (String chunk) -> void } -> untyped
|
|
45
|
+
|
|
46
|
+
def fetch_page: (Internal::Request::Prepared prepared, URI::Generic uri, Didit::type_spec item, Array[untyped] seen) -> Page[untyped]
|
|
47
|
+
def deprecated: (String name, String note) -> nil
|
|
48
|
+
|
|
49
|
+
attr_reader config: Internal::Config
|
|
50
|
+
attr_reader transport: Internal::Transport
|
|
51
|
+
|
|
52
|
+
def setup: (Internal::Config config, Internal::Transport transport, raw: bool) -> self
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
def copy: (Internal::Config config, raw: bool) -> Client
|
|
57
|
+
def parse: (Internal::Request::Prepared prepared, Internal::Transport::Response response, untyped type, untyped page) -> untyped
|
|
58
|
+
def check_status: (Internal::Request::Prepared prepared, Internal::Transport::Response response) -> Internal::Transport::Response
|
|
59
|
+
def parse_json: (Internal::Request::Prepared prepared, Internal::Transport::Response response) -> untyped
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
module Didit
|
|
2
|
+
class DiditError < StandardError
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
class ConfigurationError < DiditError
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class APIConnectionError < DiditError
|
|
9
|
+
attr_reader http_method: String?
|
|
10
|
+
attr_reader url: String?
|
|
11
|
+
|
|
12
|
+
def initialize: (?String message, ?http_method: String?, ?url: String?) -> void
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class APITimeoutError < APIConnectionError
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
module ResponseDetails
|
|
19
|
+
attr_reader status: Integer
|
|
20
|
+
attr_reader headers: Hash[String, String]
|
|
21
|
+
attr_reader body: untyped
|
|
22
|
+
attr_reader request_id: String?
|
|
23
|
+
|
|
24
|
+
def status_code: () -> Integer
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class APIResponseValidationError < DiditError
|
|
28
|
+
include ResponseDetails
|
|
29
|
+
|
|
30
|
+
def initialize: (String message, status: Integer, ?headers: Hash[String, String], ?body: untyped,
|
|
31
|
+
?request_id: String?) -> void
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
class APIStatusError < DiditError
|
|
35
|
+
include ResponseDetails
|
|
36
|
+
|
|
37
|
+
def initialize: (String message, status: Integer, ?headers: Hash[String, String], ?body: untyped,
|
|
38
|
+
?request_id: String?) -> void
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class BadRequestError < APIStatusError
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class AuthenticationError < APIStatusError
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class PermissionDeniedError < APIStatusError
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
class NotFoundError < APIStatusError
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class ConflictError < APIStatusError
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
class UnprocessableEntityError < APIStatusError
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
class RateLimitError < APIStatusError
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
class InternalServerError < APIStatusError
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
class WebhookVerificationError < DiditError
|
|
66
|
+
REASONS: Array[Symbol]
|
|
67
|
+
|
|
68
|
+
attr_reader reason: Symbol
|
|
69
|
+
|
|
70
|
+
def initialize: (Symbol reason, String message) -> void
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
class TokenVerificationError < DiditError
|
|
74
|
+
REASONS: Array[Symbol]
|
|
75
|
+
|
|
76
|
+
attr_reader reason: Symbol
|
|
77
|
+
|
|
78
|
+
def initialize: (Symbol reason, String message) -> void
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Didit
|
|
2
|
+
class FilePart
|
|
3
|
+
CONTENT_TYPES: Hash[String, String]
|
|
4
|
+
DEFAULT_CONTENT_TYPE: String
|
|
5
|
+
|
|
6
|
+
@content_type: String?
|
|
7
|
+
|
|
8
|
+
attr_reader content: String | Pathname | IO | StringIO
|
|
9
|
+
attr_reader filename: String?
|
|
10
|
+
|
|
11
|
+
def initialize: (String | Pathname | IO | StringIO content, ?filename: String?, ?content_type: String?) -> void
|
|
12
|
+
def self.from_path: (String | Pathname path, ?filename: String?, ?content_type: String?) -> FilePart
|
|
13
|
+
def self.wrap: (untyped value, String field) -> FilePart
|
|
14
|
+
def self.default_filename: (untyped content) -> String?
|
|
15
|
+
def content_type: () -> String
|
|
16
|
+
def read: () -> String
|
|
17
|
+
def inspect: () -> String
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
module Didit
|
|
2
|
+
module Internal
|
|
3
|
+
# Builds the Net::HTTP for an origin (the +http_client:+ option).
|
|
4
|
+
type http_client = ^(URI::Generic uri) -> Net::HTTP
|
|
5
|
+
|
|
6
|
+
module Util
|
|
7
|
+
REQUEST_ID_HEADERS: Array[String]
|
|
8
|
+
REDACTED: String
|
|
9
|
+
|
|
10
|
+
def self?.user_agent: () -> String
|
|
11
|
+
def self?.client_header: () -> String
|
|
12
|
+
def self?.request_id: (Hash[String, String] headers) -> String?
|
|
13
|
+
def self?.redact: [T] (T value, Array[String?] secrets) -> T
|
|
14
|
+
def self?.redact_value: (untyped value, Array[String] secrets) -> untyped
|
|
15
|
+
def self?.origin: (URI::Generic | String uri) -> String
|
|
16
|
+
def self?.display_url: (URI::Generic | String uri) -> String
|
|
17
|
+
def self?.pause: (Float seconds) -> void
|
|
18
|
+
def self?.debug_from_env?: () -> bool
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
module Errors
|
|
22
|
+
STATUS_ERRORS: Hash[Integer, singleton(APIStatusError)]
|
|
23
|
+
DETAIL_KEYS: Array[String]
|
|
24
|
+
|
|
25
|
+
def self?.status_error: (status: Integer, headers: Hash[String, String], raw_body: String?, ?redact: Array[String?]) -> APIStatusError
|
|
26
|
+
def self?.parse_body: (String? raw_body) -> untyped
|
|
27
|
+
def self?.message_for: (Integer status, untyped body) -> String
|
|
28
|
+
def self?.detail_of: (untyped body) -> String?
|
|
29
|
+
def self?.hash_detail: (Hash[String, untyped] body) -> String?
|
|
30
|
+
def self?.present?: (untyped value) -> bool
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class Config
|
|
34
|
+
DEFAULT_BASE_URL: String
|
|
35
|
+
DEFAULT_ACCOUNT_BASE_URL: String
|
|
36
|
+
DEFAULT_TIMEOUT: Float
|
|
37
|
+
DEFAULT_MAX_RETRIES: Integer
|
|
38
|
+
FIELDS: Array[Symbol]
|
|
39
|
+
|
|
40
|
+
attr_reader api_key: String?
|
|
41
|
+
attr_reader account_token: String?
|
|
42
|
+
attr_reader organization_id: String?
|
|
43
|
+
attr_reader application_id: String?
|
|
44
|
+
attr_reader base_url: String
|
|
45
|
+
attr_reader account_base_url: String
|
|
46
|
+
attr_reader timeout: Float
|
|
47
|
+
attr_reader max_retries: Integer
|
|
48
|
+
attr_reader default_headers: Hash[String, String?]
|
|
49
|
+
attr_reader logger: untyped
|
|
50
|
+
attr_reader http_client: http_client?
|
|
51
|
+
|
|
52
|
+
def initialize: (**untyped options) -> void
|
|
53
|
+
def merge: (Hash[Symbol, untyped] changes) -> Config
|
|
54
|
+
def self.check_url: (Symbol name, untyped url) -> String
|
|
55
|
+
def self.check_timeout: (untyped value) -> Float
|
|
56
|
+
def self.check_max_retries: (untyped value) -> Integer
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
def present: (untyped value) -> String?
|
|
61
|
+
def check_headers: (untyped headers) -> Hash[String, String?]
|
|
62
|
+
def check_http_client: (untyped value) -> http_client?
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
module Log
|
|
66
|
+
def self?.response: (Config config, Request::Prepared prepared, Transport::Response response, Float elapsed) -> void
|
|
67
|
+
def self?.retry: (Config config, Request::Prepared prepared, String reason, Numeric delay, Integer retries_left) -> void
|
|
68
|
+
def self?.enabled?: (Config config) -> bool
|
|
69
|
+
def self?.write: (Config config, String message) -> void
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
module Multipart
|
|
73
|
+
def self?.encode: (Hash[String, untyped] fields, Array[String] file_fields) -> [String, String]
|
|
74
|
+
def self?.text: (untyped value) -> String
|
|
75
|
+
def self?.field_part: (String body, String boundary, String name, String value) -> void
|
|
76
|
+
def self?.file_part: (String body, String boundary, String name, FilePart part) -> void
|
|
77
|
+
def self?.quote: (untyped value) -> String
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
module Request
|
|
81
|
+
class Prepared < Struct[untyped]
|
|
82
|
+
attr_accessor http_method: Symbol
|
|
83
|
+
attr_accessor uri: URI::Generic
|
|
84
|
+
attr_accessor headers: Hash[String, String]
|
|
85
|
+
attr_accessor body: String?
|
|
86
|
+
attr_accessor timeout: Float
|
|
87
|
+
attr_accessor max_retries: Integer
|
|
88
|
+
attr_accessor origin: String
|
|
89
|
+
attr_accessor redact: Array[String]
|
|
90
|
+
|
|
91
|
+
def self?.new: (http_method: Symbol, uri: URI::Generic, headers: Hash[String, String], body: String?,
|
|
92
|
+
timeout: Float, max_retries: Integer, origin: String, redact: Array[String]) -> Prepared
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
class Result < Struct[untyped]
|
|
96
|
+
attr_accessor response: Transport::Response
|
|
97
|
+
attr_accessor retries_taken: Integer
|
|
98
|
+
attr_accessor elapsed: Float
|
|
99
|
+
|
|
100
|
+
def self?.new: (response: Transport::Response, retries_taken: Integer, elapsed: Float) -> Result
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
type options = { timeout: Float, max_retries: Integer, extra_headers: Hash[untyped, untyped],
|
|
104
|
+
extra_query: Hash[untyped, untyped], extra_body: Hash[untyped, untyped] }
|
|
105
|
+
|
|
106
|
+
IDEMPOTENT: Array[Symbol]
|
|
107
|
+
INITIAL_RETRY_DELAY: Float
|
|
108
|
+
MAX_RETRY_DELAY: Float
|
|
109
|
+
MAX_RETRY_AFTER: Float
|
|
110
|
+
OPTION_KEYS: Array[Symbol]
|
|
111
|
+
UNRESERVED: Regexp
|
|
112
|
+
|
|
113
|
+
def self?.options: (Config config, untyped raw) -> options
|
|
114
|
+
def self?.prepare: (Config config, Symbol http_method, String path, options opts, ?path_params: Hash[String, untyped],
|
|
115
|
+
?query: Hash[String, untyped]?, ?body: untyped, ?encoding: Symbol, ?file_fields: Array[String],
|
|
116
|
+
?headers: Hash[String, untyped], ?auth: Symbol, ?api: Symbol, ?scope: Symbol?,
|
|
117
|
+
?accept: String) -> Prepared
|
|
118
|
+
def self?.scoped: (Config config, Hash[String, untyped] path_params) -> Hash[String, untyped]
|
|
119
|
+
def self?.check_credentials: (Config config, Symbol auth) -> void
|
|
120
|
+
def self?.encode_path: (String path, Hash[String, untyped] params) -> String
|
|
121
|
+
def self?.path_segment: (String name, untyped value) -> String
|
|
122
|
+
def self?.merge: (untyped values, untyped extra) -> Hash[String, untyped]
|
|
123
|
+
def self?.encode_query: (Hash[String, untyped] values) -> String
|
|
124
|
+
def self?.query_value: (untyped value) -> String
|
|
125
|
+
def self?.encode_body: (untyped body, untyped extra_body, Symbol encoding, Array[String] file_fields) -> [String?, String?]
|
|
126
|
+
def self?.json_value: (untyped value) -> untyped
|
|
127
|
+
def self?.build_headers: (Config config, Symbol auth, accept: String, content_type: String?,
|
|
128
|
+
op_headers: Hash[String, untyped], extra_headers: Hash[untyped, untyped]) -> Hash[String, String]
|
|
129
|
+
def self?.merge_headers: (Array[[untyped, untyped]] pairs) -> Hash[String, String]
|
|
130
|
+
def self?.credential_header: (Config config, Symbol auth) -> [String, String]?
|
|
131
|
+
class Attempt < Struct[untyped]
|
|
132
|
+
attr_accessor response: Transport::Response?
|
|
133
|
+
attr_accessor failure: Transport::Failure?
|
|
134
|
+
attr_accessor streamed: bool
|
|
135
|
+
attr_accessor elapsed: Float
|
|
136
|
+
|
|
137
|
+
def self.new: (?response: Transport::Response?, ?failure: Transport::Failure?, ?streamed: bool, ?elapsed: Float) -> Attempt
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def self?.perform: (Config config, Transport transport, Prepared prepared) ?{ (String chunk) -> void } -> Result
|
|
141
|
+
def self?.attempt: (Transport transport, Prepared prepared) ?{ (String chunk) -> void } -> Attempt
|
|
142
|
+
def self?.retry_delay: (Config config, Prepared prepared, Attempt attempt, Integer retries) -> Float?
|
|
143
|
+
def self?.retry_status?: (Symbol http_method, Integer status) -> bool
|
|
144
|
+
def self?.retry_failure?: (Symbol http_method, Transport::Failure failure) -> bool
|
|
145
|
+
def self?.backoff: (Integer retries_taken) -> Float
|
|
146
|
+
def self?.retry_after: (String? value, ?now: Time) -> Float?
|
|
147
|
+
def self?.http_date_seconds: (String text, Time now) -> Float?
|
|
148
|
+
def self?.connection_error: (Prepared prepared, Transport::Failure failure) -> APIConnectionError
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
class Transport
|
|
152
|
+
class Response < Struct[untyped]
|
|
153
|
+
attr_accessor status: Integer
|
|
154
|
+
attr_accessor headers: Hash[String, String]
|
|
155
|
+
attr_accessor body: String?
|
|
156
|
+
|
|
157
|
+
def self?.new: (status: Integer, headers: Hash[String, String], body: String?) -> Response
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
class Failure < StandardError
|
|
161
|
+
attr_reader error: Exception
|
|
162
|
+
attr_reader sent: bool
|
|
163
|
+
|
|
164
|
+
def initialize: (Exception error, sent: bool) -> void
|
|
165
|
+
def timeout?: () -> bool
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
NOT_SENT_ERRORS: Array[singleton(Exception)]
|
|
169
|
+
TRANSPORT_ERRORS: Array[singleton(Exception)]
|
|
170
|
+
TIMEOUT_ERRORS: Array[singleton(Exception)]
|
|
171
|
+
MAX_IDLE: Integer
|
|
172
|
+
METHODS: Hash[Symbol, singleton(Net::HTTPRequest)]
|
|
173
|
+
|
|
174
|
+
@mutex: Thread::Mutex
|
|
175
|
+
@idle: Hash[String, Array[Net::HTTP]]
|
|
176
|
+
@pid: Integer
|
|
177
|
+
|
|
178
|
+
attr_reader http_client: http_client?
|
|
179
|
+
|
|
180
|
+
def initialize: (?http_client: http_client?) -> void
|
|
181
|
+
def execute: (Symbol http_method, URI::Generic uri, Hash[String, String] headers, String? body, Float timeout) ?{ (String chunk) -> void } -> Response
|
|
182
|
+
def close: () -> nil
|
|
183
|
+
|
|
184
|
+
private
|
|
185
|
+
|
|
186
|
+
def perform: (Net::HTTP http, Net::HTTPRequest request) ?{ (String chunk) -> void } -> Response
|
|
187
|
+
def build: (Symbol http_method, URI::Generic uri, Hash[String, String] headers, String? body) -> Net::HTTPRequest
|
|
188
|
+
def target: (URI::Generic uri) -> String
|
|
189
|
+
def checkout: (URI::Generic uri, Float timeout) -> Net::HTTP
|
|
190
|
+
def start: (Net::HTTP http) -> void
|
|
191
|
+
def checkin: (URI::Generic uri, Net::HTTP http) -> void
|
|
192
|
+
def discard: (Net::HTTP http) -> void
|
|
193
|
+
def reset_after_fork: () -> void
|
|
194
|
+
def new_session: (URI::Generic uri) -> Net::HTTP
|
|
195
|
+
def configure: (Net::HTTP http, Float timeout) -> void
|
|
196
|
+
def pool_key: (URI::Generic uri) -> String
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
end
|
data/sig/didit/model.rbs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Didit
|
|
2
|
+
class Model
|
|
3
|
+
@data: Hash[String, untyped]
|
|
4
|
+
@cache: Hash[Symbol, untyped]
|
|
5
|
+
self.@fields: Hash[Symbol, [String, Didit::type_spec]]?
|
|
6
|
+
|
|
7
|
+
def self.fields: () -> Hash[Symbol, [String, Didit::type_spec]]
|
|
8
|
+
def self.field: (Symbol name, String wire, ?Didit::type_spec type) -> void
|
|
9
|
+
def self.from_json: (untyped value) -> untyped
|
|
10
|
+
def self.coerce: (untyped value, Didit::type_spec? type) -> untyped
|
|
11
|
+
def self.symbolize: (untyped value) -> untyped
|
|
12
|
+
def self.fields_of: (singleton(Model) klass) -> Hash[Symbol, [String, Didit::type_spec]]
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def self.coerce_container: (untyped value, Array[untyped] type) -> untyped
|
|
17
|
+
def self.fits?: (untyped value, untyped type) -> bool
|
|
18
|
+
def self.coerce_model: (untyped value, untyped type) -> untyped
|
|
19
|
+
def self.parse_time: (untyped value) -> untyped
|
|
20
|
+
def self.parse_date: (untyped value) -> untyped
|
|
21
|
+
|
|
22
|
+
public
|
|
23
|
+
|
|
24
|
+
def initialize: (?Hash[String | Symbol, untyped] data) -> void
|
|
25
|
+
def []: (String | Symbol key) -> untyped
|
|
26
|
+
def key?: (String | Symbol key) -> bool
|
|
27
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
28
|
+
def to_json: (*untyped args) -> String
|
|
29
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
|
30
|
+
def ==: (untyped other) -> bool
|
|
31
|
+
def eql?: (untyped other) -> bool
|
|
32
|
+
def hash: () -> Integer
|
|
33
|
+
def inspect: () -> String
|
|
34
|
+
def to_s: () -> String
|
|
35
|
+
|
|
36
|
+
def raw_data: () -> Hash[String, untyped]
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def read_field: (Symbol name) -> untyped
|
|
41
|
+
end
|
|
42
|
+
end
|
data/sig/didit/page.rbs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Didit
|
|
2
|
+
class Page[unchecked out Item]
|
|
3
|
+
include Enumerable[Item]
|
|
4
|
+
|
|
5
|
+
@client: Didit::Client
|
|
6
|
+
@prepared: Didit::Internal::Request::Prepared
|
|
7
|
+
@item: Didit::type_spec
|
|
8
|
+
@data: Hash[String, untyped]
|
|
9
|
+
@seen: Array[untyped]
|
|
10
|
+
|
|
11
|
+
attr_reader results: Array[Item]
|
|
12
|
+
|
|
13
|
+
def initialize: (client: Didit::Client, prepared: Didit::Internal::Request::Prepared, item: Didit::type_spec,
|
|
14
|
+
data: untyped, ?seen: Array[untyped]?) -> void
|
|
15
|
+
def total_count: () -> Integer?
|
|
16
|
+
def next_url: () -> String?
|
|
17
|
+
def previous_url: () -> String?
|
|
18
|
+
def each: () { (Item item) -> void } -> self
|
|
19
|
+
| () -> Enumerator[Item, self]
|
|
20
|
+
def next_page?: () -> bool
|
|
21
|
+
def next_page: () -> Page[Item]?
|
|
22
|
+
def auto_paging_each: () { (Item item) -> void } -> nil
|
|
23
|
+
| () -> Enumerator[Item, nil]
|
|
24
|
+
def []: (String | Symbol key) -> untyped
|
|
25
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
26
|
+
def inspect: () -> String
|
|
27
|
+
def self.normalize: (URI::Generic uri) -> Array[untyped]
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def link: (untyped value) -> String?
|
|
32
|
+
def resolve: (String url) -> URI::Generic
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Didit
|
|
2
|
+
class RawResponse
|
|
3
|
+
@parser: ^() -> untyped
|
|
4
|
+
@parsed: bool
|
|
5
|
+
@value: untyped
|
|
6
|
+
|
|
7
|
+
attr_reader status: Integer
|
|
8
|
+
attr_reader headers: Hash[String, String]
|
|
9
|
+
attr_reader body: String?
|
|
10
|
+
attr_reader retries_taken: Integer
|
|
11
|
+
attr_reader elapsed: Float
|
|
12
|
+
|
|
13
|
+
def initialize: (status: Integer, headers: Hash[String, String], body: String?, retries_taken: Integer,
|
|
14
|
+
elapsed: Float, parser: ^() -> untyped) -> void
|
|
15
|
+
def status_code: () -> Integer
|
|
16
|
+
def request_id: () -> String?
|
|
17
|
+
def parse: () -> untyped
|
|
18
|
+
def inspect: () -> String
|
|
19
|
+
end
|
|
20
|
+
end
|