@planqk/planqk-service-sdk 2.6.2 → 2.7.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 (48) hide show
  1. package/dist/sdk/Client.d.ts +2 -2
  2. package/dist/sdk/Client.js +1 -1
  3. package/dist/sdk/api/resources/serviceApi/client/Client.d.ts +4 -4
  4. package/dist/sdk/api/resources/serviceApi/client/Client.js +6 -2
  5. package/dist/sdk/api/types/LogEntry.d.ts +8 -0
  6. package/dist/sdk/api/types/LogEntry.js +5 -0
  7. package/dist/sdk/api/types/index.d.ts +1 -0
  8. package/dist/sdk/api/types/index.js +1 -0
  9. package/fern/fern.config.json +1 -1
  10. package/fern/generators.yml +6 -4
  11. package/fern/openapi/openapi.yml +104 -80
  12. package/package.json +1 -1
  13. package/planqk/service/_version.py +1 -1
  14. package/planqk/service/client.py +3 -3
  15. package/planqk/service/sdk/__init__.py +58 -8
  16. package/planqk/service/sdk/client.py +27 -7
  17. package/planqk/service/sdk/core/__init__.py +80 -20
  18. package/planqk/service/sdk/core/client_wrapper.py +8 -6
  19. package/planqk/service/sdk/core/force_multipart.py +4 -2
  20. package/planqk/service/sdk/core/http_response.py +1 -1
  21. package/planqk/service/sdk/core/http_sse/__init__.py +42 -0
  22. package/planqk/service/sdk/core/http_sse/_api.py +112 -0
  23. package/planqk/service/sdk/core/http_sse/_decoders.py +61 -0
  24. package/planqk/service/sdk/core/http_sse/_exceptions.py +7 -0
  25. package/planqk/service/sdk/core/http_sse/_models.py +17 -0
  26. package/planqk/service/sdk/core/pydantic_utilities.py +5 -2
  27. package/planqk/service/sdk/core/unchecked_base_model.py +341 -0
  28. package/planqk/service/sdk/service_api/__init__.py +0 -3
  29. package/planqk/service/sdk/service_api/client.py +17 -21
  30. package/planqk/service/sdk/service_api/raw_client.py +36 -40
  31. package/planqk/service/sdk/types/__init__.py +54 -4
  32. package/planqk/service/sdk/types/hal_link.py +3 -2
  33. package/planqk/service/sdk/types/log_entry.py +23 -0
  34. package/planqk/service/sdk/types/request_body.py +5 -0
  35. package/planqk/service/sdk/types/result_response.py +27 -0
  36. package/planqk/service/sdk/{service_api/types/get_result_response_embedded.py → types/result_response_embedded.py} +4 -3
  37. package/planqk/service/sdk/{service_api/types/get_result_response_links.py → types/result_response_links.py} +4 -3
  38. package/planqk/service/sdk/types/service_execution.py +3 -2
  39. package/pyproject.toml +1 -1
  40. package/requirements-dev.txt +59 -43
  41. package/requirements.txt +6 -6
  42. package/src/sdk/Client.ts +2 -2
  43. package/src/sdk/api/resources/serviceApi/client/Client.ts +15 -7
  44. package/src/sdk/api/types/LogEntry.ts +9 -0
  45. package/src/sdk/api/types/index.ts +1 -0
  46. package/uv.lock +77 -47
  47. package/planqk/service/sdk/service_api/types/__init__.py +0 -9
  48. package/planqk/service/sdk/service_api/types/get_result_response.py +0 -26
@@ -9,7 +9,7 @@ export declare namespace PlanqkServiceApiClient {
9
9
  environment?: core.Supplier<environments.PlanqkServiceApiEnvironment | string>;
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
- token: core.Supplier<core.BearerToken>;
12
+ token?: core.Supplier<core.BearerToken | undefined>;
13
13
  /** Additional headers to include in requests. */
14
14
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
15
  }
@@ -27,6 +27,6 @@ export declare namespace PlanqkServiceApiClient {
27
27
  export declare class PlanqkServiceApiClient {
28
28
  protected readonly _options: PlanqkServiceApiClient.Options;
29
29
  protected _serviceApi: ServiceApi | undefined;
30
- constructor(_options: PlanqkServiceApiClient.Options);
30
+ constructor(_options?: PlanqkServiceApiClient.Options);
31
31
  get serviceApi(): ServiceApi;
32
32
  }
@@ -43,7 +43,7 @@ const Client_js_1 = require("./api/resources/serviceApi/client/Client.js");
43
43
  class PlanqkServiceApiClient {
44
44
  _options;
45
45
  _serviceApi;
46
- constructor(_options) {
46
+ constructor(_options = {}) {
47
47
  this._options = {
48
48
  ..._options,
49
49
  headers: (0, headers_js_1.mergeHeaders)({
@@ -9,7 +9,7 @@ export declare namespace ServiceApi {
9
9
  environment?: core.Supplier<environments.PlanqkServiceApiEnvironment | string>;
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
- token: core.Supplier<core.BearerToken>;
12
+ token?: core.Supplier<core.BearerToken | undefined>;
13
13
  /** Additional headers to include in requests. */
14
14
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
15
  }
@@ -26,7 +26,7 @@ export declare namespace ServiceApi {
26
26
  }
27
27
  export declare class ServiceApi {
28
28
  protected readonly _options: ServiceApi.Options;
29
- constructor(_options: ServiceApi.Options);
29
+ constructor(_options?: ServiceApi.Options);
30
30
  /**
31
31
  * Retrieves a list of all service executions.
32
32
  * The response includes links to each service execution, allowing for further queries on their status and results.
@@ -93,7 +93,7 @@ export declare class ServiceApi {
93
93
  * @example
94
94
  * await client.serviceApi.getLogs("id")
95
95
  */
96
- getLogs(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<string[]>;
96
+ getLogs(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.LogEntry[]>;
97
97
  private __getLogs;
98
98
  /**
99
99
  * Cancel a pending or running service execution.
@@ -106,5 +106,5 @@ export declare class ServiceApi {
106
106
  */
107
107
  cancelExecution(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.ServiceExecution>;
108
108
  private __cancelExecution;
109
- protected _getAuthorizationHeader(): Promise<string>;
109
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
110
110
  }
@@ -43,7 +43,7 @@ const headers_js_1 = require("../../../../core/headers.js");
43
43
  const errors = __importStar(require("../../../../errors/index.js"));
44
44
  class ServiceApi {
45
45
  _options;
46
- constructor(_options) {
46
+ constructor(_options = {}) {
47
47
  this._options = _options;
48
48
  }
49
49
  /**
@@ -403,7 +403,11 @@ class ServiceApi {
403
403
  }
404
404
  }
405
405
  async _getAuthorizationHeader() {
406
- return `Bearer ${await core.Supplier.get(this._options.token)}`;
406
+ const bearer = await core.Supplier.get(this._options.token);
407
+ if (bearer != null) {
408
+ return `Bearer ${bearer}`;
409
+ }
410
+ return undefined;
407
411
  }
408
412
  }
409
413
  exports.ServiceApi = ServiceApi;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface LogEntry {
5
+ message?: string;
6
+ severity?: string;
7
+ timestamp?: string;
8
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,3 @@
1
1
  export * from "./ServiceExecution.js";
2
+ export * from "./LogEntry.js";
2
3
  export * from "./HalLink.js";
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ServiceExecution.js"), exports);
18
+ __exportStar(require("./LogEntry.js"), exports);
18
19
  __exportStar(require("./HalLink.js"), exports);
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "organization": "planqk-service",
3
- "version": "0.65.35"
3
+ "version": "0.86.2"
4
4
  }
@@ -6,8 +6,8 @@ default-group: local
6
6
  groups:
7
7
  local:
8
8
  generators:
9
- - name: fernapi/fern-typescript-node-sdk
10
- version: 2.4.6
9
+ - name: fernapi/fern-typescript-sdk
10
+ version: 3.7.1
11
11
  output:
12
12
  location: local-file-system
13
13
  path: ../generated/typescript
@@ -18,8 +18,10 @@ groups:
18
18
  skipResponseValidation: true
19
19
  noSerdeLayer: true
20
20
  - name: fernapi/fern-python-sdk
21
- version: 4.25.0
21
+ version: 4.31.0
22
22
  output:
23
23
  location: local-file-system
24
24
  path: ../generated/python
25
- config: {}
25
+ config:
26
+ pydantic_config:
27
+ skip_validation: true
@@ -4,6 +4,105 @@ info:
4
4
  title: PLANQK Service API
5
5
  description: |
6
6
  API description for a managed PLANQK Service.
7
+ components:
8
+ schemas:
9
+ RequestBody:
10
+ type: object
11
+ additionalProperties: true
12
+ #
13
+ # Define the schema of your service execution input here
14
+ #
15
+ ResultResponse:
16
+ type: object
17
+ additionalProperties: true
18
+ properties:
19
+ #
20
+ # Add the schema of your result response here
21
+ #
22
+
23
+ # DO NOT REMOVE THE FOLLOWING LINES
24
+ _links:
25
+ type: object
26
+ properties:
27
+ status:
28
+ $ref: '#/components/schemas/HALLink'
29
+ additionalProperties:
30
+ $ref: '#/components/schemas/HALLink'
31
+ _embedded:
32
+ type: object
33
+ properties:
34
+ status:
35
+ $ref: '#/components/schemas/ServiceExecution'
36
+ ServiceExecution:
37
+ type: object
38
+ properties:
39
+ id:
40
+ type: string
41
+ examples: [ 87cb778e-ac43-11ec-b909-0242ac120002 ]
42
+ status:
43
+ type: string
44
+ enum: [ UNKNOWN, PENDING, RUNNING, SUCCEEDED, CANCELLED, FAILED ]
45
+ examples: [ SUCCEEDED ]
46
+ createdAt:
47
+ type: string
48
+ examples: [ "2022-01-01 22:38:08" ]
49
+ startedAt:
50
+ type: string
51
+ examples: [ "2022-01-01 22:39:08" ]
52
+ endedAt:
53
+ type: string
54
+ examples: [ "2022-01-01 22:40:08" ]
55
+ LogEntry:
56
+ type: object
57
+ properties:
58
+ message:
59
+ type: string
60
+ severity:
61
+ type: string
62
+ timestamp:
63
+ type: string
64
+ format: date-time
65
+ # Representation of link as defined in HAL: https://datatracker.ietf.org/doc/html/draft-kelly-json-hal-11
66
+ HALLink:
67
+ type: object
68
+ properties:
69
+ href:
70
+ type: string
71
+ description: The URL of the link
72
+ templated:
73
+ type: boolean
74
+ description: Whether the link is templated (optional)
75
+ default: false
76
+ type:
77
+ type: string
78
+ description: The media type of the link (optional)
79
+ deprecation:
80
+ type: string
81
+ description: A URL that provides further information about the deprecation of the link (optional)
82
+ name:
83
+ type: string
84
+ description: The name of the link (optional)
85
+ profile:
86
+ type: string
87
+ description: A URL that provides further information about the profile of the link (optional)
88
+ title:
89
+ type: string
90
+ description: The title of the link (optional)
91
+ hreflang:
92
+ type: string
93
+ description: The language of the link's target resource (optional)
94
+ securitySchemes:
95
+ ApplicationCredentials:
96
+ type: oauth2
97
+ flows:
98
+ clientCredentials:
99
+ tokenUrl: https://gateway.platform.planqk.de/token
100
+ scopes: {}
101
+ security:
102
+ - ApplicationCredentials: []
103
+ servers:
104
+ - url: https://gateway.platform.planqk.de/<context>/<service>/<version>
105
+ description: The service endpoint
7
106
  paths:
8
107
  /:
9
108
  get:
@@ -36,8 +135,7 @@ paths:
36
135
  content:
37
136
  application/json:
38
137
  schema:
39
- type: object
40
- additionalProperties: true
138
+ $ref: "#/components/schemas/RequestBody"
41
139
  responses:
42
140
  "201":
43
141
  description: Service execution is submitted
@@ -96,21 +194,7 @@ paths:
96
194
  content:
97
195
  application/json:
98
196
  schema:
99
- type: object
100
- additionalProperties: true
101
- properties:
102
- _links:
103
- type: object
104
- properties:
105
- status:
106
- $ref: '#/components/schemas/HALLink'
107
- additionalProperties:
108
- $ref: '#/components/schemas/HALLink'
109
- _embedded:
110
- type: object
111
- properties:
112
- status:
113
- $ref: '#/components/schemas/ServiceExecution'
197
+ $ref: "#/components/schemas/ResultResponse"
114
198
  /{id}/result/{file}:
115
199
  get:
116
200
  tags:
@@ -165,7 +249,9 @@ paths:
165
249
  schema:
166
250
  type: array
167
251
  items:
168
- type: string
252
+ $ref: "#/components/schemas/LogEntry"
253
+ "204":
254
+ description: No log entries available
169
255
  /{id}/cancel:
170
256
  put:
171
257
  tags:
@@ -188,65 +274,3 @@ paths:
188
274
  application/json:
189
275
  schema:
190
276
  $ref: "#/components/schemas/ServiceExecution"
191
- components:
192
- schemas:
193
- ServiceExecution:
194
- type: object
195
- properties:
196
- id:
197
- type: string
198
- examples: [ 87cb778e-ac43-11ec-b909-0242ac120002 ]
199
- status:
200
- type: string
201
- enum: [ UNKNOWN, PENDING, RUNNING, SUCCEEDED, CANCELLED, FAILED ]
202
- examples: [ SUCCEEDED ]
203
- createdAt:
204
- type: string
205
- examples: [ "2022-01-01 22:38:08" ]
206
- startedAt:
207
- type: string
208
- examples: [ "2022-01-01 22:39:08" ]
209
- endedAt:
210
- type: string
211
- examples: [ "2022-01-01 22:40:08" ]
212
- # Representation of link as defined in HAL: https://datatracker.ietf.org/doc/html/draft-kelly-json-hal-11
213
- HALLink:
214
- type: object
215
- properties:
216
- href:
217
- type: string
218
- description: The URL of the link
219
- templated:
220
- type: boolean
221
- description: Whether the link is templated (optional)
222
- default: false
223
- type:
224
- type: string
225
- description: The media type of the link (optional)
226
- deprecation:
227
- type: string
228
- description: A URL that provides further information about the deprecation of the link (optional)
229
- name:
230
- type: string
231
- description: The name of the link (optional)
232
- profile:
233
- type: string
234
- description: A URL that provides further information about the profile of the link (optional)
235
- title:
236
- type: string
237
- description: The title of the link (optional)
238
- hreflang:
239
- type: string
240
- description: The language of the link's target resource (optional)
241
- securitySchemes:
242
- ApplicationCredentials:
243
- type: oauth2
244
- flows:
245
- clientCredentials:
246
- tokenUrl: https://gateway.platform.planqk.de/token
247
- scopes: {}
248
- security:
249
- - ApplicationCredentials: []
250
- servers:
251
- - url: https://gateway.platform.planqk.de/<context>/<service>/<version>
252
- description: The service endpoint
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planqk/planqk-service-sdk",
3
- "version": "2.6.2",
3
+ "version": "2.7.0",
4
4
  "description": "SDK to interact with PLANQK Managed Services.",
5
5
  "author": "Kipu Quantum GmbH",
6
6
  "contributors": [
@@ -1 +1 @@
1
- __version__ = "2.6.2"
1
+ __version__ = "2.7.0"
@@ -5,7 +5,7 @@ import time
5
5
  import typing
6
6
 
7
7
  from planqk.service.auth import DEFAULT_TOKEN_ENDPOINT, PlanqkServiceAuth
8
- from planqk.service.sdk import PlanqkServiceApi, ServiceExecution, GetResultResponse
8
+ from planqk.service.sdk import PlanqkServiceApi, ServiceExecution, LogEntry, ResultResponse
9
9
  from planqk.service.sdk.service_api.client import ServiceApiClient
10
10
  from planqk.service.sdk.types.service_execution_status import ServiceExecutionStatus
11
11
 
@@ -61,7 +61,7 @@ class PlanqkServiceExecution:
61
61
  def refresh(self):
62
62
  self._service_execution = self._client.api.get_status(id=self.id)
63
63
 
64
- def result(self) -> GetResultResponse:
64
+ def result(self) -> ResultResponse:
65
65
  self.wait_for_final_state()
66
66
  delay = 1 # Start with a small delay
67
67
  max_delay = 16 # Maximum delay
@@ -105,7 +105,7 @@ class PlanqkServiceExecution:
105
105
  def cancel(self) -> None:
106
106
  self._client.api.cancel_execution(id=self.id)
107
107
 
108
- def logs(self) -> typing.List[str]:
108
+ def logs(self) -> typing.List[LogEntry]:
109
109
  return self._client.api.get_logs(id=self.id)
110
110
 
111
111
 
@@ -2,20 +2,70 @@
2
2
 
3
3
  # isort: skip_file
4
4
 
5
- from .types import HalLink, ServiceExecution, ServiceExecutionStatus
6
- from . import service_api
7
- from .client import AsyncPlanqkServiceApi, PlanqkServiceApi
8
- from .environment import PlanqkServiceApiEnvironment
9
- from .service_api import GetResultResponse, GetResultResponseEmbedded, GetResultResponseLinks
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .types import (
10
+ HalLink,
11
+ LogEntry,
12
+ RequestBody,
13
+ ResultResponse,
14
+ ResultResponseEmbedded,
15
+ ResultResponseLinks,
16
+ ServiceExecution,
17
+ ServiceExecutionStatus,
18
+ )
19
+ from . import service_api
20
+ from .client import AsyncPlanqkServiceApi, PlanqkServiceApi
21
+ from .environment import PlanqkServiceApiEnvironment
22
+ _dynamic_imports: typing.Dict[str, str] = {
23
+ "AsyncPlanqkServiceApi": ".client",
24
+ "HalLink": ".types",
25
+ "LogEntry": ".types",
26
+ "PlanqkServiceApi": ".client",
27
+ "PlanqkServiceApiEnvironment": ".environment",
28
+ "RequestBody": ".types",
29
+ "ResultResponse": ".types",
30
+ "ResultResponseEmbedded": ".types",
31
+ "ResultResponseLinks": ".types",
32
+ "ServiceExecution": ".types",
33
+ "ServiceExecutionStatus": ".types",
34
+ "service_api": ".service_api",
35
+ }
36
+
37
+
38
+ def __getattr__(attr_name: str) -> typing.Any:
39
+ module_name = _dynamic_imports.get(attr_name)
40
+ if module_name is None:
41
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
42
+ try:
43
+ module = import_module(module_name, __package__)
44
+ if module_name == f".{attr_name}":
45
+ return module
46
+ else:
47
+ return getattr(module, attr_name)
48
+ except ImportError as e:
49
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
50
+ except AttributeError as e:
51
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
52
+
53
+
54
+ def __dir__():
55
+ lazy_attrs = list(_dynamic_imports.keys())
56
+ return sorted(lazy_attrs)
57
+
10
58
 
11
59
  __all__ = [
12
60
  "AsyncPlanqkServiceApi",
13
- "GetResultResponse",
14
- "GetResultResponseEmbedded",
15
- "GetResultResponseLinks",
16
61
  "HalLink",
62
+ "LogEntry",
17
63
  "PlanqkServiceApi",
18
64
  "PlanqkServiceApiEnvironment",
65
+ "RequestBody",
66
+ "ResultResponse",
67
+ "ResultResponseEmbedded",
68
+ "ResultResponseLinks",
19
69
  "ServiceExecution",
20
70
  "ServiceExecutionStatus",
21
71
  "service_api",
@@ -1,11 +1,15 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import typing
4
6
 
5
7
  import httpx
6
8
  from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
7
9
  from .environment import PlanqkServiceApiEnvironment
8
- from .service_api.client import AsyncServiceApiClient, ServiceApiClient
10
+
11
+ if typing.TYPE_CHECKING:
12
+ from .service_api.client import AsyncServiceApiClient, ServiceApiClient
9
13
 
10
14
 
11
15
  class PlanqkServiceApi:
@@ -26,7 +30,7 @@ class PlanqkServiceApi:
26
30
 
27
31
 
28
32
 
29
- token : typing.Union[str, typing.Callable[[], str]]
33
+ token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
30
34
  headers : typing.Optional[typing.Dict[str, str]]
31
35
  Additional headers to send with every request.
32
36
 
@@ -53,7 +57,7 @@ class PlanqkServiceApi:
53
57
  *,
54
58
  base_url: typing.Optional[str] = None,
55
59
  environment: PlanqkServiceApiEnvironment = PlanqkServiceApiEnvironment.DEFAULT,
56
- token: typing.Union[str, typing.Callable[[], str]],
60
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
57
61
  headers: typing.Optional[typing.Dict[str, str]] = None,
58
62
  timeout: typing.Optional[float] = None,
59
63
  follow_redirects: typing.Optional[bool] = True,
@@ -73,7 +77,15 @@ class PlanqkServiceApi:
73
77
  else httpx.Client(timeout=_defaulted_timeout),
74
78
  timeout=_defaulted_timeout,
75
79
  )
76
- self.service_api = ServiceApiClient(client_wrapper=self._client_wrapper)
80
+ self._service_api: typing.Optional[ServiceApiClient] = None
81
+
82
+ @property
83
+ def service_api(self):
84
+ if self._service_api is None:
85
+ from .service_api.client import ServiceApiClient # noqa: E402
86
+
87
+ self._service_api = ServiceApiClient(client_wrapper=self._client_wrapper)
88
+ return self._service_api
77
89
 
78
90
 
79
91
  class AsyncPlanqkServiceApi:
@@ -94,7 +106,7 @@ class AsyncPlanqkServiceApi:
94
106
 
95
107
 
96
108
 
97
- token : typing.Union[str, typing.Callable[[], str]]
109
+ token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
98
110
  headers : typing.Optional[typing.Dict[str, str]]
99
111
  Additional headers to send with every request.
100
112
 
@@ -121,7 +133,7 @@ class AsyncPlanqkServiceApi:
121
133
  *,
122
134
  base_url: typing.Optional[str] = None,
123
135
  environment: PlanqkServiceApiEnvironment = PlanqkServiceApiEnvironment.DEFAULT,
124
- token: typing.Union[str, typing.Callable[[], str]],
136
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
125
137
  headers: typing.Optional[typing.Dict[str, str]] = None,
126
138
  timeout: typing.Optional[float] = None,
127
139
  follow_redirects: typing.Optional[bool] = True,
@@ -141,7 +153,15 @@ class AsyncPlanqkServiceApi:
141
153
  else httpx.AsyncClient(timeout=_defaulted_timeout),
142
154
  timeout=_defaulted_timeout,
143
155
  )
144
- self.service_api = AsyncServiceApiClient(client_wrapper=self._client_wrapper)
156
+ self._service_api: typing.Optional[AsyncServiceApiClient] = None
157
+
158
+ @property
159
+ def service_api(self):
160
+ if self._service_api is None:
161
+ from .service_api.client import AsyncServiceApiClient # noqa: E402
162
+
163
+ self._service_api = AsyncServiceApiClient(client_wrapper=self._client_wrapper)
164
+ return self._service_api
145
165
 
146
166
 
147
167
  def _get_base_url(*, base_url: typing.Optional[str] = None, environment: PlanqkServiceApiEnvironment) -> str:
@@ -2,26 +2,83 @@
2
2
 
3
3
  # isort: skip_file
4
4
 
5
- from .api_error import ApiError
6
- from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
7
- from .datetime_utils import serialize_datetime
8
- from .file import File, convert_file_dict_to_httpx_tuples, with_content_type
9
- from .http_client import AsyncHttpClient, HttpClient
10
- from .http_response import AsyncHttpResponse, HttpResponse
11
- from .jsonable_encoder import jsonable_encoder
12
- from .pydantic_utilities import (
13
- IS_PYDANTIC_V2,
14
- UniversalBaseModel,
15
- UniversalRootModel,
16
- parse_obj_as,
17
- universal_field_validator,
18
- universal_root_validator,
19
- update_forward_refs,
20
- )
21
- from .query_encoder import encode_query
22
- from .remove_none_from_dict import remove_none_from_dict
23
- from .request_options import RequestOptions
24
- from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .api_error import ApiError
10
+ from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
11
+ from .datetime_utils import serialize_datetime
12
+ from .file import File, convert_file_dict_to_httpx_tuples, with_content_type
13
+ from .http_client import AsyncHttpClient, HttpClient
14
+ from .http_response import AsyncHttpResponse, HttpResponse
15
+ from .jsonable_encoder import jsonable_encoder
16
+ from .pydantic_utilities import (
17
+ IS_PYDANTIC_V2,
18
+ UniversalBaseModel,
19
+ UniversalRootModel,
20
+ parse_obj_as,
21
+ universal_field_validator,
22
+ universal_root_validator,
23
+ update_forward_refs,
24
+ )
25
+ from .query_encoder import encode_query
26
+ from .remove_none_from_dict import remove_none_from_dict
27
+ from .request_options import RequestOptions
28
+ from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
29
+ from .unchecked_base_model import UncheckedBaseModel, UnionMetadata, construct_type
30
+ _dynamic_imports: typing.Dict[str, str] = {
31
+ "ApiError": ".api_error",
32
+ "AsyncClientWrapper": ".client_wrapper",
33
+ "AsyncHttpClient": ".http_client",
34
+ "AsyncHttpResponse": ".http_response",
35
+ "BaseClientWrapper": ".client_wrapper",
36
+ "FieldMetadata": ".serialization",
37
+ "File": ".file",
38
+ "HttpClient": ".http_client",
39
+ "HttpResponse": ".http_response",
40
+ "IS_PYDANTIC_V2": ".pydantic_utilities",
41
+ "RequestOptions": ".request_options",
42
+ "SyncClientWrapper": ".client_wrapper",
43
+ "UncheckedBaseModel": ".unchecked_base_model",
44
+ "UnionMetadata": ".unchecked_base_model",
45
+ "UniversalBaseModel": ".pydantic_utilities",
46
+ "UniversalRootModel": ".pydantic_utilities",
47
+ "construct_type": ".unchecked_base_model",
48
+ "convert_and_respect_annotation_metadata": ".serialization",
49
+ "convert_file_dict_to_httpx_tuples": ".file",
50
+ "encode_query": ".query_encoder",
51
+ "jsonable_encoder": ".jsonable_encoder",
52
+ "parse_obj_as": ".pydantic_utilities",
53
+ "remove_none_from_dict": ".remove_none_from_dict",
54
+ "serialize_datetime": ".datetime_utils",
55
+ "universal_field_validator": ".pydantic_utilities",
56
+ "universal_root_validator": ".pydantic_utilities",
57
+ "update_forward_refs": ".pydantic_utilities",
58
+ "with_content_type": ".file",
59
+ }
60
+
61
+
62
+ def __getattr__(attr_name: str) -> typing.Any:
63
+ module_name = _dynamic_imports.get(attr_name)
64
+ if module_name is None:
65
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
66
+ try:
67
+ module = import_module(module_name, __package__)
68
+ if module_name == f".{attr_name}":
69
+ return module
70
+ else:
71
+ return getattr(module, attr_name)
72
+ except ImportError as e:
73
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
74
+ except AttributeError as e:
75
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
76
+
77
+
78
+ def __dir__():
79
+ lazy_attrs = list(_dynamic_imports.keys())
80
+ return sorted(lazy_attrs)
81
+
25
82
 
26
83
  __all__ = [
27
84
  "ApiError",
@@ -36,8 +93,11 @@ __all__ = [
36
93
  "IS_PYDANTIC_V2",
37
94
  "RequestOptions",
38
95
  "SyncClientWrapper",
96
+ "UncheckedBaseModel",
97
+ "UnionMetadata",
39
98
  "UniversalBaseModel",
40
99
  "UniversalRootModel",
100
+ "construct_type",
41
101
  "convert_and_respect_annotation_metadata",
42
102
  "convert_file_dict_to_httpx_tuples",
43
103
  "encode_query",