agentmail 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentmail-0.0.3/PKG-INFO +169 -0
- agentmail-0.0.3/README.md +142 -0
- agentmail-0.0.3/pyproject.toml +64 -0
- agentmail-0.0.3/src/agent_mail/__init__.py +102 -0
- agentmail-0.0.3/src/agent_mail/client.py +152 -0
- agentmail-0.0.3/src/agent_mail/core/__init__.py +47 -0
- agentmail-0.0.3/src/agent_mail/core/api_error.py +15 -0
- agentmail-0.0.3/src/agent_mail/core/client_wrapper.py +76 -0
- agentmail-0.0.3/src/agent_mail/core/datetime_utils.py +28 -0
- agentmail-0.0.3/src/agent_mail/core/file.py +67 -0
- agentmail-0.0.3/src/agent_mail/core/http_client.py +499 -0
- agentmail-0.0.3/src/agent_mail/core/jsonable_encoder.py +101 -0
- agentmail-0.0.3/src/agent_mail/core/pydantic_utilities.py +296 -0
- agentmail-0.0.3/src/agent_mail/core/query_encoder.py +58 -0
- agentmail-0.0.3/src/agent_mail/core/remove_none_from_dict.py +11 -0
- agentmail-0.0.3/src/agent_mail/core/request_options.py +35 -0
- agentmail-0.0.3/src/agent_mail/core/serialization.py +272 -0
- agentmail-0.0.3/src/agent_mail/environment.py +7 -0
- agentmail-0.0.3/src/agent_mail/errors/__init__.py +7 -0
- agentmail-0.0.3/src/agent_mail/errors/is_taken_error.py +9 -0
- agentmail-0.0.3/src/agent_mail/errors/not_found_error.py +9 -0
- agentmail-0.0.3/src/agent_mail/errors/validation_error.py +9 -0
- agentmail-0.0.3/src/agent_mail/inboxes/__init__.py +5 -0
- agentmail-0.0.3/src/agent_mail/inboxes/client.py +529 -0
- agentmail-0.0.3/src/agent_mail/inboxes/types/__init__.py +9 -0
- agentmail-0.0.3/src/agent_mail/inboxes/types/create_inbox_request.py +41 -0
- agentmail-0.0.3/src/agent_mail/inboxes/types/display_name.py +3 -0
- agentmail-0.0.3/src/agent_mail/inboxes/types/inbox.py +49 -0
- agentmail-0.0.3/src/agent_mail/inboxes/types/inbox_id.py +3 -0
- agentmail-0.0.3/src/agent_mail/inboxes/types/list_inboxes_response.py +30 -0
- agentmail-0.0.3/src/agent_mail/messages/__init__.py +55 -0
- agentmail-0.0.3/src/agent_mail/messages/client.py +954 -0
- agentmail-0.0.3/src/agent_mail/messages/types/__init__.py +53 -0
- agentmail-0.0.3/src/agent_mail/messages/types/addresses.py +5 -0
- agentmail-0.0.3/src/agent_mail/messages/types/attachment.py +39 -0
- agentmail-0.0.3/src/agent_mail/messages/types/attachment_id.py +3 -0
- agentmail-0.0.3/src/agent_mail/messages/types/list_messages_response.py +30 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message.py +64 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_attachments.py +6 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_bcc.py +5 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_cc.py +5 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_from.py +3 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_html.py +5 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_id.py +3 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_item.py +40 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_preview.py +5 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_sent_at.py +5 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_subject.py +5 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_text.py +5 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_thread_id.py +3 -0
- agentmail-0.0.3/src/agent_mail/messages/types/message_to.py +5 -0
- agentmail-0.0.3/src/agent_mail/messages/types/reply_to_message_request.py +28 -0
- agentmail-0.0.3/src/agent_mail/messages/types/send_message_bcc.py +6 -0
- agentmail-0.0.3/src/agent_mail/messages/types/send_message_cc.py +6 -0
- agentmail-0.0.3/src/agent_mail/messages/types/send_message_request.py +30 -0
- agentmail-0.0.3/src/agent_mail/messages/types/send_message_response.py +22 -0
- agentmail-0.0.3/src/agent_mail/messages/types/send_message_to.py +5 -0
- agentmail-0.0.3/src/agent_mail/py.typed +0 -0
- agentmail-0.0.3/src/agent_mail/threads/__init__.py +23 -0
- agentmail-0.0.3/src/agent_mail/threads/client.py +424 -0
- agentmail-0.0.3/src/agent_mail/threads/types/__init__.py +21 -0
- agentmail-0.0.3/src/agent_mail/threads/types/list_threads_response.py +30 -0
- agentmail-0.0.3/src/agent_mail/threads/types/thread.py +39 -0
- agentmail-0.0.3/src/agent_mail/threads/types/thread_id.py +3 -0
- agentmail-0.0.3/src/agent_mail/threads/types/thread_item.py +28 -0
- agentmail-0.0.3/src/agent_mail/threads/types/thread_participants.py +5 -0
- agentmail-0.0.3/src/agent_mail/threads/types/thread_preview.py +5 -0
- agentmail-0.0.3/src/agent_mail/threads/types/thread_subject.py +5 -0
- agentmail-0.0.3/src/agent_mail/threads/types/thread_updated_at.py +5 -0
- agentmail-0.0.3/src/agent_mail/types/__init__.py +11 -0
- agentmail-0.0.3/src/agent_mail/types/count.py +3 -0
- agentmail-0.0.3/src/agent_mail/types/error_name.py +3 -0
- agentmail-0.0.3/src/agent_mail/types/error_response.py +24 -0
- agentmail-0.0.3/src/agent_mail/types/last_key.py +5 -0
- agentmail-0.0.3/src/agent_mail/types/limit.py +3 -0
- agentmail-0.0.3/src/agent_mail/types/query_limit.py +5 -0
- agentmail-0.0.3/src/agent_mail/types/validation_error_response.py +24 -0
- agentmail-0.0.3/src/agent_mail/version.py +3 -0
agentmail-0.0.3/PKG-INFO
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: agentmail
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary:
|
|
5
|
+
Requires-Python: >=3.8,<4.0
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Operating System :: MacOS
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Operating System :: POSIX
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Dist: httpx (>=0.21.2)
|
|
22
|
+
Requires-Dist: pydantic (>=1.9.2)
|
|
23
|
+
Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
|
|
24
|
+
Requires-Dist: typing_extensions (>=4.0.0)
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# AgentMail Python Library
|
|
28
|
+
|
|
29
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fagentmail-to%2Fagentmail-python)
|
|
30
|
+
[](https://pypi.python.org/pypi/agentmail)
|
|
31
|
+
|
|
32
|
+
The AgentMail Python library provides convenient access to the AgentMail API from Python.
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
pip install agentmail
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Reference
|
|
41
|
+
|
|
42
|
+
A full reference for this library is available [here](./reference.md).
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
Instantiate and use the client with the following:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from agent_mail import AgentMailApi
|
|
50
|
+
from agent_mail.environment import AgentMailApiEnvironment
|
|
51
|
+
|
|
52
|
+
client = AgentMailApi(
|
|
53
|
+
api_key="YOUR_API_KEY",
|
|
54
|
+
environment=AgentMailApiEnvironment.PRODUCTION,
|
|
55
|
+
)
|
|
56
|
+
client.inboxes.create_inbox(
|
|
57
|
+
domain="yourdomain.com",
|
|
58
|
+
)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Async Client
|
|
62
|
+
|
|
63
|
+
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
import asyncio
|
|
67
|
+
|
|
68
|
+
from agent_mail import AsyncAgentMailApi
|
|
69
|
+
from agent_mail.environment import AgentMailApiEnvironment
|
|
70
|
+
|
|
71
|
+
client = AsyncAgentMailApi(
|
|
72
|
+
api_key="YOUR_API_KEY",
|
|
73
|
+
environment=AgentMailApiEnvironment.PRODUCTION,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
async def main() -> None:
|
|
78
|
+
await client.inboxes.create_inbox(
|
|
79
|
+
domain="yourdomain.com",
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
asyncio.run(main())
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Exception Handling
|
|
87
|
+
|
|
88
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
89
|
+
will be thrown.
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from agent_mail.core.api_error import ApiError
|
|
93
|
+
|
|
94
|
+
try:
|
|
95
|
+
client.inboxes.create_inbox(...)
|
|
96
|
+
except ApiError as e:
|
|
97
|
+
print(e.status_code)
|
|
98
|
+
print(e.body)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Advanced
|
|
102
|
+
|
|
103
|
+
### Retries
|
|
104
|
+
|
|
105
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
106
|
+
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
|
|
107
|
+
retry limit (default: 2).
|
|
108
|
+
|
|
109
|
+
A request is deemed retryable when any of the following HTTP status codes is returned:
|
|
110
|
+
|
|
111
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
112
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
113
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
|
114
|
+
|
|
115
|
+
Use the `max_retries` request option to configure this behavior.
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
client.inboxes.create_inbox(..., request_options={
|
|
119
|
+
"max_retries": 1
|
|
120
|
+
})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Timeouts
|
|
124
|
+
|
|
125
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
|
|
129
|
+
from agent_mail import AgentMailApi
|
|
130
|
+
|
|
131
|
+
client = AgentMailApi(
|
|
132
|
+
...,
|
|
133
|
+
timeout=20.0,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
# Override timeout for a specific method
|
|
138
|
+
client.inboxes.create_inbox(..., request_options={
|
|
139
|
+
"timeout_in_seconds": 1
|
|
140
|
+
})
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Custom Client
|
|
144
|
+
|
|
145
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
|
146
|
+
and transports.
|
|
147
|
+
```python
|
|
148
|
+
import httpx
|
|
149
|
+
from agent_mail import AgentMailApi
|
|
150
|
+
|
|
151
|
+
client = AgentMailApi(
|
|
152
|
+
...,
|
|
153
|
+
httpx_client=httpx.Client(
|
|
154
|
+
proxies="http://my.test.proxy.example.com",
|
|
155
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
156
|
+
),
|
|
157
|
+
)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Contributing
|
|
161
|
+
|
|
162
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
163
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
|
164
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
165
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
166
|
+
an issue first to discuss with us!
|
|
167
|
+
|
|
168
|
+
On the other hand, contributions to the README are always very welcome!
|
|
169
|
+
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# AgentMail Python Library
|
|
2
|
+
|
|
3
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fagentmail-to%2Fagentmail-python)
|
|
4
|
+
[](https://pypi.python.org/pypi/agentmail)
|
|
5
|
+
|
|
6
|
+
The AgentMail Python library provides convenient access to the AgentMail API from Python.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
pip install agentmail
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Reference
|
|
15
|
+
|
|
16
|
+
A full reference for this library is available [here](./reference.md).
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
Instantiate and use the client with the following:
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from agent_mail import AgentMailApi
|
|
24
|
+
from agent_mail.environment import AgentMailApiEnvironment
|
|
25
|
+
|
|
26
|
+
client = AgentMailApi(
|
|
27
|
+
api_key="YOUR_API_KEY",
|
|
28
|
+
environment=AgentMailApiEnvironment.PRODUCTION,
|
|
29
|
+
)
|
|
30
|
+
client.inboxes.create_inbox(
|
|
31
|
+
domain="yourdomain.com",
|
|
32
|
+
)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Async Client
|
|
36
|
+
|
|
37
|
+
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
import asyncio
|
|
41
|
+
|
|
42
|
+
from agent_mail import AsyncAgentMailApi
|
|
43
|
+
from agent_mail.environment import AgentMailApiEnvironment
|
|
44
|
+
|
|
45
|
+
client = AsyncAgentMailApi(
|
|
46
|
+
api_key="YOUR_API_KEY",
|
|
47
|
+
environment=AgentMailApiEnvironment.PRODUCTION,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
async def main() -> None:
|
|
52
|
+
await client.inboxes.create_inbox(
|
|
53
|
+
domain="yourdomain.com",
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
asyncio.run(main())
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Exception Handling
|
|
61
|
+
|
|
62
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
63
|
+
will be thrown.
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from agent_mail.core.api_error import ApiError
|
|
67
|
+
|
|
68
|
+
try:
|
|
69
|
+
client.inboxes.create_inbox(...)
|
|
70
|
+
except ApiError as e:
|
|
71
|
+
print(e.status_code)
|
|
72
|
+
print(e.body)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Advanced
|
|
76
|
+
|
|
77
|
+
### Retries
|
|
78
|
+
|
|
79
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
80
|
+
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
|
|
81
|
+
retry limit (default: 2).
|
|
82
|
+
|
|
83
|
+
A request is deemed retryable when any of the following HTTP status codes is returned:
|
|
84
|
+
|
|
85
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
86
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
87
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
|
88
|
+
|
|
89
|
+
Use the `max_retries` request option to configure this behavior.
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
client.inboxes.create_inbox(..., request_options={
|
|
93
|
+
"max_retries": 1
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Timeouts
|
|
98
|
+
|
|
99
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
|
|
103
|
+
from agent_mail import AgentMailApi
|
|
104
|
+
|
|
105
|
+
client = AgentMailApi(
|
|
106
|
+
...,
|
|
107
|
+
timeout=20.0,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
# Override timeout for a specific method
|
|
112
|
+
client.inboxes.create_inbox(..., request_options={
|
|
113
|
+
"timeout_in_seconds": 1
|
|
114
|
+
})
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Custom Client
|
|
118
|
+
|
|
119
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
|
120
|
+
and transports.
|
|
121
|
+
```python
|
|
122
|
+
import httpx
|
|
123
|
+
from agent_mail import AgentMailApi
|
|
124
|
+
|
|
125
|
+
client = AgentMailApi(
|
|
126
|
+
...,
|
|
127
|
+
httpx_client=httpx.Client(
|
|
128
|
+
proxies="http://my.test.proxy.example.com",
|
|
129
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
130
|
+
),
|
|
131
|
+
)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Contributing
|
|
135
|
+
|
|
136
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
137
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
|
138
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
139
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
140
|
+
an issue first to discuss with us!
|
|
141
|
+
|
|
142
|
+
On the other hand, contributions to the README are always very welcome!
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "agentmail"
|
|
3
|
+
|
|
4
|
+
[tool.poetry]
|
|
5
|
+
name = "agentmail"
|
|
6
|
+
version = "0.0.3"
|
|
7
|
+
description = ""
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
authors = []
|
|
10
|
+
keywords = []
|
|
11
|
+
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Programming Language :: Python",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.8",
|
|
17
|
+
"Programming Language :: Python :: 3.9",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Operating System :: POSIX",
|
|
23
|
+
"Operating System :: MacOS",
|
|
24
|
+
"Operating System :: POSIX :: Linux",
|
|
25
|
+
"Operating System :: Microsoft :: Windows",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
"Typing :: Typed"
|
|
28
|
+
]
|
|
29
|
+
packages = [
|
|
30
|
+
{ include = "agent_mail", from = "src"}
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Repository = 'https://github.com/agentmail-to/agentmail-python'
|
|
35
|
+
|
|
36
|
+
[tool.poetry.dependencies]
|
|
37
|
+
python = "^3.8"
|
|
38
|
+
httpx = ">=0.21.2"
|
|
39
|
+
pydantic = ">= 1.9.2"
|
|
40
|
+
pydantic-core = "^2.18.2"
|
|
41
|
+
typing_extensions = ">= 4.0.0"
|
|
42
|
+
|
|
43
|
+
[tool.poetry.dev-dependencies]
|
|
44
|
+
mypy = "1.0.1"
|
|
45
|
+
pytest = "^7.4.0"
|
|
46
|
+
pytest-asyncio = "^0.23.5"
|
|
47
|
+
python-dateutil = "^2.9.0"
|
|
48
|
+
types-python-dateutil = "^2.9.0.20240316"
|
|
49
|
+
ruff = "^0.5.6"
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
testpaths = [ "tests" ]
|
|
53
|
+
asyncio_mode = "auto"
|
|
54
|
+
|
|
55
|
+
[tool.mypy]
|
|
56
|
+
plugins = ["pydantic.mypy"]
|
|
57
|
+
|
|
58
|
+
[tool.ruff]
|
|
59
|
+
line-length = 120
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
[build-system]
|
|
63
|
+
requires = ["poetry-core"]
|
|
64
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .types import Count, ErrorName, ErrorResponse, LastKey, Limit, QueryLimit, ValidationErrorResponse
|
|
4
|
+
from .errors import IsTakenError, NotFoundError, ValidationError
|
|
5
|
+
from . import inboxes, messages, threads
|
|
6
|
+
from .client import AgentMailApi, AsyncAgentMailApi
|
|
7
|
+
from .environment import AgentMailApiEnvironment
|
|
8
|
+
from .inboxes import CreateInboxRequest, DisplayName, Inbox, InboxId, ListInboxesResponse
|
|
9
|
+
from .messages import (
|
|
10
|
+
Addresses,
|
|
11
|
+
Attachment,
|
|
12
|
+
AttachmentId,
|
|
13
|
+
ListMessagesResponse,
|
|
14
|
+
Message,
|
|
15
|
+
MessageAttachments,
|
|
16
|
+
MessageBcc,
|
|
17
|
+
MessageCc,
|
|
18
|
+
MessageFrom,
|
|
19
|
+
MessageHtml,
|
|
20
|
+
MessageId,
|
|
21
|
+
MessageItem,
|
|
22
|
+
MessagePreview,
|
|
23
|
+
MessageSentAt,
|
|
24
|
+
MessageSubject,
|
|
25
|
+
MessageText,
|
|
26
|
+
MessageThreadId,
|
|
27
|
+
MessageTo,
|
|
28
|
+
ReplyToMessageRequest,
|
|
29
|
+
SendMessageBcc,
|
|
30
|
+
SendMessageCc,
|
|
31
|
+
SendMessageRequest,
|
|
32
|
+
SendMessageResponse,
|
|
33
|
+
SendMessageTo,
|
|
34
|
+
)
|
|
35
|
+
from .threads import (
|
|
36
|
+
ListThreadsResponse,
|
|
37
|
+
Thread,
|
|
38
|
+
ThreadId,
|
|
39
|
+
ThreadItem,
|
|
40
|
+
ThreadParticipants,
|
|
41
|
+
ThreadPreview,
|
|
42
|
+
ThreadSubject,
|
|
43
|
+
ThreadUpdatedAt,
|
|
44
|
+
)
|
|
45
|
+
from .version import __version__
|
|
46
|
+
|
|
47
|
+
__all__ = [
|
|
48
|
+
"Addresses",
|
|
49
|
+
"AgentMailApi",
|
|
50
|
+
"AgentMailApiEnvironment",
|
|
51
|
+
"AsyncAgentMailApi",
|
|
52
|
+
"Attachment",
|
|
53
|
+
"AttachmentId",
|
|
54
|
+
"Count",
|
|
55
|
+
"CreateInboxRequest",
|
|
56
|
+
"DisplayName",
|
|
57
|
+
"ErrorName",
|
|
58
|
+
"ErrorResponse",
|
|
59
|
+
"Inbox",
|
|
60
|
+
"InboxId",
|
|
61
|
+
"IsTakenError",
|
|
62
|
+
"LastKey",
|
|
63
|
+
"Limit",
|
|
64
|
+
"ListInboxesResponse",
|
|
65
|
+
"ListMessagesResponse",
|
|
66
|
+
"ListThreadsResponse",
|
|
67
|
+
"Message",
|
|
68
|
+
"MessageAttachments",
|
|
69
|
+
"MessageBcc",
|
|
70
|
+
"MessageCc",
|
|
71
|
+
"MessageFrom",
|
|
72
|
+
"MessageHtml",
|
|
73
|
+
"MessageId",
|
|
74
|
+
"MessageItem",
|
|
75
|
+
"MessagePreview",
|
|
76
|
+
"MessageSentAt",
|
|
77
|
+
"MessageSubject",
|
|
78
|
+
"MessageText",
|
|
79
|
+
"MessageThreadId",
|
|
80
|
+
"MessageTo",
|
|
81
|
+
"NotFoundError",
|
|
82
|
+
"QueryLimit",
|
|
83
|
+
"ReplyToMessageRequest",
|
|
84
|
+
"SendMessageBcc",
|
|
85
|
+
"SendMessageCc",
|
|
86
|
+
"SendMessageRequest",
|
|
87
|
+
"SendMessageResponse",
|
|
88
|
+
"SendMessageTo",
|
|
89
|
+
"Thread",
|
|
90
|
+
"ThreadId",
|
|
91
|
+
"ThreadItem",
|
|
92
|
+
"ThreadParticipants",
|
|
93
|
+
"ThreadPreview",
|
|
94
|
+
"ThreadSubject",
|
|
95
|
+
"ThreadUpdatedAt",
|
|
96
|
+
"ValidationError",
|
|
97
|
+
"ValidationErrorResponse",
|
|
98
|
+
"__version__",
|
|
99
|
+
"inboxes",
|
|
100
|
+
"messages",
|
|
101
|
+
"threads",
|
|
102
|
+
]
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from .environment import AgentMailApiEnvironment
|
|
5
|
+
import os
|
|
6
|
+
import httpx
|
|
7
|
+
from .core.api_error import ApiError
|
|
8
|
+
from .core.client_wrapper import SyncClientWrapper
|
|
9
|
+
from .inboxes.client import InboxesClient
|
|
10
|
+
from .threads.client import ThreadsClient
|
|
11
|
+
from .messages.client import MessagesClient
|
|
12
|
+
from .core.client_wrapper import AsyncClientWrapper
|
|
13
|
+
from .inboxes.client import AsyncInboxesClient
|
|
14
|
+
from .threads.client import AsyncThreadsClient
|
|
15
|
+
from .messages.client import AsyncMessagesClient
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AgentMailApi:
|
|
19
|
+
"""
|
|
20
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
|
21
|
+
|
|
22
|
+
Parameters
|
|
23
|
+
----------
|
|
24
|
+
base_url : typing.Optional[str]
|
|
25
|
+
The base url to use for requests from the client.
|
|
26
|
+
|
|
27
|
+
environment : typing.Optional[AgentMailApiEnvironment]
|
|
28
|
+
The environment to use for requests from the client.
|
|
29
|
+
|
|
30
|
+
api_key : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
|
|
31
|
+
timeout : typing.Optional[float]
|
|
32
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
33
|
+
|
|
34
|
+
follow_redirects : typing.Optional[bool]
|
|
35
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
36
|
+
|
|
37
|
+
httpx_client : typing.Optional[httpx.Client]
|
|
38
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
|
39
|
+
|
|
40
|
+
Examples
|
|
41
|
+
--------
|
|
42
|
+
from agent_mail import AgentMailApi
|
|
43
|
+
from agent_mail.environment import AgentMailApiEnvironment
|
|
44
|
+
|
|
45
|
+
client = AgentMailApi(
|
|
46
|
+
api_key="YOUR_API_KEY",
|
|
47
|
+
environment=AgentMailApiEnvironment.PRODUCTION,
|
|
48
|
+
)
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
def __init__(
|
|
52
|
+
self,
|
|
53
|
+
*,
|
|
54
|
+
base_url: typing.Optional[str] = None,
|
|
55
|
+
environment: typing.Optional[AgentMailApiEnvironment] = None,
|
|
56
|
+
api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv("AGENTMAIL_API_KEY"),
|
|
57
|
+
timeout: typing.Optional[float] = None,
|
|
58
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
59
|
+
httpx_client: typing.Optional[httpx.Client] = None,
|
|
60
|
+
):
|
|
61
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
62
|
+
if api_key is None:
|
|
63
|
+
raise ApiError(
|
|
64
|
+
body="The client must be instantiated be either passing in api_key or setting AGENTMAIL_API_KEY"
|
|
65
|
+
)
|
|
66
|
+
self._client_wrapper = SyncClientWrapper(
|
|
67
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
68
|
+
api_key=api_key,
|
|
69
|
+
httpx_client=httpx_client
|
|
70
|
+
if httpx_client is not None
|
|
71
|
+
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
72
|
+
if follow_redirects is not None
|
|
73
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
74
|
+
timeout=_defaulted_timeout,
|
|
75
|
+
)
|
|
76
|
+
self.inboxes = InboxesClient(client_wrapper=self._client_wrapper)
|
|
77
|
+
self.threads = ThreadsClient(client_wrapper=self._client_wrapper)
|
|
78
|
+
self.messages = MessagesClient(client_wrapper=self._client_wrapper)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class AsyncAgentMailApi:
|
|
82
|
+
"""
|
|
83
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
|
84
|
+
|
|
85
|
+
Parameters
|
|
86
|
+
----------
|
|
87
|
+
base_url : typing.Optional[str]
|
|
88
|
+
The base url to use for requests from the client.
|
|
89
|
+
|
|
90
|
+
environment : typing.Optional[AgentMailApiEnvironment]
|
|
91
|
+
The environment to use for requests from the client.
|
|
92
|
+
|
|
93
|
+
api_key : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
|
|
94
|
+
timeout : typing.Optional[float]
|
|
95
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
96
|
+
|
|
97
|
+
follow_redirects : typing.Optional[bool]
|
|
98
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
99
|
+
|
|
100
|
+
httpx_client : typing.Optional[httpx.AsyncClient]
|
|
101
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
|
102
|
+
|
|
103
|
+
Examples
|
|
104
|
+
--------
|
|
105
|
+
from agent_mail import AsyncAgentMailApi
|
|
106
|
+
from agent_mail.environment import AgentMailApiEnvironment
|
|
107
|
+
|
|
108
|
+
client = AsyncAgentMailApi(
|
|
109
|
+
api_key="YOUR_API_KEY",
|
|
110
|
+
environment=AgentMailApiEnvironment.PRODUCTION,
|
|
111
|
+
)
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
def __init__(
|
|
115
|
+
self,
|
|
116
|
+
*,
|
|
117
|
+
base_url: typing.Optional[str] = None,
|
|
118
|
+
environment: typing.Optional[AgentMailApiEnvironment] = None,
|
|
119
|
+
api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv("AGENTMAIL_API_KEY"),
|
|
120
|
+
timeout: typing.Optional[float] = None,
|
|
121
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
122
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
|
123
|
+
):
|
|
124
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
125
|
+
if api_key is None:
|
|
126
|
+
raise ApiError(
|
|
127
|
+
body="The client must be instantiated be either passing in api_key or setting AGENTMAIL_API_KEY"
|
|
128
|
+
)
|
|
129
|
+
self._client_wrapper = AsyncClientWrapper(
|
|
130
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
131
|
+
api_key=api_key,
|
|
132
|
+
httpx_client=httpx_client
|
|
133
|
+
if httpx_client is not None
|
|
134
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
135
|
+
if follow_redirects is not None
|
|
136
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
|
137
|
+
timeout=_defaulted_timeout,
|
|
138
|
+
)
|
|
139
|
+
self.inboxes = AsyncInboxesClient(client_wrapper=self._client_wrapper)
|
|
140
|
+
self.threads = AsyncThreadsClient(client_wrapper=self._client_wrapper)
|
|
141
|
+
self.messages = AsyncMessagesClient(client_wrapper=self._client_wrapper)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _get_base_url(
|
|
145
|
+
*, base_url: typing.Optional[str] = None, environment: typing.Optional[AgentMailApiEnvironment] = None
|
|
146
|
+
) -> str:
|
|
147
|
+
if base_url is not None:
|
|
148
|
+
return base_url
|
|
149
|
+
elif environment is not None:
|
|
150
|
+
return environment.value
|
|
151
|
+
else:
|
|
152
|
+
raise Exception("Please pass in either base_url or environment to construct the client")
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .api_error import ApiError
|
|
4
|
+
from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
|
|
5
|
+
from .datetime_utils import serialize_datetime
|
|
6
|
+
from .file import File, convert_file_dict_to_httpx_tuples, with_content_type
|
|
7
|
+
from .http_client import AsyncHttpClient, HttpClient
|
|
8
|
+
from .jsonable_encoder import jsonable_encoder
|
|
9
|
+
from .pydantic_utilities import (
|
|
10
|
+
IS_PYDANTIC_V2,
|
|
11
|
+
UniversalBaseModel,
|
|
12
|
+
UniversalRootModel,
|
|
13
|
+
parse_obj_as,
|
|
14
|
+
universal_field_validator,
|
|
15
|
+
universal_root_validator,
|
|
16
|
+
update_forward_refs,
|
|
17
|
+
)
|
|
18
|
+
from .query_encoder import encode_query
|
|
19
|
+
from .remove_none_from_dict import remove_none_from_dict
|
|
20
|
+
from .request_options import RequestOptions
|
|
21
|
+
from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"ApiError",
|
|
25
|
+
"AsyncClientWrapper",
|
|
26
|
+
"AsyncHttpClient",
|
|
27
|
+
"BaseClientWrapper",
|
|
28
|
+
"FieldMetadata",
|
|
29
|
+
"File",
|
|
30
|
+
"HttpClient",
|
|
31
|
+
"IS_PYDANTIC_V2",
|
|
32
|
+
"RequestOptions",
|
|
33
|
+
"SyncClientWrapper",
|
|
34
|
+
"UniversalBaseModel",
|
|
35
|
+
"UniversalRootModel",
|
|
36
|
+
"convert_and_respect_annotation_metadata",
|
|
37
|
+
"convert_file_dict_to_httpx_tuples",
|
|
38
|
+
"encode_query",
|
|
39
|
+
"jsonable_encoder",
|
|
40
|
+
"parse_obj_as",
|
|
41
|
+
"remove_none_from_dict",
|
|
42
|
+
"serialize_datetime",
|
|
43
|
+
"universal_field_validator",
|
|
44
|
+
"universal_root_validator",
|
|
45
|
+
"update_forward_refs",
|
|
46
|
+
"with_content_type",
|
|
47
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApiError(Exception):
|
|
7
|
+
status_code: typing.Optional[int]
|
|
8
|
+
body: typing.Any
|
|
9
|
+
|
|
10
|
+
def __init__(self, *, status_code: typing.Optional[int] = None, body: typing.Any = None):
|
|
11
|
+
self.status_code = status_code
|
|
12
|
+
self.body = body
|
|
13
|
+
|
|
14
|
+
def __str__(self) -> str:
|
|
15
|
+
return f"status_code: {self.status_code}, body: {self.body}"
|