Skip to content

Commit 167b11e

Browse files
feat(api): api update
1 parent f6dbe33 commit 167b11e

32 files changed

Lines changed: 976 additions & 645 deletions

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/unlayer/unlayer-b4c4ec2aa5631a32336e52d2c64dc8dc5bfe262f8630e21900ccbab702071d50.yml
3-
openapi_spec_hash: 12a39212e6991daf3731f164dad85455
4-
config_hash: 6f1858ca62cea01f7c1c4427b9263c25
1+
configured_endpoints: 9
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/unlayer/unlayer-e87049219505c250c95423461c7fb7aa280a3238f98577973c687c1030da26bf.yml
3+
openapi_spec_hash: 613060b45d55c1ab27b70973e4402dfd
4+
config_hash: 2029dabcdae1b263de41e1a890ee90d8

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,10 @@ from unlayer import Unlayer
199199

200200
client = Unlayer()
201201

202-
generate = client.ai.generate.create(
203-
display_mode="email",
204-
input=[{"type": "text"}],
205-
output={
206-
"block_type": "template",
207-
"type": "json",
208-
},
202+
convert_full_to_simple = client.templates.convert_full_to_simple.create(
203+
design={"body": {"foo": "bar"}},
209204
)
210-
print(generate.output)
205+
print(convert_full_to_simple.design)
211206
```
212207

213208
## Handling errors

api.md

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,75 @@
1-
# AI
2-
3-
## Generate
1+
# Projects
42

53
Types:
64

75
```python
8-
from unlayer.types.ai import GenerateCreateResponse
6+
from unlayer.types import ProjectRetrieveResponse
97
```
108

119
Methods:
1210

13-
- <code title="post /v3/ai/generate">client.ai.generate.<a href="./src/unlayer/resources/ai/generate.py">create</a>(\*\*<a href="src/unlayer/types/ai/generate_create_params.py">params</a>) -> <a href="./src/unlayer/types/ai/generate_create_response.py">GenerateCreateResponse</a></code>
11+
- <code title="get /v3/projects/{id}">client.projects.<a href="./src/unlayer/resources/projects.py">retrieve</a>(id) -> <a href="./src/unlayer/types/project_retrieve_response.py">ProjectRetrieveResponse</a></code>
1412

15-
# Convert
13+
# Templates
1614

17-
## FullToSimple
15+
Types:
16+
17+
```python
18+
from unlayer.types import TemplateRetrieveResponse, TemplateListResponse
19+
```
20+
21+
Methods:
22+
23+
- <code title="get /v3/templates/{id}">client.templates.<a href="./src/unlayer/resources/templates/templates.py">retrieve</a>(id, \*\*<a href="src/unlayer/types/template_retrieve_params.py">params</a>) -> <a href="./src/unlayer/types/template_retrieve_response.py">TemplateRetrieveResponse</a></code>
24+
- <code title="get /v3/templates">client.templates.<a href="./src/unlayer/resources/templates/templates.py">list</a>(\*\*<a href="src/unlayer/types/template_list_params.py">params</a>) -> <a href="./src/unlayer/types/template_list_response.py">SyncCursorPage[TemplateListResponse]</a></code>
25+
26+
## ConvertFullToSimple
1827

1928
Types:
2029

2130
```python
22-
from unlayer.types.convert import FullToSimpleCreateResponse
31+
from unlayer.types.templates import ConvertFullToSimpleCreateResponse
2332
```
2433

2534
Methods:
2635

27-
- <code title="post /v3/convert/full-to-simple">client.convert.full_to_simple.<a href="./src/unlayer/resources/convert/full_to_simple.py">create</a>(\*\*<a href="src/unlayer/types/convert/full_to_simple_create_params.py">params</a>) -> <a href="./src/unlayer/types/convert/full_to_simple_create_response.py">FullToSimpleCreateResponse</a></code>
36+
- <code title="post /v3/templates/convert/full-to-simple">client.templates.convert_full_to_simple.<a href="./src/unlayer/resources/templates/convert_full_to_simple.py">create</a>(\*\*<a href="src/unlayer/types/templates/convert_full_to_simple_create_params.py">params</a>) -> <a href="./src/unlayer/types/templates/convert_full_to_simple_create_response.py">ConvertFullToSimpleCreateResponse</a></code>
2837

29-
## SimpleToFull
38+
## ConvertSimpleToFull
3039

3140
Types:
3241

3342
```python
34-
from unlayer.types.convert import SimpleToFullCreateResponse
43+
from unlayer.types.templates import ConvertSimpleToFullCreateResponse
3544
```
3645

3746
Methods:
3847

39-
- <code title="post /v3/convert/simple-to-full">client.convert.simple_to_full.<a href="./src/unlayer/resources/convert/simple_to_full.py">create</a>(\*\*<a href="src/unlayer/types/convert/simple_to_full_create_params.py">params</a>) -> <a href="./src/unlayer/types/convert/simple_to_full_create_response.py">SimpleToFullCreateResponse</a></code>
48+
- <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>
4049

41-
# Projects
50+
## Generate
4251

4352
Types:
4453

4554
```python
46-
from unlayer.types import ProjectRetrieveResponse
55+
from unlayer.types.templates import GenerateCreateResponse
4756
```
4857

4958
Methods:
5059

51-
- <code title="get /v3/projects/{id}">client.projects.<a href="./src/unlayer/resources/projects.py">retrieve</a>(id) -> <a href="./src/unlayer/types/project_retrieve_response.py">ProjectRetrieveResponse</a></code>
60+
- <code title="post /v3/templates/generate">client.templates.generate.<a href="./src/unlayer/resources/templates/generate.py">create</a>(\*\*<a href="src/unlayer/types/templates/generate_create_params.py">params</a>) -> <a href="./src/unlayer/types/templates/generate_create_response.py">GenerateCreateResponse</a></code>
5261

53-
# Templates
62+
## Import
5463

5564
Types:
5665

5766
```python
58-
from unlayer.types import TemplateRetrieveResponse, TemplateListResponse
67+
from unlayer.types.templates import ImportCreateResponse
5968
```
6069

6170
Methods:
6271

63-
- <code title="get /v3/templates/{id}">client.templates.<a href="./src/unlayer/resources/templates.py">retrieve</a>(id, \*\*<a href="src/unlayer/types/template_retrieve_params.py">params</a>) -> <a href="./src/unlayer/types/template_retrieve_response.py">TemplateRetrieveResponse</a></code>
64-
- <code title="get /v3/templates">client.templates.<a href="./src/unlayer/resources/templates.py">list</a>(\*\*<a href="src/unlayer/types/template_list_params.py">params</a>) -> <a href="./src/unlayer/types/template_list_response.py">SyncCursorPage[TemplateListResponse]</a></code>
72+
- <code title="post /v3/templates/import">client.templates.import*.<a href="./src/unlayer/resources/templates/import*.py">create</a>(\*\*<a href="src/unlayer/types/templates/import_create_params.py">params</a>) -> <a href="./src/unlayer/types/templates/import_create_response.py">ImportCreateResponse</a></code>
6573

6674
# Workspaces
6775

src/unlayer/_client.py

Lines changed: 20 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@
3636
)
3737

3838
if TYPE_CHECKING:
39-
from .resources import ai, convert, projects, templates, workspaces
40-
from .resources.ai.ai import AIResource, AsyncAIResource
39+
from .resources import projects, templates, workspaces
4140
from .resources.projects import ProjectsResource, AsyncProjectsResource
42-
from .resources.templates import TemplatesResource, AsyncTemplatesResource
4341
from .resources.workspaces import WorkspacesResource, AsyncWorkspacesResource
44-
from .resources.convert.convert import ConvertResource, AsyncConvertResource
42+
from .resources.templates.templates import TemplatesResource, AsyncTemplatesResource
4543

4644
__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Unlayer", "AsyncUnlayer", "Client", "AsyncClient"]
4745

@@ -121,18 +119,6 @@ def __init__(
121119
_strict_response_validation=_strict_response_validation,
122120
)
123121

124-
@cached_property
125-
def ai(self) -> AIResource:
126-
from .resources.ai import AIResource
127-
128-
return AIResource(self)
129-
130-
@cached_property
131-
def convert(self) -> ConvertResource:
132-
from .resources.convert import ConvertResource
133-
134-
return ConvertResource(self)
135-
136122
@cached_property
137123
def projects(self) -> ProjectsResource:
138124
"""Project details and configuration."""
@@ -142,7 +128,9 @@ def projects(self) -> ProjectsResource:
142128

143129
@cached_property
144130
def templates(self) -> TemplatesResource:
145-
"""Template management and retrieval."""
131+
"""
132+
Template management — list, retrieve, generate, import, export, and convert designs.
133+
"""
146134
from .resources.templates import TemplatesResource
147135

148136
return TemplatesResource(self)
@@ -369,18 +357,6 @@ def __init__(
369357
_strict_response_validation=_strict_response_validation,
370358
)
371359

372-
@cached_property
373-
def ai(self) -> AsyncAIResource:
374-
from .resources.ai import AsyncAIResource
375-
376-
return AsyncAIResource(self)
377-
378-
@cached_property
379-
def convert(self) -> AsyncConvertResource:
380-
from .resources.convert import AsyncConvertResource
381-
382-
return AsyncConvertResource(self)
383-
384360
@cached_property
385361
def projects(self) -> AsyncProjectsResource:
386362
"""Project details and configuration."""
@@ -390,7 +366,9 @@ def projects(self) -> AsyncProjectsResource:
390366

391367
@cached_property
392368
def templates(self) -> AsyncTemplatesResource:
393-
"""Template management and retrieval."""
369+
"""
370+
Template management — list, retrieve, generate, import, export, and convert designs.
371+
"""
394372
from .resources.templates import AsyncTemplatesResource
395373

396374
return AsyncTemplatesResource(self)
@@ -548,18 +526,6 @@ class UnlayerWithRawResponse:
548526
def __init__(self, client: Unlayer) -> None:
549527
self._client = client
550528

551-
@cached_property
552-
def ai(self) -> ai.AIResourceWithRawResponse:
553-
from .resources.ai import AIResourceWithRawResponse
554-
555-
return AIResourceWithRawResponse(self._client.ai)
556-
557-
@cached_property
558-
def convert(self) -> convert.ConvertResourceWithRawResponse:
559-
from .resources.convert import ConvertResourceWithRawResponse
560-
561-
return ConvertResourceWithRawResponse(self._client.convert)
562-
563529
@cached_property
564530
def projects(self) -> projects.ProjectsResourceWithRawResponse:
565531
"""Project details and configuration."""
@@ -569,7 +535,9 @@ def projects(self) -> projects.ProjectsResourceWithRawResponse:
569535

570536
@cached_property
571537
def templates(self) -> templates.TemplatesResourceWithRawResponse:
572-
"""Template management and retrieval."""
538+
"""
539+
Template management — list, retrieve, generate, import, export, and convert designs.
540+
"""
573541
from .resources.templates import TemplatesResourceWithRawResponse
574542

575543
return TemplatesResourceWithRawResponse(self._client.templates)
@@ -588,18 +556,6 @@ class AsyncUnlayerWithRawResponse:
588556
def __init__(self, client: AsyncUnlayer) -> None:
589557
self._client = client
590558

591-
@cached_property
592-
def ai(self) -> ai.AsyncAIResourceWithRawResponse:
593-
from .resources.ai import AsyncAIResourceWithRawResponse
594-
595-
return AsyncAIResourceWithRawResponse(self._client.ai)
596-
597-
@cached_property
598-
def convert(self) -> convert.AsyncConvertResourceWithRawResponse:
599-
from .resources.convert import AsyncConvertResourceWithRawResponse
600-
601-
return AsyncConvertResourceWithRawResponse(self._client.convert)
602-
603559
@cached_property
604560
def projects(self) -> projects.AsyncProjectsResourceWithRawResponse:
605561
"""Project details and configuration."""
@@ -609,7 +565,9 @@ def projects(self) -> projects.AsyncProjectsResourceWithRawResponse:
609565

610566
@cached_property
611567
def templates(self) -> templates.AsyncTemplatesResourceWithRawResponse:
612-
"""Template management and retrieval."""
568+
"""
569+
Template management — list, retrieve, generate, import, export, and convert designs.
570+
"""
613571
from .resources.templates import AsyncTemplatesResourceWithRawResponse
614572

615573
return AsyncTemplatesResourceWithRawResponse(self._client.templates)
@@ -628,18 +586,6 @@ class UnlayerWithStreamedResponse:
628586
def __init__(self, client: Unlayer) -> None:
629587
self._client = client
630588

631-
@cached_property
632-
def ai(self) -> ai.AIResourceWithStreamingResponse:
633-
from .resources.ai import AIResourceWithStreamingResponse
634-
635-
return AIResourceWithStreamingResponse(self._client.ai)
636-
637-
@cached_property
638-
def convert(self) -> convert.ConvertResourceWithStreamingResponse:
639-
from .resources.convert import ConvertResourceWithStreamingResponse
640-
641-
return ConvertResourceWithStreamingResponse(self._client.convert)
642-
643589
@cached_property
644590
def projects(self) -> projects.ProjectsResourceWithStreamingResponse:
645591
"""Project details and configuration."""
@@ -649,7 +595,9 @@ def projects(self) -> projects.ProjectsResourceWithStreamingResponse:
649595

650596
@cached_property
651597
def templates(self) -> templates.TemplatesResourceWithStreamingResponse:
652-
"""Template management and retrieval."""
598+
"""
599+
Template management — list, retrieve, generate, import, export, and convert designs.
600+
"""
653601
from .resources.templates import TemplatesResourceWithStreamingResponse
654602

655603
return TemplatesResourceWithStreamingResponse(self._client.templates)
@@ -668,18 +616,6 @@ class AsyncUnlayerWithStreamedResponse:
668616
def __init__(self, client: AsyncUnlayer) -> None:
669617
self._client = client
670618

671-
@cached_property
672-
def ai(self) -> ai.AsyncAIResourceWithStreamingResponse:
673-
from .resources.ai import AsyncAIResourceWithStreamingResponse
674-
675-
return AsyncAIResourceWithStreamingResponse(self._client.ai)
676-
677-
@cached_property
678-
def convert(self) -> convert.AsyncConvertResourceWithStreamingResponse:
679-
from .resources.convert import AsyncConvertResourceWithStreamingResponse
680-
681-
return AsyncConvertResourceWithStreamingResponse(self._client.convert)
682-
683619
@cached_property
684620
def projects(self) -> projects.AsyncProjectsResourceWithStreamingResponse:
685621
"""Project details and configuration."""
@@ -689,7 +625,9 @@ def projects(self) -> projects.AsyncProjectsResourceWithStreamingResponse:
689625

690626
@cached_property
691627
def templates(self) -> templates.AsyncTemplatesResourceWithStreamingResponse:
692-
"""Template management and retrieval."""
628+
"""
629+
Template management — list, retrieve, generate, import, export, and convert designs.
630+
"""
693631
from .resources.templates import AsyncTemplatesResourceWithStreamingResponse
694632

695633
return AsyncTemplatesResourceWithStreamingResponse(self._client.templates)

src/unlayer/resources/__init__.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from .ai import (
4-
AIResource,
5-
AsyncAIResource,
6-
AIResourceWithRawResponse,
7-
AsyncAIResourceWithRawResponse,
8-
AIResourceWithStreamingResponse,
9-
AsyncAIResourceWithStreamingResponse,
10-
)
11-
from .convert import (
12-
ConvertResource,
13-
AsyncConvertResource,
14-
ConvertResourceWithRawResponse,
15-
AsyncConvertResourceWithRawResponse,
16-
ConvertResourceWithStreamingResponse,
17-
AsyncConvertResourceWithStreamingResponse,
18-
)
193
from .projects import (
204
ProjectsResource,
215
AsyncProjectsResource,
@@ -42,18 +26,6 @@
4226
)
4327

4428
__all__ = [
45-
"AIResource",
46-
"AsyncAIResource",
47-
"AIResourceWithRawResponse",
48-
"AsyncAIResourceWithRawResponse",
49-
"AIResourceWithStreamingResponse",
50-
"AsyncAIResourceWithStreamingResponse",
51-
"ConvertResource",
52-
"AsyncConvertResource",
53-
"ConvertResourceWithRawResponse",
54-
"AsyncConvertResourceWithRawResponse",
55-
"ConvertResourceWithStreamingResponse",
56-
"AsyncConvertResourceWithStreamingResponse",
5729
"ProjectsResource",
5830
"AsyncProjectsResource",
5931
"ProjectsResourceWithRawResponse",

src/unlayer/resources/ai/__init__.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)