Skip to content

Commit 5f2bb03

Browse files
committed
feat(client): wip models
1 parent 2510872 commit 5f2bb03

File tree

4 files changed

+51
-65
lines changed

4 files changed

+51
-65
lines changed

scaleway_qaas_client/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright 2025 Scaleway
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
114
from quantum_as_a_service_api_client.models import (
215
ScalewayQaasV1Alpha1Platform as QaaSPlatform,
316
)
@@ -32,4 +45,11 @@
3245
from quantum_as_a_service_api_client.models import (
3346
ScalewayQaasV1Alpha1ProcessStatus as QaaSProcessStatus,
3447
)
48+
from job_payload.models import (
49+
SerializationType,
50+
CircuitData,
51+
RunData,
52+
BackendData,
53+
ClientData,
54+
)
3555
from .client import QaaSClient

scaleway_qaas_client/client.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright 2025 Scaleway
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
114
import json
215
import randomname
316

@@ -29,6 +42,9 @@
2942
from quantum_as_a_service_api_client.api.platforms.list_platforms import (
3043
sync as _list_platforms_sync,
3144
)
45+
from quantum_as_a_service_api_client.api.platforms.get_platform import (
46+
sync as _get_platform_sync,
47+
)
3248
from quantum_as_a_service_api_client.api.jobs.create_job import (
3349
sync as _create_job_sync,
3450
)
@@ -56,7 +72,14 @@ def __init__(self, project_id: str, secret_key: str, url: str = __DEFAULT_URL):
5672
verify_ssl="https" in url,
5773
)
5874

59-
def list_platforms(self, name: Optional[str]) -> List[ScalewayQaasV1Alpha1Platform]:
75+
def get_platform(self, platform_id: str) -> ScalewayQaasV1Alpha1Platform:
76+
platform = _get_platform_sync(client=self.__client, platform_id=platform_id)
77+
78+
return platform
79+
80+
def list_platforms(
81+
self, name: Optional[str] = None
82+
) -> List[ScalewayQaasV1Alpha1Platform]:
6083
response = _list_platforms_sync(client=self.__client, name=name)
6184

6285
assert response

scaleway_qaas_client/models.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

tests/test_api.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ def test_list_platform():
3939
def test_create_delete_session():
4040
client = _get_client()
4141

42-
platforms = client.list_platforms(name="aer_simulation_pop_c16m128")
42+
platforms = client.list_platforms(
43+
name=os.environ.get("TEST_PLATFORM_NAME", "aer_simulation_pop_c16m128")
44+
)
4345

4446
assert platforms is not None
4547
assert len(platforms) == 1
@@ -64,8 +66,10 @@ def test_create_delete_session():
6466

6567
session = client.terminate_session(session.id)
6668

67-
while session.status is not "cancelled":
69+
while session.status is "stopping":
6870
session = client.get_session(session.id)
6971
time.sleep(3)
7072

71-
session = client.delete_session(session.id)
73+
assert session.status == "stopped"
74+
75+
client.delete_session(session.id)

0 commit comments

Comments
 (0)