@planqk/planqk-api-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.
- package/.devcontainer/devcontainer.json +32 -0
- package/.devcontainer/post-create.sh +7 -0
- package/.env.template +2 -0
- package/.gitlab-ci.yml +71 -0
- package/.python-version +1 -0
- package/.releaserc.json +45 -0
- package/LICENSE +201 -0
- package/README-node.md +18 -0
- package/README-python.md +21 -0
- package/README.md +56 -0
- package/dist/Client.d.ts +32 -0
- package/dist/Client.js +60 -0
- package/dist/api/errors/BadRequestError.d.ts +8 -0
- package/dist/api/errors/BadRequestError.js +52 -0
- package/dist/api/errors/ForbiddenError.d.ts +8 -0
- package/dist/api/errors/ForbiddenError.js +52 -0
- package/dist/api/errors/InternalServerError.d.ts +8 -0
- package/dist/api/errors/InternalServerError.js +52 -0
- package/dist/api/errors/NotFoundError.d.ts +8 -0
- package/dist/api/errors/NotFoundError.js +52 -0
- package/dist/api/errors/UnauthorizedError.d.ts +8 -0
- package/dist/api/errors/UnauthorizedError.js +52 -0
- package/dist/api/errors/index.d.ts +5 -0
- package/dist/api/errors/index.js +21 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +19 -0
- package/dist/api/resources/dataPools/client/Client.d.ts +177 -0
- package/dist/api/resources/dataPools/client/Client.js +676 -0
- package/dist/api/resources/dataPools/client/index.d.ts +2 -0
- package/dist/api/resources/dataPools/client/index.js +17 -0
- package/dist/api/resources/dataPools/client/requests/AddDataPoolFileRequest.d.ts +14 -0
- package/dist/api/resources/dataPools/client/requests/AddDataPoolFileRequest.js +5 -0
- package/dist/api/resources/dataPools/client/requests/CreateDataPoolRequest.d.ts +10 -0
- package/dist/api/resources/dataPools/client/requests/CreateDataPoolRequest.js +5 -0
- package/dist/api/resources/dataPools/client/requests/UpdateDataPoolRequest.d.ts +12 -0
- package/dist/api/resources/dataPools/client/requests/UpdateDataPoolRequest.js +5 -0
- package/dist/api/resources/dataPools/client/requests/index.d.ts +3 -0
- package/dist/api/resources/dataPools/client/requests/index.js +2 -0
- package/dist/api/resources/dataPools/index.d.ts +1 -0
- package/dist/api/resources/dataPools/index.js +17 -0
- package/dist/api/resources/index.d.ts +2 -0
- package/dist/api/resources/index.js +41 -0
- package/dist/api/types/DataPoolDto.d.ts +23 -0
- package/dist/api/types/DataPoolDto.js +14 -0
- package/dist/api/types/DataPoolFileDto.d.ts +12 -0
- package/dist/api/types/DataPoolFileDto.js +5 -0
- package/dist/api/types/OauthScope.d.ts +9 -0
- package/dist/api/types/OauthScope.js +9 -0
- package/dist/api/types/index.d.ts +3 -0
- package/dist/api/types/index.js +19 -0
- package/dist/core/fetcher/APIResponse.d.ts +20 -0
- package/dist/core/fetcher/APIResponse.js +2 -0
- package/dist/core/fetcher/BinaryResponse.d.ts +20 -0
- package/dist/core/fetcher/BinaryResponse.js +17 -0
- package/dist/core/fetcher/Fetcher.d.ts +40 -0
- package/dist/core/fetcher/Fetcher.js +105 -0
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +85 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +94 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/ResponseWithBody.d.ts +4 -0
- package/dist/core/fetcher/ResponseWithBody.js +6 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +13 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +8 -0
- package/dist/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getErrorResponseBody.js +32 -0
- package/dist/core/fetcher/getFetchFn.d.ts +1 -0
- package/dist/core/fetcher/getFetchFn.js +6 -0
- package/dist/core/fetcher/getHeader.d.ts +1 -0
- package/dist/core/fetcher/getHeader.js +11 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +12 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +44 -0
- package/dist/core/fetcher/index.d.ts +9 -0
- package/dist/core/fetcher/index.js +15 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +33 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +29 -0
- package/dist/core/fetcher/signals.d.ts +11 -0
- package/dist/core/fetcher/signals.js +36 -0
- package/dist/core/file.d.ts +1 -0
- package/dist/core/file.js +2 -0
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +16 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +166 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.js +12 -0
- package/dist/core/form-data-utils/index.d.ts +2 -0
- package/dist/core/form-data-utils/index.js +20 -0
- package/dist/core/headers.d.ts +3 -0
- package/dist/core/headers.js +29 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.js +44 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +5 -0
- package/dist/core/runtime/runtime.d.ts +9 -0
- package/dist/core/runtime/runtime.js +101 -0
- package/dist/core/url/index.d.ts +2 -0
- package/dist/core/url/index.js +7 -0
- package/dist/core/url/join.d.ts +1 -0
- package/dist/core/url/join.js +49 -0
- package/dist/core/url/qs.d.ts +6 -0
- package/dist/core/url/qs.js +67 -0
- package/dist/environments.d.ts +7 -0
- package/dist/environments.js +9 -0
- package/dist/errors/PlanqkApiError.d.ts +15 -0
- package/dist/errors/PlanqkApiError.js +33 -0
- package/dist/errors/PlanqkApiTimeoutError.d.ts +6 -0
- package/dist/errors/PlanqkApiTimeoutError.js +13 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +44 -0
- package/eslint.config.mjs +11 -0
- package/fern/fern.config.json +4 -0
- package/fern/generators.yml +25 -0
- package/fern/openapi/openapi.json +610 -0
- package/notebooks/python-sdk.ipynb +218 -0
- package/package.json +48 -0
- package/planqk/__init__.py +0 -0
- package/planqk/api/__init__.py +1 -0
- package/planqk/api/_version.py +1 -0
- package/planqk/api/client.py +19 -0
- package/planqk/api/credentials.py +103 -0
- package/planqk/api/sdk/__init__.py +25 -0
- package/planqk/api/sdk/client.py +153 -0
- package/planqk/api/sdk/core/__init__.py +52 -0
- package/planqk/api/sdk/core/api_error.py +23 -0
- package/planqk/api/sdk/core/client_wrapper.py +76 -0
- package/planqk/api/sdk/core/datetime_utils.py +28 -0
- package/planqk/api/sdk/core/file.py +67 -0
- package/planqk/api/sdk/core/force_multipart.py +16 -0
- package/planqk/api/sdk/core/http_client.py +543 -0
- package/planqk/api/sdk/core/http_response.py +55 -0
- package/planqk/api/sdk/core/jsonable_encoder.py +100 -0
- package/planqk/api/sdk/core/pydantic_utilities.py +255 -0
- package/planqk/api/sdk/core/query_encoder.py +58 -0
- package/planqk/api/sdk/core/remove_none_from_dict.py +11 -0
- package/planqk/api/sdk/core/request_options.py +35 -0
- package/planqk/api/sdk/core/serialization.py +276 -0
- package/planqk/api/sdk/data_pools/__init__.py +4 -0
- package/planqk/api/sdk/data_pools/client.py +700 -0
- package/planqk/api/sdk/data_pools/raw_client.py +1650 -0
- package/planqk/api/sdk/environment.py +7 -0
- package/planqk/api/sdk/errors/__init__.py +11 -0
- package/planqk/api/sdk/errors/bad_request_error.py +10 -0
- package/planqk/api/sdk/errors/forbidden_error.py +10 -0
- package/planqk/api/sdk/errors/internal_server_error.py +10 -0
- package/planqk/api/sdk/errors/not_found_error.py +10 -0
- package/planqk/api/sdk/errors/unauthorized_error.py +10 -0
- package/planqk/api/sdk/types/__init__.py +10 -0
- package/planqk/api/sdk/types/data_pool_dto.py +33 -0
- package/planqk/api/sdk/types/data_pool_dto_current_user_permission.py +5 -0
- package/planqk/api/sdk/types/data_pool_file_dto.py +27 -0
- package/planqk/api/sdk/types/oauth_scope.py +5 -0
- package/pyproject.toml +51 -0
- package/scripts/update-version.sh +6 -0
- package/src/Client.ts +53 -0
- package/src/api/errors/BadRequestError.ts +18 -0
- package/src/api/errors/ForbiddenError.ts +18 -0
- package/src/api/errors/InternalServerError.ts +18 -0
- package/src/api/errors/NotFoundError.ts +18 -0
- package/src/api/errors/UnauthorizedError.ts +18 -0
- package/src/api/errors/index.ts +5 -0
- package/src/api/index.ts +3 -0
- package/src/api/resources/dataPools/client/Client.ts +825 -0
- package/src/api/resources/dataPools/client/index.ts +2 -0
- package/src/api/resources/dataPools/client/requests/AddDataPoolFileRequest.ts +17 -0
- package/src/api/resources/dataPools/client/requests/CreateDataPoolRequest.ts +11 -0
- package/src/api/resources/dataPools/client/requests/UpdateDataPoolRequest.ts +13 -0
- package/src/api/resources/dataPools/client/requests/index.ts +3 -0
- package/src/api/resources/dataPools/index.ts +1 -0
- package/src/api/resources/index.ts +2 -0
- package/src/api/types/DataPoolDto.ts +25 -0
- package/src/api/types/DataPoolFileDto.ts +13 -0
- package/src/api/types/OauthScope.ts +10 -0
- package/src/api/types/index.ts +3 -0
- package/src/core/fetcher/APIResponse.ts +23 -0
- package/src/core/fetcher/BinaryResponse.ts +36 -0
- package/src/core/fetcher/Fetcher.ts +163 -0
- package/src/core/fetcher/Headers.ts +93 -0
- package/src/core/fetcher/HttpResponsePromise.ts +116 -0
- package/src/core/fetcher/RawResponse.ts +61 -0
- package/src/core/fetcher/ResponseWithBody.ts +7 -0
- package/src/core/fetcher/Supplier.ts +11 -0
- package/src/core/fetcher/createRequestUrl.ts +6 -0
- package/src/core/fetcher/getErrorResponseBody.ts +32 -0
- package/src/core/fetcher/getFetchFn.ts +3 -0
- package/src/core/fetcher/getHeader.ts +8 -0
- package/src/core/fetcher/getRequestBody.ts +16 -0
- package/src/core/fetcher/getResponseBody.ts +43 -0
- package/src/core/fetcher/index.ts +9 -0
- package/src/core/fetcher/makeRequest.ts +44 -0
- package/src/core/fetcher/requestWithRetries.ts +33 -0
- package/src/core/fetcher/signals.ts +38 -0
- package/src/core/file.ts +11 -0
- package/src/core/form-data-utils/FormDataWrapper.ts +176 -0
- package/src/core/form-data-utils/encodeAsFormParameter.ts +12 -0
- package/src/core/form-data-utils/index.ts +2 -0
- package/src/core/headers.ts +35 -0
- package/src/core/index.ts +5 -0
- package/src/core/json.ts +27 -0
- package/src/core/runtime/index.ts +1 -0
- package/src/core/runtime/runtime.ts +133 -0
- package/src/core/url/index.ts +2 -0
- package/src/core/url/join.ts +55 -0
- package/src/core/url/qs.ts +74 -0
- package/src/environments.ts +9 -0
- package/src/errors/PlanqkApiError.ts +55 -0
- package/src/errors/PlanqkApiTimeoutError.ts +10 -0
- package/src/errors/index.ts +2 -0
- package/src/index.test.ts +17 -0
- package/src/index.ts +4 -0
- package/tsconfig.json +18 -0
- package/uv.lock +1102 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
from .http_client import AsyncHttpClient, HttpClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BaseClientWrapper:
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
*,
|
|
13
|
+
api_key: str,
|
|
14
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
15
|
+
base_url: str,
|
|
16
|
+
timeout: typing.Optional[float] = None,
|
|
17
|
+
):
|
|
18
|
+
self.api_key = api_key
|
|
19
|
+
self._headers = headers
|
|
20
|
+
self._base_url = base_url
|
|
21
|
+
self._timeout = timeout
|
|
22
|
+
|
|
23
|
+
def get_headers(self) -> typing.Dict[str, str]:
|
|
24
|
+
headers: typing.Dict[str, str] = {
|
|
25
|
+
"X-Fern-Language": "Python",
|
|
26
|
+
**(self.get_custom_headers() or {}),
|
|
27
|
+
}
|
|
28
|
+
headers["X-Auth-Token"] = self.api_key
|
|
29
|
+
return headers
|
|
30
|
+
|
|
31
|
+
def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]:
|
|
32
|
+
return self._headers
|
|
33
|
+
|
|
34
|
+
def get_base_url(self) -> str:
|
|
35
|
+
return self._base_url
|
|
36
|
+
|
|
37
|
+
def get_timeout(self) -> typing.Optional[float]:
|
|
38
|
+
return self._timeout
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class SyncClientWrapper(BaseClientWrapper):
|
|
42
|
+
def __init__(
|
|
43
|
+
self,
|
|
44
|
+
*,
|
|
45
|
+
api_key: str,
|
|
46
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
47
|
+
base_url: str,
|
|
48
|
+
timeout: typing.Optional[float] = None,
|
|
49
|
+
httpx_client: httpx.Client,
|
|
50
|
+
):
|
|
51
|
+
super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout)
|
|
52
|
+
self.httpx_client = HttpClient(
|
|
53
|
+
httpx_client=httpx_client,
|
|
54
|
+
base_headers=self.get_headers,
|
|
55
|
+
base_timeout=self.get_timeout,
|
|
56
|
+
base_url=self.get_base_url,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class AsyncClientWrapper(BaseClientWrapper):
|
|
61
|
+
def __init__(
|
|
62
|
+
self,
|
|
63
|
+
*,
|
|
64
|
+
api_key: str,
|
|
65
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
66
|
+
base_url: str,
|
|
67
|
+
timeout: typing.Optional[float] = None,
|
|
68
|
+
httpx_client: httpx.AsyncClient,
|
|
69
|
+
):
|
|
70
|
+
super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout)
|
|
71
|
+
self.httpx_client = AsyncHttpClient(
|
|
72
|
+
httpx_client=httpx_client,
|
|
73
|
+
base_headers=self.get_headers,
|
|
74
|
+
base_timeout=self.get_timeout,
|
|
75
|
+
base_url=self.get_base_url,
|
|
76
|
+
)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def serialize_datetime(v: dt.datetime) -> str:
|
|
7
|
+
"""
|
|
8
|
+
Serialize a datetime including timezone info.
|
|
9
|
+
|
|
10
|
+
Uses the timezone info provided if present, otherwise uses the current runtime's timezone info.
|
|
11
|
+
|
|
12
|
+
UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def _serialize_zoned_datetime(v: dt.datetime) -> str:
|
|
16
|
+
if v.tzinfo is not None and v.tzinfo.tzname(None) == dt.timezone.utc.tzname(None):
|
|
17
|
+
# UTC is a special case where we use "Z" at the end instead of "+00:00"
|
|
18
|
+
return v.isoformat().replace("+00:00", "Z")
|
|
19
|
+
else:
|
|
20
|
+
# Delegate to the typical +/- offset format
|
|
21
|
+
return v.isoformat()
|
|
22
|
+
|
|
23
|
+
if v.tzinfo is not None:
|
|
24
|
+
return _serialize_zoned_datetime(v)
|
|
25
|
+
else:
|
|
26
|
+
local_tz = dt.datetime.now().astimezone().tzinfo
|
|
27
|
+
localized_dt = v.replace(tzinfo=local_tz)
|
|
28
|
+
return _serialize_zoned_datetime(localized_dt)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from typing import IO, Dict, List, Mapping, Optional, Tuple, Union, cast
|
|
4
|
+
|
|
5
|
+
# File typing inspired by the flexibility of types within the httpx library
|
|
6
|
+
# https://github.com/encode/httpx/blob/master/httpx/_types.py
|
|
7
|
+
FileContent = Union[IO[bytes], bytes, str]
|
|
8
|
+
File = Union[
|
|
9
|
+
# file (or bytes)
|
|
10
|
+
FileContent,
|
|
11
|
+
# (filename, file (or bytes))
|
|
12
|
+
Tuple[Optional[str], FileContent],
|
|
13
|
+
# (filename, file (or bytes), content_type)
|
|
14
|
+
Tuple[Optional[str], FileContent, Optional[str]],
|
|
15
|
+
# (filename, file (or bytes), content_type, headers)
|
|
16
|
+
Tuple[
|
|
17
|
+
Optional[str],
|
|
18
|
+
FileContent,
|
|
19
|
+
Optional[str],
|
|
20
|
+
Mapping[str, str],
|
|
21
|
+
],
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def convert_file_dict_to_httpx_tuples(
|
|
26
|
+
d: Dict[str, Union[File, List[File]]],
|
|
27
|
+
) -> List[Tuple[str, File]]:
|
|
28
|
+
"""
|
|
29
|
+
The format we use is a list of tuples, where the first element is the
|
|
30
|
+
name of the file and the second is the file object. Typically HTTPX wants
|
|
31
|
+
a dict, but to be able to send lists of files, you have to use the list
|
|
32
|
+
approach (which also works for non-lists)
|
|
33
|
+
https://github.com/encode/httpx/pull/1032
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
httpx_tuples = []
|
|
37
|
+
for key, file_like in d.items():
|
|
38
|
+
if isinstance(file_like, list):
|
|
39
|
+
for file_like_item in file_like:
|
|
40
|
+
httpx_tuples.append((key, file_like_item))
|
|
41
|
+
else:
|
|
42
|
+
httpx_tuples.append((key, file_like))
|
|
43
|
+
return httpx_tuples
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def with_content_type(*, file: File, default_content_type: str) -> File:
|
|
47
|
+
"""
|
|
48
|
+
This function resolves to the file's content type, if provided, and defaults
|
|
49
|
+
to the default_content_type value if not.
|
|
50
|
+
"""
|
|
51
|
+
if isinstance(file, tuple):
|
|
52
|
+
if len(file) == 2:
|
|
53
|
+
filename, content = cast(Tuple[Optional[str], FileContent], file) # type: ignore
|
|
54
|
+
return (filename, content, default_content_type)
|
|
55
|
+
elif len(file) == 3:
|
|
56
|
+
filename, content, file_content_type = cast(Tuple[Optional[str], FileContent, Optional[str]], file) # type: ignore
|
|
57
|
+
out_content_type = file_content_type or default_content_type
|
|
58
|
+
return (filename, content, out_content_type)
|
|
59
|
+
elif len(file) == 4:
|
|
60
|
+
filename, content, file_content_type, headers = cast( # type: ignore
|
|
61
|
+
Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], file
|
|
62
|
+
)
|
|
63
|
+
out_content_type = file_content_type or default_content_type
|
|
64
|
+
return (filename, content, out_content_type, headers)
|
|
65
|
+
else:
|
|
66
|
+
raise ValueError(f"Unexpected tuple length: {len(file)}")
|
|
67
|
+
return (None, file, default_content_type)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ForceMultipartDict(dict):
|
|
5
|
+
"""
|
|
6
|
+
A dictionary subclass that always evaluates to True in boolean contexts.
|
|
7
|
+
|
|
8
|
+
This is used to force multipart/form-data encoding in HTTP requests even when
|
|
9
|
+
the dictionary is empty, which would normally evaluate to False.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __bool__(self):
|
|
13
|
+
return True
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
FORCE_MULTIPART = ForceMultipartDict()
|