pyloops 1.6.0__py3-none-any.whl
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.
- pyloops/__init__.py +8 -0
- pyloops/api/__init__.py +1 -0
- pyloops/api/api_key/__init__.py +1 -0
- pyloops/api/api_key/get_api_key.py +133 -0
- pyloops/api/contact_properties/__init__.py +1 -0
- pyloops/api/contact_properties/get_contacts_properties.py +180 -0
- pyloops/api/contact_properties/post_contacts_properties.py +178 -0
- pyloops/api/contacts/__init__.py +1 -0
- pyloops/api/contacts/get_contacts_find.py +197 -0
- pyloops/api/contacts/post_contacts_create.py +183 -0
- pyloops/api/contacts/post_contacts_delete.py +183 -0
- pyloops/api/contacts/put_contacts_update.py +186 -0
- pyloops/api/dedicated_sending_i_ps/__init__.py +1 -0
- pyloops/api/dedicated_sending_i_ps/get_dedicated_sending_ips.py +144 -0
- pyloops/api/events/__init__.py +1 -0
- pyloops/api/events/post_events_send.py +199 -0
- pyloops/api/mailing_lists/__init__.py +1 -0
- pyloops/api/mailing_lists/get_lists.py +144 -0
- pyloops/api/transactional_emails/__init__.py +1 -0
- pyloops/api/transactional_emails/get_transactional.py +115 -0
- pyloops/api/transactional_emails/post_transactional.py +323 -0
- pyloops/client.py +268 -0
- pyloops/errors.py +16 -0
- pyloops/models/__init__.py +83 -0
- pyloops/models/contact.py +240 -0
- pyloops/models/contact_delete_request.py +69 -0
- pyloops/models/contact_delete_response.py +69 -0
- pyloops/models/contact_failure_response.py +69 -0
- pyloops/models/contact_mailing_lists.py +46 -0
- pyloops/models/contact_opt_in_status_type_1.py +10 -0
- pyloops/models/contact_opt_in_status_type_2_type_1.py +10 -0
- pyloops/models/contact_opt_in_status_type_3_type_1.py +10 -0
- pyloops/models/contact_property.py +77 -0
- pyloops/models/contact_property_create_request.py +69 -0
- pyloops/models/contact_property_failure_response.py +69 -0
- pyloops/models/contact_property_success_response.py +61 -0
- pyloops/models/contact_request.py +143 -0
- pyloops/models/contact_request_mailing_lists.py +46 -0
- pyloops/models/contact_success_response.py +69 -0
- pyloops/models/contact_update_request.py +141 -0
- pyloops/models/contact_update_request_mailing_lists.py +46 -0
- pyloops/models/event_failure_response.py +69 -0
- pyloops/models/event_request.py +135 -0
- pyloops/models/event_request_event_properties.py +46 -0
- pyloops/models/event_request_mailing_lists.py +46 -0
- pyloops/models/event_success_response.py +61 -0
- pyloops/models/get_api_key_response_200.py +69 -0
- pyloops/models/get_api_key_response_401.py +79 -0
- pyloops/models/get_dedicated_sending_ips_response_500.py +69 -0
- pyloops/models/idempotency_key_failure_response.py +69 -0
- pyloops/models/mailing_list.py +85 -0
- pyloops/models/transactional_failure_2_response.py +77 -0
- pyloops/models/transactional_failure_3_response.py +83 -0
- pyloops/models/transactional_failure_3_response_error.py +70 -0
- pyloops/models/transactional_failure_4_response.py +83 -0
- pyloops/models/transactional_failure_4_response_error.py +70 -0
- pyloops/models/transactional_failure_5_response.py +91 -0
- pyloops/models/transactional_failure_5_response_error.py +70 -0
- pyloops/models/transactional_failure_response.py +69 -0
- pyloops/models/transactional_request.py +128 -0
- pyloops/models/transactional_request_attachments_item.py +77 -0
- pyloops/models/transactional_request_data_variables.py +46 -0
- pyloops/models/transactional_success_response.py +61 -0
- pyloops/py.typed +1 -0
- pyloops/types.py +54 -0
- pyloops-1.6.0.dist-info/METADATA +131 -0
- pyloops-1.6.0.dist-info/RECORD +68 -0
- pyloops-1.6.0.dist-info/WHEEL +4 -0
pyloops/__init__.py
ADDED
pyloops/api/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.get_api_key_response_200 import GetApiKeyResponse200
|
|
9
|
+
from ...models.get_api_key_response_401 import GetApiKeyResponse401
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs() -> dict[str, Any]:
|
|
14
|
+
_kwargs: dict[str, Any] = {
|
|
15
|
+
"method": "get",
|
|
16
|
+
"url": "/api-key",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return _kwargs
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _parse_response(
|
|
23
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
24
|
+
) -> GetApiKeyResponse200 | GetApiKeyResponse401 | None:
|
|
25
|
+
if response.status_code == 200:
|
|
26
|
+
response_200 = GetApiKeyResponse200.from_dict(response.json())
|
|
27
|
+
|
|
28
|
+
return response_200
|
|
29
|
+
|
|
30
|
+
if response.status_code == 401:
|
|
31
|
+
response_401 = GetApiKeyResponse401.from_dict(response.json())
|
|
32
|
+
|
|
33
|
+
return response_401
|
|
34
|
+
|
|
35
|
+
if client.raise_on_unexpected_status:
|
|
36
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
37
|
+
else:
|
|
38
|
+
return None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _build_response(
|
|
42
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
43
|
+
) -> Response[GetApiKeyResponse200 | GetApiKeyResponse401]:
|
|
44
|
+
return Response(
|
|
45
|
+
status_code=HTTPStatus(response.status_code),
|
|
46
|
+
content=response.content,
|
|
47
|
+
headers=response.headers,
|
|
48
|
+
parsed=_parse_response(client=client, response=response),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def sync_detailed(
|
|
53
|
+
*,
|
|
54
|
+
client: AuthenticatedClient,
|
|
55
|
+
) -> Response[GetApiKeyResponse200 | GetApiKeyResponse401]:
|
|
56
|
+
"""Test your API key
|
|
57
|
+
|
|
58
|
+
Raises:
|
|
59
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
60
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
Response[GetApiKeyResponse200 | GetApiKeyResponse401]
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
kwargs = _get_kwargs()
|
|
67
|
+
|
|
68
|
+
response = client.get_httpx_client().request(
|
|
69
|
+
**kwargs,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
return _build_response(client=client, response=response)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def sync(
|
|
76
|
+
*,
|
|
77
|
+
client: AuthenticatedClient,
|
|
78
|
+
) -> GetApiKeyResponse200 | GetApiKeyResponse401 | None:
|
|
79
|
+
"""Test your API key
|
|
80
|
+
|
|
81
|
+
Raises:
|
|
82
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
83
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
GetApiKeyResponse200 | GetApiKeyResponse401
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
return sync_detailed(
|
|
90
|
+
client=client,
|
|
91
|
+
).parsed
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
async def asyncio_detailed(
|
|
95
|
+
*,
|
|
96
|
+
client: AuthenticatedClient,
|
|
97
|
+
) -> Response[GetApiKeyResponse200 | GetApiKeyResponse401]:
|
|
98
|
+
"""Test your API key
|
|
99
|
+
|
|
100
|
+
Raises:
|
|
101
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
102
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
Response[GetApiKeyResponse200 | GetApiKeyResponse401]
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
kwargs = _get_kwargs()
|
|
109
|
+
|
|
110
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
111
|
+
|
|
112
|
+
return _build_response(client=client, response=response)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
async def asyncio(
|
|
116
|
+
*,
|
|
117
|
+
client: AuthenticatedClient,
|
|
118
|
+
) -> GetApiKeyResponse200 | GetApiKeyResponse401 | None:
|
|
119
|
+
"""Test your API key
|
|
120
|
+
|
|
121
|
+
Raises:
|
|
122
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
123
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
GetApiKeyResponse200 | GetApiKeyResponse401
|
|
127
|
+
"""
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
await asyncio_detailed(
|
|
131
|
+
client=client,
|
|
132
|
+
)
|
|
133
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.contact_property import ContactProperty
|
|
9
|
+
from ...types import UNSET, Response, Unset
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs(
|
|
13
|
+
*,
|
|
14
|
+
list_: str | Unset = UNSET,
|
|
15
|
+
) -> dict[str, Any]:
|
|
16
|
+
params: dict[str, Any] = {}
|
|
17
|
+
|
|
18
|
+
params["list"] = list_
|
|
19
|
+
|
|
20
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
21
|
+
|
|
22
|
+
_kwargs: dict[str, Any] = {
|
|
23
|
+
"method": "get",
|
|
24
|
+
"url": "/contacts/properties",
|
|
25
|
+
"params": params,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return _kwargs
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _parse_response(
|
|
32
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
33
|
+
) -> Any | list[ContactProperty] | None:
|
|
34
|
+
if response.status_code == 200:
|
|
35
|
+
response_200 = []
|
|
36
|
+
_response_200 = response.json()
|
|
37
|
+
for response_200_item_data in _response_200:
|
|
38
|
+
response_200_item = ContactProperty.from_dict(response_200_item_data)
|
|
39
|
+
|
|
40
|
+
response_200.append(response_200_item)
|
|
41
|
+
|
|
42
|
+
return response_200
|
|
43
|
+
|
|
44
|
+
if response.status_code == 405:
|
|
45
|
+
response_405 = cast(Any, None)
|
|
46
|
+
return response_405
|
|
47
|
+
|
|
48
|
+
if client.raise_on_unexpected_status:
|
|
49
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
+
else:
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _build_response(
|
|
55
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
56
|
+
) -> Response[Any | list[ContactProperty]]:
|
|
57
|
+
return Response(
|
|
58
|
+
status_code=HTTPStatus(response.status_code),
|
|
59
|
+
content=response.content,
|
|
60
|
+
headers=response.headers,
|
|
61
|
+
parsed=_parse_response(client=client, response=response),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def sync_detailed(
|
|
66
|
+
*,
|
|
67
|
+
client: AuthenticatedClient,
|
|
68
|
+
list_: str | Unset = UNSET,
|
|
69
|
+
) -> Response[Any | list[ContactProperty]]:
|
|
70
|
+
r"""Get a list of contact properties
|
|
71
|
+
|
|
72
|
+
Retrieve a list of your account's contact properties.<br>Use the `list` parameter to query \"all\"
|
|
73
|
+
or \"custom\" properties.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
list_ (str | Unset):
|
|
77
|
+
|
|
78
|
+
Raises:
|
|
79
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
80
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
Response[Any | list[ContactProperty]]
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
kwargs = _get_kwargs(
|
|
87
|
+
list_=list_,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
response = client.get_httpx_client().request(
|
|
91
|
+
**kwargs,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return _build_response(client=client, response=response)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def sync(
|
|
98
|
+
*,
|
|
99
|
+
client: AuthenticatedClient,
|
|
100
|
+
list_: str | Unset = UNSET,
|
|
101
|
+
) -> Any | list[ContactProperty] | None:
|
|
102
|
+
r"""Get a list of contact properties
|
|
103
|
+
|
|
104
|
+
Retrieve a list of your account's contact properties.<br>Use the `list` parameter to query \"all\"
|
|
105
|
+
or \"custom\" properties.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
list_ (str | Unset):
|
|
109
|
+
|
|
110
|
+
Raises:
|
|
111
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
112
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
Any | list[ContactProperty]
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
return sync_detailed(
|
|
119
|
+
client=client,
|
|
120
|
+
list_=list_,
|
|
121
|
+
).parsed
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
async def asyncio_detailed(
|
|
125
|
+
*,
|
|
126
|
+
client: AuthenticatedClient,
|
|
127
|
+
list_: str | Unset = UNSET,
|
|
128
|
+
) -> Response[Any | list[ContactProperty]]:
|
|
129
|
+
r"""Get a list of contact properties
|
|
130
|
+
|
|
131
|
+
Retrieve a list of your account's contact properties.<br>Use the `list` parameter to query \"all\"
|
|
132
|
+
or \"custom\" properties.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
list_ (str | Unset):
|
|
136
|
+
|
|
137
|
+
Raises:
|
|
138
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
139
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
Response[Any | list[ContactProperty]]
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
kwargs = _get_kwargs(
|
|
146
|
+
list_=list_,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
150
|
+
|
|
151
|
+
return _build_response(client=client, response=response)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
async def asyncio(
|
|
155
|
+
*,
|
|
156
|
+
client: AuthenticatedClient,
|
|
157
|
+
list_: str | Unset = UNSET,
|
|
158
|
+
) -> Any | list[ContactProperty] | None:
|
|
159
|
+
r"""Get a list of contact properties
|
|
160
|
+
|
|
161
|
+
Retrieve a list of your account's contact properties.<br>Use the `list` parameter to query \"all\"
|
|
162
|
+
or \"custom\" properties.
|
|
163
|
+
|
|
164
|
+
Args:
|
|
165
|
+
list_ (str | Unset):
|
|
166
|
+
|
|
167
|
+
Raises:
|
|
168
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
169
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
Any | list[ContactProperty]
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
await asyncio_detailed(
|
|
177
|
+
client=client,
|
|
178
|
+
list_=list_,
|
|
179
|
+
)
|
|
180
|
+
).parsed
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.contact_property_create_request import ContactPropertyCreateRequest
|
|
9
|
+
from ...models.contact_property_failure_response import ContactPropertyFailureResponse
|
|
10
|
+
from ...models.contact_property_success_response import ContactPropertySuccessResponse
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: ContactPropertyCreateRequest,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/contacts/properties",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_kwargs["json"] = body.to_dict()
|
|
26
|
+
|
|
27
|
+
headers["Content-Type"] = "application/json"
|
|
28
|
+
|
|
29
|
+
_kwargs["headers"] = headers
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(
|
|
34
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
35
|
+
) -> Any | ContactPropertyFailureResponse | ContactPropertySuccessResponse | None:
|
|
36
|
+
if response.status_code == 200:
|
|
37
|
+
response_200 = ContactPropertySuccessResponse.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
return response_200
|
|
40
|
+
|
|
41
|
+
if response.status_code == 400:
|
|
42
|
+
response_400 = ContactPropertyFailureResponse.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_400
|
|
45
|
+
|
|
46
|
+
if response.status_code == 405:
|
|
47
|
+
response_405 = cast(Any, None)
|
|
48
|
+
return response_405
|
|
49
|
+
|
|
50
|
+
if client.raise_on_unexpected_status:
|
|
51
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
52
|
+
else:
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _build_response(
|
|
57
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
58
|
+
) -> Response[Any | ContactPropertyFailureResponse | ContactPropertySuccessResponse]:
|
|
59
|
+
return Response(
|
|
60
|
+
status_code=HTTPStatus(response.status_code),
|
|
61
|
+
content=response.content,
|
|
62
|
+
headers=response.headers,
|
|
63
|
+
parsed=_parse_response(client=client, response=response),
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def sync_detailed(
|
|
68
|
+
*,
|
|
69
|
+
client: AuthenticatedClient,
|
|
70
|
+
body: ContactPropertyCreateRequest,
|
|
71
|
+
) -> Response[Any | ContactPropertyFailureResponse | ContactPropertySuccessResponse]:
|
|
72
|
+
"""Create a contact property
|
|
73
|
+
|
|
74
|
+
Add a contact property to your team.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
body (ContactPropertyCreateRequest):
|
|
78
|
+
|
|
79
|
+
Raises:
|
|
80
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
81
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
Response[Any | ContactPropertyFailureResponse | ContactPropertySuccessResponse]
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
kwargs = _get_kwargs(
|
|
88
|
+
body=body,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
response = client.get_httpx_client().request(
|
|
92
|
+
**kwargs,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
return _build_response(client=client, response=response)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def sync(
|
|
99
|
+
*,
|
|
100
|
+
client: AuthenticatedClient,
|
|
101
|
+
body: ContactPropertyCreateRequest,
|
|
102
|
+
) -> Any | ContactPropertyFailureResponse | ContactPropertySuccessResponse | None:
|
|
103
|
+
"""Create a contact property
|
|
104
|
+
|
|
105
|
+
Add a contact property to your team.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
body (ContactPropertyCreateRequest):
|
|
109
|
+
|
|
110
|
+
Raises:
|
|
111
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
112
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
Any | ContactPropertyFailureResponse | ContactPropertySuccessResponse
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
return sync_detailed(
|
|
119
|
+
client=client,
|
|
120
|
+
body=body,
|
|
121
|
+
).parsed
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
async def asyncio_detailed(
|
|
125
|
+
*,
|
|
126
|
+
client: AuthenticatedClient,
|
|
127
|
+
body: ContactPropertyCreateRequest,
|
|
128
|
+
) -> Response[Any | ContactPropertyFailureResponse | ContactPropertySuccessResponse]:
|
|
129
|
+
"""Create a contact property
|
|
130
|
+
|
|
131
|
+
Add a contact property to your team.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
body (ContactPropertyCreateRequest):
|
|
135
|
+
|
|
136
|
+
Raises:
|
|
137
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
138
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
Response[Any | ContactPropertyFailureResponse | ContactPropertySuccessResponse]
|
|
142
|
+
"""
|
|
143
|
+
|
|
144
|
+
kwargs = _get_kwargs(
|
|
145
|
+
body=body,
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
149
|
+
|
|
150
|
+
return _build_response(client=client, response=response)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
async def asyncio(
|
|
154
|
+
*,
|
|
155
|
+
client: AuthenticatedClient,
|
|
156
|
+
body: ContactPropertyCreateRequest,
|
|
157
|
+
) -> Any | ContactPropertyFailureResponse | ContactPropertySuccessResponse | None:
|
|
158
|
+
"""Create a contact property
|
|
159
|
+
|
|
160
|
+
Add a contact property to your team.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
body (ContactPropertyCreateRequest):
|
|
164
|
+
|
|
165
|
+
Raises:
|
|
166
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
167
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
168
|
+
|
|
169
|
+
Returns:
|
|
170
|
+
Any | ContactPropertyFailureResponse | ContactPropertySuccessResponse
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
await asyncio_detailed(
|
|
175
|
+
client=client,
|
|
176
|
+
body=body,
|
|
177
|
+
)
|
|
178
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.contact import Contact
|
|
9
|
+
from ...models.contact_failure_response import ContactFailureResponse
|
|
10
|
+
from ...types import UNSET, Response, Unset
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
email: str | Unset = UNSET,
|
|
16
|
+
user_id: str | Unset = UNSET,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
params: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
params["email"] = email
|
|
21
|
+
|
|
22
|
+
params["userId"] = user_id
|
|
23
|
+
|
|
24
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
25
|
+
|
|
26
|
+
_kwargs: dict[str, Any] = {
|
|
27
|
+
"method": "get",
|
|
28
|
+
"url": "/contacts/find",
|
|
29
|
+
"params": params,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return _kwargs
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _parse_response(
|
|
36
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
37
|
+
) -> Any | ContactFailureResponse | list[Contact] | None:
|
|
38
|
+
if response.status_code == 200:
|
|
39
|
+
response_200 = []
|
|
40
|
+
_response_200 = response.json()
|
|
41
|
+
for response_200_item_data in _response_200:
|
|
42
|
+
response_200_item = Contact.from_dict(response_200_item_data)
|
|
43
|
+
|
|
44
|
+
response_200.append(response_200_item)
|
|
45
|
+
|
|
46
|
+
return response_200
|
|
47
|
+
|
|
48
|
+
if response.status_code == 400:
|
|
49
|
+
response_400 = ContactFailureResponse.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_400
|
|
52
|
+
|
|
53
|
+
if response.status_code == 405:
|
|
54
|
+
response_405 = cast(Any, None)
|
|
55
|
+
return response_405
|
|
56
|
+
|
|
57
|
+
if client.raise_on_unexpected_status:
|
|
58
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
59
|
+
else:
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _build_response(
|
|
64
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
65
|
+
) -> Response[Any | ContactFailureResponse | list[Contact]]:
|
|
66
|
+
return Response(
|
|
67
|
+
status_code=HTTPStatus(response.status_code),
|
|
68
|
+
content=response.content,
|
|
69
|
+
headers=response.headers,
|
|
70
|
+
parsed=_parse_response(client=client, response=response),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def sync_detailed(
|
|
75
|
+
*,
|
|
76
|
+
client: AuthenticatedClient,
|
|
77
|
+
email: str | Unset = UNSET,
|
|
78
|
+
user_id: str | Unset = UNSET,
|
|
79
|
+
) -> Response[Any | ContactFailureResponse | list[Contact]]:
|
|
80
|
+
"""Find a contact
|
|
81
|
+
|
|
82
|
+
Search for a contact by `email` or `userId`. Only one parameter is allowed.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
email (str | Unset):
|
|
86
|
+
user_id (str | Unset):
|
|
87
|
+
|
|
88
|
+
Raises:
|
|
89
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
90
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
Response[Any | ContactFailureResponse | list[Contact]]
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
kwargs = _get_kwargs(
|
|
97
|
+
email=email,
|
|
98
|
+
user_id=user_id,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
response = client.get_httpx_client().request(
|
|
102
|
+
**kwargs,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
return _build_response(client=client, response=response)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def sync(
|
|
109
|
+
*,
|
|
110
|
+
client: AuthenticatedClient,
|
|
111
|
+
email: str | Unset = UNSET,
|
|
112
|
+
user_id: str | Unset = UNSET,
|
|
113
|
+
) -> Any | ContactFailureResponse | list[Contact] | None:
|
|
114
|
+
"""Find a contact
|
|
115
|
+
|
|
116
|
+
Search for a contact by `email` or `userId`. Only one parameter is allowed.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
email (str | Unset):
|
|
120
|
+
user_id (str | Unset):
|
|
121
|
+
|
|
122
|
+
Raises:
|
|
123
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
124
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
Any | ContactFailureResponse | list[Contact]
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
return sync_detailed(
|
|
131
|
+
client=client,
|
|
132
|
+
email=email,
|
|
133
|
+
user_id=user_id,
|
|
134
|
+
).parsed
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
async def asyncio_detailed(
|
|
138
|
+
*,
|
|
139
|
+
client: AuthenticatedClient,
|
|
140
|
+
email: str | Unset = UNSET,
|
|
141
|
+
user_id: str | Unset = UNSET,
|
|
142
|
+
) -> Response[Any | ContactFailureResponse | list[Contact]]:
|
|
143
|
+
"""Find a contact
|
|
144
|
+
|
|
145
|
+
Search for a contact by `email` or `userId`. Only one parameter is allowed.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
email (str | Unset):
|
|
149
|
+
user_id (str | Unset):
|
|
150
|
+
|
|
151
|
+
Raises:
|
|
152
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
153
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
Response[Any | ContactFailureResponse | list[Contact]]
|
|
157
|
+
"""
|
|
158
|
+
|
|
159
|
+
kwargs = _get_kwargs(
|
|
160
|
+
email=email,
|
|
161
|
+
user_id=user_id,
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
165
|
+
|
|
166
|
+
return _build_response(client=client, response=response)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
async def asyncio(
|
|
170
|
+
*,
|
|
171
|
+
client: AuthenticatedClient,
|
|
172
|
+
email: str | Unset = UNSET,
|
|
173
|
+
user_id: str | Unset = UNSET,
|
|
174
|
+
) -> Any | ContactFailureResponse | list[Contact] | None:
|
|
175
|
+
"""Find a contact
|
|
176
|
+
|
|
177
|
+
Search for a contact by `email` or `userId`. Only one parameter is allowed.
|
|
178
|
+
|
|
179
|
+
Args:
|
|
180
|
+
email (str | Unset):
|
|
181
|
+
user_id (str | Unset):
|
|
182
|
+
|
|
183
|
+
Raises:
|
|
184
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
185
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
186
|
+
|
|
187
|
+
Returns:
|
|
188
|
+
Any | ContactFailureResponse | list[Contact]
|
|
189
|
+
"""
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
await asyncio_detailed(
|
|
193
|
+
client=client,
|
|
194
|
+
email=email,
|
|
195
|
+
user_id=user_id,
|
|
196
|
+
)
|
|
197
|
+
).parsed
|