Skip to content

Commit 4050224

Browse files
authored
feat(tem): add field to accept new headers in create email endpoint (#414)
1 parent 1218ffc commit 4050224

File tree

8 files changed

+100
-0
lines changed

8 files changed

+100
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .types import ListEmailsRequestOrderBy
1010
from .types import CreateEmailRequestAddress
1111
from .types import CreateEmailRequestAttachment
12+
from .types import CreateEmailRequestHeader
1213
from .types import CreateEmailResponse
1314
from .types import Domain
1415
from .types import DomainLastStatus
@@ -35,6 +36,7 @@
3536
"ListEmailsRequestOrderBy",
3637
"CreateEmailRequestAddress",
3738
"CreateEmailRequestAttachment",
39+
"CreateEmailRequestHeader",
3840
"CreateEmailResponse",
3941
"Domain",
4042
"DomainLastStatus",

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
ListEmailsRequestOrderBy,
2222
CreateEmailRequestAddress,
2323
CreateEmailRequestAttachment,
24+
CreateEmailRequestHeader,
2425
CreateEmailResponse,
2526
Domain,
2627
DomainLastStatus,
@@ -69,6 +70,7 @@ async def create_email(
6970
project_id: Optional[str] = None,
7071
attachments: Optional[List[CreateEmailRequestAttachment]] = None,
7172
send_before: Optional[datetime] = None,
73+
additional_headers: Optional[List[CreateEmailRequestHeader]] = None,
7274
) -> CreateEmailResponse:
7375
"""
7476
Send an email.
@@ -84,6 +86,7 @@ async def create_email(
8486
:param project_id: ID of the Project in which to create the email.
8587
:param attachments: Array of attachments.
8688
:param send_before: Maximum date to deliver the email.
89+
:param additional_headers: Array of additional headers as key-value.
8790
:return: :class:`CreateEmailResponse <CreateEmailResponse>`
8891
8992
Usage:
@@ -116,6 +119,7 @@ async def create_email(
116119
project_id=project_id,
117120
attachments=attachments,
118121
send_before=send_before,
122+
additional_headers=additional_headers,
119123
),
120124
self.client,
121125
),

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .types import (
99
CreateEmailRequestAddress,
1010
CreateEmailRequestAttachment,
11+
CreateEmailRequestHeader,
1112
CreateEmailResponse,
1213
Domain,
1314
DomainLastStatus,
@@ -394,6 +395,21 @@ def marshal_CreateEmailRequestAttachment(
394395
return output
395396

396397

398+
def marshal_CreateEmailRequestHeader(
399+
request: CreateEmailRequestHeader,
400+
defaults: ProfileDefaults,
401+
) -> Dict[str, Any]:
402+
output: Dict[str, Any] = {}
403+
404+
if request.key is not None:
405+
output["key"] = request.key
406+
407+
if request.value is not None:
408+
output["value"] = request.value
409+
410+
return output
411+
412+
397413
def marshal_CreateDomainRequest(
398414
request: CreateDomainRequest,
399415
defaults: ProfileDefaults,
@@ -418,6 +434,12 @@ def marshal_CreateEmailRequest(
418434
) -> Dict[str, Any]:
419435
output: Dict[str, Any] = {}
420436

437+
if request.additional_headers is not None:
438+
output["additional_headers"] = [
439+
marshal_CreateEmailRequestHeader(v, defaults)
440+
for v in request.additional_headers
441+
]
442+
421443
if request.attachments is not None:
422444
output["attachments"] = [
423445
marshal_CreateEmailRequestAttachment(v, defaults)

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,23 @@ class CreateEmailRequestAttachment:
142142
"""
143143

144144

145+
@dataclass
146+
class CreateEmailRequestHeader:
147+
"""
148+
Create email request. header.
149+
"""
150+
151+
key: str
152+
"""
153+
Email header key.
154+
"""
155+
156+
value: str
157+
"""
158+
Email header value.
159+
"""
160+
161+
145162
@dataclass
146163
class CreateEmailResponse:
147164
"""
@@ -583,6 +600,11 @@ class CreateEmailRequest:
583600
Maximum date to deliver the email.
584601
"""
585602

603+
additional_headers: Optional[List[CreateEmailRequestHeader]]
604+
"""
605+
Array of additional headers as key-value.
606+
"""
607+
586608

587609
@dataclass
588610
class GetEmailRequest:

scaleway/scaleway/tem/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .types import ListEmailsRequestOrderBy
1010
from .types import CreateEmailRequestAddress
1111
from .types import CreateEmailRequestAttachment
12+
from .types import CreateEmailRequestHeader
1213
from .types import CreateEmailResponse
1314
from .types import Domain
1415
from .types import DomainLastStatus
@@ -35,6 +36,7 @@
3536
"ListEmailsRequestOrderBy",
3637
"CreateEmailRequestAddress",
3738
"CreateEmailRequestAttachment",
39+
"CreateEmailRequestHeader",
3840
"CreateEmailResponse",
3941
"Domain",
4042
"DomainLastStatus",

scaleway/scaleway/tem/v1alpha1/api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
ListEmailsRequestOrderBy,
2222
CreateEmailRequestAddress,
2323
CreateEmailRequestAttachment,
24+
CreateEmailRequestHeader,
2425
CreateEmailResponse,
2526
Domain,
2627
DomainLastStatus,
@@ -69,6 +70,7 @@ def create_email(
6970
project_id: Optional[str] = None,
7071
attachments: Optional[List[CreateEmailRequestAttachment]] = None,
7172
send_before: Optional[datetime] = None,
73+
additional_headers: Optional[List[CreateEmailRequestHeader]] = None,
7274
) -> CreateEmailResponse:
7375
"""
7476
Send an email.
@@ -84,6 +86,7 @@ def create_email(
8486
:param project_id: ID of the Project in which to create the email.
8587
:param attachments: Array of attachments.
8688
:param send_before: Maximum date to deliver the email.
89+
:param additional_headers: Array of additional headers as key-value.
8790
:return: :class:`CreateEmailResponse <CreateEmailResponse>`
8891
8992
Usage:
@@ -116,6 +119,7 @@ def create_email(
116119
project_id=project_id,
117120
attachments=attachments,
118121
send_before=send_before,
122+
additional_headers=additional_headers,
119123
),
120124
self.client,
121125
),

scaleway/scaleway/tem/v1alpha1/marshalling.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .types import (
99
CreateEmailRequestAddress,
1010
CreateEmailRequestAttachment,
11+
CreateEmailRequestHeader,
1112
CreateEmailResponse,
1213
Domain,
1314
DomainLastStatus,
@@ -394,6 +395,21 @@ def marshal_CreateEmailRequestAttachment(
394395
return output
395396

396397

398+
def marshal_CreateEmailRequestHeader(
399+
request: CreateEmailRequestHeader,
400+
defaults: ProfileDefaults,
401+
) -> Dict[str, Any]:
402+
output: Dict[str, Any] = {}
403+
404+
if request.key is not None:
405+
output["key"] = request.key
406+
407+
if request.value is not None:
408+
output["value"] = request.value
409+
410+
return output
411+
412+
397413
def marshal_CreateDomainRequest(
398414
request: CreateDomainRequest,
399415
defaults: ProfileDefaults,
@@ -418,6 +434,12 @@ def marshal_CreateEmailRequest(
418434
) -> Dict[str, Any]:
419435
output: Dict[str, Any] = {}
420436

437+
if request.additional_headers is not None:
438+
output["additional_headers"] = [
439+
marshal_CreateEmailRequestHeader(v, defaults)
440+
for v in request.additional_headers
441+
]
442+
421443
if request.attachments is not None:
422444
output["attachments"] = [
423445
marshal_CreateEmailRequestAttachment(v, defaults)

scaleway/scaleway/tem/v1alpha1/types.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,23 @@ class CreateEmailRequestAttachment:
142142
"""
143143

144144

145+
@dataclass
146+
class CreateEmailRequestHeader:
147+
"""
148+
Create email request. header.
149+
"""
150+
151+
key: str
152+
"""
153+
Email header key.
154+
"""
155+
156+
value: str
157+
"""
158+
Email header value.
159+
"""
160+
161+
145162
@dataclass
146163
class CreateEmailResponse:
147164
"""
@@ -583,6 +600,11 @@ class CreateEmailRequest:
583600
Maximum date to deliver the email.
584601
"""
585602

603+
additional_headers: Optional[List[CreateEmailRequestHeader]]
604+
"""
605+
Array of additional headers as key-value.
606+
"""
607+
586608

587609
@dataclass
588610
class GetEmailRequest:

0 commit comments

Comments
 (0)