inttegro.async_resources.message_templates

Generated public typing surface. Do not edit by hand.

  1# Generated by scripts/generate_async_resources.py; do not edit by hand.
  2"""Message templates resource for reusable SMS and email content."""
  3from __future__ import annotations
  4from ..async_http_client import AsyncHttpClient
  5
  6class AsyncMessageTemplates:
  7    """Create, publish, archive, look up, page, and preview message templates.
  8
  9    Access this service as ``AsyncInttegroClient.message_templates``. Methods use the client's shared transport and return the typed resource shapes documented below.
 10    """
 11
 12    def __init__(self, http: AsyncHttpClient):
 13        self.http = http
 14
 15    async def create(self, payload: dict, idempotency_key: str | None=None):
 16        """Create a reusable message template.
 17
 18        API endpoint: ``/message_templates/create``.
 19
 20        Args:
 21            payload (dict): Typed request object or equivalent request mapping for this operation.
 22            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
 23
 24        Returns:
 25            ``MessageTemplate`` decoded from the documented response shape.
 26
 27        Raises:
 28            APIError: The API rejected the request or could not complete it.
 29            NetworkError: The request could not reach the Inttegro API.
 30            TimeoutError: The configured request deadline elapsed.
 31        """
 32        return await self.http.post_with_headers('/message_templates/create', payload, self._idempotency_headers(idempotency_key))
 33
 34    async def update(self, payload: dict, idempotency_key: str | None=None):
 35        """Update a message template draft.
 36
 37        API endpoint: ``/message_templates/update``.
 38
 39        Args:
 40            payload (dict): Typed request object or equivalent request mapping for this operation.
 41            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
 42
 43        Returns:
 44            ``MessageTemplate`` decoded from the documented response shape.
 45
 46        Raises:
 47            APIError: The API rejected the request or could not complete it.
 48            NetworkError: The request could not reach the Inttegro API.
 49            TimeoutError: The configured request deadline elapsed.
 50        """
 51        return await self.http.post_with_headers('/message_templates/update', payload, self._idempotency_headers(idempotency_key))
 52
 53    async def publish(self, template_id: str, idempotency_key: str | None=None):
 54        """Publish the current draft version of a template.
 55
 56        API endpoint: ``/message_templates/publish``.
 57
 58        Args:
 59            template_id (str): Unique identifier of the template.
 60            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
 61
 62        Returns:
 63            ``MessageTemplate`` decoded from the documented response shape.
 64
 65        Raises:
 66            APIError: The API rejected the request or could not complete it.
 67            NetworkError: The request could not reach the Inttegro API.
 68            TimeoutError: The configured request deadline elapsed.
 69        """
 70        return await self.http.post_with_headers('/message_templates/publish', {'id': template_id}, self._idempotency_headers(idempotency_key))
 71
 72    async def archive(self, template_id: str, idempotency_key: str | None=None):
 73        """Archive a template.
 74
 75        API endpoint: ``/message_templates/archive``.
 76
 77        Args:
 78            template_id (str): Unique identifier of the template.
 79            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
 80
 81        Returns:
 82            ``MessageTemplate`` decoded from the documented response shape.
 83
 84        Raises:
 85            APIError: The API rejected the request or could not complete it.
 86            NetworkError: The request could not reach the Inttegro API.
 87            TimeoutError: The configured request deadline elapsed.
 88        """
 89        return await self.http.post_with_headers('/message_templates/archive', {'id': template_id}, self._idempotency_headers(idempotency_key))
 90
 91    async def lookup(self, template_id: str):
 92        """Look up one template by ID.
 93
 94        API endpoint: ``/message_templates/lookup``.
 95
 96        Args:
 97            template_id (str): Unique identifier of the template.
 98
 99        Returns:
100            ``MessageTemplate`` decoded from the documented response shape.
101
102        Raises:
103            APIError: The API rejected the request or could not complete it.
104            NetworkError: The request could not reach the Inttegro API.
105            TimeoutError: The configured request deadline elapsed.
106        """
107        return await self.http.post('/message_templates/lookup', {'id': template_id})
108
109    async def page(self, payload: dict | None=None):
110        """Page through message templates.
111
112        API endpoint: ``/message_templates/page``.
113
114        Args:
115            payload (dict | None): Typed request object or equivalent request mapping for this operation.
116
117        Returns:
118            ``Page`` decoded from the documented response shape.
119
120        Raises:
121            APIError: The API rejected the request or could not complete it.
122            NetworkError: The request could not reach the Inttegro API.
123            TimeoutError: The configured request deadline elapsed.
124        """
125        return await self.http.post('/message_templates/page', payload or {})
126
127    async def render_preview(self, payload: dict):
128        """Render a draft-aware template preview.
129
130        API endpoint: ``/message_templates/render_preview``.
131
132        Args:
133            payload (dict): Typed request object or equivalent request mapping for this operation.
134
135        Returns:
136            ``Preview`` decoded from the documented response shape.
137
138        Raises:
139            APIError: The API rejected the request or could not complete it.
140            NetworkError: The request could not reach the Inttegro API.
141            TimeoutError: The configured request deadline elapsed.
142        """
143        return await self.http.post('/message_templates/render_preview', payload)
144
145    def _idempotency_headers(self, idempotency_key: str | None) -> dict[str, str]:
146        return {'Idempotency-Key': idempotency_key} if idempotency_key else {}
class AsyncMessageTemplates:
  7class AsyncMessageTemplates:
  8    """Create, publish, archive, look up, page, and preview message templates.
  9
 10    Access this service as ``AsyncInttegroClient.message_templates``. Methods use the client's shared transport and return the typed resource shapes documented below.
 11    """
 12
 13    def __init__(self, http: AsyncHttpClient):
 14        self.http = http
 15
 16    async def create(self, payload: dict, idempotency_key: str | None=None):
 17        """Create a reusable message template.
 18
 19        API endpoint: ``/message_templates/create``.
 20
 21        Args:
 22            payload (dict): Typed request object or equivalent request mapping for this operation.
 23            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
 24
 25        Returns:
 26            ``MessageTemplate`` decoded from the documented response shape.
 27
 28        Raises:
 29            APIError: The API rejected the request or could not complete it.
 30            NetworkError: The request could not reach the Inttegro API.
 31            TimeoutError: The configured request deadline elapsed.
 32        """
 33        return await self.http.post_with_headers('/message_templates/create', payload, self._idempotency_headers(idempotency_key))
 34
 35    async def update(self, payload: dict, idempotency_key: str | None=None):
 36        """Update a message template draft.
 37
 38        API endpoint: ``/message_templates/update``.
 39
 40        Args:
 41            payload (dict): Typed request object or equivalent request mapping for this operation.
 42            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
 43
 44        Returns:
 45            ``MessageTemplate`` decoded from the documented response shape.
 46
 47        Raises:
 48            APIError: The API rejected the request or could not complete it.
 49            NetworkError: The request could not reach the Inttegro API.
 50            TimeoutError: The configured request deadline elapsed.
 51        """
 52        return await self.http.post_with_headers('/message_templates/update', payload, self._idempotency_headers(idempotency_key))
 53
 54    async def publish(self, template_id: str, idempotency_key: str | None=None):
 55        """Publish the current draft version of a template.
 56
 57        API endpoint: ``/message_templates/publish``.
 58
 59        Args:
 60            template_id (str): Unique identifier of the template.
 61            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
 62
 63        Returns:
 64            ``MessageTemplate`` decoded from the documented response shape.
 65
 66        Raises:
 67            APIError: The API rejected the request or could not complete it.
 68            NetworkError: The request could not reach the Inttegro API.
 69            TimeoutError: The configured request deadline elapsed.
 70        """
 71        return await self.http.post_with_headers('/message_templates/publish', {'id': template_id}, self._idempotency_headers(idempotency_key))
 72
 73    async def archive(self, template_id: str, idempotency_key: str | None=None):
 74        """Archive a template.
 75
 76        API endpoint: ``/message_templates/archive``.
 77
 78        Args:
 79            template_id (str): Unique identifier of the template.
 80            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
 81
 82        Returns:
 83            ``MessageTemplate`` decoded from the documented response shape.
 84
 85        Raises:
 86            APIError: The API rejected the request or could not complete it.
 87            NetworkError: The request could not reach the Inttegro API.
 88            TimeoutError: The configured request deadline elapsed.
 89        """
 90        return await self.http.post_with_headers('/message_templates/archive', {'id': template_id}, self._idempotency_headers(idempotency_key))
 91
 92    async def lookup(self, template_id: str):
 93        """Look up one template by ID.
 94
 95        API endpoint: ``/message_templates/lookup``.
 96
 97        Args:
 98            template_id (str): Unique identifier of the template.
 99
100        Returns:
101            ``MessageTemplate`` decoded from the documented response shape.
102
103        Raises:
104            APIError: The API rejected the request or could not complete it.
105            NetworkError: The request could not reach the Inttegro API.
106            TimeoutError: The configured request deadline elapsed.
107        """
108        return await self.http.post('/message_templates/lookup', {'id': template_id})
109
110    async def page(self, payload: dict | None=None):
111        """Page through message templates.
112
113        API endpoint: ``/message_templates/page``.
114
115        Args:
116            payload (dict | None): Typed request object or equivalent request mapping for this operation.
117
118        Returns:
119            ``Page`` decoded from the documented response shape.
120
121        Raises:
122            APIError: The API rejected the request or could not complete it.
123            NetworkError: The request could not reach the Inttegro API.
124            TimeoutError: The configured request deadline elapsed.
125        """
126        return await self.http.post('/message_templates/page', payload or {})
127
128    async def render_preview(self, payload: dict):
129        """Render a draft-aware template preview.
130
131        API endpoint: ``/message_templates/render_preview``.
132
133        Args:
134            payload (dict): Typed request object or equivalent request mapping for this operation.
135
136        Returns:
137            ``Preview`` decoded from the documented response shape.
138
139        Raises:
140            APIError: The API rejected the request or could not complete it.
141            NetworkError: The request could not reach the Inttegro API.
142            TimeoutError: The configured request deadline elapsed.
143        """
144        return await self.http.post('/message_templates/render_preview', payload)
145
146    def _idempotency_headers(self, idempotency_key: str | None) -> dict[str, str]:
147        return {'Idempotency-Key': idempotency_key} if idempotency_key else {}

Create, publish, archive, look up, page, and preview message templates.

Access this service as AsyncInttegroClient.message_templates. Methods use the client's shared transport and return the typed resource shapes documented below.

AsyncMessageTemplates(http: inttegro.async_http_client.AsyncHttpClient)
13    def __init__(self, http: AsyncHttpClient):
14        self.http = http
http
async def create( self, payload: inttegro.message_template.CreateSMSRequest | inttegro.message_template.CreateEmailRequest, idempotency_key: str | None = None) -> inttegro.message_template.MessageTemplate:
16    async def create(self, payload: dict, idempotency_key: str | None=None):
17        """Create a reusable message template.
18
19        API endpoint: ``/message_templates/create``.
20
21        Args:
22            payload (dict): Typed request object or equivalent request mapping for this operation.
23            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
24
25        Returns:
26            ``MessageTemplate`` decoded from the documented response shape.
27
28        Raises:
29            APIError: The API rejected the request or could not complete it.
30            NetworkError: The request could not reach the Inttegro API.
31            TimeoutError: The configured request deadline elapsed.
32        """
33        return await self.http.post_with_headers('/message_templates/create', payload, self._idempotency_headers(idempotency_key))

Create a reusable message template.

API endpoint: /message_templates/create.

Arguments:
  • payload (dict): Typed request object or equivalent request mapping for this operation.
  • idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
Returns:

MessageTemplate decoded from the documented response shape.

Raises:
  • APIError: The API rejected the request or could not complete it.
  • NetworkError: The request could not reach the Inttegro API.
  • TimeoutError: The configured request deadline elapsed.
async def update( self, payload: inttegro.message_template.UpdateRequest, idempotency_key: str | None = None) -> inttegro.message_template.MessageTemplate:
35    async def update(self, payload: dict, idempotency_key: str | None=None):
36        """Update a message template draft.
37
38        API endpoint: ``/message_templates/update``.
39
40        Args:
41            payload (dict): Typed request object or equivalent request mapping for this operation.
42            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
43
44        Returns:
45            ``MessageTemplate`` decoded from the documented response shape.
46
47        Raises:
48            APIError: The API rejected the request or could not complete it.
49            NetworkError: The request could not reach the Inttegro API.
50            TimeoutError: The configured request deadline elapsed.
51        """
52        return await self.http.post_with_headers('/message_templates/update', payload, self._idempotency_headers(idempotency_key))

Update a message template draft.

API endpoint: /message_templates/update.

Arguments:
  • payload (dict): Typed request object or equivalent request mapping for this operation.
  • idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
Returns:

MessageTemplate decoded from the documented response shape.

Raises:
  • APIError: The API rejected the request or could not complete it.
  • NetworkError: The request could not reach the Inttegro API.
  • TimeoutError: The configured request deadline elapsed.
async def publish( self, template_id: str, idempotency_key: str | None = None) -> inttegro.message_template.MessageTemplate:
54    async def publish(self, template_id: str, idempotency_key: str | None=None):
55        """Publish the current draft version of a template.
56
57        API endpoint: ``/message_templates/publish``.
58
59        Args:
60            template_id (str): Unique identifier of the template.
61            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
62
63        Returns:
64            ``MessageTemplate`` decoded from the documented response shape.
65
66        Raises:
67            APIError: The API rejected the request or could not complete it.
68            NetworkError: The request could not reach the Inttegro API.
69            TimeoutError: The configured request deadline elapsed.
70        """
71        return await self.http.post_with_headers('/message_templates/publish', {'id': template_id}, self._idempotency_headers(idempotency_key))

Publish the current draft version of a template.

API endpoint: /message_templates/publish.

Arguments:
  • template_id (str): Unique identifier of the template.
  • idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
Returns:

MessageTemplate decoded from the documented response shape.

Raises:
  • APIError: The API rejected the request or could not complete it.
  • NetworkError: The request could not reach the Inttegro API.
  • TimeoutError: The configured request deadline elapsed.
async def archive( self, template_id: str, idempotency_key: str | None = None) -> inttegro.message_template.MessageTemplate:
73    async def archive(self, template_id: str, idempotency_key: str | None=None):
74        """Archive a template.
75
76        API endpoint: ``/message_templates/archive``.
77
78        Args:
79            template_id (str): Unique identifier of the template.
80            idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
81
82        Returns:
83            ``MessageTemplate`` decoded from the documented response shape.
84
85        Raises:
86            APIError: The API rejected the request or could not complete it.
87            NetworkError: The request could not reach the Inttegro API.
88            TimeoutError: The configured request deadline elapsed.
89        """
90        return await self.http.post_with_headers('/message_templates/archive', {'id': template_id}, self._idempotency_headers(idempotency_key))

Archive a template.

API endpoint: /message_templates/archive.

Arguments:
  • template_id (str): Unique identifier of the template.
  • idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
Returns:

MessageTemplate decoded from the documented response shape.

Raises:
  • APIError: The API rejected the request or could not complete it.
  • NetworkError: The request could not reach the Inttegro API.
  • TimeoutError: The configured request deadline elapsed.
async def lookup( self, template_id: str) -> inttegro.message_template.MessageTemplate:
 92    async def lookup(self, template_id: str):
 93        """Look up one template by ID.
 94
 95        API endpoint: ``/message_templates/lookup``.
 96
 97        Args:
 98            template_id (str): Unique identifier of the template.
 99
100        Returns:
101            ``MessageTemplate`` decoded from the documented response shape.
102
103        Raises:
104            APIError: The API rejected the request or could not complete it.
105            NetworkError: The request could not reach the Inttegro API.
106            TimeoutError: The configured request deadline elapsed.
107        """
108        return await self.http.post('/message_templates/lookup', {'id': template_id})

Look up one template by ID.

API endpoint: /message_templates/lookup.

Arguments:
  • template_id (str): Unique identifier of the template.
Returns:

MessageTemplate decoded from the documented response shape.

Raises:
  • APIError: The API rejected the request or could not complete it.
  • NetworkError: The request could not reach the Inttegro API.
  • TimeoutError: The configured request deadline elapsed.
async def page( self, payload: inttegro.message_template.PageRequest | None = None) -> inttegro.message_template.Page:
110    async def page(self, payload: dict | None=None):
111        """Page through message templates.
112
113        API endpoint: ``/message_templates/page``.
114
115        Args:
116            payload (dict | None): Typed request object or equivalent request mapping for this operation.
117
118        Returns:
119            ``Page`` decoded from the documented response shape.
120
121        Raises:
122            APIError: The API rejected the request or could not complete it.
123            NetworkError: The request could not reach the Inttegro API.
124            TimeoutError: The configured request deadline elapsed.
125        """
126        return await self.http.post('/message_templates/page', payload or {})

Page through message templates.

API endpoint: /message_templates/page.

Arguments:
  • payload (dict | None): Typed request object or equivalent request mapping for this operation.
Returns:

Page decoded from the documented response shape.

Raises:
  • APIError: The API rejected the request or could not complete it.
  • NetworkError: The request could not reach the Inttegro API.
  • TimeoutError: The configured request deadline elapsed.
async def render_preview( self, payload: inttegro.message_template.RenderPreviewRequest) -> inttegro.message_template.Preview:
128    async def render_preview(self, payload: dict):
129        """Render a draft-aware template preview.
130
131        API endpoint: ``/message_templates/render_preview``.
132
133        Args:
134            payload (dict): Typed request object or equivalent request mapping for this operation.
135
136        Returns:
137            ``Preview`` decoded from the documented response shape.
138
139        Raises:
140            APIError: The API rejected the request or could not complete it.
141            NetworkError: The request could not reach the Inttegro API.
142            TimeoutError: The configured request deadline elapsed.
143        """
144        return await self.http.post('/message_templates/render_preview', payload)

Render a draft-aware template preview.

API endpoint: /message_templates/render_preview.

Arguments:
  • payload (dict): Typed request object or equivalent request mapping for this operation.
Returns:

Preview decoded from the documented response shape.

Raises:
  • APIError: The API rejected the request or could not complete it.
  • NetworkError: The request could not reach the Inttegro API.
  • TimeoutError: The configured request deadline elapsed.