Skip to content

Commit af1227f

Browse files
Release 0.1.3
1 parent c1458cb commit af1227f

8 files changed

Lines changed: 289 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.1.2"
6+
version = "0.1.3"
77
description = ""
88
readme = "README.md"
99
authors = []

reference.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,71 @@ client.inboxes.create()
192192
</dl>
193193

194194

195+
</dd>
196+
</dl>
197+
</details>
198+
199+
<details><summary><code>client.inboxes.<a href="src/agentmail/inboxes/client.py">update</a>(...)</code></summary>
200+
<dl>
201+
<dd>
202+
203+
#### 🔌 Usage
204+
205+
<dl>
206+
<dd>
207+
208+
<dl>
209+
<dd>
210+
211+
```python
212+
from agentmail import AgentMail
213+
214+
client = AgentMail(
215+
api_key="YOUR_API_KEY",
216+
)
217+
client.inboxes.update(
218+
inbox_id="inbox_id",
219+
display_name="display_name",
220+
)
221+
222+
```
223+
</dd>
224+
</dl>
225+
</dd>
226+
</dl>
227+
228+
#### ⚙️ Parameters
229+
230+
<dl>
231+
<dd>
232+
233+
<dl>
234+
<dd>
235+
236+
**inbox_id:** `InboxId`
237+
238+
</dd>
239+
</dl>
240+
241+
<dl>
242+
<dd>
243+
244+
**display_name:** `DisplayName`
245+
246+
</dd>
247+
</dl>
248+
249+
<dl>
250+
<dd>
251+
252+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
253+
254+
</dd>
255+
</dl>
256+
</dd>
257+
</dl>
258+
259+
195260
</dd>
196261
</dl>
197262
</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.1.2",
26+
"User-Agent": "agentmail/0.1.3",
2727
"X-Fern-Language": "Python",
2828
"X-Fern-SDK-Name": "agentmail",
29-
"X-Fern-SDK-Version": "0.1.2",
29+
"X-Fern-SDK-Version": "0.1.3",
3030
**(self.get_custom_headers() or {}),
3131
}
3232
headers["Authorization"] = f"Bearer {self._get_api_key()}"

src/agentmail/inboxes/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
from importlib import import_module
77

88
if typing.TYPE_CHECKING:
9-
from .types import ClientId, CreateInboxRequest, DisplayName, Inbox, InboxId, ListInboxesResponse
9+
from .types import (
10+
ClientId,
11+
CreateInboxRequest,
12+
DisplayName,
13+
Inbox,
14+
InboxId,
15+
ListInboxesResponse,
16+
UpdateInboxRequest,
17+
)
1018
from . import drafts, messages, metrics, threads
1119
_dynamic_imports: typing.Dict[str, str] = {
1220
"ClientId": ".types",
@@ -15,6 +23,7 @@
1523
"Inbox": ".types",
1624
"InboxId": ".types",
1725
"ListInboxesResponse": ".types",
26+
"UpdateInboxRequest": ".types",
1827
"drafts": ".drafts",
1928
"messages": ".messages",
2029
"metrics": ".metrics",
@@ -50,6 +59,7 @@ def __dir__():
5059
"Inbox",
5160
"InboxId",
5261
"ListInboxesResponse",
62+
"UpdateInboxRequest",
5363
"drafts",
5464
"messages",
5565
"metrics",

src/agentmail/inboxes/client.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,38 @@ def create(
151151
)
152152
return _response.data
153153

154+
def update(
155+
self, inbox_id: InboxId, *, display_name: DisplayName, request_options: typing.Optional[RequestOptions] = None
156+
) -> Inbox:
157+
"""
158+
Parameters
159+
----------
160+
inbox_id : InboxId
161+
162+
display_name : DisplayName
163+
164+
request_options : typing.Optional[RequestOptions]
165+
Request-specific configuration.
166+
167+
Returns
168+
-------
169+
Inbox
170+
171+
Examples
172+
--------
173+
from agentmail import AgentMail
174+
175+
client = AgentMail(
176+
api_key="YOUR_API_KEY",
177+
)
178+
client.inboxes.update(
179+
inbox_id="inbox_id",
180+
display_name="display_name",
181+
)
182+
"""
183+
_response = self._raw_client.update(inbox_id, display_name=display_name, request_options=request_options)
184+
return _response.data
185+
154186
def delete(self, inbox_id: InboxId, *, request_options: typing.Optional[RequestOptions] = None) -> None:
155187
"""
156188
Parameters
@@ -362,6 +394,46 @@ async def main() -> None:
362394
)
363395
return _response.data
364396

397+
async def update(
398+
self, inbox_id: InboxId, *, display_name: DisplayName, request_options: typing.Optional[RequestOptions] = None
399+
) -> Inbox:
400+
"""
401+
Parameters
402+
----------
403+
inbox_id : InboxId
404+
405+
display_name : DisplayName
406+
407+
request_options : typing.Optional[RequestOptions]
408+
Request-specific configuration.
409+
410+
Returns
411+
-------
412+
Inbox
413+
414+
Examples
415+
--------
416+
import asyncio
417+
418+
from agentmail import AsyncAgentMail
419+
420+
client = AsyncAgentMail(
421+
api_key="YOUR_API_KEY",
422+
)
423+
424+
425+
async def main() -> None:
426+
await client.inboxes.update(
427+
inbox_id="inbox_id",
428+
display_name="display_name",
429+
)
430+
431+
432+
asyncio.run(main())
433+
"""
434+
_response = await self._raw_client.update(inbox_id, display_name=display_name, request_options=request_options)
435+
return _response.data
436+
365437
async def delete(self, inbox_id: InboxId, *, request_options: typing.Optional[RequestOptions] = None) -> None:
366438
"""
367439
Parameters

src/agentmail/inboxes/raw_client.py

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,59 @@ def create(
188188
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
189189
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
190190

191+
def update(
192+
self, inbox_id: InboxId, *, display_name: DisplayName, request_options: typing.Optional[RequestOptions] = None
193+
) -> HttpResponse[Inbox]:
194+
"""
195+
Parameters
196+
----------
197+
inbox_id : InboxId
198+
199+
display_name : DisplayName
200+
201+
request_options : typing.Optional[RequestOptions]
202+
Request-specific configuration.
203+
204+
Returns
205+
-------
206+
HttpResponse[Inbox]
207+
"""
208+
_response = self._client_wrapper.httpx_client.request(
209+
f"v0/inboxes/{jsonable_encoder(inbox_id)}",
210+
base_url=self._client_wrapper.get_environment().http,
211+
method="PATCH",
212+
json={
213+
"display_name": display_name,
214+
},
215+
request_options=request_options,
216+
omit=OMIT,
217+
)
218+
try:
219+
if 200 <= _response.status_code < 300:
220+
_data = typing.cast(
221+
Inbox,
222+
construct_type(
223+
type_=Inbox, # type: ignore
224+
object_=_response.json(),
225+
),
226+
)
227+
return HttpResponse(response=_response, data=_data)
228+
if _response.status_code == 404:
229+
raise NotFoundError(
230+
headers=dict(_response.headers),
231+
body=typing.cast(
232+
ErrorResponse,
233+
construct_type(
234+
type_=ErrorResponse, # type: ignore
235+
object_=_response.json(),
236+
),
237+
),
238+
)
239+
_response_json = _response.json()
240+
except JSONDecodeError:
241+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
242+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
243+
191244
def delete(
192245
self, inbox_id: InboxId, *, request_options: typing.Optional[RequestOptions] = None
193246
) -> HttpResponse[None]:
@@ -394,6 +447,59 @@ async def create(
394447
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
395448
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
396449

450+
async def update(
451+
self, inbox_id: InboxId, *, display_name: DisplayName, request_options: typing.Optional[RequestOptions] = None
452+
) -> AsyncHttpResponse[Inbox]:
453+
"""
454+
Parameters
455+
----------
456+
inbox_id : InboxId
457+
458+
display_name : DisplayName
459+
460+
request_options : typing.Optional[RequestOptions]
461+
Request-specific configuration.
462+
463+
Returns
464+
-------
465+
AsyncHttpResponse[Inbox]
466+
"""
467+
_response = await self._client_wrapper.httpx_client.request(
468+
f"v0/inboxes/{jsonable_encoder(inbox_id)}",
469+
base_url=self._client_wrapper.get_environment().http,
470+
method="PATCH",
471+
json={
472+
"display_name": display_name,
473+
},
474+
request_options=request_options,
475+
omit=OMIT,
476+
)
477+
try:
478+
if 200 <= _response.status_code < 300:
479+
_data = typing.cast(
480+
Inbox,
481+
construct_type(
482+
type_=Inbox, # type: ignore
483+
object_=_response.json(),
484+
),
485+
)
486+
return AsyncHttpResponse(response=_response, data=_data)
487+
if _response.status_code == 404:
488+
raise NotFoundError(
489+
headers=dict(_response.headers),
490+
body=typing.cast(
491+
ErrorResponse,
492+
construct_type(
493+
type_=ErrorResponse, # type: ignore
494+
object_=_response.json(),
495+
),
496+
),
497+
)
498+
_response_json = _response.json()
499+
except JSONDecodeError:
500+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
501+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
502+
397503
async def delete(
398504
self, inbox_id: InboxId, *, request_options: typing.Optional[RequestOptions] = None
399505
) -> AsyncHttpResponse[None]:

src/agentmail/inboxes/types/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
from .inbox import Inbox
1313
from .inbox_id import InboxId
1414
from .list_inboxes_response import ListInboxesResponse
15+
from .update_inbox_request import UpdateInboxRequest
1516
_dynamic_imports: typing.Dict[str, str] = {
1617
"ClientId": ".client_id",
1718
"CreateInboxRequest": ".create_inbox_request",
1819
"DisplayName": ".display_name",
1920
"Inbox": ".inbox",
2021
"InboxId": ".inbox_id",
2122
"ListInboxesResponse": ".list_inboxes_response",
23+
"UpdateInboxRequest": ".update_inbox_request",
2224
}
2325

2426

@@ -43,4 +45,12 @@ def __dir__():
4345
return sorted(lazy_attrs)
4446

4547

46-
__all__ = ["ClientId", "CreateInboxRequest", "DisplayName", "Inbox", "InboxId", "ListInboxesResponse"]
48+
__all__ = [
49+
"ClientId",
50+
"CreateInboxRequest",
51+
"DisplayName",
52+
"Inbox",
53+
"InboxId",
54+
"ListInboxesResponse",
55+
"UpdateInboxRequest",
56+
]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
import pydantic
6+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
7+
from ...core.unchecked_base_model import UncheckedBaseModel
8+
from .display_name import DisplayName
9+
10+
11+
class UpdateInboxRequest(UncheckedBaseModel):
12+
display_name: DisplayName
13+
14+
if IS_PYDANTIC_V2:
15+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
16+
else:
17+
18+
class Config:
19+
frozen = True
20+
smart_union = True
21+
extra = pydantic.Extra.allow

0 commit comments

Comments
 (0)