Skip to content

Commit d094c14

Browse files
authored
feat(TEM): return/filter emails subject and add ToS when create a domain (#90)
1 parent 43ea89a commit d094c14

File tree

6 files changed

+80
-6
lines changed

6 files changed

+80
-6
lines changed

scaleway-async/scaleway_async/tem/v1alpha1/api.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ async def list_emails(
199199
mail_from: Optional[str] = None,
200200
mail_to: Optional[str] = None,
201201
statuses: Optional[List[EmailStatus]] = None,
202+
subject: Optional[str] = None,
202203
) -> ListEmailsResponse:
203204
"""
204205
List emails sent from a domain and/or for a project and/or for an organization
@@ -213,6 +214,7 @@ async def list_emails(
213214
:param mail_from: Optional, list emails sent with this `mail_from` sender's address.
214215
:param mail_to: Optional, list emails sent with this `mail_to` recipient's address.
215216
:param statuses: Optional, list emails having any of this status.
217+
:param subject: Optional, list emails having this subject.
216218
:return: :class:`ListEmailsResponse <ListEmailsResponse>`
217219
218220
Usage:
@@ -238,6 +240,7 @@ async def list_emails(
238240
"project_id": project_id or self.client.default_project_id,
239241
"since": since,
240242
"statuses": statuses,
243+
"subject": subject,
241244
"until": until,
242245
},
243246
)
@@ -259,6 +262,7 @@ async def list_emails_all(
259262
mail_from: Optional[str] = None,
260263
mail_to: Optional[str] = None,
261264
statuses: Optional[List[EmailStatus]] = None,
265+
subject: Optional[str] = None,
262266
) -> List[Email]:
263267
"""
264268
List emails sent from a domain and/or for a project and/or for an organization
@@ -273,6 +277,7 @@ async def list_emails_all(
273277
:param mail_from: Optional, list emails sent with this `mail_from` sender's address.
274278
:param mail_to: Optional, list emails sent with this `mail_to` recipient's address.
275279
:param statuses: Optional, list emails having any of this status.
280+
:param subject: Optional, list emails having this subject.
276281
:return: :class:`List[ListEmailsResponse] <List[ListEmailsResponse]>`
277282
278283
Usage:
@@ -297,6 +302,7 @@ async def list_emails_all(
297302
"mail_from": mail_from,
298303
"mail_to": mail_to,
299304
"statuses": statuses,
305+
"subject": subject,
300306
},
301307
)
302308

@@ -380,20 +386,25 @@ async def create_domain(
380386
self,
381387
*,
382388
domain_name: str,
389+
accept_tos: bool,
383390
region: Optional[Region] = None,
384391
project_id: Optional[str] = None,
385392
) -> Domain:
386393
"""
387394
Register a domain in a project
388395
:param region: Region to target. If none is passed will use default region from the config.
389-
:param project_id:
390-
:param domain_name:
396+
:param project_id: ID of the project to which the domain belongs.
397+
:param domain_name: Fully qualified domain dame.
398+
:param accept_tos: Accept the Scaleway Terms of Service.
391399
:return: :class:`Domain <Domain>`
392400
393401
Usage:
394402
::
395403
396-
result = await api.create_domain(domain_name="example")
404+
result = await api.create_domain(
405+
domain_name="example",
406+
accept_tos=True,
407+
)
397408
"""
398409

399410
param_region = validate_path_param(
@@ -406,6 +417,7 @@ async def create_domain(
406417
body=marshal_CreateDomainRequest(
407418
CreateDomainRequest(
408419
domain_name=domain_name,
420+
accept_tos=accept_tos,
409421
region=region,
410422
project_id=project_id,
411423
),

scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ def unmarshal_Email(data: Any) -> Email:
160160
field = data.get("status_details")
161161
args["status_details"] = field
162162

163+
field = data.get("subject")
164+
args["subject"] = field
165+
163166
field = data.get("try_count")
164167
args["try_count"] = field
165168

@@ -272,6 +275,7 @@ def marshal_CreateDomainRequest(
272275
defaults: ProfileDefaults,
273276
) -> Dict[str, Any]:
274277
return {
278+
"accept_tos": request.accept_tos,
275279
"domain_name": request.domain_name,
276280
"project_id": request.project_id or defaults.default_project_id,
277281
}

scaleway-async/scaleway_async/tem/v1alpha1/types.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ class Email:
219219
Type of the recipient.
220220
"""
221221

222+
subject: str
223+
"""
224+
Subject of the email.
225+
"""
226+
222227
created_at: Optional[datetime]
223228
"""
224229
Creation date of the email object.
@@ -467,6 +472,11 @@ class ListEmailsRequest:
467472
Optional, list emails having any of this status.
468473
"""
469474

475+
subject: Optional[str]
476+
"""
477+
Optional, list emails having this subject.
478+
"""
479+
470480

471481
@dataclass
472482
class GetStatisticsRequest:
@@ -522,8 +532,19 @@ class CreateDomainRequest:
522532
"""
523533

524534
project_id: Optional[str]
535+
"""
536+
ID of the project to which the domain belongs.
537+
"""
525538

526539
domain_name: str
540+
"""
541+
Fully qualified domain dame.
542+
"""
543+
544+
accept_tos: bool
545+
"""
546+
Accept the Scaleway Terms of Service.
547+
"""
527548

528549

529550
@dataclass

scaleway/scaleway/tem/v1alpha1/api.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def list_emails(
199199
mail_from: Optional[str] = None,
200200
mail_to: Optional[str] = None,
201201
statuses: Optional[List[EmailStatus]] = None,
202+
subject: Optional[str] = None,
202203
) -> ListEmailsResponse:
203204
"""
204205
List emails sent from a domain and/or for a project and/or for an organization
@@ -213,6 +214,7 @@ def list_emails(
213214
:param mail_from: Optional, list emails sent with this `mail_from` sender's address.
214215
:param mail_to: Optional, list emails sent with this `mail_to` recipient's address.
215216
:param statuses: Optional, list emails having any of this status.
217+
:param subject: Optional, list emails having this subject.
216218
:return: :class:`ListEmailsResponse <ListEmailsResponse>`
217219
218220
Usage:
@@ -238,6 +240,7 @@ def list_emails(
238240
"project_id": project_id or self.client.default_project_id,
239241
"since": since,
240242
"statuses": statuses,
243+
"subject": subject,
241244
"until": until,
242245
},
243246
)
@@ -259,6 +262,7 @@ def list_emails_all(
259262
mail_from: Optional[str] = None,
260263
mail_to: Optional[str] = None,
261264
statuses: Optional[List[EmailStatus]] = None,
265+
subject: Optional[str] = None,
262266
) -> List[Email]:
263267
"""
264268
List emails sent from a domain and/or for a project and/or for an organization
@@ -273,6 +277,7 @@ def list_emails_all(
273277
:param mail_from: Optional, list emails sent with this `mail_from` sender's address.
274278
:param mail_to: Optional, list emails sent with this `mail_to` recipient's address.
275279
:param statuses: Optional, list emails having any of this status.
280+
:param subject: Optional, list emails having this subject.
276281
:return: :class:`List[ListEmailsResponse] <List[ListEmailsResponse]>`
277282
278283
Usage:
@@ -297,6 +302,7 @@ def list_emails_all(
297302
"mail_from": mail_from,
298303
"mail_to": mail_to,
299304
"statuses": statuses,
305+
"subject": subject,
300306
},
301307
)
302308

@@ -380,20 +386,25 @@ def create_domain(
380386
self,
381387
*,
382388
domain_name: str,
389+
accept_tos: bool,
383390
region: Optional[Region] = None,
384391
project_id: Optional[str] = None,
385392
) -> Domain:
386393
"""
387394
Register a domain in a project
388395
:param region: Region to target. If none is passed will use default region from the config.
389-
:param project_id:
390-
:param domain_name:
396+
:param project_id: ID of the project to which the domain belongs.
397+
:param domain_name: Fully qualified domain dame.
398+
:param accept_tos: Accept the Scaleway Terms of Service.
391399
:return: :class:`Domain <Domain>`
392400
393401
Usage:
394402
::
395403
396-
result = api.create_domain(domain_name="example")
404+
result = api.create_domain(
405+
domain_name="example",
406+
accept_tos=True,
407+
)
397408
"""
398409

399410
param_region = validate_path_param(
@@ -406,6 +417,7 @@ def create_domain(
406417
body=marshal_CreateDomainRequest(
407418
CreateDomainRequest(
408419
domain_name=domain_name,
420+
accept_tos=accept_tos,
409421
region=region,
410422
project_id=project_id,
411423
),

scaleway/scaleway/tem/v1alpha1/marshalling.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ def unmarshal_Email(data: Any) -> Email:
160160
field = data.get("status_details")
161161
args["status_details"] = field
162162

163+
field = data.get("subject")
164+
args["subject"] = field
165+
163166
field = data.get("try_count")
164167
args["try_count"] = field
165168

@@ -272,6 +275,7 @@ def marshal_CreateDomainRequest(
272275
defaults: ProfileDefaults,
273276
) -> Dict[str, Any]:
274277
return {
278+
"accept_tos": request.accept_tos,
275279
"domain_name": request.domain_name,
276280
"project_id": request.project_id or defaults.default_project_id,
277281
}

scaleway/scaleway/tem/v1alpha1/types.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ class Email:
219219
Type of the recipient.
220220
"""
221221

222+
subject: str
223+
"""
224+
Subject of the email.
225+
"""
226+
222227
created_at: Optional[datetime]
223228
"""
224229
Creation date of the email object.
@@ -467,6 +472,11 @@ class ListEmailsRequest:
467472
Optional, list emails having any of this status.
468473
"""
469474

475+
subject: Optional[str]
476+
"""
477+
Optional, list emails having this subject.
478+
"""
479+
470480

471481
@dataclass
472482
class GetStatisticsRequest:
@@ -522,8 +532,19 @@ class CreateDomainRequest:
522532
"""
523533

524534
project_id: Optional[str]
535+
"""
536+
ID of the project to which the domain belongs.
537+
"""
525538

526539
domain_name: str
540+
"""
541+
Fully qualified domain dame.
542+
"""
543+
544+
accept_tos: bool
545+
"""
546+
Accept the Scaleway Terms of Service.
547+
"""
527548

528549

529550
@dataclass

0 commit comments

Comments
 (0)