Skip to content

Commit 6538f6d

Browse files
authored
refactor(account): move create and notify methods for account request to v3 (#295)
1 parent a52bb57 commit 6538f6d

File tree

8 files changed

+32
-32
lines changed

8 files changed

+32
-32
lines changed

scaleway-async/scaleway_async/account/v2/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def create_project(
5757

5858
res = self._request(
5959
"POST",
60-
"/account/v2/projects",
60+
f"/account/v2/projects",
6161
body=marshal_CreateProjectRequest(
6262
CreateProjectRequest(
6363
name=name or random_name(prefix="proj"),
@@ -102,7 +102,7 @@ async def list_projects(
102102

103103
res = self._request(
104104
"GET",
105-
"/account/v2/projects",
105+
f"/account/v2/projects",
106106
params={
107107
"name": name,
108108
"order_by": order_by,

scaleway-async/scaleway_async/account/v2/marshalling.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515

1616
def unmarshal_Project(data: Any) -> Project:
17-
if not isinstance(data, dict):
17+
if type(data) is not dict:
1818
raise TypeError(
19-
"Unmarshalling the type 'Project' failed as data isn't a dictionary."
19+
f"Unmarshalling the type 'Project' failed as data isn't a dictionary."
2020
)
2121

2222
args: Dict[str, Any] = {}
2323

2424
field = data.get("created_at", None)
25-
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
25+
args["created_at"] = parser.isoparse(field) if type(field) is str else field
2626

2727
field = data.get("description", None)
2828
args["description"] = field
@@ -37,15 +37,15 @@ def unmarshal_Project(data: Any) -> Project:
3737
args["organization_id"] = field
3838

3939
field = data.get("updated_at", None)
40-
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
40+
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
4141

4242
return Project(**args)
4343

4444

4545
def unmarshal_ListProjectsResponse(data: Any) -> ListProjectsResponse:
46-
if not isinstance(data, dict):
46+
if type(data) is not dict:
4747
raise TypeError(
48-
"Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary."
48+
f"Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary."
4949
)
5050

5151
args: Dict[str, Any] = {}

scaleway-async/scaleway_async/account/v3/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async def create_project(
5454

5555
res = self._request(
5656
"POST",
57-
"/account/v3/projects",
57+
f"/account/v3/projects",
5858
body=marshal_ProjectApiCreateProjectRequest(
5959
ProjectApiCreateProjectRequest(
6060
description=description,
@@ -97,7 +97,7 @@ async def list_projects(
9797

9898
res = self._request(
9999
"GET",
100-
"/account/v3/projects",
100+
f"/account/v3/projects",
101101
params={
102102
"name": name,
103103
"order_by": order_by,

scaleway-async/scaleway_async/account/v3/marshalling.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515

1616
def unmarshal_Project(data: Any) -> Project:
17-
if not isinstance(data, dict):
17+
if type(data) is not dict:
1818
raise TypeError(
19-
"Unmarshalling the type 'Project' failed as data isn't a dictionary."
19+
f"Unmarshalling the type 'Project' failed as data isn't a dictionary."
2020
)
2121

2222
args: Dict[str, Any] = {}
2323

2424
field = data.get("created_at", None)
25-
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
25+
args["created_at"] = parser.isoparse(field) if type(field) is str else field
2626

2727
field = data.get("description", None)
2828
args["description"] = field
@@ -37,15 +37,15 @@ def unmarshal_Project(data: Any) -> Project:
3737
args["organization_id"] = field
3838

3939
field = data.get("updated_at", None)
40-
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
40+
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
4141

4242
return Project(**args)
4343

4444

4545
def unmarshal_ListProjectsResponse(data: Any) -> ListProjectsResponse:
46-
if not isinstance(data, dict):
46+
if type(data) is not dict:
4747
raise TypeError(
48-
"Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary."
48+
f"Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary."
4949
)
5050

5151
args: Dict[str, Any] = {}

scaleway/scaleway/account/v2/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def create_project(
5757

5858
res = self._request(
5959
"POST",
60-
"/account/v2/projects",
60+
f"/account/v2/projects",
6161
body=marshal_CreateProjectRequest(
6262
CreateProjectRequest(
6363
name=name or random_name(prefix="proj"),
@@ -102,7 +102,7 @@ def list_projects(
102102

103103
res = self._request(
104104
"GET",
105-
"/account/v2/projects",
105+
f"/account/v2/projects",
106106
params={
107107
"name": name,
108108
"order_by": order_by,

scaleway/scaleway/account/v2/marshalling.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515

1616
def unmarshal_Project(data: Any) -> Project:
17-
if not isinstance(data, dict):
17+
if type(data) is not dict:
1818
raise TypeError(
19-
"Unmarshalling the type 'Project' failed as data isn't a dictionary."
19+
f"Unmarshalling the type 'Project' failed as data isn't a dictionary."
2020
)
2121

2222
args: Dict[str, Any] = {}
2323

2424
field = data.get("created_at", None)
25-
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
25+
args["created_at"] = parser.isoparse(field) if type(field) is str else field
2626

2727
field = data.get("description", None)
2828
args["description"] = field
@@ -37,15 +37,15 @@ def unmarshal_Project(data: Any) -> Project:
3737
args["organization_id"] = field
3838

3939
field = data.get("updated_at", None)
40-
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
40+
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
4141

4242
return Project(**args)
4343

4444

4545
def unmarshal_ListProjectsResponse(data: Any) -> ListProjectsResponse:
46-
if not isinstance(data, dict):
46+
if type(data) is not dict:
4747
raise TypeError(
48-
"Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary."
48+
f"Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary."
4949
)
5050

5151
args: Dict[str, Any] = {}

scaleway/scaleway/account/v3/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def create_project(
5454

5555
res = self._request(
5656
"POST",
57-
"/account/v3/projects",
57+
f"/account/v3/projects",
5858
body=marshal_ProjectApiCreateProjectRequest(
5959
ProjectApiCreateProjectRequest(
6060
description=description,
@@ -97,7 +97,7 @@ def list_projects(
9797

9898
res = self._request(
9999
"GET",
100-
"/account/v3/projects",
100+
f"/account/v3/projects",
101101
params={
102102
"name": name,
103103
"order_by": order_by,

scaleway/scaleway/account/v3/marshalling.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515

1616
def unmarshal_Project(data: Any) -> Project:
17-
if not isinstance(data, dict):
17+
if type(data) is not dict:
1818
raise TypeError(
19-
"Unmarshalling the type 'Project' failed as data isn't a dictionary."
19+
f"Unmarshalling the type 'Project' failed as data isn't a dictionary."
2020
)
2121

2222
args: Dict[str, Any] = {}
2323

2424
field = data.get("created_at", None)
25-
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
25+
args["created_at"] = parser.isoparse(field) if type(field) is str else field
2626

2727
field = data.get("description", None)
2828
args["description"] = field
@@ -37,15 +37,15 @@ def unmarshal_Project(data: Any) -> Project:
3737
args["organization_id"] = field
3838

3939
field = data.get("updated_at", None)
40-
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
40+
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
4141

4242
return Project(**args)
4343

4444

4545
def unmarshal_ListProjectsResponse(data: Any) -> ListProjectsResponse:
46-
if not isinstance(data, dict):
46+
if type(data) is not dict:
4747
raise TypeError(
48-
"Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary."
48+
f"Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary."
4949
)
5050

5151
args: Dict[str, Any] = {}

0 commit comments

Comments
 (0)