Skip to content

Commit ee0b464

Browse files
committed
[QI2-1637] CRS protocol version negotiation
1 parent 150465b commit ee0b464

File tree

7 files changed

+62
-8
lines changed

7 files changed

+62
-8
lines changed

compute_api_client/api/backend_types_api.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ async def read_backend_types_backend_types_get(
337337
max_number_of_shots: Optional[StrictInt] = None,
338338
enabled: Optional[StrictBool] = None,
339339
identifier: Optional[StrictStr] = None,
340+
protocol_version__isnull: Optional[StrictBool] = None,
341+
protocol_version: Optional[StrictInt] = None,
340342
sort_by: Annotated[Optional[StrictStr], Field(description="The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'.")] = None,
341343
latest: Annotated[Optional[StrictBool], Field(description="If True gets the most recently created object.")] = None,
342344
page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number")] = None,
@@ -384,6 +386,10 @@ async def read_backend_types_backend_types_get(
384386
:type enabled: bool
385387
:param identifier:
386388
:type identifier: str
389+
:param protocol_version__isnull:
390+
:type protocol_version__isnull: bool
391+
:param protocol_version:
392+
:type protocol_version: int
387393
:param sort_by: The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'.
388394
:type sort_by: str
389395
:param latest: If True gets the most recently created object.
@@ -428,6 +434,8 @@ async def read_backend_types_backend_types_get(
428434
max_number_of_shots=max_number_of_shots,
429435
enabled=enabled,
430436
identifier=identifier,
437+
protocol_version__isnull=protocol_version__isnull,
438+
protocol_version=protocol_version,
431439
sort_by=sort_by,
432440
latest=latest,
433441
page=page,
@@ -470,6 +478,8 @@ async def read_backend_types_backend_types_get_with_http_info(
470478
max_number_of_shots: Optional[StrictInt] = None,
471479
enabled: Optional[StrictBool] = None,
472480
identifier: Optional[StrictStr] = None,
481+
protocol_version__isnull: Optional[StrictBool] = None,
482+
protocol_version: Optional[StrictInt] = None,
473483
sort_by: Annotated[Optional[StrictStr], Field(description="The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'.")] = None,
474484
latest: Annotated[Optional[StrictBool], Field(description="If True gets the most recently created object.")] = None,
475485
page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number")] = None,
@@ -517,6 +527,10 @@ async def read_backend_types_backend_types_get_with_http_info(
517527
:type enabled: bool
518528
:param identifier:
519529
:type identifier: str
530+
:param protocol_version__isnull:
531+
:type protocol_version__isnull: bool
532+
:param protocol_version:
533+
:type protocol_version: int
520534
:param sort_by: The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'.
521535
:type sort_by: str
522536
:param latest: If True gets the most recently created object.
@@ -561,6 +575,8 @@ async def read_backend_types_backend_types_get_with_http_info(
561575
max_number_of_shots=max_number_of_shots,
562576
enabled=enabled,
563577
identifier=identifier,
578+
protocol_version__isnull=protocol_version__isnull,
579+
protocol_version=protocol_version,
564580
sort_by=sort_by,
565581
latest=latest,
566582
page=page,
@@ -603,6 +619,8 @@ async def read_backend_types_backend_types_get_without_preload_content(
603619
max_number_of_shots: Optional[StrictInt] = None,
604620
enabled: Optional[StrictBool] = None,
605621
identifier: Optional[StrictStr] = None,
622+
protocol_version__isnull: Optional[StrictBool] = None,
623+
protocol_version: Optional[StrictInt] = None,
606624
sort_by: Annotated[Optional[StrictStr], Field(description="The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'.")] = None,
607625
latest: Annotated[Optional[StrictBool], Field(description="If True gets the most recently created object.")] = None,
608626
page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number")] = None,
@@ -650,6 +668,10 @@ async def read_backend_types_backend_types_get_without_preload_content(
650668
:type enabled: bool
651669
:param identifier:
652670
:type identifier: str
671+
:param protocol_version__isnull:
672+
:type protocol_version__isnull: bool
673+
:param protocol_version:
674+
:type protocol_version: int
653675
:param sort_by: The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'.
654676
:type sort_by: str
655677
:param latest: If True gets the most recently created object.
@@ -694,6 +716,8 @@ async def read_backend_types_backend_types_get_without_preload_content(
694716
max_number_of_shots=max_number_of_shots,
695717
enabled=enabled,
696718
identifier=identifier,
719+
protocol_version__isnull=protocol_version__isnull,
720+
protocol_version=protocol_version,
697721
sort_by=sort_by,
698722
latest=latest,
699723
page=page,
@@ -731,6 +755,8 @@ def _read_backend_types_backend_types_get_serialize(
731755
max_number_of_shots,
732756
enabled,
733757
identifier,
758+
protocol_version__isnull,
759+
protocol_version,
734760
sort_by,
735761
latest,
736762
page,
@@ -808,6 +834,14 @@ def _read_backend_types_backend_types_get_serialize(
808834

809835
_query_params.append(('identifier', identifier))
810836

837+
if protocol_version__isnull is not None:
838+
839+
_query_params.append(('protocol_version__isnull', protocol_version__isnull))
840+
841+
if protocol_version is not None:
842+
843+
_query_params.append(('protocol_version', protocol_version))
844+
811845
if sort_by is not None:
812846

813847
_query_params.append(('sort_by', sort_by))

compute_api_client/docs/BackendType.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Name | Type | Description | Notes
2121
**max_number_of_shots** | **int** | |
2222
**enabled** | **bool** | |
2323
**identifier** | **str** | |
24+
**protocol_version** | **int** | | [optional]
2425

2526
## Example
2627

compute_api_client/docs/BackendTypePatch.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Name | Type | Description | Notes
1919
**max_number_of_shots** | **int** | | [optional]
2020
**enabled** | **bool** | | [optional]
2121
**identifier** | **str** | | [optional]
22+
**protocol_version** | **int** | | [optional]
2223

2324
## Example
2425

compute_api_client/docs/BackendTypesApi.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Name | Type | Description | Notes
9393
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
9494

9595
# **read_backend_types_backend_types_get**
96-
> PageBackendType read_backend_types_backend_types_get(id=id, name=name, infrastructure=infrastructure, description=description, image_id=image_id, is_hardware=is_hardware, supports_raw_data=supports_raw_data, nqubits=nqubits, status=status, default_number_of_shots=default_number_of_shots, max_number_of_shots=max_number_of_shots, enabled=enabled, identifier=identifier, sort_by=sort_by, latest=latest, page=page, size=size)
96+
> PageBackendType read_backend_types_backend_types_get(id=id, name=name, infrastructure=infrastructure, description=description, image_id=image_id, is_hardware=is_hardware, supports_raw_data=supports_raw_data, nqubits=nqubits, status=status, default_number_of_shots=default_number_of_shots, max_number_of_shots=max_number_of_shots, enabled=enabled, identifier=identifier, protocol_version__isnull=protocol_version__isnull, protocol_version=protocol_version, sort_by=sort_by, latest=latest, page=page, size=size)
9797
9898
List backend types
9999

@@ -134,14 +134,16 @@ async with compute_api_client.ApiClient(configuration) as api_client:
134134
max_number_of_shots = 56 # int | (optional)
135135
enabled = True # bool | (optional)
136136
identifier = 'identifier_example' # str | (optional)
137+
protocol_version__isnull = True # bool | (optional)
138+
protocol_version = 56 # int | (optional)
137139
sort_by = 'sort_by_example' # str | The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'. (optional)
138140
latest = True # bool | If True gets the most recently created object. (optional)
139141
page = 1 # int | Page number (optional) (default to 1)
140142
size = 50 # int | Page size (optional) (default to 50)
141143

142144
try:
143145
# List backend types
144-
api_response = await api_instance.read_backend_types_backend_types_get(id=id, name=name, infrastructure=infrastructure, description=description, image_id=image_id, is_hardware=is_hardware, supports_raw_data=supports_raw_data, nqubits=nqubits, status=status, default_number_of_shots=default_number_of_shots, max_number_of_shots=max_number_of_shots, enabled=enabled, identifier=identifier, sort_by=sort_by, latest=latest, page=page, size=size)
146+
api_response = await api_instance.read_backend_types_backend_types_get(id=id, name=name, infrastructure=infrastructure, description=description, image_id=image_id, is_hardware=is_hardware, supports_raw_data=supports_raw_data, nqubits=nqubits, status=status, default_number_of_shots=default_number_of_shots, max_number_of_shots=max_number_of_shots, enabled=enabled, identifier=identifier, protocol_version__isnull=protocol_version__isnull, protocol_version=protocol_version, sort_by=sort_by, latest=latest, page=page, size=size)
145147
print("The response of BackendTypesApi->read_backend_types_backend_types_get:\n")
146148
pprint(api_response)
147149
except Exception as e:
@@ -167,6 +169,8 @@ Name | Type | Description | Notes
167169
**max_number_of_shots** | **int**| | [optional]
168170
**enabled** | **bool**| | [optional]
169171
**identifier** | **str**| | [optional]
172+
**protocol_version__isnull** | **bool**| | [optional]
173+
**protocol_version** | **int**| | [optional]
170174
**sort_by** | **str**| The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'. | [optional]
171175
**latest** | **bool**| If True gets the most recently created object. | [optional]
172176
**page** | **int**| Page number | [optional] [default to 1]

compute_api_client/models/backend_type.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import json
1919

2020

21-
from typing import Any, ClassVar, Dict, List
21+
from typing import Any, ClassVar, Dict, List, Optional
2222
from pydantic import BaseModel, StrictBool, StrictInt, StrictStr
2323
from pydantic import Field
2424
from typing_extensions import Annotated
@@ -49,7 +49,8 @@ class BackendType(BaseModel):
4949
max_number_of_shots: StrictInt
5050
enabled: StrictBool
5151
identifier: Annotated[str, Field(strict=True, max_length=32)]
52-
__properties: ClassVar[List[str]] = ["id", "name", "infrastructure", "description", "image_id", "is_hardware", "supports_raw_data", "features", "default_compiler_config", "gateset", "topology", "nqubits", "status", "default_number_of_shots", "max_number_of_shots", "enabled", "identifier"]
52+
protocol_version: Optional[StrictInt] = None
53+
__properties: ClassVar[List[str]] = ["id", "name", "infrastructure", "description", "image_id", "is_hardware", "supports_raw_data", "features", "default_compiler_config", "gateset", "topology", "nqubits", "status", "default_number_of_shots", "max_number_of_shots", "enabled", "identifier", "protocol_version"]
5354

5455
model_config = {
5556
"populate_by_name": True,
@@ -87,6 +88,11 @@ def to_dict(self) -> Dict[str, Any]:
8788
},
8889
exclude_none=True,
8990
)
91+
# set to None if protocol_version (nullable) is None
92+
# and model_fields_set contains the field
93+
if self.protocol_version is None and "protocol_version" in self.model_fields_set:
94+
_dict['protocol_version'] = None
95+
9096
return _dict
9197

9298
@classmethod
@@ -115,7 +121,8 @@ def from_dict(cls, obj: Dict) -> Self:
115121
"default_number_of_shots": obj.get("default_number_of_shots"),
116122
"max_number_of_shots": obj.get("max_number_of_shots"),
117123
"enabled": obj.get("enabled"),
118-
"identifier": obj.get("identifier")
124+
"identifier": obj.get("identifier"),
125+
"protocol_version": obj.get("protocol_version")
119126
})
120127
return _obj
121128

compute_api_client/models/backend_type_patch.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class BackendTypePatch(BaseModel):
4646
max_number_of_shots: Optional[StrictInt] = None
4747
enabled: Optional[StrictBool] = None
4848
identifier: Optional[Annotated[str, Field(strict=True, max_length=32)]] = None
49-
__properties: ClassVar[List[str]] = ["name", "infrastructure", "description", "image_id", "is_hardware", "supports_raw_data", "features", "default_compiler_config", "gateset", "topology", "nqubits", "default_number_of_shots", "max_number_of_shots", "enabled", "identifier"]
49+
protocol_version: Optional[StrictInt] = None
50+
__properties: ClassVar[List[str]] = ["name", "infrastructure", "description", "image_id", "is_hardware", "supports_raw_data", "features", "default_compiler_config", "gateset", "topology", "nqubits", "default_number_of_shots", "max_number_of_shots", "enabled", "identifier", "protocol_version"]
5051

5152
model_config = {
5253
"populate_by_name": True,
@@ -159,6 +160,11 @@ def to_dict(self) -> Dict[str, Any]:
159160
if self.identifier is None and "identifier" in self.model_fields_set:
160161
_dict['identifier'] = None
161162

163+
# set to None if protocol_version (nullable) is None
164+
# and model_fields_set contains the field
165+
if self.protocol_version is None and "protocol_version" in self.model_fields_set:
166+
_dict['protocol_version'] = None
167+
162168
return _dict
163169

164170
@classmethod
@@ -185,7 +191,8 @@ def from_dict(cls, obj: Dict) -> Self:
185191
"default_number_of_shots": obj.get("default_number_of_shots"),
186192
"max_number_of_shots": obj.get("max_number_of_shots"),
187193
"enabled": obj.get("enabled"),
188-
"identifier": obj.get("identifier")
194+
"identifier": obj.get("identifier"),
195+
"protocol_version": obj.get("protocol_version")
189196
})
190197
return _obj
191198

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "qi-compute-api-client"
3-
version = "0.52.0"
3+
version = "0.53.0"
44
description = "An API client for the Compute Job Manager of Quantum Inspire."
55
authors = [{ name = "Quantum Inspire", email = "[email protected]" }]
66
requires-python = "~=3.9"

0 commit comments

Comments
 (0)