dataleon 0.1.0a2__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.
Files changed (58) hide show
  1. dataleon/__init__.py +100 -0
  2. dataleon/_base_client.py +1995 -0
  3. dataleon/_client.py +412 -0
  4. dataleon/_compat.py +219 -0
  5. dataleon/_constants.py +14 -0
  6. dataleon/_exceptions.py +108 -0
  7. dataleon/_files.py +123 -0
  8. dataleon/_models.py +829 -0
  9. dataleon/_qs.py +150 -0
  10. dataleon/_resource.py +43 -0
  11. dataleon/_response.py +830 -0
  12. dataleon/_streaming.py +333 -0
  13. dataleon/_types.py +219 -0
  14. dataleon/_utils/__init__.py +57 -0
  15. dataleon/_utils/_logs.py +25 -0
  16. dataleon/_utils/_proxy.py +65 -0
  17. dataleon/_utils/_reflection.py +42 -0
  18. dataleon/_utils/_resources_proxy.py +24 -0
  19. dataleon/_utils/_streams.py +12 -0
  20. dataleon/_utils/_sync.py +86 -0
  21. dataleon/_utils/_transform.py +447 -0
  22. dataleon/_utils/_typing.py +151 -0
  23. dataleon/_utils/_utils.py +422 -0
  24. dataleon/_version.py +4 -0
  25. dataleon/lib/.keep +4 -0
  26. dataleon/py.typed +0 -0
  27. dataleon/resources/__init__.py +33 -0
  28. dataleon/resources/companies/__init__.py +33 -0
  29. dataleon/resources/companies/companies.py +706 -0
  30. dataleon/resources/companies/documents.py +361 -0
  31. dataleon/resources/individuals/__init__.py +33 -0
  32. dataleon/resources/individuals/documents.py +361 -0
  33. dataleon/resources/individuals/individuals.py +711 -0
  34. dataleon/types/__init__.py +17 -0
  35. dataleon/types/companies/__init__.py +5 -0
  36. dataleon/types/companies/document_upload_params.py +56 -0
  37. dataleon/types/company_create_params.py +94 -0
  38. dataleon/types/company_list_params.py +37 -0
  39. dataleon/types/company_list_response.py +10 -0
  40. dataleon/types/company_registration.py +431 -0
  41. dataleon/types/company_retrieve_params.py +15 -0
  42. dataleon/types/company_update_params.py +94 -0
  43. dataleon/types/individual.py +325 -0
  44. dataleon/types/individual_create_params.py +68 -0
  45. dataleon/types/individual_list_params.py +37 -0
  46. dataleon/types/individual_list_response.py +10 -0
  47. dataleon/types/individual_retrieve_params.py +15 -0
  48. dataleon/types/individual_update_params.py +68 -0
  49. dataleon/types/individuals/__init__.py +7 -0
  50. dataleon/types/individuals/document_response.py +41 -0
  51. dataleon/types/individuals/document_upload_params.py +56 -0
  52. dataleon/types/individuals/generic_document.py +57 -0
  53. dataleon/types/shared/__init__.py +3 -0
  54. dataleon/types/shared/check.py +26 -0
  55. dataleon-0.1.0a2.dist-info/METADATA +449 -0
  56. dataleon-0.1.0a2.dist-info/RECORD +58 -0
  57. dataleon-0.1.0a2.dist-info/WHEEL +4 -0
  58. dataleon-0.1.0a2.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 NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
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.individuals 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
+ individual_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 individuals
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 individual_id:
72
+ raise ValueError(f"Expected a non-empty value for `individual_id` but received {individual_id!r}")
73
+ return self._get(
74
+ f"/individuals/{individual_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
+ individual_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 | NotGiven = NOT_GIVEN,
121
+ url: str | NotGiven = NOT_GIVEN,
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 individual
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 individual_id:
148
+ raise ValueError(f"Expected a non-empty value for `individual_id` but received {individual_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"/individuals/{individual_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
+ individual_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 individuals
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 individual_id:
216
+ raise ValueError(f"Expected a non-empty value for `individual_id` but received {individual_id!r}")
217
+ return await self._get(
218
+ f"/individuals/{individual_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
+ individual_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 | NotGiven = NOT_GIVEN,
265
+ url: str | NotGiven = NOT_GIVEN,
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 individual
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 individual_id:
292
+ raise ValueError(f"Expected a non-empty value for `individual_id` but received {individual_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"/individuals/{individual_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
+ )