Visitar URL original
feat(api): api update · unlayer/unlayer-python@41fbf63 · GitHub
Skip to content

Commit 41fbf63

Browse files
feat(api): api update
1 parent 1bebc1a commit 41fbf63

21 files changed

Lines changed: 1965 additions & 4 deletions

‎.stats.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 10
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/unlayer/unlayer-3d1f50d8fdb57c0bbafaa16aeffc061ee7532ed5a9823bacbce1cc0916c008b9.yml
3-
openapi_spec_hash: 97d36fb19154cc936e9ef2558965e290
4-
config_hash: 20e7fbba9d423291aaf676f6a629dcaf
1+
configured_endpoints: 14
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/unlayer/unlayer-8f62b635191810fa318afdeaabbbb0276b0e1f85f18b5ff2ddaad9a18241f047.yml
3+
openapi_spec_hash: e80a61e80827f2a822db46f4ba82c15d
4+
config_hash: 2949daec69cb6f5d34ae232544245952

‎api.md‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,54 @@ Methods:
4747

4848
- <code title="post /v3/templates/convert/simple-to-full">client.templates.convert_simple_to_full.<a href="./src/unlayer/resources/templates/convert_simple_to_full.py">create</a>(\*\*<a href="src/unlayer/types/templates/convert_simple_to_full_create_params.py">params</a>) -> <a href="./src/unlayer/types/templates/convert_simple_to_full_create_response.py">ConvertSimpleToFullCreateResponse</a></code>
4949

50+
## ExportHTML
51+
52+
Types:
53+
54+
```python
55+
from unlayer.types.templates import ExportHTMLCreateResponse
56+
```
57+
58+
Methods:
59+
60+
- <code title="post /v3/templates/export/html">client.templates.export_html.<a href="./src/unlayer/resources/templates/export_html.py">create</a>(\*\*<a href="src/unlayer/types/templates/export_html_create_params.py">params</a>) -> <a href="./src/unlayer/types/templates/export_html_create_response.py">ExportHTMLCreateResponse</a></code>
61+
62+
## ExportImage
63+
64+
Types:
65+
66+
```python
67+
from unlayer.types.templates import ExportImageCreateResponse
68+
```
69+
70+
Methods:
71+
72+
- <code title="post /v3/templates/export/image">client.templates.export_image.<a href="./src/unlayer/resources/templates/export_image.py">create</a>(\*\*<a href="src/unlayer/types/templates/export_image_create_params.py">params</a>) -> <a href="./src/unlayer/types/templates/export_image_create_response.py">ExportImageCreateResponse</a></code>
73+
74+
## ExportPdf
75+
76+
Types:
77+
78+
```python
79+
from unlayer.types.templates import ExportPdfCreateResponse
80+
```
81+
82+
Methods:
83+
84+
- <code title="post /v3/templates/export/pdf">client.templates.export_pdf.<a href="./src/unlayer/resources/templates/export_pdf.py">create</a>(\*\*<a href="src/unlayer/types/templates/export_pdf_create_params.py">params</a>) -> <a href="./src/unlayer/types/templates/export_pdf_create_response.py">ExportPdfCreateResponse</a></code>
85+
86+
## ExportZip
87+
88+
Types:
89+
90+
```python
91+
from unlayer.types.templates import ExportZipCreateResponse
92+
```
93+
94+
Methods:
95+
96+
- <code title="post /v3/templates/export/zip">client.templates.export_zip.<a href="./src/unlayer/resources/templates/export_zip.py">create</a>(\*\*<a href="src/unlayer/types/templates/export_zip_create_params.py">params</a>) -> <a href="./src/unlayer/types/templates/export_zip_create_response.py">ExportZipCreateResponse</a></code>
97+
5098
## Generate
5199

52100
Types:

‎src/unlayer/resources/templates/__init__.py‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,38 @@
2424
TemplatesResourceWithStreamingResponse,
2525
AsyncTemplatesResourceWithStreamingResponse,
2626
)
27+
from .export_pdf import (
28+
ExportPdfResource,
29+
AsyncExportPdfResource,
30+
ExportPdfResourceWithRawResponse,
31+
AsyncExportPdfResourceWithRawResponse,
32+
ExportPdfResourceWithStreamingResponse,
33+
AsyncExportPdfResourceWithStreamingResponse,
34+
)
35+
from .export_zip import (
36+
ExportZipResource,
37+
AsyncExportZipResource,
38+
ExportZipResourceWithRawResponse,
39+
AsyncExportZipResourceWithRawResponse,
40+
ExportZipResourceWithStreamingResponse,
41+
AsyncExportZipResourceWithStreamingResponse,
42+
)
43+
from .export_html import (
44+
ExportHTMLResource,
45+
AsyncExportHTMLResource,
46+
ExportHTMLResourceWithRawResponse,
47+
AsyncExportHTMLResourceWithRawResponse,
48+
ExportHTMLResourceWithStreamingResponse,
49+
AsyncExportHTMLResourceWithStreamingResponse,
50+
)
51+
from .export_image import (
52+
ExportImageResource,
53+
AsyncExportImageResource,
54+
ExportImageResourceWithRawResponse,
55+
AsyncExportImageResourceWithRawResponse,
56+
ExportImageResourceWithStreamingResponse,
57+
AsyncExportImageResourceWithStreamingResponse,
58+
)
2759
from .convert_full_to_simple import (
2860
ConvertFullToSimpleResource,
2961
AsyncConvertFullToSimpleResource,
@@ -54,6 +86,30 @@
5486
"AsyncConvertSimpleToFullResourceWithRawResponse",
5587
"ConvertSimpleToFullResourceWithStreamingResponse",
5688
"AsyncConvertSimpleToFullResourceWithStreamingResponse",
89+
"ExportHTMLResource",
90+
"AsyncExportHTMLResource",
91+
"ExportHTMLResourceWithRawResponse",
92+
"AsyncExportHTMLResourceWithRawResponse",
93+
"ExportHTMLResourceWithStreamingResponse",
94+
"AsyncExportHTMLResourceWithStreamingResponse",
95+
"ExportImageResource",
96+
"AsyncExportImageResource",
97+
"ExportImageResourceWithRawResponse",
98+
"AsyncExportImageResourceWithRawResponse",
99+
"ExportImageResourceWithStreamingResponse",
100+
"AsyncExportImageResourceWithStreamingResponse",
101+
"ExportPdfResource",
102+
"AsyncExportPdfResource",
103+
"ExportPdfResourceWithRawResponse",
104+
"AsyncExportPdfResourceWithRawResponse",
105+
"ExportPdfResourceWithStreamingResponse",
106+
"AsyncExportPdfResourceWithStreamingResponse",
107+
"ExportZipResource",
108+
"AsyncExportZipResource",
109+
"ExportZipResourceWithRawResponse",
110+
"AsyncExportZipResourceWithRawResponse",
111+
"ExportZipResourceWithStreamingResponse",
112+
"AsyncExportZipResourceWithStreamingResponse",
57113
"GenerateResource",
58114
"AsyncGenerateResource",
59115
"GenerateResourceWithRawResponse",
Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Union
6+
from typing_extensions import Literal
7+
8+
import httpx
9+
10+
from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
11+
from ..._utils import maybe_transform, async_maybe_transform
12+
from ..._compat import cached_property
13+
from ..._resource import SyncAPIResource, AsyncAPIResource
14+
from ..._response import (
15+
to_raw_response_wrapper,
16+
to_streamed_response_wrapper,
17+
async_to_raw_response_wrapper,
18+
async_to_streamed_response_wrapper,
19+
)
20+
from ..._base_client import make_request_options
21+
from ...types.templates import export_html_create_params
22+
from ...types.templates.export_html_create_response import ExportHTMLCreateResponse
23+
24+
__all__ = ["ExportHTMLResource", "AsyncExportHTMLResource"]
25+
26+
27+
class ExportHTMLResource(SyncAPIResource):
28+
@cached_property
29+
def with_raw_response(self) -> ExportHTMLResourceWithRawResponse:
30+
"""
31+
This property can be used as a prefix for any HTTP method call to return
32+
the raw response object instead of the parsed content.
33+
34+
For more information, see https://www.github.com/unlayer/unlayer-python#accessing-raw-response-data-eg-headers
35+
"""
36+
return ExportHTMLResourceWithRawResponse(self)
37+
38+
@cached_property
39+
def with_streaming_response(self) -> ExportHTMLResourceWithStreamingResponse:
40+
"""
41+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
42+
43+
For more information, see https://www.github.com/unlayer/unlayer-python#with_streaming_response
44+
"""
45+
return ExportHTMLResourceWithStreamingResponse(self)
46+
47+
def create(
48+
self,
49+
*,
50+
design: object,
51+
project_id: str | Omit = omit,
52+
custom_js: Union[str, SequenceNotStr[str]] | Omit = omit,
53+
design_tags: object | Omit = omit,
54+
design_tags_config: object | Omit = omit,
55+
display_mode: Literal["email", "web", "popup", "document"] | Omit = omit,
56+
editor_version: str | Omit = omit,
57+
language: str | Omit = omit,
58+
languages: SequenceNotStr[str] | Omit = omit,
59+
merge_tags: object | Omit = omit,
60+
merge_tags_schema: object | Omit = omit,
61+
safe_html: bool | Omit = omit,
62+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
63+
# The extra values given here take precedence over values defined on the client or passed to this method.
64+
extra_headers: Headers | None = None,
65+
extra_query: Query | None = None,
66+
extra_body: Body | None = None,
67+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
68+
) -> ExportHTMLCreateResponse:
69+
"""
70+
Export a design as rendered HTML.
71+
72+
Args:
73+
design: Unlayer design JSON
74+
75+
project_id: The project ID (required for PAT auth, auto-resolved for API key auth)
76+
77+
extra_headers: Send extra headers
78+
79+
extra_query: Add additional query parameters to the request
80+
81+
extra_body: Add additional JSON properties to the request
82+
83+
timeout: Override the client-level default timeout for this request, in seconds
84+
"""
85+
return self._post(
86+
"/v3/templates/export/html",
87+
body=maybe_transform(
88+
{
89+
"design": design,
90+
"custom_js": custom_js,
91+
"design_tags": design_tags,
92+
"design_tags_config": design_tags_config,
93+
"display_mode": display_mode,
94+
"editor_version": editor_version,
95+
"language": language,
96+
"languages": languages,
97+
"merge_tags": merge_tags,
98+
"merge_tags_schema": merge_tags_schema,
99+
"safe_html": safe_html,
100+
},
101+
export_html_create_params.ExportHTMLCreateParams,
102+
),
103+
options=make_request_options(
104+
extra_headers=extra_headers,
105+
extra_query=extra_query,
106+
extra_body=extra_body,
107+
timeout=timeout,
108+
query=maybe_transform({"project_id": project_id}, export_html_create_params.ExportHTMLCreateParams),
109+
),
110+
cast_to=ExportHTMLCreateResponse,
111+
)
112+
113+
114+
class AsyncExportHTMLResource(AsyncAPIResource):
115+
@cached_property
116+
def with_raw_response(self) -> AsyncExportHTMLResourceWithRawResponse:
117+
"""
118+
This property can be used as a prefix for any HTTP method call to return
119+
the raw response object instead of the parsed content.
120+
121+
For more information, see https://www.github.com/unlayer/unlayer-python#accessing-raw-response-data-eg-headers
122+
"""
123+
return AsyncExportHTMLResourceWithRawResponse(self)
124+
125+
@cached_property
126+
def with_streaming_response(self) -> AsyncExportHTMLResourceWithStreamingResponse:
127+
"""
128+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
129+
130+
For more information, see https://www.github.com/unlayer/unlayer-python#with_streaming_response
131+
"""
132+
return AsyncExportHTMLResourceWithStreamingResponse(self)
133+
134+
async def create(
135+
self,
136+
*,
137+
design: object,
138+
project_id: str | Omit = omit,
139+
custom_js: Union[str, SequenceNotStr[str]] | Omit = omit,
140+
design_tags: object | Omit = omit,
141+
design_tags_config: object | Omit = omit,
142+
display_mode: Literal["email", "web", "popup", "document"] | Omit = omit,
143+
editor_version: str | Omit = omit,
144+
language: str | Omit = omit,
145+
languages: SequenceNotStr[str] | Omit = omit,
146+
merge_tags: object | Omit = omit,
147+
merge_tags_schema: object | Omit = omit,
148+
safe_html: bool | Omit = omit,
149+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
150+
# The extra values given here take precedence over values defined on the client or passed to this method.
151+
extra_headers: Headers | None = None,
152+
extra_query: Query | None = None,
153+
extra_body: Body | None = None,
154+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
155+
) -> ExportHTMLCreateResponse:
156+
"""
157+
Export a design as rendered HTML.
158+
159+
Args:
160+
design: Unlayer design JSON
161+
162+
project_id: The project ID (required for PAT auth, auto-resolved for API key auth)
163+
164+
extra_headers: Send extra headers
165+
166+
extra_query: Add additional query parameters to the request
167+
168+
extra_body: Add additional JSON properties to the request
169+
170+
timeout: Override the client-level default timeout for this request, in seconds
171+
"""
172+
return await self._post(
173+
"/v3/templates/export/html",
174+
body=await async_maybe_transform(
175+
{
176+
"design": design,
177+
"custom_js": custom_js,
178+
"design_tags": design_tags,
179+
"design_tags_config": design_tags_config,
180+
"display_mode": display_mode,
181+
"editor_version": editor_version,
182+
"language": language,
183+
"languages": languages,
184+
"merge_tags": merge_tags,
185+
"merge_tags_schema": merge_tags_schema,
186+
"safe_html": safe_html,
187+
},
188+
export_html_create_params.ExportHTMLCreateParams,
189+
),
190+
options=make_request_options(
191+
extra_headers=extra_headers,
192+
extra_query=extra_query,
193+
extra_body=extra_body,
194+
timeout=timeout,
195+
query=await async_maybe_transform(
196+
{"project_id": project_id}, export_html_create_params.ExportHTMLCreateParams
197+
),
198+
),
199+
cast_to=ExportHTMLCreateResponse,
200+
)
201+
202+
203+
class ExportHTMLResourceWithRawResponse:
204+
def __init__(self, export_html: ExportHTMLResource) -> None:
205+
self._export_html = export_html
206+
207+
self.create = to_raw_response_wrapper(
208+
export_html.create,
209+
)
210+
211+
212+
class AsyncExportHTMLResourceWithRawResponse:
213+
def __init__(self, export_html: AsyncExportHTMLResource) -> None:
214+
self._export_html = export_html
215+
216+
self.create = async_to_raw_response_wrapper(
217+
export_html.create,
218+
)
219+
220+
221+
class ExportHTMLResourceWithStreamingResponse:
222+
def __init__(self, export_html: ExportHTMLResource) -> None:
223+
self._export_html = export_html
224+
225+
self.create = to_streamed_response_wrapper(
226+
export_html.create,
227+
)
228+
229+
230+
class AsyncExportHTMLResourceWithStreamingResponse:
231+
def __init__(self, export_html: AsyncExportHTMLResource) -> None:
232+
self._export_html = export_html
233+
234+
self.create = async_to_streamed_response_wrapper(
235+
export_html.create,
236+
)

0 commit comments

Comments
 (0)