dataleon 0.1.0a8__py3-none-any.whl
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.
Potentially problematic release.
This version of dataleon might be problematic. Click here for more details.
- dataleon/__init__.py +102 -0
- dataleon/_base_client.py +1995 -0
- dataleon/_client.py +412 -0
- dataleon/_compat.py +219 -0
- dataleon/_constants.py +14 -0
- dataleon/_exceptions.py +108 -0
- dataleon/_files.py +123 -0
- dataleon/_models.py +840 -0
- dataleon/_qs.py +150 -0
- dataleon/_resource.py +43 -0
- dataleon/_response.py +830 -0
- dataleon/_streaming.py +331 -0
- dataleon/_types.py +260 -0
- dataleon/_utils/__init__.py +64 -0
- dataleon/_utils/_compat.py +45 -0
- dataleon/_utils/_datetime_parse.py +136 -0
- dataleon/_utils/_logs.py +25 -0
- dataleon/_utils/_proxy.py +65 -0
- dataleon/_utils/_reflection.py +42 -0
- dataleon/_utils/_resources_proxy.py +24 -0
- dataleon/_utils/_streams.py +12 -0
- dataleon/_utils/_sync.py +58 -0
- dataleon/_utils/_transform.py +457 -0
- dataleon/_utils/_typing.py +156 -0
- dataleon/_utils/_utils.py +421 -0
- dataleon/_version.py +4 -0
- dataleon/lib/.keep +4 -0
- dataleon/py.typed +0 -0
- dataleon/resources/__init__.py +33 -0
- dataleon/resources/companies/__init__.py +33 -0
- dataleon/resources/companies/companies.py +706 -0
- dataleon/resources/companies/documents.py +361 -0
- dataleon/resources/individuals/__init__.py +33 -0
- dataleon/resources/individuals/documents.py +361 -0
- dataleon/resources/individuals/individuals.py +711 -0
- dataleon/types/__init__.py +17 -0
- dataleon/types/companies/__init__.py +5 -0
- dataleon/types/companies/document_upload_params.py +56 -0
- dataleon/types/company_create_params.py +101 -0
- dataleon/types/company_list_params.py +37 -0
- dataleon/types/company_list_response.py +10 -0
- dataleon/types/company_registration.py +439 -0
- dataleon/types/company_retrieve_params.py +15 -0
- dataleon/types/company_update_params.py +101 -0
- dataleon/types/individual.py +336 -0
- dataleon/types/individual_create_params.py +78 -0
- dataleon/types/individual_list_params.py +37 -0
- dataleon/types/individual_list_response.py +10 -0
- dataleon/types/individual_retrieve_params.py +15 -0
- dataleon/types/individual_update_params.py +78 -0
- dataleon/types/individuals/__init__.py +7 -0
- dataleon/types/individuals/document_response.py +41 -0
- dataleon/types/individuals/document_upload_params.py +56 -0
- dataleon/types/individuals/generic_document.py +57 -0
- dataleon/types/shared/__init__.py +3 -0
- dataleon/types/shared/check.py +26 -0
- dataleon-0.1.0a8.dist-info/METADATA +448 -0
- dataleon-0.1.0a8.dist-info/RECORD +60 -0
- dataleon-0.1.0a8.dist-info/WHEEL +4 -0
- dataleon-0.1.0a8.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Mapping, cast
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given
|
|
11
|
+
from ..._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
|
|
12
|
+
from ..._compat import cached_property
|
|
13
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
14
|
+
from ..._response import (
|
|
15
|
+
to_raw_response_wrapper,
|
|
16
|
+
to_streamed_response_wrapper,
|
|
17
|
+
async_to_raw_response_wrapper,
|
|
18
|
+
async_to_streamed_response_wrapper,
|
|
19
|
+
)
|
|
20
|
+
from ..._base_client import make_request_options
|
|
21
|
+
from ...types.companies import document_upload_params
|
|
22
|
+
from ...types.individuals.generic_document import GenericDocument
|
|
23
|
+
from ...types.individuals.document_response import DocumentResponse
|
|
24
|
+
|
|
25
|
+
__all__ = ["DocumentsResource", "AsyncDocumentsResource"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class DocumentsResource(SyncAPIResource):
|
|
29
|
+
@cached_property
|
|
30
|
+
def with_raw_response(self) -> DocumentsResourceWithRawResponse:
|
|
31
|
+
"""
|
|
32
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
33
|
+
the raw response object instead of the parsed content.
|
|
34
|
+
|
|
35
|
+
For more information, see https://www.github.com/dataleonlabs/dataleon-python#accessing-raw-response-data-eg-headers
|
|
36
|
+
"""
|
|
37
|
+
return DocumentsResourceWithRawResponse(self)
|
|
38
|
+
|
|
39
|
+
@cached_property
|
|
40
|
+
def with_streaming_response(self) -> DocumentsResourceWithStreamingResponse:
|
|
41
|
+
"""
|
|
42
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
43
|
+
|
|
44
|
+
For more information, see https://www.github.com/dataleonlabs/dataleon-python#with_streaming_response
|
|
45
|
+
"""
|
|
46
|
+
return DocumentsResourceWithStreamingResponse(self)
|
|
47
|
+
|
|
48
|
+
def list(
|
|
49
|
+
self,
|
|
50
|
+
company_id: str,
|
|
51
|
+
*,
|
|
52
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
53
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
54
|
+
extra_headers: Headers | None = None,
|
|
55
|
+
extra_query: Query | None = None,
|
|
56
|
+
extra_body: Body | None = None,
|
|
57
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
58
|
+
) -> DocumentResponse:
|
|
59
|
+
"""
|
|
60
|
+
Get documents to an company
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
extra_headers: Send extra headers
|
|
64
|
+
|
|
65
|
+
extra_query: Add additional query parameters to the request
|
|
66
|
+
|
|
67
|
+
extra_body: Add additional JSON properties to the request
|
|
68
|
+
|
|
69
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
70
|
+
"""
|
|
71
|
+
if not company_id:
|
|
72
|
+
raise ValueError(f"Expected a non-empty value for `company_id` but received {company_id!r}")
|
|
73
|
+
return self._get(
|
|
74
|
+
f"/companies/{company_id}/documents",
|
|
75
|
+
options=make_request_options(
|
|
76
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
77
|
+
),
|
|
78
|
+
cast_to=DocumentResponse,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
def upload(
|
|
82
|
+
self,
|
|
83
|
+
company_id: str,
|
|
84
|
+
*,
|
|
85
|
+
document_type: Literal[
|
|
86
|
+
"liasse_fiscale",
|
|
87
|
+
"amortised_loan_schedule",
|
|
88
|
+
"invoice",
|
|
89
|
+
"receipt",
|
|
90
|
+
"company_statuts",
|
|
91
|
+
"registration_company_certificate",
|
|
92
|
+
"kbis",
|
|
93
|
+
"rib",
|
|
94
|
+
"livret_famille",
|
|
95
|
+
"birth_certificate",
|
|
96
|
+
"payslip",
|
|
97
|
+
"social_security_card",
|
|
98
|
+
"vehicle_registration_certificate",
|
|
99
|
+
"carte_grise",
|
|
100
|
+
"criminal_record_extract",
|
|
101
|
+
"proof_of_address",
|
|
102
|
+
"identity_card_front",
|
|
103
|
+
"identity_card_back",
|
|
104
|
+
"driver_license_front",
|
|
105
|
+
"driver_license_back",
|
|
106
|
+
"identity_document",
|
|
107
|
+
"driver_license",
|
|
108
|
+
"passport",
|
|
109
|
+
"tax",
|
|
110
|
+
"certificate_of_incorporation",
|
|
111
|
+
"certificate_of_good_standing",
|
|
112
|
+
"lcb_ft_lab_aml_policies",
|
|
113
|
+
"niu_entreprise",
|
|
114
|
+
"financial_statements",
|
|
115
|
+
"rccm",
|
|
116
|
+
"proof_of_source_funds",
|
|
117
|
+
"organizational_chart",
|
|
118
|
+
"risk_policies",
|
|
119
|
+
],
|
|
120
|
+
file: FileTypes | Omit = omit,
|
|
121
|
+
url: str | Omit = omit,
|
|
122
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
123
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
124
|
+
extra_headers: Headers | None = None,
|
|
125
|
+
extra_query: Query | None = None,
|
|
126
|
+
extra_body: Body | None = None,
|
|
127
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
128
|
+
) -> GenericDocument:
|
|
129
|
+
"""
|
|
130
|
+
Upload documents to an company
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
document_type: Filter by document type for upload (must be one of the allowed values)
|
|
134
|
+
|
|
135
|
+
file: File to upload (required)
|
|
136
|
+
|
|
137
|
+
url: URL of the file to upload (either `file` or `url` is required)
|
|
138
|
+
|
|
139
|
+
extra_headers: Send extra headers
|
|
140
|
+
|
|
141
|
+
extra_query: Add additional query parameters to the request
|
|
142
|
+
|
|
143
|
+
extra_body: Add additional JSON properties to the request
|
|
144
|
+
|
|
145
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
146
|
+
"""
|
|
147
|
+
if not company_id:
|
|
148
|
+
raise ValueError(f"Expected a non-empty value for `company_id` but received {company_id!r}")
|
|
149
|
+
body = deepcopy_minimal(
|
|
150
|
+
{
|
|
151
|
+
"document_type": document_type,
|
|
152
|
+
"file": file,
|
|
153
|
+
"url": url,
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
|
157
|
+
# It should be noted that the actual Content-Type header that will be
|
|
158
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
159
|
+
# multipart/form-data; boundary=---abc--
|
|
160
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
161
|
+
return self._post(
|
|
162
|
+
f"/companies/{company_id}/documents",
|
|
163
|
+
body=maybe_transform(body, document_upload_params.DocumentUploadParams),
|
|
164
|
+
files=files,
|
|
165
|
+
options=make_request_options(
|
|
166
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
167
|
+
),
|
|
168
|
+
cast_to=GenericDocument,
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class AsyncDocumentsResource(AsyncAPIResource):
|
|
173
|
+
@cached_property
|
|
174
|
+
def with_raw_response(self) -> AsyncDocumentsResourceWithRawResponse:
|
|
175
|
+
"""
|
|
176
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
177
|
+
the raw response object instead of the parsed content.
|
|
178
|
+
|
|
179
|
+
For more information, see https://www.github.com/dataleonlabs/dataleon-python#accessing-raw-response-data-eg-headers
|
|
180
|
+
"""
|
|
181
|
+
return AsyncDocumentsResourceWithRawResponse(self)
|
|
182
|
+
|
|
183
|
+
@cached_property
|
|
184
|
+
def with_streaming_response(self) -> AsyncDocumentsResourceWithStreamingResponse:
|
|
185
|
+
"""
|
|
186
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
187
|
+
|
|
188
|
+
For more information, see https://www.github.com/dataleonlabs/dataleon-python#with_streaming_response
|
|
189
|
+
"""
|
|
190
|
+
return AsyncDocumentsResourceWithStreamingResponse(self)
|
|
191
|
+
|
|
192
|
+
async def list(
|
|
193
|
+
self,
|
|
194
|
+
company_id: str,
|
|
195
|
+
*,
|
|
196
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
197
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
198
|
+
extra_headers: Headers | None = None,
|
|
199
|
+
extra_query: Query | None = None,
|
|
200
|
+
extra_body: Body | None = None,
|
|
201
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
202
|
+
) -> DocumentResponse:
|
|
203
|
+
"""
|
|
204
|
+
Get documents to an company
|
|
205
|
+
|
|
206
|
+
Args:
|
|
207
|
+
extra_headers: Send extra headers
|
|
208
|
+
|
|
209
|
+
extra_query: Add additional query parameters to the request
|
|
210
|
+
|
|
211
|
+
extra_body: Add additional JSON properties to the request
|
|
212
|
+
|
|
213
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
214
|
+
"""
|
|
215
|
+
if not company_id:
|
|
216
|
+
raise ValueError(f"Expected a non-empty value for `company_id` but received {company_id!r}")
|
|
217
|
+
return await self._get(
|
|
218
|
+
f"/companies/{company_id}/documents",
|
|
219
|
+
options=make_request_options(
|
|
220
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
221
|
+
),
|
|
222
|
+
cast_to=DocumentResponse,
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
async def upload(
|
|
226
|
+
self,
|
|
227
|
+
company_id: str,
|
|
228
|
+
*,
|
|
229
|
+
document_type: Literal[
|
|
230
|
+
"liasse_fiscale",
|
|
231
|
+
"amortised_loan_schedule",
|
|
232
|
+
"invoice",
|
|
233
|
+
"receipt",
|
|
234
|
+
"company_statuts",
|
|
235
|
+
"registration_company_certificate",
|
|
236
|
+
"kbis",
|
|
237
|
+
"rib",
|
|
238
|
+
"livret_famille",
|
|
239
|
+
"birth_certificate",
|
|
240
|
+
"payslip",
|
|
241
|
+
"social_security_card",
|
|
242
|
+
"vehicle_registration_certificate",
|
|
243
|
+
"carte_grise",
|
|
244
|
+
"criminal_record_extract",
|
|
245
|
+
"proof_of_address",
|
|
246
|
+
"identity_card_front",
|
|
247
|
+
"identity_card_back",
|
|
248
|
+
"driver_license_front",
|
|
249
|
+
"driver_license_back",
|
|
250
|
+
"identity_document",
|
|
251
|
+
"driver_license",
|
|
252
|
+
"passport",
|
|
253
|
+
"tax",
|
|
254
|
+
"certificate_of_incorporation",
|
|
255
|
+
"certificate_of_good_standing",
|
|
256
|
+
"lcb_ft_lab_aml_policies",
|
|
257
|
+
"niu_entreprise",
|
|
258
|
+
"financial_statements",
|
|
259
|
+
"rccm",
|
|
260
|
+
"proof_of_source_funds",
|
|
261
|
+
"organizational_chart",
|
|
262
|
+
"risk_policies",
|
|
263
|
+
],
|
|
264
|
+
file: FileTypes | Omit = omit,
|
|
265
|
+
url: str | Omit = omit,
|
|
266
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
267
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
268
|
+
extra_headers: Headers | None = None,
|
|
269
|
+
extra_query: Query | None = None,
|
|
270
|
+
extra_body: Body | None = None,
|
|
271
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
272
|
+
) -> GenericDocument:
|
|
273
|
+
"""
|
|
274
|
+
Upload documents to an company
|
|
275
|
+
|
|
276
|
+
Args:
|
|
277
|
+
document_type: Filter by document type for upload (must be one of the allowed values)
|
|
278
|
+
|
|
279
|
+
file: File to upload (required)
|
|
280
|
+
|
|
281
|
+
url: URL of the file to upload (either `file` or `url` is required)
|
|
282
|
+
|
|
283
|
+
extra_headers: Send extra headers
|
|
284
|
+
|
|
285
|
+
extra_query: Add additional query parameters to the request
|
|
286
|
+
|
|
287
|
+
extra_body: Add additional JSON properties to the request
|
|
288
|
+
|
|
289
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
290
|
+
"""
|
|
291
|
+
if not company_id:
|
|
292
|
+
raise ValueError(f"Expected a non-empty value for `company_id` but received {company_id!r}")
|
|
293
|
+
body = deepcopy_minimal(
|
|
294
|
+
{
|
|
295
|
+
"document_type": document_type,
|
|
296
|
+
"file": file,
|
|
297
|
+
"url": url,
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
|
|
301
|
+
# It should be noted that the actual Content-Type header that will be
|
|
302
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
303
|
+
# multipart/form-data; boundary=---abc--
|
|
304
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
305
|
+
return await self._post(
|
|
306
|
+
f"/companies/{company_id}/documents",
|
|
307
|
+
body=await async_maybe_transform(body, document_upload_params.DocumentUploadParams),
|
|
308
|
+
files=files,
|
|
309
|
+
options=make_request_options(
|
|
310
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
311
|
+
),
|
|
312
|
+
cast_to=GenericDocument,
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
class DocumentsResourceWithRawResponse:
|
|
317
|
+
def __init__(self, documents: DocumentsResource) -> None:
|
|
318
|
+
self._documents = documents
|
|
319
|
+
|
|
320
|
+
self.list = to_raw_response_wrapper(
|
|
321
|
+
documents.list,
|
|
322
|
+
)
|
|
323
|
+
self.upload = to_raw_response_wrapper(
|
|
324
|
+
documents.upload,
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
class AsyncDocumentsResourceWithRawResponse:
|
|
329
|
+
def __init__(self, documents: AsyncDocumentsResource) -> None:
|
|
330
|
+
self._documents = documents
|
|
331
|
+
|
|
332
|
+
self.list = async_to_raw_response_wrapper(
|
|
333
|
+
documents.list,
|
|
334
|
+
)
|
|
335
|
+
self.upload = async_to_raw_response_wrapper(
|
|
336
|
+
documents.upload,
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
class DocumentsResourceWithStreamingResponse:
|
|
341
|
+
def __init__(self, documents: DocumentsResource) -> None:
|
|
342
|
+
self._documents = documents
|
|
343
|
+
|
|
344
|
+
self.list = to_streamed_response_wrapper(
|
|
345
|
+
documents.list,
|
|
346
|
+
)
|
|
347
|
+
self.upload = to_streamed_response_wrapper(
|
|
348
|
+
documents.upload,
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
class AsyncDocumentsResourceWithStreamingResponse:
|
|
353
|
+
def __init__(self, documents: AsyncDocumentsResource) -> None:
|
|
354
|
+
self._documents = documents
|
|
355
|
+
|
|
356
|
+
self.list = async_to_streamed_response_wrapper(
|
|
357
|
+
documents.list,
|
|
358
|
+
)
|
|
359
|
+
self.upload = async_to_streamed_response_wrapper(
|
|
360
|
+
documents.upload,
|
|
361
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .documents import (
|
|
4
|
+
DocumentsResource,
|
|
5
|
+
AsyncDocumentsResource,
|
|
6
|
+
DocumentsResourceWithRawResponse,
|
|
7
|
+
AsyncDocumentsResourceWithRawResponse,
|
|
8
|
+
DocumentsResourceWithStreamingResponse,
|
|
9
|
+
AsyncDocumentsResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
11
|
+
from .individuals import (
|
|
12
|
+
IndividualsResource,
|
|
13
|
+
AsyncIndividualsResource,
|
|
14
|
+
IndividualsResourceWithRawResponse,
|
|
15
|
+
AsyncIndividualsResourceWithRawResponse,
|
|
16
|
+
IndividualsResourceWithStreamingResponse,
|
|
17
|
+
AsyncIndividualsResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"DocumentsResource",
|
|
22
|
+
"AsyncDocumentsResource",
|
|
23
|
+
"DocumentsResourceWithRawResponse",
|
|
24
|
+
"AsyncDocumentsResourceWithRawResponse",
|
|
25
|
+
"DocumentsResourceWithStreamingResponse",
|
|
26
|
+
"AsyncDocumentsResourceWithStreamingResponse",
|
|
27
|
+
"IndividualsResource",
|
|
28
|
+
"AsyncIndividualsResource",
|
|
29
|
+
"IndividualsResourceWithRawResponse",
|
|
30
|
+
"AsyncIndividualsResourceWithRawResponse",
|
|
31
|
+
"IndividualsResourceWithStreamingResponse",
|
|
32
|
+
"AsyncIndividualsResourceWithStreamingResponse",
|
|
33
|
+
]
|