Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions scaleway-async/scaleway_async/account/v2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# This file was automatically generated. DO NOT EDIT.
# If you have any remark or suggestion do not hesitate to open an issue.
from .types import CaptchaProviderName
from .types import ListProjectsRequestOrderBy
from .types import CaptchaProvider
from .types import ListProjectsResponse
from .types import Project
from .api import AccountV2API

__all__ = [
"CaptchaProviderName",
"ListProjectsRequestOrderBy",
"CaptchaProvider",
"ListProjectsResponse",
"Project",
"AccountV2API",
Expand Down
23 changes: 23 additions & 0 deletions scaleway-async/scaleway_async/account/v2/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
)
from .types import (
ListProjectsRequestOrderBy,
CaptchaProvider,
ListProjectsResponse,
Project,
CreateProjectRequest,
Expand All @@ -19,6 +20,7 @@
marshal_CreateProjectRequest,
marshal_UpdateProjectRequest,
unmarshal_Project,
unmarshal_CaptchaProvider,
unmarshal_ListProjectsResponse,
)

Expand Down Expand Up @@ -250,3 +252,24 @@ async def update_project(

self._throw_on_error(res)
return unmarshal_Project(res.json())

async def get_captcha_provider(
self,
) -> CaptchaProvider:
"""
Get a Captcha provider.
:return: :class:`CaptchaProvider <CaptchaProvider>`

Usage:
::

result = await api.get_captcha_provider()
"""

res = self._request(
"GET",
f"/account/v2/captcha-provider",
)

self._throw_on_error(res)
return unmarshal_CaptchaProvider(res.json())
15 changes: 15 additions & 0 deletions scaleway-async/scaleway_async/account/v2/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from scaleway_core.profile import ProfileDefaults
from dateutil import parser
from .types import (
CaptchaProvider,
ListProjectsResponse,
Project,
CreateProjectRequest,
Expand Down Expand Up @@ -42,6 +43,20 @@ def unmarshal_Project(data: Any) -> Project:
return Project(**args)


def unmarshal_CaptchaProvider(data: Any) -> CaptchaProvider:
if type(data) is not dict:
raise TypeError(
f"Unmarshalling the type 'CaptchaProvider' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("name")
args["name"] = field

return CaptchaProvider(**args)


def unmarshal_ListProjectsResponse(data: Any) -> ListProjectsResponse:
if type(data) is not dict:
raise TypeError(
Expand Down
15 changes: 15 additions & 0 deletions scaleway-async/scaleway_async/account/v2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
from typing import List, Optional


class CaptchaProviderName(str, Enum):
UNKNOWN_NAME = "unknown_name"
RECAPTCHA_V2 = "recaptcha_v2"
FRIENDLY_CAPTCHA = "friendly_captcha"
HCAPTCHA = "hcaptcha"

def __str__(self) -> str:
return str(self.value)


class ListProjectsRequestOrderBy(str, Enum):
CREATED_AT_ASC = "created_at_asc"
CREATED_AT_DESC = "created_at_desc"
Expand All @@ -18,6 +28,11 @@ def __str__(self) -> str:
return str(self.value)


@dataclass
class CaptchaProvider:
name: CaptchaProviderName


@dataclass
class ListProjectsResponse:
"""
Expand Down
4 changes: 4 additions & 0 deletions scaleway/scaleway/account/v2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# This file was automatically generated. DO NOT EDIT.
# If you have any remark or suggestion do not hesitate to open an issue.
from .types import CaptchaProviderName
from .types import ListProjectsRequestOrderBy
from .types import CaptchaProvider
from .types import ListProjectsResponse
from .types import Project
from .api import AccountV2API

__all__ = [
"CaptchaProviderName",
"ListProjectsRequestOrderBy",
"CaptchaProvider",
"ListProjectsResponse",
"Project",
"AccountV2API",
Expand Down
23 changes: 23 additions & 0 deletions scaleway/scaleway/account/v2/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
)
from .types import (
ListProjectsRequestOrderBy,
CaptchaProvider,
ListProjectsResponse,
Project,
CreateProjectRequest,
Expand All @@ -19,6 +20,7 @@
marshal_CreateProjectRequest,
marshal_UpdateProjectRequest,
unmarshal_Project,
unmarshal_CaptchaProvider,
unmarshal_ListProjectsResponse,
)

Expand Down Expand Up @@ -250,3 +252,24 @@ def update_project(

self._throw_on_error(res)
return unmarshal_Project(res.json())

def get_captcha_provider(
self,
) -> CaptchaProvider:
"""
Get a Captcha provider.
:return: :class:`CaptchaProvider <CaptchaProvider>`

Usage:
::

result = api.get_captcha_provider()
"""

res = self._request(
"GET",
f"/account/v2/captcha-provider",
)

self._throw_on_error(res)
return unmarshal_CaptchaProvider(res.json())
15 changes: 15 additions & 0 deletions scaleway/scaleway/account/v2/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from scaleway_core.profile import ProfileDefaults
from dateutil import parser
from .types import (
CaptchaProvider,
ListProjectsResponse,
Project,
CreateProjectRequest,
Expand Down Expand Up @@ -42,6 +43,20 @@ def unmarshal_Project(data: Any) -> Project:
return Project(**args)


def unmarshal_CaptchaProvider(data: Any) -> CaptchaProvider:
if type(data) is not dict:
raise TypeError(
f"Unmarshalling the type 'CaptchaProvider' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("name")
args["name"] = field

return CaptchaProvider(**args)


def unmarshal_ListProjectsResponse(data: Any) -> ListProjectsResponse:
if type(data) is not dict:
raise TypeError(
Expand Down
15 changes: 15 additions & 0 deletions scaleway/scaleway/account/v2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
from typing import List, Optional


class CaptchaProviderName(str, Enum):
UNKNOWN_NAME = "unknown_name"
RECAPTCHA_V2 = "recaptcha_v2"
FRIENDLY_CAPTCHA = "friendly_captcha"
HCAPTCHA = "hcaptcha"

def __str__(self) -> str:
return str(self.value)


class ListProjectsRequestOrderBy(str, Enum):
CREATED_AT_ASC = "created_at_asc"
CREATED_AT_DESC = "created_at_desc"
Expand All @@ -18,6 +28,11 @@ def __str__(self) -> str:
return str(self.value)


@dataclass
class CaptchaProvider:
name: CaptchaProviderName


@dataclass
class ListProjectsResponse:
"""
Expand Down