@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.
Files changed (222) hide show
  1. package/.devcontainer/devcontainer.json +32 -0
  2. package/.devcontainer/post-create.sh +7 -0
  3. package/.env.template +2 -0
  4. package/.gitlab-ci.yml +71 -0
  5. package/.python-version +1 -0
  6. package/.releaserc.json +45 -0
  7. package/LICENSE +201 -0
  8. package/README-node.md +18 -0
  9. package/README-python.md +21 -0
  10. package/README.md +56 -0
  11. package/dist/Client.d.ts +32 -0
  12. package/dist/Client.js +60 -0
  13. package/dist/api/errors/BadRequestError.d.ts +8 -0
  14. package/dist/api/errors/BadRequestError.js +52 -0
  15. package/dist/api/errors/ForbiddenError.d.ts +8 -0
  16. package/dist/api/errors/ForbiddenError.js +52 -0
  17. package/dist/api/errors/InternalServerError.d.ts +8 -0
  18. package/dist/api/errors/InternalServerError.js +52 -0
  19. package/dist/api/errors/NotFoundError.d.ts +8 -0
  20. package/dist/api/errors/NotFoundError.js +52 -0
  21. package/dist/api/errors/UnauthorizedError.d.ts +8 -0
  22. package/dist/api/errors/UnauthorizedError.js +52 -0
  23. package/dist/api/errors/index.d.ts +5 -0
  24. package/dist/api/errors/index.js +21 -0
  25. package/dist/api/index.d.ts +3 -0
  26. package/dist/api/index.js +19 -0
  27. package/dist/api/resources/dataPools/client/Client.d.ts +177 -0
  28. package/dist/api/resources/dataPools/client/Client.js +676 -0
  29. package/dist/api/resources/dataPools/client/index.d.ts +2 -0
  30. package/dist/api/resources/dataPools/client/index.js +17 -0
  31. package/dist/api/resources/dataPools/client/requests/AddDataPoolFileRequest.d.ts +14 -0
  32. package/dist/api/resources/dataPools/client/requests/AddDataPoolFileRequest.js +5 -0
  33. package/dist/api/resources/dataPools/client/requests/CreateDataPoolRequest.d.ts +10 -0
  34. package/dist/api/resources/dataPools/client/requests/CreateDataPoolRequest.js +5 -0
  35. package/dist/api/resources/dataPools/client/requests/UpdateDataPoolRequest.d.ts +12 -0
  36. package/dist/api/resources/dataPools/client/requests/UpdateDataPoolRequest.js +5 -0
  37. package/dist/api/resources/dataPools/client/requests/index.d.ts +3 -0
  38. package/dist/api/resources/dataPools/client/requests/index.js +2 -0
  39. package/dist/api/resources/dataPools/index.d.ts +1 -0
  40. package/dist/api/resources/dataPools/index.js +17 -0
  41. package/dist/api/resources/index.d.ts +2 -0
  42. package/dist/api/resources/index.js +41 -0
  43. package/dist/api/types/DataPoolDto.d.ts +23 -0
  44. package/dist/api/types/DataPoolDto.js +14 -0
  45. package/dist/api/types/DataPoolFileDto.d.ts +12 -0
  46. package/dist/api/types/DataPoolFileDto.js +5 -0
  47. package/dist/api/types/OauthScope.d.ts +9 -0
  48. package/dist/api/types/OauthScope.js +9 -0
  49. package/dist/api/types/index.d.ts +3 -0
  50. package/dist/api/types/index.js +19 -0
  51. package/dist/core/fetcher/APIResponse.d.ts +20 -0
  52. package/dist/core/fetcher/APIResponse.js +2 -0
  53. package/dist/core/fetcher/BinaryResponse.d.ts +20 -0
  54. package/dist/core/fetcher/BinaryResponse.js +17 -0
  55. package/dist/core/fetcher/Fetcher.d.ts +40 -0
  56. package/dist/core/fetcher/Fetcher.js +105 -0
  57. package/dist/core/fetcher/Headers.d.ts +2 -0
  58. package/dist/core/fetcher/Headers.js +85 -0
  59. package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
  60. package/dist/core/fetcher/HttpResponsePromise.js +94 -0
  61. package/dist/core/fetcher/RawResponse.d.ts +29 -0
  62. package/dist/core/fetcher/RawResponse.js +44 -0
  63. package/dist/core/fetcher/ResponseWithBody.d.ts +4 -0
  64. package/dist/core/fetcher/ResponseWithBody.js +6 -0
  65. package/dist/core/fetcher/Supplier.d.ts +4 -0
  66. package/dist/core/fetcher/Supplier.js +13 -0
  67. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  68. package/dist/core/fetcher/createRequestUrl.js +8 -0
  69. package/dist/core/fetcher/getErrorResponseBody.d.ts +1 -0
  70. package/dist/core/fetcher/getErrorResponseBody.js +32 -0
  71. package/dist/core/fetcher/getFetchFn.d.ts +1 -0
  72. package/dist/core/fetcher/getFetchFn.js +6 -0
  73. package/dist/core/fetcher/getHeader.d.ts +1 -0
  74. package/dist/core/fetcher/getHeader.js +11 -0
  75. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  76. package/dist/core/fetcher/getRequestBody.js +12 -0
  77. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  78. package/dist/core/fetcher/getResponseBody.js +44 -0
  79. package/dist/core/fetcher/index.d.ts +9 -0
  80. package/dist/core/fetcher/index.js +15 -0
  81. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  82. package/dist/core/fetcher/makeRequest.js +33 -0
  83. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  84. package/dist/core/fetcher/requestWithRetries.js +29 -0
  85. package/dist/core/fetcher/signals.d.ts +11 -0
  86. package/dist/core/fetcher/signals.js +36 -0
  87. package/dist/core/file.d.ts +1 -0
  88. package/dist/core/file.js +2 -0
  89. package/dist/core/form-data-utils/FormDataWrapper.d.ts +16 -0
  90. package/dist/core/form-data-utils/FormDataWrapper.js +166 -0
  91. package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
  92. package/dist/core/form-data-utils/encodeAsFormParameter.js +12 -0
  93. package/dist/core/form-data-utils/index.d.ts +2 -0
  94. package/dist/core/form-data-utils/index.js +20 -0
  95. package/dist/core/headers.d.ts +3 -0
  96. package/dist/core/headers.js +29 -0
  97. package/dist/core/index.d.ts +5 -0
  98. package/dist/core/index.js +44 -0
  99. package/dist/core/json.d.ts +15 -0
  100. package/dist/core/json.js +24 -0
  101. package/dist/core/runtime/index.d.ts +1 -0
  102. package/dist/core/runtime/index.js +5 -0
  103. package/dist/core/runtime/runtime.d.ts +9 -0
  104. package/dist/core/runtime/runtime.js +101 -0
  105. package/dist/core/url/index.d.ts +2 -0
  106. package/dist/core/url/index.js +7 -0
  107. package/dist/core/url/join.d.ts +1 -0
  108. package/dist/core/url/join.js +49 -0
  109. package/dist/core/url/qs.d.ts +6 -0
  110. package/dist/core/url/qs.js +67 -0
  111. package/dist/environments.d.ts +7 -0
  112. package/dist/environments.js +9 -0
  113. package/dist/errors/PlanqkApiError.d.ts +15 -0
  114. package/dist/errors/PlanqkApiError.js +33 -0
  115. package/dist/errors/PlanqkApiTimeoutError.d.ts +6 -0
  116. package/dist/errors/PlanqkApiTimeoutError.js +13 -0
  117. package/dist/errors/index.d.ts +2 -0
  118. package/dist/errors/index.js +7 -0
  119. package/dist/index.d.ts +4 -0
  120. package/dist/index.js +44 -0
  121. package/eslint.config.mjs +11 -0
  122. package/fern/fern.config.json +4 -0
  123. package/fern/generators.yml +25 -0
  124. package/fern/openapi/openapi.json +610 -0
  125. package/notebooks/python-sdk.ipynb +218 -0
  126. package/package.json +48 -0
  127. package/planqk/__init__.py +0 -0
  128. package/planqk/api/__init__.py +1 -0
  129. package/planqk/api/_version.py +1 -0
  130. package/planqk/api/client.py +19 -0
  131. package/planqk/api/credentials.py +103 -0
  132. package/planqk/api/sdk/__init__.py +25 -0
  133. package/planqk/api/sdk/client.py +153 -0
  134. package/planqk/api/sdk/core/__init__.py +52 -0
  135. package/planqk/api/sdk/core/api_error.py +23 -0
  136. package/planqk/api/sdk/core/client_wrapper.py +76 -0
  137. package/planqk/api/sdk/core/datetime_utils.py +28 -0
  138. package/planqk/api/sdk/core/file.py +67 -0
  139. package/planqk/api/sdk/core/force_multipart.py +16 -0
  140. package/planqk/api/sdk/core/http_client.py +543 -0
  141. package/planqk/api/sdk/core/http_response.py +55 -0
  142. package/planqk/api/sdk/core/jsonable_encoder.py +100 -0
  143. package/planqk/api/sdk/core/pydantic_utilities.py +255 -0
  144. package/planqk/api/sdk/core/query_encoder.py +58 -0
  145. package/planqk/api/sdk/core/remove_none_from_dict.py +11 -0
  146. package/planqk/api/sdk/core/request_options.py +35 -0
  147. package/planqk/api/sdk/core/serialization.py +276 -0
  148. package/planqk/api/sdk/data_pools/__init__.py +4 -0
  149. package/planqk/api/sdk/data_pools/client.py +700 -0
  150. package/planqk/api/sdk/data_pools/raw_client.py +1650 -0
  151. package/planqk/api/sdk/environment.py +7 -0
  152. package/planqk/api/sdk/errors/__init__.py +11 -0
  153. package/planqk/api/sdk/errors/bad_request_error.py +10 -0
  154. package/planqk/api/sdk/errors/forbidden_error.py +10 -0
  155. package/planqk/api/sdk/errors/internal_server_error.py +10 -0
  156. package/planqk/api/sdk/errors/not_found_error.py +10 -0
  157. package/planqk/api/sdk/errors/unauthorized_error.py +10 -0
  158. package/planqk/api/sdk/types/__init__.py +10 -0
  159. package/planqk/api/sdk/types/data_pool_dto.py +33 -0
  160. package/planqk/api/sdk/types/data_pool_dto_current_user_permission.py +5 -0
  161. package/planqk/api/sdk/types/data_pool_file_dto.py +27 -0
  162. package/planqk/api/sdk/types/oauth_scope.py +5 -0
  163. package/pyproject.toml +51 -0
  164. package/scripts/update-version.sh +6 -0
  165. package/src/Client.ts +53 -0
  166. package/src/api/errors/BadRequestError.ts +18 -0
  167. package/src/api/errors/ForbiddenError.ts +18 -0
  168. package/src/api/errors/InternalServerError.ts +18 -0
  169. package/src/api/errors/NotFoundError.ts +18 -0
  170. package/src/api/errors/UnauthorizedError.ts +18 -0
  171. package/src/api/errors/index.ts +5 -0
  172. package/src/api/index.ts +3 -0
  173. package/src/api/resources/dataPools/client/Client.ts +825 -0
  174. package/src/api/resources/dataPools/client/index.ts +2 -0
  175. package/src/api/resources/dataPools/client/requests/AddDataPoolFileRequest.ts +17 -0
  176. package/src/api/resources/dataPools/client/requests/CreateDataPoolRequest.ts +11 -0
  177. package/src/api/resources/dataPools/client/requests/UpdateDataPoolRequest.ts +13 -0
  178. package/src/api/resources/dataPools/client/requests/index.ts +3 -0
  179. package/src/api/resources/dataPools/index.ts +1 -0
  180. package/src/api/resources/index.ts +2 -0
  181. package/src/api/types/DataPoolDto.ts +25 -0
  182. package/src/api/types/DataPoolFileDto.ts +13 -0
  183. package/src/api/types/OauthScope.ts +10 -0
  184. package/src/api/types/index.ts +3 -0
  185. package/src/core/fetcher/APIResponse.ts +23 -0
  186. package/src/core/fetcher/BinaryResponse.ts +36 -0
  187. package/src/core/fetcher/Fetcher.ts +163 -0
  188. package/src/core/fetcher/Headers.ts +93 -0
  189. package/src/core/fetcher/HttpResponsePromise.ts +116 -0
  190. package/src/core/fetcher/RawResponse.ts +61 -0
  191. package/src/core/fetcher/ResponseWithBody.ts +7 -0
  192. package/src/core/fetcher/Supplier.ts +11 -0
  193. package/src/core/fetcher/createRequestUrl.ts +6 -0
  194. package/src/core/fetcher/getErrorResponseBody.ts +32 -0
  195. package/src/core/fetcher/getFetchFn.ts +3 -0
  196. package/src/core/fetcher/getHeader.ts +8 -0
  197. package/src/core/fetcher/getRequestBody.ts +16 -0
  198. package/src/core/fetcher/getResponseBody.ts +43 -0
  199. package/src/core/fetcher/index.ts +9 -0
  200. package/src/core/fetcher/makeRequest.ts +44 -0
  201. package/src/core/fetcher/requestWithRetries.ts +33 -0
  202. package/src/core/fetcher/signals.ts +38 -0
  203. package/src/core/file.ts +11 -0
  204. package/src/core/form-data-utils/FormDataWrapper.ts +176 -0
  205. package/src/core/form-data-utils/encodeAsFormParameter.ts +12 -0
  206. package/src/core/form-data-utils/index.ts +2 -0
  207. package/src/core/headers.ts +35 -0
  208. package/src/core/index.ts +5 -0
  209. package/src/core/json.ts +27 -0
  210. package/src/core/runtime/index.ts +1 -0
  211. package/src/core/runtime/runtime.ts +133 -0
  212. package/src/core/url/index.ts +2 -0
  213. package/src/core/url/join.ts +55 -0
  214. package/src/core/url/qs.ts +74 -0
  215. package/src/environments.ts +9 -0
  216. package/src/errors/PlanqkApiError.ts +55 -0
  217. package/src/errors/PlanqkApiTimeoutError.ts +10 -0
  218. package/src/errors/index.ts +2 -0
  219. package/src/index.test.ts +17 -0
  220. package/src/index.ts +4 -0
  221. package/tsconfig.json +18 -0
  222. 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()