@planqk/planqk-api-sdk 1.3.0 → 1.3.4

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 (36) hide show
  1. package/.fossa.yml +8 -0
  2. package/.gitlab-ci.yml +34 -5
  3. package/apps/README.md +24 -0
  4. package/apps/python-test-app/main.py +3 -3
  5. package/apps/test-file.txt +1 -0
  6. package/apps/ts-test-app/index.ts +8 -8
  7. package/apps/ts-test-app/package-lock.json +8 -6
  8. package/apps/ts-test-app/package.json +5 -9
  9. package/notebooks/python-sdk.ipynb +2 -1
  10. package/package.json +1 -1
  11. package/planqk/api/_version.py +1 -1
  12. package/planqk/api/client.py +5 -2
  13. package/planqk/api/sdk/__init__.py +2 -34
  14. package/planqk/api/sdk/client.py +0 -3
  15. package/planqk/api/sdk/types/__init__.py +1 -30
  16. package/pyproject.toml +3 -1
  17. package/uv.lock +642 -331
  18. package/apps/python-test-app/my_file.txt +0 -1
  19. package/apps/ts-test-app/test-file.txt +0 -1
  20. package/planqk/api/sdk/authentication/__init__.py +0 -7
  21. package/planqk/api/sdk/authentication/client.py +0 -102
  22. package/planqk/api/sdk/authentication/raw_client.py +0 -183
  23. package/planqk/api/sdk/authentication/types/__init__.py +0 -7
  24. package/planqk/api/sdk/authentication/types/authorize_response.py +0 -8
  25. package/planqk/api/sdk/types/access_token.py +0 -26
  26. package/planqk/api/sdk/types/organization_membership.py +0 -27
  27. package/planqk/api/sdk/types/organization_membership_account_type.py +0 -5
  28. package/planqk/api/sdk/types/organization_membership_role.py +0 -5
  29. package/planqk/api/sdk/types/personal_access_token_principal.py +0 -31
  30. package/planqk/api/sdk/types/personal_access_token_principal_account_type.py +0 -5
  31. package/planqk/api/sdk/types/service_execution.py +0 -27
  32. package/planqk/api/sdk/types/service_execution_status.py +0 -7
  33. package/planqk/api/sdk/types/service_execution_token_principal.py +0 -34
  34. package/planqk/api/sdk/types/user_context.py +0 -35
  35. package/planqk/api/sdk/types/user_context_account_type.py +0 -5
  36. package/planqk/api/sdk/types/user_context_context_type.py +0 -5
@@ -1 +0,0 @@
1
- Hello World
@@ -1 +0,0 @@
1
- This is a test file for the PlanQK API SDK.
@@ -1,7 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- # isort: skip_file
4
-
5
- from .types import AuthorizeResponse
6
-
7
- __all__ = ["AuthorizeResponse"]
@@ -1,102 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
- from ..core.request_options import RequestOptions
7
- from .raw_client import AsyncRawAuthenticationClient, RawAuthenticationClient
8
- from .types.authorize_response import AuthorizeResponse
9
-
10
-
11
- class AuthenticationClient:
12
- def __init__(self, *, client_wrapper: SyncClientWrapper):
13
- self._raw_client = RawAuthenticationClient(client_wrapper=client_wrapper)
14
-
15
- @property
16
- def with_raw_response(self) -> RawAuthenticationClient:
17
- """
18
- Retrieves a raw implementation of this client that returns raw responses.
19
-
20
- Returns
21
- -------
22
- RawAuthenticationClient
23
- """
24
- return self._raw_client
25
-
26
- def authorize(self, *, request_options: typing.Optional[RequestOptions] = None) -> AuthorizeResponse:
27
- """
28
- Get the authenticated principal based on the provided token.
29
-
30
- Parameters
31
- ----------
32
- request_options : typing.Optional[RequestOptions]
33
- Request-specific configuration.
34
-
35
- Returns
36
- -------
37
- AuthorizeResponse
38
- The scopes of the provided token.
39
-
40
- Examples
41
- --------
42
- from planqk import PlanqkApi
43
-
44
- client = PlanqkApi(
45
- organization_id="YOUR_ORGANIZATION_ID",
46
- api_key="YOUR_API_KEY",
47
- )
48
- client.authentication.authorize()
49
- """
50
- _response = self._raw_client.authorize(request_options=request_options)
51
- return _response.data
52
-
53
-
54
- class AsyncAuthenticationClient:
55
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
56
- self._raw_client = AsyncRawAuthenticationClient(client_wrapper=client_wrapper)
57
-
58
- @property
59
- def with_raw_response(self) -> AsyncRawAuthenticationClient:
60
- """
61
- Retrieves a raw implementation of this client that returns raw responses.
62
-
63
- Returns
64
- -------
65
- AsyncRawAuthenticationClient
66
- """
67
- return self._raw_client
68
-
69
- async def authorize(self, *, request_options: typing.Optional[RequestOptions] = None) -> AuthorizeResponse:
70
- """
71
- Get the authenticated principal based on the provided token.
72
-
73
- Parameters
74
- ----------
75
- request_options : typing.Optional[RequestOptions]
76
- Request-specific configuration.
77
-
78
- Returns
79
- -------
80
- AuthorizeResponse
81
- The scopes of the provided token.
82
-
83
- Examples
84
- --------
85
- import asyncio
86
-
87
- from planqk import AsyncPlanqkApi
88
-
89
- client = AsyncPlanqkApi(
90
- organization_id="YOUR_ORGANIZATION_ID",
91
- api_key="YOUR_API_KEY",
92
- )
93
-
94
-
95
- async def main() -> None:
96
- await client.authentication.authorize()
97
-
98
-
99
- asyncio.run(main())
100
- """
101
- _response = await self._raw_client.authorize(request_options=request_options)
102
- return _response.data
@@ -1,183 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
- from json.decoder import JSONDecodeError
5
-
6
- from ..core.api_error import ApiError
7
- from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
- from ..core.http_response import AsyncHttpResponse, HttpResponse
9
- from ..core.pydantic_utilities import parse_obj_as
10
- from ..core.request_options import RequestOptions
11
- from ..errors.forbidden_error import ForbiddenError
12
- from ..errors.internal_server_error import InternalServerError
13
- from ..errors.not_found_error import NotFoundError
14
- from ..errors.unauthorized_error import UnauthorizedError
15
- from .types.authorize_response import AuthorizeResponse
16
-
17
-
18
- class RawAuthenticationClient:
19
- def __init__(self, *, client_wrapper: SyncClientWrapper):
20
- self._client_wrapper = client_wrapper
21
-
22
- def authorize(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[AuthorizeResponse]:
23
- """
24
- Get the authenticated principal based on the provided token.
25
-
26
- Parameters
27
- ----------
28
- request_options : typing.Optional[RequestOptions]
29
- Request-specific configuration.
30
-
31
- Returns
32
- -------
33
- HttpResponse[AuthorizeResponse]
34
- The scopes of the provided token.
35
- """
36
- _response = self._client_wrapper.httpx_client.request(
37
- "authorize",
38
- method="POST",
39
- request_options=request_options,
40
- )
41
- try:
42
- if 200 <= _response.status_code < 300:
43
- _data = typing.cast(
44
- AuthorizeResponse,
45
- parse_obj_as(
46
- type_=AuthorizeResponse, # type: ignore
47
- object_=_response.json(),
48
- ),
49
- )
50
- return HttpResponse(response=_response, data=_data)
51
- if _response.status_code == 401:
52
- raise UnauthorizedError(
53
- headers=dict(_response.headers),
54
- body=typing.cast(
55
- typing.Optional[typing.Any],
56
- parse_obj_as(
57
- type_=typing.Optional[typing.Any], # type: ignore
58
- object_=_response.json(),
59
- ),
60
- ),
61
- )
62
- if _response.status_code == 403:
63
- raise ForbiddenError(
64
- headers=dict(_response.headers),
65
- body=typing.cast(
66
- typing.Optional[typing.Any],
67
- parse_obj_as(
68
- type_=typing.Optional[typing.Any], # type: ignore
69
- object_=_response.json(),
70
- ),
71
- ),
72
- )
73
- if _response.status_code == 404:
74
- raise NotFoundError(
75
- headers=dict(_response.headers),
76
- body=typing.cast(
77
- typing.Optional[typing.Any],
78
- parse_obj_as(
79
- type_=typing.Optional[typing.Any], # type: ignore
80
- object_=_response.json(),
81
- ),
82
- ),
83
- )
84
- if _response.status_code == 500:
85
- raise InternalServerError(
86
- headers=dict(_response.headers),
87
- body=typing.cast(
88
- typing.Optional[typing.Any],
89
- parse_obj_as(
90
- type_=typing.Optional[typing.Any], # type: ignore
91
- object_=_response.json(),
92
- ),
93
- ),
94
- )
95
- _response_json = _response.json()
96
- except JSONDecodeError:
97
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
98
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
99
-
100
-
101
- class AsyncRawAuthenticationClient:
102
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
103
- self._client_wrapper = client_wrapper
104
-
105
- async def authorize(
106
- self, *, request_options: typing.Optional[RequestOptions] = None
107
- ) -> AsyncHttpResponse[AuthorizeResponse]:
108
- """
109
- Get the authenticated principal based on the provided token.
110
-
111
- Parameters
112
- ----------
113
- request_options : typing.Optional[RequestOptions]
114
- Request-specific configuration.
115
-
116
- Returns
117
- -------
118
- AsyncHttpResponse[AuthorizeResponse]
119
- The scopes of the provided token.
120
- """
121
- _response = await self._client_wrapper.httpx_client.request(
122
- "authorize",
123
- method="POST",
124
- request_options=request_options,
125
- )
126
- try:
127
- if 200 <= _response.status_code < 300:
128
- _data = typing.cast(
129
- AuthorizeResponse,
130
- parse_obj_as(
131
- type_=AuthorizeResponse, # type: ignore
132
- object_=_response.json(),
133
- ),
134
- )
135
- return AsyncHttpResponse(response=_response, data=_data)
136
- if _response.status_code == 401:
137
- raise UnauthorizedError(
138
- headers=dict(_response.headers),
139
- body=typing.cast(
140
- typing.Optional[typing.Any],
141
- parse_obj_as(
142
- type_=typing.Optional[typing.Any], # type: ignore
143
- object_=_response.json(),
144
- ),
145
- ),
146
- )
147
- if _response.status_code == 403:
148
- raise ForbiddenError(
149
- headers=dict(_response.headers),
150
- body=typing.cast(
151
- typing.Optional[typing.Any],
152
- parse_obj_as(
153
- type_=typing.Optional[typing.Any], # type: ignore
154
- object_=_response.json(),
155
- ),
156
- ),
157
- )
158
- if _response.status_code == 404:
159
- raise NotFoundError(
160
- headers=dict(_response.headers),
161
- body=typing.cast(
162
- typing.Optional[typing.Any],
163
- parse_obj_as(
164
- type_=typing.Optional[typing.Any], # type: ignore
165
- object_=_response.json(),
166
- ),
167
- ),
168
- )
169
- if _response.status_code == 500:
170
- raise InternalServerError(
171
- headers=dict(_response.headers),
172
- body=typing.cast(
173
- typing.Optional[typing.Any],
174
- parse_obj_as(
175
- type_=typing.Optional[typing.Any], # type: ignore
176
- object_=_response.json(),
177
- ),
178
- ),
179
- )
180
- _response_json = _response.json()
181
- except JSONDecodeError:
182
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
183
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -1,7 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- # isort: skip_file
4
-
5
- from .authorize_response import AuthorizeResponse
6
-
7
- __all__ = ["AuthorizeResponse"]
@@ -1,8 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- from ...types.personal_access_token_principal import PersonalAccessTokenPrincipal
6
- from ...types.service_execution_token_principal import ServiceExecutionTokenPrincipal
7
-
8
- AuthorizeResponse = typing.Union[PersonalAccessTokenPrincipal, ServiceExecutionTokenPrincipal]
@@ -1,26 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import datetime as dt
4
- import typing
5
-
6
- import pydantic
7
- import typing_extensions
8
- from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
9
- from ..core.serialization import FieldMetadata
10
-
11
-
12
- class AccessToken(UniversalBaseModel):
13
- id: typing.Optional[str] = None
14
- name: typing.Optional[str] = None
15
- created_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="createdAt")] = None
16
- used_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="usedAt")] = None
17
- expires_at: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="expiresAt")] = None
18
-
19
- if IS_PYDANTIC_V2:
20
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
21
- else:
22
-
23
- class Config:
24
- frozen = True
25
- smart_union = True
26
- extra = pydantic.Extra.allow
@@ -1,27 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- import pydantic
6
- import typing_extensions
7
- from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
- from ..core.serialization import FieldMetadata
9
- from .organization_membership_account_type import OrganizationMembershipAccountType
10
- from .organization_membership_role import OrganizationMembershipRole
11
-
12
-
13
- class OrganizationMembership(UniversalBaseModel):
14
- id: typing.Optional[str] = None
15
- account_type: typing_extensions.Annotated[
16
- typing.Optional[OrganizationMembershipAccountType], FieldMetadata(alias="accountType")
17
- ] = None
18
- role: typing.Optional[OrganizationMembershipRole] = None
19
-
20
- if IS_PYDANTIC_V2:
21
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
- else:
23
-
24
- class Config:
25
- frozen = True
26
- smart_union = True
27
- extra = pydantic.Extra.allow
@@ -1,5 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- OrganizationMembershipAccountType = typing.Union[typing.Literal["BASIC", "PRO", "BUSINESS"], typing.Any]
@@ -1,5 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- OrganizationMembershipRole = typing.Union[typing.Literal["VIEWER", "MAINTAINER", "OWNER"], typing.Any]
@@ -1,31 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- import pydantic
6
- import typing_extensions
7
- from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
- from ..core.serialization import FieldMetadata
9
- from .access_token import AccessToken
10
- from .organization_membership import OrganizationMembership
11
- from .personal_access_token_principal_account_type import PersonalAccessTokenPrincipalAccountType
12
-
13
-
14
- class PersonalAccessTokenPrincipal(UniversalBaseModel):
15
- id: typing.Optional[str] = None
16
- access_token: typing_extensions.Annotated[typing.Optional[AccessToken], FieldMetadata(alias="accessToken")] = None
17
- account_type: typing_extensions.Annotated[
18
- typing.Optional[PersonalAccessTokenPrincipalAccountType], FieldMetadata(alias="accountType")
19
- ] = None
20
- organization_memberships: typing_extensions.Annotated[
21
- typing.Optional[typing.List[OrganizationMembership]], FieldMetadata(alias="organizationMemberships")
22
- ] = None
23
-
24
- if IS_PYDANTIC_V2:
25
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
26
- else:
27
-
28
- class Config:
29
- frozen = True
30
- smart_union = True
31
- extra = pydantic.Extra.allow
@@ -1,5 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- PersonalAccessTokenPrincipalAccountType = typing.Union[typing.Literal["BASIC", "PRO", "BUSINESS"], typing.Any]
@@ -1,27 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import datetime as dt
4
- import typing
5
-
6
- import pydantic
7
- import typing_extensions
8
- from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
9
- from ..core.serialization import FieldMetadata
10
- from .service_execution_status import ServiceExecutionStatus
11
-
12
-
13
- class ServiceExecution(UniversalBaseModel):
14
- id: typing.Optional[str] = None
15
- created_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="createdAt")] = None
16
- started_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="startedAt")] = None
17
- ended_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="endedAt")] = None
18
- status: typing.Optional[ServiceExecutionStatus] = None
19
-
20
- if IS_PYDANTIC_V2:
21
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
- else:
23
-
24
- class Config:
25
- frozen = True
26
- smart_union = True
27
- extra = pydantic.Extra.allow
@@ -1,7 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- ServiceExecutionStatus = typing.Union[
6
- typing.Literal["UNKNOWN", "PENDING", "RUNNING", "SUCCEEDED", "FAILED"], typing.Any
7
- ]
@@ -1,34 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from __future__ import annotations
4
-
5
- import typing
6
-
7
- import pydantic
8
- import typing_extensions
9
- from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel, update_forward_refs
10
- from ..core.serialization import FieldMetadata
11
- from .service_execution import ServiceExecution
12
-
13
-
14
- class ServiceExecutionTokenPrincipal(UniversalBaseModel):
15
- service_execution: typing_extensions.Annotated[
16
- typing.Optional[ServiceExecution], FieldMetadata(alias="serviceExecution")
17
- ] = None
18
- service_provider: typing_extensions.Annotated[
19
- typing.Optional["UserContext"], FieldMetadata(alias="serviceProvider")
20
- ] = None
21
-
22
- if IS_PYDANTIC_V2:
23
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
24
- else:
25
-
26
- class Config:
27
- frozen = True
28
- smart_union = True
29
- extra = pydantic.Extra.allow
30
-
31
-
32
- from .user_context import UserContext # noqa: E402, F401, I001
33
-
34
- update_forward_refs(ServiceExecutionTokenPrincipal)
@@ -1,35 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from __future__ import annotations
4
-
5
- import typing
6
-
7
- import pydantic
8
- import typing_extensions
9
- from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel, update_forward_refs
10
- from ..core.serialization import FieldMetadata
11
- from .user_context_account_type import UserContextAccountType
12
- from .user_context_context_type import UserContextContextType
13
-
14
-
15
- class UserContext(UniversalBaseModel):
16
- id: typing.Optional[str] = None
17
- context_type: typing_extensions.Annotated[
18
- typing.Optional[UserContextContextType], FieldMetadata(alias="contextType")
19
- ] = None
20
- account_type: typing_extensions.Annotated[
21
- typing.Optional[UserContextAccountType], FieldMetadata(alias="accountType")
22
- ] = None
23
- parent: typing.Optional["UserContext"] = None
24
-
25
- if IS_PYDANTIC_V2:
26
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
27
- else:
28
-
29
- class Config:
30
- frozen = True
31
- smart_union = True
32
- extra = pydantic.Extra.allow
33
-
34
-
35
- update_forward_refs(UserContext)
@@ -1,5 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- UserContextAccountType = typing.Union[typing.Literal["BASIC", "PRO", "BUSINESS"], typing.Any]
@@ -1,5 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- UserContextContextType = typing.Union[typing.Literal["USER", "ORGANIZATION", "SERVICE_EXECUTION"], typing.Any]