|
23 | 23 | ListEmailsRequestOrderBy,
|
24 | 24 | ListWebhookEventsRequestOrderBy,
|
25 | 25 | ListWebhooksRequestOrderBy,
|
| 26 | + OfferName, |
26 | 27 | WebhookEventStatus,
|
27 | 28 | WebhookEventType,
|
28 | 29 | Blocklist,
|
|
41 | 42 | ListBlocklistsResponse,
|
42 | 43 | ListDomainsResponse,
|
43 | 44 | ListEmailsResponse,
|
| 45 | + ListOfferSubscriptionsResponse, |
| 46 | + ListOffersResponse, |
| 47 | + ListPoolsResponse, |
44 | 48 | ListWebhookEventsResponse,
|
45 | 49 | ListWebhooksResponse,
|
| 50 | + OfferSubscription, |
| 51 | + Pool, |
| 52 | + ProjectConsumption, |
46 | 53 | ProjectSettings,
|
47 | 54 | Statistics,
|
48 | 55 | UpdateDomainRequest,
|
| 56 | + UpdateOfferSubscriptionRequest, |
49 | 57 | UpdateProjectSettingsRequest,
|
50 | 58 | UpdateProjectSettingsRequestUpdatePeriodicReport,
|
51 | 59 | UpdateWebhookRequest,
|
|
59 | 67 | from .marshalling import (
|
60 | 68 | unmarshal_Email,
|
61 | 69 | unmarshal_Domain,
|
| 70 | + unmarshal_OfferSubscription, |
62 | 71 | unmarshal_Webhook,
|
63 | 72 | unmarshal_BulkCreateBlocklistsResponse,
|
64 | 73 | unmarshal_CreateEmailResponse,
|
65 | 74 | unmarshal_DomainLastStatus,
|
66 | 75 | unmarshal_ListBlocklistsResponse,
|
67 | 76 | unmarshal_ListDomainsResponse,
|
68 | 77 | unmarshal_ListEmailsResponse,
|
| 78 | + unmarshal_ListOfferSubscriptionsResponse, |
| 79 | + unmarshal_ListOffersResponse, |
| 80 | + unmarshal_ListPoolsResponse, |
69 | 81 | unmarshal_ListWebhookEventsResponse,
|
70 | 82 | unmarshal_ListWebhooksResponse,
|
| 83 | + unmarshal_ProjectConsumption, |
71 | 84 | unmarshal_ProjectSettings,
|
72 | 85 | unmarshal_Statistics,
|
73 | 86 | marshal_BulkCreateBlocklistsRequest,
|
74 | 87 | marshal_CreateDomainRequest,
|
75 | 88 | marshal_CreateEmailRequest,
|
76 | 89 | marshal_CreateWebhookRequest,
|
77 | 90 | marshal_UpdateDomainRequest,
|
| 91 | + marshal_UpdateOfferSubscriptionRequest, |
78 | 92 | marshal_UpdateProjectSettingsRequest,
|
79 | 93 | marshal_UpdateWebhookRequest,
|
80 | 94 | )
|
@@ -1469,3 +1483,214 @@ async def delete_blocklist(
|
1469 | 1483 | )
|
1470 | 1484 |
|
1471 | 1485 | self._throw_on_error(res)
|
| 1486 | + |
| 1487 | + async def list_offer_subscriptions( |
| 1488 | + self, |
| 1489 | + *, |
| 1490 | + region: Optional[ScwRegion] = None, |
| 1491 | + project_id: Optional[str] = None, |
| 1492 | + ) -> ListOfferSubscriptionsResponse: |
| 1493 | + """ |
| 1494 | + Get information about subscribed offers. |
| 1495 | + Retrieve information about the offers you are subscribed to using the `project_id` and `region` parameters. |
| 1496 | + :param region: Region to target. If none is passed will use default region from the config. |
| 1497 | + :param project_id: ID of the Project. |
| 1498 | + :return: :class:`ListOfferSubscriptionsResponse <ListOfferSubscriptionsResponse>` |
| 1499 | +
|
| 1500 | + Usage: |
| 1501 | + :: |
| 1502 | +
|
| 1503 | + result = await api.list_offer_subscriptions() |
| 1504 | + """ |
| 1505 | + |
| 1506 | + param_region = validate_path_param( |
| 1507 | + "region", region or self.client.default_region |
| 1508 | + ) |
| 1509 | + |
| 1510 | + res = self._request( |
| 1511 | + "GET", |
| 1512 | + f"/transactional-email/v1alpha1/regions/{param_region}/offer-subscriptions", |
| 1513 | + params={ |
| 1514 | + "project_id": project_id or self.client.default_project_id, |
| 1515 | + }, |
| 1516 | + ) |
| 1517 | + |
| 1518 | + self._throw_on_error(res) |
| 1519 | + return unmarshal_ListOfferSubscriptionsResponse(res.json()) |
| 1520 | + |
| 1521 | + async def update_offer_subscription( |
| 1522 | + self, |
| 1523 | + *, |
| 1524 | + region: Optional[ScwRegion] = None, |
| 1525 | + project_id: Optional[str] = None, |
| 1526 | + name: Optional[OfferName] = None, |
| 1527 | + ) -> OfferSubscription: |
| 1528 | + """ |
| 1529 | + Update a subscribed offer. |
| 1530 | + :param region: Region to target. If none is passed will use default region from the config. |
| 1531 | + :param project_id: ID of the Project. |
| 1532 | + :param name: Name of the offer-subscription. |
| 1533 | + :return: :class:`OfferSubscription <OfferSubscription>` |
| 1534 | +
|
| 1535 | + Usage: |
| 1536 | + :: |
| 1537 | +
|
| 1538 | + result = await api.update_offer_subscription() |
| 1539 | + """ |
| 1540 | + |
| 1541 | + param_region = validate_path_param( |
| 1542 | + "region", region or self.client.default_region |
| 1543 | + ) |
| 1544 | + |
| 1545 | + res = self._request( |
| 1546 | + "PATCH", |
| 1547 | + f"/transactional-email/v1alpha1/regions/{param_region}/offer-subscriptions", |
| 1548 | + body=marshal_UpdateOfferSubscriptionRequest( |
| 1549 | + UpdateOfferSubscriptionRequest( |
| 1550 | + region=region, |
| 1551 | + project_id=project_id, |
| 1552 | + name=name, |
| 1553 | + ), |
| 1554 | + self.client, |
| 1555 | + ), |
| 1556 | + ) |
| 1557 | + |
| 1558 | + self._throw_on_error(res) |
| 1559 | + return unmarshal_OfferSubscription(res.json()) |
| 1560 | + |
| 1561 | + async def list_offers( |
| 1562 | + self, |
| 1563 | + *, |
| 1564 | + region: Optional[ScwRegion] = None, |
| 1565 | + ) -> ListOffersResponse: |
| 1566 | + """ |
| 1567 | + List the available offers. |
| 1568 | + Retrieve the list of the available and free-of-charge offers you can subscribe to. |
| 1569 | + :param region: Region to target. If none is passed will use default region from the config. |
| 1570 | + :return: :class:`ListOffersResponse <ListOffersResponse>` |
| 1571 | +
|
| 1572 | + Usage: |
| 1573 | + :: |
| 1574 | +
|
| 1575 | + result = await api.list_offers() |
| 1576 | + """ |
| 1577 | + |
| 1578 | + param_region = validate_path_param( |
| 1579 | + "region", region or self.client.default_region |
| 1580 | + ) |
| 1581 | + |
| 1582 | + res = self._request( |
| 1583 | + "GET", |
| 1584 | + f"/transactional-email/v1alpha1/regions/{param_region}/offers", |
| 1585 | + ) |
| 1586 | + |
| 1587 | + self._throw_on_error(res) |
| 1588 | + return unmarshal_ListOffersResponse(res.json()) |
| 1589 | + |
| 1590 | + async def list_pools( |
| 1591 | + self, |
| 1592 | + *, |
| 1593 | + region: Optional[ScwRegion] = None, |
| 1594 | + page: Optional[int] = None, |
| 1595 | + page_size: Optional[int] = None, |
| 1596 | + project_id: Optional[str] = None, |
| 1597 | + ) -> ListPoolsResponse: |
| 1598 | + """ |
| 1599 | + Get information about a sending pool. |
| 1600 | + Retrieve information about a sending pool, including its creation status and configuration parameters. |
| 1601 | + :param region: Region to target. If none is passed will use default region from the config. |
| 1602 | + :param page: Requested page number. Value must be greater or equal to 1. |
| 1603 | + :param page_size: Requested page size. Value must be between 1 and 1000. |
| 1604 | + :param project_id: ID of the Project. |
| 1605 | + :return: :class:`ListPoolsResponse <ListPoolsResponse>` |
| 1606 | +
|
| 1607 | + Usage: |
| 1608 | + :: |
| 1609 | +
|
| 1610 | + result = await api.list_pools() |
| 1611 | + """ |
| 1612 | + |
| 1613 | + param_region = validate_path_param( |
| 1614 | + "region", region or self.client.default_region |
| 1615 | + ) |
| 1616 | + |
| 1617 | + res = self._request( |
| 1618 | + "GET", |
| 1619 | + f"/transactional-email/v1alpha1/regions/{param_region}/pools", |
| 1620 | + params={ |
| 1621 | + "page": page, |
| 1622 | + "page_size": page_size or self.client.default_page_size, |
| 1623 | + "project_id": project_id or self.client.default_project_id, |
| 1624 | + }, |
| 1625 | + ) |
| 1626 | + |
| 1627 | + self._throw_on_error(res) |
| 1628 | + return unmarshal_ListPoolsResponse(res.json()) |
| 1629 | + |
| 1630 | + async def list_pools_all( |
| 1631 | + self, |
| 1632 | + *, |
| 1633 | + region: Optional[ScwRegion] = None, |
| 1634 | + page: Optional[int] = None, |
| 1635 | + page_size: Optional[int] = None, |
| 1636 | + project_id: Optional[str] = None, |
| 1637 | + ) -> List[Pool]: |
| 1638 | + """ |
| 1639 | + Get information about a sending pool. |
| 1640 | + Retrieve information about a sending pool, including its creation status and configuration parameters. |
| 1641 | + :param region: Region to target. If none is passed will use default region from the config. |
| 1642 | + :param page: Requested page number. Value must be greater or equal to 1. |
| 1643 | + :param page_size: Requested page size. Value must be between 1 and 1000. |
| 1644 | + :param project_id: ID of the Project. |
| 1645 | + :return: :class:`List[Pool] <List[Pool]>` |
| 1646 | +
|
| 1647 | + Usage: |
| 1648 | + :: |
| 1649 | +
|
| 1650 | + result = await api.list_pools_all() |
| 1651 | + """ |
| 1652 | + |
| 1653 | + return await fetch_all_pages_async( |
| 1654 | + type=ListPoolsResponse, |
| 1655 | + key="pools", |
| 1656 | + fetcher=self.list_pools, |
| 1657 | + args={ |
| 1658 | + "region": region, |
| 1659 | + "page": page, |
| 1660 | + "page_size": page_size, |
| 1661 | + "project_id": project_id, |
| 1662 | + }, |
| 1663 | + ) |
| 1664 | + |
| 1665 | + async def get_project_consumption( |
| 1666 | + self, |
| 1667 | + *, |
| 1668 | + region: Optional[ScwRegion] = None, |
| 1669 | + project_id: Optional[str] = None, |
| 1670 | + ) -> ProjectConsumption: |
| 1671 | + """ |
| 1672 | + Get project resource consumption. |
| 1673 | + :param region: Region to target. If none is passed will use default region from the config. |
| 1674 | + :param project_id: ID of the project. |
| 1675 | + :return: :class:`ProjectConsumption <ProjectConsumption>` |
| 1676 | +
|
| 1677 | + Usage: |
| 1678 | + :: |
| 1679 | +
|
| 1680 | + result = await api.get_project_consumption() |
| 1681 | + """ |
| 1682 | + |
| 1683 | + param_region = validate_path_param( |
| 1684 | + "region", region or self.client.default_region |
| 1685 | + ) |
| 1686 | + |
| 1687 | + res = self._request( |
| 1688 | + "GET", |
| 1689 | + f"/transactional-email/v1alpha1/regions/{param_region}/project-consumption", |
| 1690 | + params={ |
| 1691 | + "project_id": project_id or self.client.default_project_id, |
| 1692 | + }, |
| 1693 | + ) |
| 1694 | + |
| 1695 | + self._throw_on_error(res) |
| 1696 | + return unmarshal_ProjectConsumption(res.json()) |
0 commit comments