dataleon 0.1.0.pre.alpha.1
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/.ignore +2 -0
- data/CHANGELOG.md +50 -0
- data/README.md +257 -0
- data/SECURITY.md +27 -0
- data/lib/dataleon/client.rb +80 -0
- data/lib/dataleon/errors.rb +214 -0
- data/lib/dataleon/file_part.rb +55 -0
- data/lib/dataleon/internal/transport/base_client.rb +563 -0
- data/lib/dataleon/internal/transport/pooled_net_requester.rb +201 -0
- data/lib/dataleon/internal/type/array_of.rb +168 -0
- data/lib/dataleon/internal/type/base_model.rb +531 -0
- data/lib/dataleon/internal/type/base_page.rb +55 -0
- data/lib/dataleon/internal/type/boolean.rb +77 -0
- data/lib/dataleon/internal/type/converter.rb +327 -0
- data/lib/dataleon/internal/type/enum.rb +131 -0
- data/lib/dataleon/internal/type/file_input.rb +108 -0
- data/lib/dataleon/internal/type/hash_of.rb +188 -0
- data/lib/dataleon/internal/type/request_parameters.rb +42 -0
- data/lib/dataleon/internal/type/union.rb +237 -0
- data/lib/dataleon/internal/type/unknown.rb +81 -0
- data/lib/dataleon/internal/util.rb +914 -0
- data/lib/dataleon/internal.rb +20 -0
- data/lib/dataleon/models/check.rb +50 -0
- data/lib/dataleon/models/companies/document_list_params.rb +16 -0
- data/lib/dataleon/models/companies/document_upload_params.rb +82 -0
- data/lib/dataleon/models/company_create_params.rb +228 -0
- data/lib/dataleon/models/company_delete_params.rb +14 -0
- data/lib/dataleon/models/company_list_params.rb +108 -0
- data/lib/dataleon/models/company_list_response.rb +8 -0
- data/lib/dataleon/models/company_registration.rb +964 -0
- data/lib/dataleon/models/company_retrieve_params.rb +30 -0
- data/lib/dataleon/models/company_update_params.rb +228 -0
- data/lib/dataleon/models/individual.rb +805 -0
- data/lib/dataleon/models/individual_create_params.rb +174 -0
- data/lib/dataleon/models/individual_delete_params.rb +14 -0
- data/lib/dataleon/models/individual_list_params.rb +108 -0
- data/lib/dataleon/models/individual_list_response.rb +8 -0
- data/lib/dataleon/models/individual_retrieve_params.rb +30 -0
- data/lib/dataleon/models/individual_update_params.rb +174 -0
- data/lib/dataleon/models/individuals/document_list_params.rb +16 -0
- data/lib/dataleon/models/individuals/document_response.rb +98 -0
- data/lib/dataleon/models/individuals/document_upload_params.rb +82 -0
- data/lib/dataleon/models/individuals/generic_document.rb +132 -0
- data/lib/dataleon/models/individuals/kbis.rb +326 -0
- data/lib/dataleon/models.rb +71 -0
- data/lib/dataleon/request_options.rb +77 -0
- data/lib/dataleon/resources/companies/documents.rb +65 -0
- data/lib/dataleon/resources/companies.rb +164 -0
- data/lib/dataleon/resources/individuals/documents.rb +65 -0
- data/lib/dataleon/resources/individuals.rb +164 -0
- data/lib/dataleon/version.rb +5 -0
- data/lib/dataleon.rb +79 -0
- data/manifest.yaml +15 -0
- data/rbi/dataleon/client.rbi +56 -0
- data/rbi/dataleon/errors.rbi +178 -0
- data/rbi/dataleon/file_part.rbi +37 -0
- data/rbi/dataleon/internal/transport/base_client.rbi +293 -0
- data/rbi/dataleon/internal/transport/pooled_net_requester.rbi +79 -0
- data/rbi/dataleon/internal/type/array_of.rbi +104 -0
- data/rbi/dataleon/internal/type/base_model.rbi +302 -0
- data/rbi/dataleon/internal/type/base_page.rbi +42 -0
- data/rbi/dataleon/internal/type/boolean.rbi +58 -0
- data/rbi/dataleon/internal/type/converter.rbi +216 -0
- data/rbi/dataleon/internal/type/enum.rbi +82 -0
- data/rbi/dataleon/internal/type/file_input.rbi +59 -0
- data/rbi/dataleon/internal/type/hash_of.rbi +104 -0
- data/rbi/dataleon/internal/type/request_parameters.rbi +29 -0
- data/rbi/dataleon/internal/type/union.rbi +128 -0
- data/rbi/dataleon/internal/type/unknown.rbi +58 -0
- data/rbi/dataleon/internal/util.rbi +487 -0
- data/rbi/dataleon/internal.rbi +16 -0
- data/rbi/dataleon/models/check.rbi +83 -0
- data/rbi/dataleon/models/companies/document_list_params.rbi +32 -0
- data/rbi/dataleon/models/companies/document_upload_params.rbi +266 -0
- data/rbi/dataleon/models/company_create_params.rbi +361 -0
- data/rbi/dataleon/models/company_delete_params.rbi +27 -0
- data/rbi/dataleon/models/company_list_params.rbi +182 -0
- data/rbi/dataleon/models/company_list_response.rbi +11 -0
- data/rbi/dataleon/models/company_registration.rbi +1628 -0
- data/rbi/dataleon/models/company_retrieve_params.rbi +57 -0
- data/rbi/dataleon/models/company_update_params.rbi +361 -0
- data/rbi/dataleon/models/individual.rbi +1281 -0
- data/rbi/dataleon/models/individual_create_params.rbi +323 -0
- data/rbi/dataleon/models/individual_delete_params.rbi +27 -0
- data/rbi/dataleon/models/individual_list_params.rbi +193 -0
- data/rbi/dataleon/models/individual_list_response.rbi +11 -0
- data/rbi/dataleon/models/individual_retrieve_params.rbi +57 -0
- data/rbi/dataleon/models/individual_update_params.rbi +323 -0
- data/rbi/dataleon/models/individuals/document_list_params.rbi +32 -0
- data/rbi/dataleon/models/individuals/document_response.rbi +190 -0
- data/rbi/dataleon/models/individuals/document_upload_params.rbi +266 -0
- data/rbi/dataleon/models/individuals/generic_document.rbi +252 -0
- data/rbi/dataleon/models/individuals/kbis.rbi +513 -0
- data/rbi/dataleon/models.rbi +33 -0
- data/rbi/dataleon/request_options.rbi +59 -0
- data/rbi/dataleon/resources/companies/documents.rbi +52 -0
- data/rbi/dataleon/resources/companies.rbi +135 -0
- data/rbi/dataleon/resources/individuals/documents.rbi +52 -0
- data/rbi/dataleon/resources/individuals.rbi +137 -0
- data/rbi/dataleon/version.rbi +5 -0
- data/sig/dataleon/client.rbs +28 -0
- data/sig/dataleon/errors.rbs +110 -0
- data/sig/dataleon/file_part.rbs +21 -0
- data/sig/dataleon/internal/transport/base_client.rbs +131 -0
- data/sig/dataleon/internal/transport/pooled_net_requester.rbs +45 -0
- data/sig/dataleon/internal/type/array_of.rbs +48 -0
- data/sig/dataleon/internal/type/base_model.rbs +102 -0
- data/sig/dataleon/internal/type/base_page.rbs +24 -0
- data/sig/dataleon/internal/type/boolean.rbs +26 -0
- data/sig/dataleon/internal/type/converter.rbs +79 -0
- data/sig/dataleon/internal/type/enum.rbs +32 -0
- data/sig/dataleon/internal/type/file_input.rbs +25 -0
- data/sig/dataleon/internal/type/hash_of.rbs +48 -0
- data/sig/dataleon/internal/type/request_parameters.rbs +17 -0
- data/sig/dataleon/internal/type/union.rbs +52 -0
- data/sig/dataleon/internal/type/unknown.rbs +26 -0
- data/sig/dataleon/internal/util.rbs +185 -0
- data/sig/dataleon/internal.rbs +9 -0
- data/sig/dataleon/models/check.rbs +50 -0
- data/sig/dataleon/models/companies/document_list_params.rbs +17 -0
- data/sig/dataleon/models/companies/document_upload_params.rbs +119 -0
- data/sig/dataleon/models/company_create_params.rbs +209 -0
- data/sig/dataleon/models/company_delete_params.rbs +15 -0
- data/sig/dataleon/models/company_list_params.rbs +120 -0
- data/sig/dataleon/models/company_list_response.rbs +7 -0
- data/sig/dataleon/models/company_registration.rbs +847 -0
- data/sig/dataleon/models/company_retrieve_params.rbs +32 -0
- data/sig/dataleon/models/company_update_params.rbs +209 -0
- data/sig/dataleon/models/individual.rbs +717 -0
- data/sig/dataleon/models/individual_create_params.rbs +172 -0
- data/sig/dataleon/models/individual_delete_params.rbs +15 -0
- data/sig/dataleon/models/individual_list_params.rbs +120 -0
- data/sig/dataleon/models/individual_list_response.rbs +7 -0
- data/sig/dataleon/models/individual_retrieve_params.rbs +32 -0
- data/sig/dataleon/models/individual_update_params.rbs +172 -0
- data/sig/dataleon/models/individuals/document_list_params.rbs +17 -0
- data/sig/dataleon/models/individuals/document_response.rbs +101 -0
- data/sig/dataleon/models/individuals/document_upload_params.rbs +119 -0
- data/sig/dataleon/models/individuals/generic_document.rbs +132 -0
- data/sig/dataleon/models/individuals/kbis.rbs +303 -0
- data/sig/dataleon/models.rbs +31 -0
- data/sig/dataleon/request_options.rbs +34 -0
- data/sig/dataleon/resources/companies/documents.rbs +22 -0
- data/sig/dataleon/resources/companies.rbs +50 -0
- data/sig/dataleon/resources/individuals/documents.rbs +22 -0
- data/sig/dataleon/resources/individuals.rbs +50 -0
- data/sig/dataleon/version.rbs +3 -0
- metadata +206 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Dataleon
|
|
4
|
+
module Resources
|
|
5
|
+
class Companies
|
|
6
|
+
sig { returns(Dataleon::Resources::Companies::Documents) }
|
|
7
|
+
attr_reader :documents
|
|
8
|
+
|
|
9
|
+
# Create a new company
|
|
10
|
+
sig do
|
|
11
|
+
params(
|
|
12
|
+
company: Dataleon::CompanyCreateParams::Company::OrHash,
|
|
13
|
+
workspace_id: String,
|
|
14
|
+
source_id: String,
|
|
15
|
+
technical_data: Dataleon::CompanyCreateParams::TechnicalData::OrHash,
|
|
16
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
17
|
+
).returns(Dataleon::CompanyRegistration)
|
|
18
|
+
end
|
|
19
|
+
def create(
|
|
20
|
+
# Main information about the company being registered.
|
|
21
|
+
company:,
|
|
22
|
+
# Unique identifier of the workspace in which the company is being created.
|
|
23
|
+
workspace_id:,
|
|
24
|
+
# Optional identifier to track the origin of the request or integration from your
|
|
25
|
+
# system.
|
|
26
|
+
source_id: nil,
|
|
27
|
+
# Technical metadata and callback configuration.
|
|
28
|
+
technical_data: nil,
|
|
29
|
+
request_options: {}
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Get a company by ID
|
|
34
|
+
sig do
|
|
35
|
+
params(
|
|
36
|
+
company_id: String,
|
|
37
|
+
document: T::Boolean,
|
|
38
|
+
scope: String,
|
|
39
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
40
|
+
).returns(Dataleon::CompanyRegistration)
|
|
41
|
+
end
|
|
42
|
+
def retrieve(
|
|
43
|
+
# ID of the company
|
|
44
|
+
company_id,
|
|
45
|
+
# Include document signed url
|
|
46
|
+
document: nil,
|
|
47
|
+
# Scope filter (id or scope)
|
|
48
|
+
scope: nil,
|
|
49
|
+
request_options: {}
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Update a company by ID
|
|
54
|
+
sig do
|
|
55
|
+
params(
|
|
56
|
+
company_id: String,
|
|
57
|
+
company: Dataleon::CompanyUpdateParams::Company::OrHash,
|
|
58
|
+
workspace_id: String,
|
|
59
|
+
source_id: String,
|
|
60
|
+
technical_data: Dataleon::CompanyUpdateParams::TechnicalData::OrHash,
|
|
61
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
62
|
+
).returns(Dataleon::CompanyRegistration)
|
|
63
|
+
end
|
|
64
|
+
def update(
|
|
65
|
+
# ID of the company to update
|
|
66
|
+
company_id,
|
|
67
|
+
# Main information about the company being registered.
|
|
68
|
+
company:,
|
|
69
|
+
# Unique identifier of the workspace in which the company is being created.
|
|
70
|
+
workspace_id:,
|
|
71
|
+
# Optional identifier to track the origin of the request or integration from your
|
|
72
|
+
# system.
|
|
73
|
+
source_id: nil,
|
|
74
|
+
# Technical metadata and callback configuration.
|
|
75
|
+
technical_data: nil,
|
|
76
|
+
request_options: {}
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Get all companies
|
|
81
|
+
sig do
|
|
82
|
+
params(
|
|
83
|
+
end_date: Date,
|
|
84
|
+
limit: Integer,
|
|
85
|
+
offset: Integer,
|
|
86
|
+
source_id: String,
|
|
87
|
+
start_date: Date,
|
|
88
|
+
state: Dataleon::CompanyListParams::State::OrSymbol,
|
|
89
|
+
status: Dataleon::CompanyListParams::Status::OrSymbol,
|
|
90
|
+
workspace_id: String,
|
|
91
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
92
|
+
).returns(T::Array[Dataleon::CompanyRegistration])
|
|
93
|
+
end
|
|
94
|
+
def list(
|
|
95
|
+
# Filter companies created before this date (format YYYY-MM-DD)
|
|
96
|
+
end_date: nil,
|
|
97
|
+
# Number of results to return (between 1 and 100)
|
|
98
|
+
limit: nil,
|
|
99
|
+
# Number of results to skip (must be ≥ 0)
|
|
100
|
+
offset: nil,
|
|
101
|
+
# Filter by source ID
|
|
102
|
+
source_id: nil,
|
|
103
|
+
# Filter companies created after this date (format YYYY-MM-DD)
|
|
104
|
+
start_date: nil,
|
|
105
|
+
# Filter by company state (must be one of the allowed values)
|
|
106
|
+
state: nil,
|
|
107
|
+
# Filter by individual status (must be one of the allowed values)
|
|
108
|
+
status: nil,
|
|
109
|
+
# Filter by workspace ID
|
|
110
|
+
workspace_id: nil,
|
|
111
|
+
request_options: {}
|
|
112
|
+
)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Delete a company by ID
|
|
116
|
+
sig do
|
|
117
|
+
params(
|
|
118
|
+
company_id: String,
|
|
119
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
120
|
+
).void
|
|
121
|
+
end
|
|
122
|
+
def delete(
|
|
123
|
+
# ID of the company to delete
|
|
124
|
+
company_id,
|
|
125
|
+
request_options: {}
|
|
126
|
+
)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# @api private
|
|
130
|
+
sig { params(client: Dataleon::Client).returns(T.attached_class) }
|
|
131
|
+
def self.new(client:)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Dataleon
|
|
4
|
+
module Resources
|
|
5
|
+
class Individuals
|
|
6
|
+
class Documents
|
|
7
|
+
# Get documents to an individuals
|
|
8
|
+
sig do
|
|
9
|
+
params(
|
|
10
|
+
individual_id: String,
|
|
11
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
12
|
+
).returns(Dataleon::Individuals::DocumentResponse)
|
|
13
|
+
end
|
|
14
|
+
def list(
|
|
15
|
+
# ID of the individual to upload document
|
|
16
|
+
individual_id,
|
|
17
|
+
request_options: {}
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Upload documents to an individual
|
|
22
|
+
sig do
|
|
23
|
+
params(
|
|
24
|
+
individual_id: String,
|
|
25
|
+
document_type:
|
|
26
|
+
Dataleon::Individuals::DocumentUploadParams::DocumentType::OrSymbol,
|
|
27
|
+
file: Dataleon::Internal::FileInput,
|
|
28
|
+
url: String,
|
|
29
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
30
|
+
).returns(Dataleon::Individuals::GenericDocument)
|
|
31
|
+
end
|
|
32
|
+
def upload(
|
|
33
|
+
# ID of the individual to upload document
|
|
34
|
+
individual_id,
|
|
35
|
+
# Filter by document type for upload (must be one of the allowed values)
|
|
36
|
+
document_type:,
|
|
37
|
+
# File to upload (required)
|
|
38
|
+
file: nil,
|
|
39
|
+
# URL of the file to upload (either `file` or `url` is required)
|
|
40
|
+
url: nil,
|
|
41
|
+
request_options: {}
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# @api private
|
|
46
|
+
sig { params(client: Dataleon::Client).returns(T.attached_class) }
|
|
47
|
+
def self.new(client:)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Dataleon
|
|
4
|
+
module Resources
|
|
5
|
+
class Individuals
|
|
6
|
+
sig { returns(Dataleon::Resources::Individuals::Documents) }
|
|
7
|
+
attr_reader :documents
|
|
8
|
+
|
|
9
|
+
# Create a new individual
|
|
10
|
+
sig do
|
|
11
|
+
params(
|
|
12
|
+
workspace_id: String,
|
|
13
|
+
person: Dataleon::IndividualCreateParams::Person::OrHash,
|
|
14
|
+
source_id: String,
|
|
15
|
+
technical_data:
|
|
16
|
+
Dataleon::IndividualCreateParams::TechnicalData::OrHash,
|
|
17
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
18
|
+
).returns(Dataleon::Individual)
|
|
19
|
+
end
|
|
20
|
+
def create(
|
|
21
|
+
# Unique identifier of the workspace where the individual is being registered.
|
|
22
|
+
workspace_id:,
|
|
23
|
+
# Personal information about the individual.
|
|
24
|
+
person: nil,
|
|
25
|
+
# Optional identifier for tracking the source system or integration from your
|
|
26
|
+
# system.
|
|
27
|
+
source_id: nil,
|
|
28
|
+
# Technical metadata related to the request or processing.
|
|
29
|
+
technical_data: nil,
|
|
30
|
+
request_options: {}
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Get an individual by ID
|
|
35
|
+
sig do
|
|
36
|
+
params(
|
|
37
|
+
individual_id: String,
|
|
38
|
+
document: T::Boolean,
|
|
39
|
+
scope: String,
|
|
40
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
41
|
+
).returns(Dataleon::Individual)
|
|
42
|
+
end
|
|
43
|
+
def retrieve(
|
|
44
|
+
# ID of the individual
|
|
45
|
+
individual_id,
|
|
46
|
+
# Include document information
|
|
47
|
+
document: nil,
|
|
48
|
+
# Scope filter (id or scope)
|
|
49
|
+
scope: nil,
|
|
50
|
+
request_options: {}
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Update an individual by ID
|
|
55
|
+
sig do
|
|
56
|
+
params(
|
|
57
|
+
individual_id: String,
|
|
58
|
+
workspace_id: String,
|
|
59
|
+
person: Dataleon::IndividualUpdateParams::Person::OrHash,
|
|
60
|
+
source_id: String,
|
|
61
|
+
technical_data:
|
|
62
|
+
Dataleon::IndividualUpdateParams::TechnicalData::OrHash,
|
|
63
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
64
|
+
).returns(Dataleon::Individual)
|
|
65
|
+
end
|
|
66
|
+
def update(
|
|
67
|
+
# ID of the individual to update
|
|
68
|
+
individual_id,
|
|
69
|
+
# Unique identifier of the workspace where the individual is being registered.
|
|
70
|
+
workspace_id:,
|
|
71
|
+
# Personal information about the individual.
|
|
72
|
+
person: nil,
|
|
73
|
+
# Optional identifier for tracking the source system or integration from your
|
|
74
|
+
# system.
|
|
75
|
+
source_id: nil,
|
|
76
|
+
# Technical metadata related to the request or processing.
|
|
77
|
+
technical_data: nil,
|
|
78
|
+
request_options: {}
|
|
79
|
+
)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Get all individuals
|
|
83
|
+
sig do
|
|
84
|
+
params(
|
|
85
|
+
end_date: Date,
|
|
86
|
+
limit: Integer,
|
|
87
|
+
offset: Integer,
|
|
88
|
+
source_id: String,
|
|
89
|
+
start_date: Date,
|
|
90
|
+
state: Dataleon::IndividualListParams::State::OrSymbol,
|
|
91
|
+
status: Dataleon::IndividualListParams::Status::OrSymbol,
|
|
92
|
+
workspace_id: String,
|
|
93
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
94
|
+
).returns(T::Array[Dataleon::Individual])
|
|
95
|
+
end
|
|
96
|
+
def list(
|
|
97
|
+
# Filter individuals created before this date (format YYYY-MM-DD)
|
|
98
|
+
end_date: nil,
|
|
99
|
+
# Number of results to return (between 1 and 100)
|
|
100
|
+
limit: nil,
|
|
101
|
+
# Number of results to offset (must be ≥ 0)
|
|
102
|
+
offset: nil,
|
|
103
|
+
# Filter by source ID
|
|
104
|
+
source_id: nil,
|
|
105
|
+
# Filter individuals created after this date (format YYYY-MM-DD)
|
|
106
|
+
start_date: nil,
|
|
107
|
+
# Filter by individual status (must be one of the allowed values)
|
|
108
|
+
state: nil,
|
|
109
|
+
# Filter by individual status (must be one of the allowed values)
|
|
110
|
+
status: nil,
|
|
111
|
+
# Filter by workspace ID
|
|
112
|
+
workspace_id: nil,
|
|
113
|
+
request_options: {}
|
|
114
|
+
)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Delete an individual by ID
|
|
118
|
+
sig do
|
|
119
|
+
params(
|
|
120
|
+
individual_id: String,
|
|
121
|
+
request_options: Dataleon::RequestOptions::OrHash
|
|
122
|
+
).void
|
|
123
|
+
end
|
|
124
|
+
def delete(
|
|
125
|
+
# ID of the individual to delete
|
|
126
|
+
individual_id,
|
|
127
|
+
request_options: {}
|
|
128
|
+
)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# @api private
|
|
132
|
+
sig { params(client: Dataleon::Client).returns(T.attached_class) }
|
|
133
|
+
def self.new(client:)
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Dataleon
|
|
2
|
+
class Client < Dataleon::Internal::Transport::BaseClient
|
|
3
|
+
DEFAULT_MAX_RETRIES: 2
|
|
4
|
+
|
|
5
|
+
DEFAULT_TIMEOUT_IN_SECONDS: Float
|
|
6
|
+
|
|
7
|
+
DEFAULT_INITIAL_RETRY_DELAY: Float
|
|
8
|
+
|
|
9
|
+
DEFAULT_MAX_RETRY_DELAY: Float
|
|
10
|
+
|
|
11
|
+
attr_reader api_key: String
|
|
12
|
+
|
|
13
|
+
attr_reader individuals: Dataleon::Resources::Individuals
|
|
14
|
+
|
|
15
|
+
attr_reader companies: Dataleon::Resources::Companies
|
|
16
|
+
|
|
17
|
+
private def auth_headers: -> ::Hash[String, String]
|
|
18
|
+
|
|
19
|
+
def initialize: (
|
|
20
|
+
?api_key: String?,
|
|
21
|
+
?base_url: String?,
|
|
22
|
+
?max_retries: Integer,
|
|
23
|
+
?timeout: Float,
|
|
24
|
+
?initial_retry_delay: Float,
|
|
25
|
+
?max_retry_delay: Float
|
|
26
|
+
) -> void
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
module Dataleon
|
|
2
|
+
module Errors
|
|
3
|
+
class Error < StandardError
|
|
4
|
+
attr_accessor cause: StandardError?
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class ConversionError < Dataleon::Errors::Error
|
|
8
|
+
def cause: -> StandardError?
|
|
9
|
+
|
|
10
|
+
def initialize: (
|
|
11
|
+
on: Class,
|
|
12
|
+
method: Symbol,
|
|
13
|
+
target: top,
|
|
14
|
+
value: top,
|
|
15
|
+
?cause: StandardError?
|
|
16
|
+
) -> void
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class APIError < Dataleon::Errors::Error
|
|
20
|
+
attr_accessor url: URI::Generic
|
|
21
|
+
|
|
22
|
+
attr_accessor status: Integer?
|
|
23
|
+
|
|
24
|
+
attr_accessor body: top?
|
|
25
|
+
|
|
26
|
+
def initialize: (
|
|
27
|
+
url: URI::Generic,
|
|
28
|
+
?status: Integer?,
|
|
29
|
+
?body: Object?,
|
|
30
|
+
?request: nil,
|
|
31
|
+
?response: nil,
|
|
32
|
+
?message: String?
|
|
33
|
+
) -> void
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class APIConnectionError < Dataleon::Errors::APIError
|
|
37
|
+
def initialize: (
|
|
38
|
+
url: URI::Generic,
|
|
39
|
+
?status: nil,
|
|
40
|
+
?body: nil,
|
|
41
|
+
?request: nil,
|
|
42
|
+
?response: nil,
|
|
43
|
+
?message: String?
|
|
44
|
+
) -> void
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class APITimeoutError < Dataleon::Errors::APIConnectionError
|
|
48
|
+
def initialize: (
|
|
49
|
+
url: URI::Generic,
|
|
50
|
+
?status: nil,
|
|
51
|
+
?body: nil,
|
|
52
|
+
?request: nil,
|
|
53
|
+
?response: nil,
|
|
54
|
+
?message: String?
|
|
55
|
+
) -> void
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
class APIStatusError < Dataleon::Errors::APIError
|
|
59
|
+
def self.for: (
|
|
60
|
+
url: URI::Generic,
|
|
61
|
+
status: Integer,
|
|
62
|
+
body: Object?,
|
|
63
|
+
request: nil,
|
|
64
|
+
response: nil,
|
|
65
|
+
?message: String?
|
|
66
|
+
) -> instance
|
|
67
|
+
|
|
68
|
+
def initialize: (
|
|
69
|
+
url: URI::Generic,
|
|
70
|
+
status: Integer,
|
|
71
|
+
body: Object?,
|
|
72
|
+
request: nil,
|
|
73
|
+
response: nil,
|
|
74
|
+
?message: String?
|
|
75
|
+
) -> void
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
class BadRequestError < Dataleon::Errors::APIStatusError
|
|
79
|
+
HTTP_STATUS: 400
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class AuthenticationError < Dataleon::Errors::APIStatusError
|
|
83
|
+
HTTP_STATUS: 401
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
class PermissionDeniedError < Dataleon::Errors::APIStatusError
|
|
87
|
+
HTTP_STATUS: 403
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
class NotFoundError < Dataleon::Errors::APIStatusError
|
|
91
|
+
HTTP_STATUS: 404
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
class ConflictError < Dataleon::Errors::APIStatusError
|
|
95
|
+
HTTP_STATUS: 409
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
class UnprocessableEntityError < Dataleon::Errors::APIStatusError
|
|
99
|
+
HTTP_STATUS: 422
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
class RateLimitError < Dataleon::Errors::APIStatusError
|
|
103
|
+
HTTP_STATUS: 429
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
class InternalServerError < Dataleon::Errors::APIStatusError
|
|
107
|
+
HTTP_STATUS: Range[Integer]
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Dataleon
|
|
2
|
+
class FilePart
|
|
3
|
+
attr_reader content: Pathname | StringIO | IO | String
|
|
4
|
+
|
|
5
|
+
attr_reader content_type: String?
|
|
6
|
+
|
|
7
|
+
attr_reader filename: String?
|
|
8
|
+
|
|
9
|
+
private def read: -> String
|
|
10
|
+
|
|
11
|
+
def to_json: (*top a) -> String
|
|
12
|
+
|
|
13
|
+
def to_yaml: (*top a) -> String
|
|
14
|
+
|
|
15
|
+
def initialize: (
|
|
16
|
+
Pathname | StringIO | IO | String content,
|
|
17
|
+
?filename: String?,
|
|
18
|
+
?content_type: String?
|
|
19
|
+
) -> void
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
module Dataleon
|
|
2
|
+
module Internal
|
|
3
|
+
module Transport
|
|
4
|
+
class BaseClient
|
|
5
|
+
extend Dataleon::Internal::Util::SorbetRuntimeSupport
|
|
6
|
+
|
|
7
|
+
type request_components =
|
|
8
|
+
{
|
|
9
|
+
method: Symbol,
|
|
10
|
+
path: String | ::Array[String],
|
|
11
|
+
query: ::Hash[String, (::Array[String] | String)?]?,
|
|
12
|
+
headers: ::Hash[String, (String
|
|
13
|
+
| Integer
|
|
14
|
+
| ::Array[(String | Integer)?])?]?,
|
|
15
|
+
body: top?,
|
|
16
|
+
unwrap: (Symbol
|
|
17
|
+
| Integer
|
|
18
|
+
| ::Array[(Symbol | Integer)]
|
|
19
|
+
| (^(top arg0) -> top))?,
|
|
20
|
+
page: Class?,
|
|
21
|
+
stream: Class?,
|
|
22
|
+
model: Dataleon::Internal::Type::Converter::input?,
|
|
23
|
+
options: Dataleon::request_opts?
|
|
24
|
+
}
|
|
25
|
+
type request_input =
|
|
26
|
+
{
|
|
27
|
+
method: Symbol,
|
|
28
|
+
url: URI::Generic,
|
|
29
|
+
headers: ::Hash[String, String],
|
|
30
|
+
body: top,
|
|
31
|
+
max_retries: Integer,
|
|
32
|
+
timeout: Float
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
MAX_REDIRECTS: 20
|
|
36
|
+
|
|
37
|
+
PLATFORM_HEADERS: ::Hash[String, String]
|
|
38
|
+
|
|
39
|
+
def self.validate!: (
|
|
40
|
+
Dataleon::Internal::Transport::BaseClient::request_components req
|
|
41
|
+
) -> void
|
|
42
|
+
|
|
43
|
+
def self.should_retry?: (
|
|
44
|
+
Integer status,
|
|
45
|
+
headers: ::Hash[String, String]
|
|
46
|
+
) -> bool
|
|
47
|
+
|
|
48
|
+
def self.follow_redirect: (
|
|
49
|
+
Dataleon::Internal::Transport::BaseClient::request_input request,
|
|
50
|
+
status: Integer,
|
|
51
|
+
response_headers: ::Hash[String, String]
|
|
52
|
+
) -> Dataleon::Internal::Transport::BaseClient::request_input
|
|
53
|
+
|
|
54
|
+
def self.reap_connection!: (
|
|
55
|
+
Integer | Dataleon::Errors::APIConnectionError status,
|
|
56
|
+
stream: Enumerable[String]?
|
|
57
|
+
) -> void
|
|
58
|
+
|
|
59
|
+
attr_reader base_url: URI::Generic
|
|
60
|
+
|
|
61
|
+
attr_reader timeout: Float
|
|
62
|
+
|
|
63
|
+
attr_reader max_retries: Integer
|
|
64
|
+
|
|
65
|
+
attr_reader initial_retry_delay: Float
|
|
66
|
+
|
|
67
|
+
attr_reader max_retry_delay: Float
|
|
68
|
+
|
|
69
|
+
attr_reader headers: ::Hash[String, String]
|
|
70
|
+
|
|
71
|
+
attr_reader idempotency_header: String?
|
|
72
|
+
|
|
73
|
+
# @api private
|
|
74
|
+
attr_reader requester: Dataleon::Internal::Transport::PooledNetRequester
|
|
75
|
+
|
|
76
|
+
def initialize: (
|
|
77
|
+
base_url: String,
|
|
78
|
+
?timeout: Float,
|
|
79
|
+
?max_retries: Integer,
|
|
80
|
+
?initial_retry_delay: Float,
|
|
81
|
+
?max_retry_delay: Float,
|
|
82
|
+
?headers: ::Hash[String, (String
|
|
83
|
+
| Integer
|
|
84
|
+
| ::Array[(String | Integer)?])?],
|
|
85
|
+
?idempotency_header: String?
|
|
86
|
+
) -> void
|
|
87
|
+
|
|
88
|
+
private def auth_headers: -> ::Hash[String, String]
|
|
89
|
+
|
|
90
|
+
private def generate_idempotency_key: -> String
|
|
91
|
+
|
|
92
|
+
private def build_request: (
|
|
93
|
+
Dataleon::Internal::Transport::BaseClient::request_components req,
|
|
94
|
+
Dataleon::request_options opts
|
|
95
|
+
) -> Dataleon::Internal::Transport::BaseClient::request_input
|
|
96
|
+
|
|
97
|
+
private def retry_delay: (
|
|
98
|
+
::Hash[String, String] headers,
|
|
99
|
+
retry_count: Integer
|
|
100
|
+
) -> Float
|
|
101
|
+
|
|
102
|
+
def send_request: (
|
|
103
|
+
Dataleon::Internal::Transport::BaseClient::request_input request,
|
|
104
|
+
redirect_count: Integer,
|
|
105
|
+
retry_count: Integer,
|
|
106
|
+
send_retry_header: bool
|
|
107
|
+
) -> [Integer, top, Enumerable[String]]
|
|
108
|
+
|
|
109
|
+
def request: (
|
|
110
|
+
Symbol method,
|
|
111
|
+
String | ::Array[String] path,
|
|
112
|
+
?query: ::Hash[String, (::Array[String] | String)?]?,
|
|
113
|
+
?headers: ::Hash[String, (String
|
|
114
|
+
| Integer
|
|
115
|
+
| ::Array[(String | Integer)?])?]?,
|
|
116
|
+
?body: top?,
|
|
117
|
+
?unwrap: (Symbol
|
|
118
|
+
| Integer
|
|
119
|
+
| ::Array[(Symbol | Integer)]
|
|
120
|
+
| (^(top arg0) -> top))?,
|
|
121
|
+
?page: Class?,
|
|
122
|
+
?stream: Class?,
|
|
123
|
+
?model: Dataleon::Internal::Type::Converter::input?,
|
|
124
|
+
?options: Dataleon::request_opts?
|
|
125
|
+
) -> top
|
|
126
|
+
|
|
127
|
+
def inspect: -> String
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module Dataleon
|
|
2
|
+
module Internal
|
|
3
|
+
module Transport
|
|
4
|
+
class PooledNetRequester
|
|
5
|
+
extend Dataleon::Internal::Util::SorbetRuntimeSupport
|
|
6
|
+
|
|
7
|
+
type request =
|
|
8
|
+
{
|
|
9
|
+
method: Symbol,
|
|
10
|
+
url: URI::Generic,
|
|
11
|
+
headers: ::Hash[String, String],
|
|
12
|
+
body: top,
|
|
13
|
+
deadline: Float
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
KEEP_ALIVE_TIMEOUT: 30
|
|
17
|
+
|
|
18
|
+
DEFAULT_MAX_CONNECTIONS: Integer
|
|
19
|
+
|
|
20
|
+
def self.connect: (URI::Generic url) -> top
|
|
21
|
+
|
|
22
|
+
def self.calibrate_socket_timeout: (top conn, Float deadline) -> void
|
|
23
|
+
|
|
24
|
+
def self.build_request: (
|
|
25
|
+
Dataleon::Internal::Transport::PooledNetRequester::request request
|
|
26
|
+
) {
|
|
27
|
+
(String arg0) -> void
|
|
28
|
+
} -> [top, (^-> void)]
|
|
29
|
+
|
|
30
|
+
private def with_pool: (
|
|
31
|
+
URI::Generic url,
|
|
32
|
+
deadline: Float
|
|
33
|
+
) {
|
|
34
|
+
(top arg0) -> void
|
|
35
|
+
} -> void
|
|
36
|
+
|
|
37
|
+
def execute: (
|
|
38
|
+
Dataleon::Internal::Transport::PooledNetRequester::request request
|
|
39
|
+
) -> [Integer, top, Enumerable[String]]
|
|
40
|
+
|
|
41
|
+
def initialize: (?size: Integer) -> void
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|