Skip to content

Commit 33a95d8

Browse files
Release 0.0.74
1 parent c090660 commit 33a95d8

6 files changed

Lines changed: 230 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "agentmail"
33

44
[tool.poetry]
55
name = "agentmail"
6-
version = "0.0.73"
6+
version = "0.0.74"
77
description = ""
88
readme = "README.md"
99
authors = []

reference.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,62 @@ client.domains.get(
10351035
</dl>
10361036

10371037

1038+
</dd>
1039+
</dl>
1040+
</details>
1041+
1042+
<details><summary><code>client.domains.<a href="src/agentmail/domains/client.py">get_zone_file</a>(...)</code></summary>
1043+
<dl>
1044+
<dd>
1045+
1046+
#### 🔌 Usage
1047+
1048+
<dl>
1049+
<dd>
1050+
1051+
<dl>
1052+
<dd>
1053+
1054+
```python
1055+
from agentmail import AgentMail
1056+
1057+
client = AgentMail(
1058+
api_key="YOUR_API_KEY",
1059+
)
1060+
client.domains.get_zone_file(
1061+
domain_id="domain_id",
1062+
)
1063+
1064+
```
1065+
</dd>
1066+
</dl>
1067+
</dd>
1068+
</dl>
1069+
1070+
#### ⚙️ Parameters
1071+
1072+
<dl>
1073+
<dd>
1074+
1075+
<dl>
1076+
<dd>
1077+
1078+
**domain_id:** `DomainId`
1079+
1080+
</dd>
1081+
</dl>
1082+
1083+
<dl>
1084+
<dd>
1085+
1086+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
1087+
1088+
</dd>
1089+
</dl>
1090+
</dd>
1091+
</dl>
1092+
1093+
10381094
</dd>
10391095
</dl>
10401096
</details>

src/agentmail/core/client_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ def __init__(
2323

2424
def get_headers(self) -> typing.Dict[str, str]:
2525
headers: typing.Dict[str, str] = {
26-
"User-Agent": "agentmail/0.0.73",
26+
"User-Agent": "agentmail/0.0.74",
2727
"X-Fern-Language": "Python",
2828
"X-Fern-SDK-Name": "agentmail",
29-
"X-Fern-SDK-Version": "0.0.73",
29+
"X-Fern-SDK-Version": "0.0.74",
3030
**(self.get_custom_headers() or {}),
3131
}
3232
headers["Authorization"] = f"Bearer {self._get_api_key()}"

src/agentmail/domains/client.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,35 @@ def get(self, domain_id: DomainId, *, request_options: typing.Optional[RequestOp
9292
_response = self._raw_client.get(domain_id, request_options=request_options)
9393
return _response.data
9494

95+
def get_zone_file(
96+
self, domain_id: DomainId, *, request_options: typing.Optional[RequestOptions] = None
97+
) -> typing.Iterator[bytes]:
98+
"""
99+
Parameters
100+
----------
101+
domain_id : DomainId
102+
103+
request_options : typing.Optional[RequestOptions]
104+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
105+
106+
Returns
107+
-------
108+
typing.Iterator[bytes]
109+
110+
Examples
111+
--------
112+
from agentmail import AgentMail
113+
114+
client = AgentMail(
115+
api_key="YOUR_API_KEY",
116+
)
117+
client.domains.get_zone_file(
118+
domain_id="domain_id",
119+
)
120+
"""
121+
with self._raw_client.get_zone_file(domain_id, request_options=request_options) as r:
122+
yield from r.data
123+
95124
def create(
96125
self,
97126
*,
@@ -276,6 +305,44 @@ async def main() -> None:
276305
_response = await self._raw_client.get(domain_id, request_options=request_options)
277306
return _response.data
278307

308+
async def get_zone_file(
309+
self, domain_id: DomainId, *, request_options: typing.Optional[RequestOptions] = None
310+
) -> typing.AsyncIterator[bytes]:
311+
"""
312+
Parameters
313+
----------
314+
domain_id : DomainId
315+
316+
request_options : typing.Optional[RequestOptions]
317+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
318+
319+
Returns
320+
-------
321+
typing.AsyncIterator[bytes]
322+
323+
Examples
324+
--------
325+
import asyncio
326+
327+
from agentmail import AsyncAgentMail
328+
329+
client = AsyncAgentMail(
330+
api_key="YOUR_API_KEY",
331+
)
332+
333+
334+
async def main() -> None:
335+
await client.domains.get_zone_file(
336+
domain_id="domain_id",
337+
)
338+
339+
340+
asyncio.run(main())
341+
"""
342+
async with self._raw_client.get_zone_file(domain_id, request_options=request_options) as r:
343+
async for _chunk in r.data:
344+
yield _chunk
345+
279346
async def create(
280347
self,
281348
*,

src/agentmail/domains/raw_client.py

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This file was auto-generated by Fern from our API Definition.
22

3+
import contextlib
34
import typing
45
from json.decoder import JSONDecodeError
56

@@ -122,6 +123,57 @@ def get(
122123
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
123124
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
124125

126+
@contextlib.contextmanager
127+
def get_zone_file(
128+
self, domain_id: DomainId, *, request_options: typing.Optional[RequestOptions] = None
129+
) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]:
130+
"""
131+
Parameters
132+
----------
133+
domain_id : DomainId
134+
135+
request_options : typing.Optional[RequestOptions]
136+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
137+
138+
Returns
139+
-------
140+
typing.Iterator[HttpResponse[typing.Iterator[bytes]]]
141+
"""
142+
with self._client_wrapper.httpx_client.stream(
143+
f"v0/domains/{jsonable_encoder(domain_id)}/zone-file",
144+
base_url=self._client_wrapper.get_environment().http,
145+
method="GET",
146+
request_options=request_options,
147+
) as _response:
148+
149+
def _stream() -> HttpResponse[typing.Iterator[bytes]]:
150+
try:
151+
if 200 <= _response.status_code < 300:
152+
_chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
153+
return HttpResponse(
154+
response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size))
155+
)
156+
_response.read()
157+
if _response.status_code == 404:
158+
raise NotFoundError(
159+
headers=dict(_response.headers),
160+
body=typing.cast(
161+
ErrorResponse,
162+
construct_type(
163+
type_=ErrorResponse, # type: ignore
164+
object_=_response.json(),
165+
),
166+
),
167+
)
168+
_response_json = _response.json()
169+
except JSONDecodeError:
170+
raise ApiError(
171+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
172+
)
173+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
174+
175+
yield _stream()
176+
125177
def create(
126178
self,
127179
*,
@@ -358,6 +410,58 @@ async def get(
358410
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
359411
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
360412

413+
@contextlib.asynccontextmanager
414+
async def get_zone_file(
415+
self, domain_id: DomainId, *, request_options: typing.Optional[RequestOptions] = None
416+
) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]:
417+
"""
418+
Parameters
419+
----------
420+
domain_id : DomainId
421+
422+
request_options : typing.Optional[RequestOptions]
423+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
424+
425+
Returns
426+
-------
427+
typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]
428+
"""
429+
async with self._client_wrapper.httpx_client.stream(
430+
f"v0/domains/{jsonable_encoder(domain_id)}/zone-file",
431+
base_url=self._client_wrapper.get_environment().http,
432+
method="GET",
433+
request_options=request_options,
434+
) as _response:
435+
436+
async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]:
437+
try:
438+
if 200 <= _response.status_code < 300:
439+
_chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
440+
return AsyncHttpResponse(
441+
response=_response,
442+
data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)),
443+
)
444+
await _response.aread()
445+
if _response.status_code == 404:
446+
raise NotFoundError(
447+
headers=dict(_response.headers),
448+
body=typing.cast(
449+
ErrorResponse,
450+
construct_type(
451+
type_=ErrorResponse, # type: ignore
452+
object_=_response.json(),
453+
),
454+
),
455+
)
456+
_response_json = _response.json()
457+
except JSONDecodeError:
458+
raise ApiError(
459+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.text
460+
)
461+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
462+
463+
yield await _stream()
464+
361465
async def create(
362466
self,
363467
*,

src/agentmail/domains/types/domain.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
from ...core.unchecked_base_model import UncheckedBaseModel
99
from .client_id import ClientId
1010
from .domain_id import DomainId
11-
from .domain_name import DomainName
1211
from .feedback_enabled import FeedbackEnabled
1312
from .verification_record import VerificationRecord
1413
from .verification_status import VerificationStatus
1514

1615

1716
class Domain(UncheckedBaseModel):
1817
domain_id: DomainId
19-
domain: DomainName
2018
status: VerificationStatus = pydantic.Field()
2119
"""
2220
The verification status of the domain.

0 commit comments

Comments
 (0)