Skip to content

Commit 4e6bf2e

Browse files
authored
feat: update generated APIs (scaleway#829)
1 parent 573b192 commit 4e6bf2e

File tree

8 files changed

+994
-0
lines changed

8 files changed

+994
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
3+
from .types import BlocklistType
34
from .types import DomainLastStatusAutoconfigStateReason
45
from .types import DomainLastStatusRecordStatus
56
from .types import DomainReputationStatus
@@ -9,6 +10,7 @@
910
from .types import EmailRcptType
1011
from .types import EmailStatus
1112
from .content import EMAIL_TRANSIENT_STATUSES
13+
from .types import ListBlocklistsRequestOrderBy
1214
from .types import ListEmailsRequestOrderBy
1315
from .types import ListWebhookEventsRequestOrderBy
1416
from .types import ListWebhooksRequestOrderBy
@@ -20,6 +22,7 @@
2022
from .types import DomainRecords
2123
from .types import DomainReputation
2224
from .types import DomainStatistics
25+
from .types import Blocklist
2326
from .types import CreateEmailRequestAddress
2427
from .types import CreateEmailRequestAttachment
2528
from .types import CreateEmailRequestHeader
@@ -33,12 +36,15 @@
3336
from .types import Webhook
3437
from .types import ProjectSettingsPeriodicReport
3538
from .types import UpdateProjectSettingsRequestUpdatePeriodicReport
39+
from .types import BulkCreateBlocklistsRequest
40+
from .types import BulkCreateBlocklistsResponse
3641
from .types import CancelEmailRequest
3742
from .types import CheckDomainRequest
3843
from .types import CreateDomainRequest
3944
from .types import CreateEmailRequest
4045
from .types import CreateEmailResponse
4146
from .types import CreateWebhookRequest
47+
from .types import DeleteBlocklistRequest
4248
from .types import DeleteWebhookRequest
4349
from .types import DomainLastStatus
4450
from .types import GetDomainLastStatusRequest
@@ -47,6 +53,8 @@
4753
from .types import GetProjectSettingsRequest
4854
from .types import GetStatisticsRequest
4955
from .types import GetWebhookRequest
56+
from .types import ListBlocklistsRequest
57+
from .types import ListBlocklistsResponse
5058
from .types import ListDomainsRequest
5159
from .types import ListDomainsResponse
5260
from .types import ListEmailsRequest
@@ -64,6 +72,7 @@
6472
from .api import TemV1Alpha1API
6573

6674
__all__ = [
75+
"BlocklistType",
6776
"DomainLastStatusAutoconfigStateReason",
6877
"DomainLastStatusRecordStatus",
6978
"DomainReputationStatus",
@@ -73,6 +82,7 @@
7382
"EmailRcptType",
7483
"EmailStatus",
7584
"EMAIL_TRANSIENT_STATUSES",
85+
"ListBlocklistsRequestOrderBy",
7686
"ListEmailsRequestOrderBy",
7787
"ListWebhookEventsRequestOrderBy",
7888
"ListWebhooksRequestOrderBy",
@@ -84,6 +94,7 @@
8494
"DomainRecords",
8595
"DomainReputation",
8696
"DomainStatistics",
97+
"Blocklist",
8798
"CreateEmailRequestAddress",
8899
"CreateEmailRequestAttachment",
89100
"CreateEmailRequestHeader",
@@ -97,12 +108,15 @@
97108
"Webhook",
98109
"ProjectSettingsPeriodicReport",
99110
"UpdateProjectSettingsRequestUpdatePeriodicReport",
111+
"BulkCreateBlocklistsRequest",
112+
"BulkCreateBlocklistsResponse",
100113
"CancelEmailRequest",
101114
"CheckDomainRequest",
102115
"CreateDomainRequest",
103116
"CreateEmailRequest",
104117
"CreateEmailResponse",
105118
"CreateWebhookRequest",
119+
"DeleteBlocklistRequest",
106120
"DeleteWebhookRequest",
107121
"DomainLastStatus",
108122
"GetDomainLastStatusRequest",
@@ -111,6 +125,8 @@
111125
"GetProjectSettingsRequest",
112126
"GetStatisticsRequest",
113127
"GetWebhookRequest",
128+
"ListBlocklistsRequest",
129+
"ListBlocklistsResponse",
114130
"ListDomainsRequest",
115131
"ListDomainsResponse",
116132
"ListEmailsRequest",

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

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,19 @@
1515
wait_for_resource_async,
1616
)
1717
from .types import (
18+
BlocklistType,
1819
DomainStatus,
1920
EmailFlag,
2021
EmailStatus,
22+
ListBlocklistsRequestOrderBy,
2123
ListEmailsRequestOrderBy,
2224
ListWebhookEventsRequestOrderBy,
2325
ListWebhooksRequestOrderBy,
2426
WebhookEventStatus,
2527
WebhookEventType,
28+
Blocklist,
29+
BulkCreateBlocklistsRequest,
30+
BulkCreateBlocklistsResponse,
2631
CreateDomainRequest,
2732
CreateEmailRequest,
2833
CreateEmailRequestAddress,
@@ -33,6 +38,7 @@
3338
Domain,
3439
DomainLastStatus,
3540
Email,
41+
ListBlocklistsResponse,
3642
ListDomainsResponse,
3743
ListEmailsResponse,
3844
ListWebhookEventsResponse,
@@ -54,14 +60,17 @@
5460
unmarshal_Email,
5561
unmarshal_Domain,
5662
unmarshal_Webhook,
63+
unmarshal_BulkCreateBlocklistsResponse,
5764
unmarshal_CreateEmailResponse,
5865
unmarshal_DomainLastStatus,
66+
unmarshal_ListBlocklistsResponse,
5967
unmarshal_ListDomainsResponse,
6068
unmarshal_ListEmailsResponse,
6169
unmarshal_ListWebhookEventsResponse,
6270
unmarshal_ListWebhooksResponse,
6371
unmarshal_ProjectSettings,
6472
unmarshal_Statistics,
73+
marshal_BulkCreateBlocklistsRequest,
6574
marshal_CreateDomainRequest,
6675
marshal_CreateEmailRequest,
6776
marshal_CreateWebhookRequest,
@@ -1277,3 +1286,187 @@ async def update_project_settings(
12771286

12781287
self._throw_on_error(res)
12791288
return unmarshal_ProjectSettings(res.json())
1289+
1290+
async def list_blocklists(
1291+
self,
1292+
*,
1293+
domain_id: str,
1294+
region: Optional[Region] = None,
1295+
order_by: Optional[ListBlocklistsRequestOrderBy] = None,
1296+
page: Optional[int] = None,
1297+
page_size: Optional[int] = None,
1298+
email: Optional[str] = None,
1299+
type_: Optional[BlocklistType] = None,
1300+
custom: Optional[bool] = None,
1301+
) -> ListBlocklistsResponse:
1302+
"""
1303+
List blocklists.
1304+
Retrieve the list of blocklists.
1305+
:param domain_id: (Optional) Filter by a domain ID.
1306+
:param region: Region to target. If none is passed will use default region from the config.
1307+
:param order_by: (Optional) List blocklist corresponding to specific criteria.
1308+
:param page: (Optional) Requested page number. Value must be greater or equal to 1.
1309+
:param page_size: (Optional) Requested page size. Value must be between 1 and 100.
1310+
:param email: (Optional) Filter by an email address.
1311+
:param type_: (Optional) Filter by a blocklist type.
1312+
:param custom: (Optional) Filter by custom blocklist (true) or automatic Transactional Email blocklist (false).
1313+
:return: :class:`ListBlocklistsResponse <ListBlocklistsResponse>`
1314+
1315+
Usage:
1316+
::
1317+
1318+
result = await api.list_blocklists(
1319+
domain_id="example",
1320+
)
1321+
"""
1322+
1323+
param_region = validate_path_param(
1324+
"region", region or self.client.default_region
1325+
)
1326+
1327+
res = self._request(
1328+
"GET",
1329+
f"/transactional-email/v1alpha1/regions/{param_region}/blocklists",
1330+
params={
1331+
"custom": custom,
1332+
"domain_id": domain_id,
1333+
"email": email,
1334+
"order_by": order_by,
1335+
"page": page,
1336+
"page_size": page_size or self.client.default_page_size,
1337+
"type": type_,
1338+
},
1339+
)
1340+
1341+
self._throw_on_error(res)
1342+
return unmarshal_ListBlocklistsResponse(res.json())
1343+
1344+
async def list_blocklists_all(
1345+
self,
1346+
*,
1347+
domain_id: str,
1348+
region: Optional[Region] = None,
1349+
order_by: Optional[ListBlocklistsRequestOrderBy] = None,
1350+
page: Optional[int] = None,
1351+
page_size: Optional[int] = None,
1352+
email: Optional[str] = None,
1353+
type_: Optional[BlocklistType] = None,
1354+
custom: Optional[bool] = None,
1355+
) -> List[Blocklist]:
1356+
"""
1357+
List blocklists.
1358+
Retrieve the list of blocklists.
1359+
:param domain_id: (Optional) Filter by a domain ID.
1360+
:param region: Region to target. If none is passed will use default region from the config.
1361+
:param order_by: (Optional) List blocklist corresponding to specific criteria.
1362+
:param page: (Optional) Requested page number. Value must be greater or equal to 1.
1363+
:param page_size: (Optional) Requested page size. Value must be between 1 and 100.
1364+
:param email: (Optional) Filter by an email address.
1365+
:param type_: (Optional) Filter by a blocklist type.
1366+
:param custom: (Optional) Filter by custom blocklist (true) or automatic Transactional Email blocklist (false).
1367+
:return: :class:`List[Blocklist] <List[Blocklist]>`
1368+
1369+
Usage:
1370+
::
1371+
1372+
result = await api.list_blocklists_all(
1373+
domain_id="example",
1374+
)
1375+
"""
1376+
1377+
return await fetch_all_pages_async(
1378+
type=ListBlocklistsResponse,
1379+
key="blocklists",
1380+
fetcher=self.list_blocklists,
1381+
args={
1382+
"domain_id": domain_id,
1383+
"region": region,
1384+
"order_by": order_by,
1385+
"page": page,
1386+
"page_size": page_size,
1387+
"email": email,
1388+
"type_": type_,
1389+
"custom": custom,
1390+
},
1391+
)
1392+
1393+
async def bulk_create_blocklists(
1394+
self,
1395+
*,
1396+
domain_id: str,
1397+
region: Optional[Region] = None,
1398+
emails: Optional[List[str]] = None,
1399+
type_: Optional[BlocklistType] = None,
1400+
reason: Optional[str] = None,
1401+
) -> BulkCreateBlocklistsResponse:
1402+
"""
1403+
Bulk create blocklists.
1404+
Create multiple blocklists in a specific Project or Organization using the `region` parameter.
1405+
:param domain_id: Domain ID linked to the blocklist.
1406+
:param region: Region to target. If none is passed will use default region from the config.
1407+
:param emails: Email blocked by the blocklist.
1408+
:param type_: Type of blocklist.
1409+
:param reason: Reason to block the email.
1410+
:return: :class:`BulkCreateBlocklistsResponse <BulkCreateBlocklistsResponse>`
1411+
1412+
Usage:
1413+
::
1414+
1415+
result = await api.bulk_create_blocklists(
1416+
domain_id="example",
1417+
)
1418+
"""
1419+
1420+
param_region = validate_path_param(
1421+
"region", region or self.client.default_region
1422+
)
1423+
1424+
res = self._request(
1425+
"POST",
1426+
f"/transactional-email/v1alpha1/regions/{param_region}/blocklists",
1427+
body=marshal_BulkCreateBlocklistsRequest(
1428+
BulkCreateBlocklistsRequest(
1429+
domain_id=domain_id,
1430+
region=region,
1431+
emails=emails,
1432+
type_=type_,
1433+
reason=reason,
1434+
),
1435+
self.client,
1436+
),
1437+
)
1438+
1439+
self._throw_on_error(res)
1440+
return unmarshal_BulkCreateBlocklistsResponse(res.json())
1441+
1442+
async def delete_blocklist(
1443+
self,
1444+
*,
1445+
blocklist_id: str,
1446+
region: Optional[Region] = None,
1447+
) -> None:
1448+
"""
1449+
Delete a blocklist.
1450+
You must specify the blocklist you want to delete by the `region` and `blocklist_id`.
1451+
:param blocklist_id: ID of the blocklist to delete.
1452+
:param region: Region to target. If none is passed will use default region from the config.
1453+
1454+
Usage:
1455+
::
1456+
1457+
result = await api.delete_blocklist(
1458+
blocklist_id="example",
1459+
)
1460+
"""
1461+
1462+
param_region = validate_path_param(
1463+
"region", region or self.client.default_region
1464+
)
1465+
param_blocklist_id = validate_path_param("blocklist_id", blocklist_id)
1466+
1467+
res = self._request(
1468+
"DELETE",
1469+
f"/transactional-email/v1alpha1/regions/{param_region}/blocklists/{param_blocklist_id}",
1470+
)
1471+
1472+
self._throw_on_error(res)

0 commit comments

Comments
 (0)