truagents 0.0.0.dev0__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.
- truagents/__init__.py +18 -0
- truagents/__version__.py +1 -0
- truagents/auth.py +293 -0
- truagents/client.py +304 -0
- truagents/errors.py +193 -0
- truagents/generated/__init__.py +8 -0
- truagents/generated/api/__init__.py +1 -0
- truagents/generated/api/email_unsubscribe/__init__.py +1 -0
- truagents/generated/api/email_unsubscribe/list_email_unsubscribes.py +290 -0
- truagents/generated/api/email_unsubscribe/push_email_unsubscribes.py +236 -0
- truagents/generated/api/o_auth/__init__.py +1 -0
- truagents/generated/api/o_auth/issue_o_auth_token.py +241 -0
- truagents/generated/api/sms_unsubscribe/__init__.py +1 -0
- truagents/generated/api/sms_unsubscribe/list_sms_unsubscribes.py +290 -0
- truagents/generated/api/sms_unsubscribe/push_sms_unsubscribes.py +232 -0
- truagents/generated/api/voice_unsubscribe/__init__.py +1 -0
- truagents/generated/api/voice_unsubscribe/list_phone_unsubscribes.py +298 -0
- truagents/generated/api/voice_unsubscribe/push_phone_unsubscribes.py +232 -0
- truagents/generated/client.py +282 -0
- truagents/generated/errors.py +16 -0
- truagents/generated/models/__init__.py +65 -0
- truagents/generated/models/email_skipped_item.py +83 -0
- truagents/generated/models/email_skipped_item_reason.py +11 -0
- truagents/generated/models/email_source_enum.py +11 -0
- truagents/generated/models/email_unsubscribe_batch_request.py +93 -0
- truagents/generated/models/email_unsubscribe_batch_response.py +119 -0
- truagents/generated/models/email_unsubscribe_item.py +50 -0
- truagents/generated/models/email_unsubscribe_list_response.py +113 -0
- truagents/generated/models/email_unsubscribe_record.py +98 -0
- truagents/generated/models/email_unsubscribe_updated_entry.py +79 -0
- truagents/generated/models/o_auth_client_credentials_request.py +87 -0
- truagents/generated/models/o_auth_client_credentials_request_grant_type.py +8 -0
- truagents/generated/models/o_auth_error_response.py +83 -0
- truagents/generated/models/o_auth_error_response_error.py +11 -0
- truagents/generated/models/o_auth_refresh_token_request.py +75 -0
- truagents/generated/models/o_auth_refresh_token_request_grant_type.py +8 -0
- truagents/generated/models/o_auth_token_response.py +97 -0
- truagents/generated/models/o_auth_token_response_token_type.py +8 -0
- truagents/generated/models/phone_skipped_item.py +83 -0
- truagents/generated/models/phone_skipped_item_reason.py +11 -0
- truagents/generated/models/phone_source_enum.py +11 -0
- truagents/generated/models/phone_unsubscribe_batch_request.py +92 -0
- truagents/generated/models/phone_unsubscribe_batch_response.py +118 -0
- truagents/generated/models/phone_unsubscribe_item.py +51 -0
- truagents/generated/models/phone_unsubscribe_list_response.py +111 -0
- truagents/generated/models/phone_unsubscribe_record.py +99 -0
- truagents/generated/models/phone_unsubscribe_updated_entry.py +79 -0
- truagents/generated/models/rest_error_response.py +74 -0
- truagents/generated/models/unauthorized_organization_error.py +90 -0
- truagents/generated/models/unauthorized_organization_error_error.py +8 -0
- truagents/generated/types.py +54 -0
- truagents/observability.py +70 -0
- truagents/retry.py +64 -0
- truagents-0.0.0.dev0.dist-info/METADATA +171 -0
- truagents-0.0.0.dev0.dist-info/RECORD +56 -0
- truagents-0.0.0.dev0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
|
|
8
|
+
T = TypeVar("T", bound="EmailUnsubscribeItem")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@_attrs_define
|
|
12
|
+
class EmailUnsubscribeItem:
|
|
13
|
+
"""
|
|
14
|
+
Attributes:
|
|
15
|
+
email (str):
|
|
16
|
+
unsubscribed (bool): `true` to opt-out, `false` to opt-in.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
email: str
|
|
20
|
+
unsubscribed: bool
|
|
21
|
+
|
|
22
|
+
def to_dict(self) -> dict[str, Any]:
|
|
23
|
+
email = self.email
|
|
24
|
+
|
|
25
|
+
unsubscribed = self.unsubscribed
|
|
26
|
+
|
|
27
|
+
field_dict: dict[str, Any] = {}
|
|
28
|
+
|
|
29
|
+
field_dict.update(
|
|
30
|
+
{
|
|
31
|
+
"email": email,
|
|
32
|
+
"unsubscribed": unsubscribed,
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
return field_dict
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
40
|
+
d = dict(src_dict)
|
|
41
|
+
email = d.pop("email")
|
|
42
|
+
|
|
43
|
+
unsubscribed = d.pop("unsubscribed")
|
|
44
|
+
|
|
45
|
+
email_unsubscribe_item = cls(
|
|
46
|
+
email=email,
|
|
47
|
+
unsubscribed=unsubscribed,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
return email_unsubscribe_item
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.email_unsubscribe_record import EmailUnsubscribeRecord
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="EmailUnsubscribeListResponse")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class EmailUnsubscribeListResponse:
|
|
18
|
+
"""
|
|
19
|
+
Example:
|
|
20
|
+
{'org_slug': 'acme-corp', 'data': [{'email': 'john@example.com', 'unsubscribed': True, 'source': 'external_api',
|
|
21
|
+
'updated_at': '2026-04-15T10:30:00Z'}, {'email': 'alice@example.com', 'unsubscribed': False, 'source': 'admin',
|
|
22
|
+
'updated_at': '2026-04-13T09:00:00Z'}], 'next_cursor':
|
|
23
|
+
'eyJvcmciOiJhY21lLWNvcnAiLCJ0cyI6IjIwMjYtMDQtMTNUMDk6MDA6MDBaIn0', 'has_more': True}
|
|
24
|
+
|
|
25
|
+
Attributes:
|
|
26
|
+
org_slug (str): Organization this page belongs to — the value you supplied, the one carried by `cursor`, or your
|
|
27
|
+
key's default organization when neither was provided. Example: acme-corp.
|
|
28
|
+
data (list[EmailUnsubscribeRecord]):
|
|
29
|
+
next_cursor (None | str): Pass to the `cursor` query parameter to fetch the next page. `null` when no more
|
|
30
|
+
results are available. See the `Cursor` parameter for the encoding contract.
|
|
31
|
+
has_more (bool):
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
org_slug: str
|
|
35
|
+
data: list[EmailUnsubscribeRecord]
|
|
36
|
+
next_cursor: None | str
|
|
37
|
+
has_more: bool
|
|
38
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
39
|
+
|
|
40
|
+
def to_dict(self) -> dict[str, Any]:
|
|
41
|
+
org_slug = self.org_slug
|
|
42
|
+
|
|
43
|
+
data = []
|
|
44
|
+
for data_item_data in self.data:
|
|
45
|
+
data_item = data_item_data.to_dict()
|
|
46
|
+
data.append(data_item)
|
|
47
|
+
|
|
48
|
+
next_cursor: None | str
|
|
49
|
+
next_cursor = self.next_cursor
|
|
50
|
+
|
|
51
|
+
has_more = self.has_more
|
|
52
|
+
|
|
53
|
+
field_dict: dict[str, Any] = {}
|
|
54
|
+
field_dict.update(self.additional_properties)
|
|
55
|
+
field_dict.update(
|
|
56
|
+
{
|
|
57
|
+
"org_slug": org_slug,
|
|
58
|
+
"data": data,
|
|
59
|
+
"next_cursor": next_cursor,
|
|
60
|
+
"has_more": has_more,
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
return field_dict
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
68
|
+
from ..models.email_unsubscribe_record import EmailUnsubscribeRecord
|
|
69
|
+
|
|
70
|
+
d = dict(src_dict)
|
|
71
|
+
org_slug = d.pop("org_slug")
|
|
72
|
+
|
|
73
|
+
data = []
|
|
74
|
+
_data = d.pop("data")
|
|
75
|
+
for data_item_data in _data:
|
|
76
|
+
data_item = EmailUnsubscribeRecord.from_dict(data_item_data)
|
|
77
|
+
|
|
78
|
+
data.append(data_item)
|
|
79
|
+
|
|
80
|
+
def _parse_next_cursor(data: object) -> None | str:
|
|
81
|
+
if data is None:
|
|
82
|
+
return data
|
|
83
|
+
return cast(None | str, data)
|
|
84
|
+
|
|
85
|
+
next_cursor = _parse_next_cursor(d.pop("next_cursor"))
|
|
86
|
+
|
|
87
|
+
has_more = d.pop("has_more")
|
|
88
|
+
|
|
89
|
+
email_unsubscribe_list_response = cls(
|
|
90
|
+
org_slug=org_slug,
|
|
91
|
+
data=data,
|
|
92
|
+
next_cursor=next_cursor,
|
|
93
|
+
has_more=has_more,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
email_unsubscribe_list_response.additional_properties = d
|
|
97
|
+
return email_unsubscribe_list_response
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def additional_keys(self) -> list[str]:
|
|
101
|
+
return list(self.additional_properties.keys())
|
|
102
|
+
|
|
103
|
+
def __getitem__(self, key: str) -> Any:
|
|
104
|
+
return self.additional_properties[key]
|
|
105
|
+
|
|
106
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
107
|
+
self.additional_properties[key] = value
|
|
108
|
+
|
|
109
|
+
def __delitem__(self, key: str) -> None:
|
|
110
|
+
del self.additional_properties[key]
|
|
111
|
+
|
|
112
|
+
def __contains__(self, key: str) -> bool:
|
|
113
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import Any, TypeVar
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..models.email_source_enum import EmailSourceEnum
|
|
11
|
+
|
|
12
|
+
T = TypeVar("T", bound="EmailUnsubscribeRecord")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@_attrs_define
|
|
16
|
+
class EmailUnsubscribeRecord:
|
|
17
|
+
"""
|
|
18
|
+
Example:
|
|
19
|
+
{'email': 'john@example.com', 'unsubscribed': True, 'source': 'external_api', 'updated_at':
|
|
20
|
+
'2026-04-15T10:30:00Z'}
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
email (str): Email address, normalized to lowercase canonical form.
|
|
24
|
+
unsubscribed (bool): `true` = opted out (TruAgents will not send on this channel).
|
|
25
|
+
source (EmailSourceEnum): The category of writer responsible for the row's most recent state change on the email
|
|
26
|
+
channel.
|
|
27
|
+
|
|
28
|
+
- `external_api` — pushed by the partner via this API.
|
|
29
|
+
- `sendgrid` — derived from a SendGrid unsubscribe event.
|
|
30
|
+
- `admin` — manually changed by a TruAgents administrator.
|
|
31
|
+
- `import` — created during initial backfill from legacy per-contact flags.
|
|
32
|
+
updated_at (datetime.datetime): ISO 8601 timestamp of the most recent state change.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
email: str
|
|
36
|
+
unsubscribed: bool
|
|
37
|
+
source: EmailSourceEnum
|
|
38
|
+
updated_at: datetime.datetime
|
|
39
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
40
|
+
|
|
41
|
+
def to_dict(self) -> dict[str, Any]:
|
|
42
|
+
email = self.email
|
|
43
|
+
|
|
44
|
+
unsubscribed = self.unsubscribed
|
|
45
|
+
|
|
46
|
+
source = self.source.value
|
|
47
|
+
|
|
48
|
+
updated_at = self.updated_at.isoformat()
|
|
49
|
+
|
|
50
|
+
field_dict: dict[str, Any] = {}
|
|
51
|
+
field_dict.update(self.additional_properties)
|
|
52
|
+
field_dict.update(
|
|
53
|
+
{
|
|
54
|
+
"email": email,
|
|
55
|
+
"unsubscribed": unsubscribed,
|
|
56
|
+
"source": source,
|
|
57
|
+
"updated_at": updated_at,
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
return field_dict
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
65
|
+
d = dict(src_dict)
|
|
66
|
+
email = d.pop("email")
|
|
67
|
+
|
|
68
|
+
unsubscribed = d.pop("unsubscribed")
|
|
69
|
+
|
|
70
|
+
source = EmailSourceEnum(d.pop("source"))
|
|
71
|
+
|
|
72
|
+
updated_at = datetime.datetime.fromisoformat(d.pop("updated_at"))
|
|
73
|
+
|
|
74
|
+
email_unsubscribe_record = cls(
|
|
75
|
+
email=email,
|
|
76
|
+
unsubscribed=unsubscribed,
|
|
77
|
+
source=source,
|
|
78
|
+
updated_at=updated_at,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
email_unsubscribe_record.additional_properties = d
|
|
82
|
+
return email_unsubscribe_record
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def additional_keys(self) -> list[str]:
|
|
86
|
+
return list(self.additional_properties.keys())
|
|
87
|
+
|
|
88
|
+
def __getitem__(self, key: str) -> Any:
|
|
89
|
+
return self.additional_properties[key]
|
|
90
|
+
|
|
91
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
92
|
+
self.additional_properties[key] = value
|
|
93
|
+
|
|
94
|
+
def __delitem__(self, key: str) -> None:
|
|
95
|
+
del self.additional_properties[key]
|
|
96
|
+
|
|
97
|
+
def __contains__(self, key: str) -> bool:
|
|
98
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import Any, TypeVar
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
T = TypeVar("T", bound="EmailUnsubscribeUpdatedEntry")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@_attrs_define
|
|
14
|
+
class EmailUnsubscribeUpdatedEntry:
|
|
15
|
+
"""
|
|
16
|
+
Attributes:
|
|
17
|
+
email (str): Echoed from the input item.
|
|
18
|
+
unsubscribed (bool): Echoed from the input item.
|
|
19
|
+
updated_at (datetime.datetime): Row's current state-change timestamp. Compare against a previously-observed
|
|
20
|
+
value for the same identifier to distinguish a real state change from an idempotent no-op.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
email: str
|
|
24
|
+
unsubscribed: bool
|
|
25
|
+
updated_at: datetime.datetime
|
|
26
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
27
|
+
|
|
28
|
+
def to_dict(self) -> dict[str, Any]:
|
|
29
|
+
email = self.email
|
|
30
|
+
|
|
31
|
+
unsubscribed = self.unsubscribed
|
|
32
|
+
|
|
33
|
+
updated_at = self.updated_at.isoformat()
|
|
34
|
+
|
|
35
|
+
field_dict: dict[str, Any] = {}
|
|
36
|
+
field_dict.update(self.additional_properties)
|
|
37
|
+
field_dict.update(
|
|
38
|
+
{
|
|
39
|
+
"email": email,
|
|
40
|
+
"unsubscribed": unsubscribed,
|
|
41
|
+
"updated_at": updated_at,
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
return field_dict
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
49
|
+
d = dict(src_dict)
|
|
50
|
+
email = d.pop("email")
|
|
51
|
+
|
|
52
|
+
unsubscribed = d.pop("unsubscribed")
|
|
53
|
+
|
|
54
|
+
updated_at = datetime.datetime.fromisoformat(d.pop("updated_at"))
|
|
55
|
+
|
|
56
|
+
email_unsubscribe_updated_entry = cls(
|
|
57
|
+
email=email,
|
|
58
|
+
unsubscribed=unsubscribed,
|
|
59
|
+
updated_at=updated_at,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
email_unsubscribe_updated_entry.additional_properties = d
|
|
63
|
+
return email_unsubscribe_updated_entry
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def additional_keys(self) -> list[str]:
|
|
67
|
+
return list(self.additional_properties.keys())
|
|
68
|
+
|
|
69
|
+
def __getitem__(self, key: str) -> Any:
|
|
70
|
+
return self.additional_properties[key]
|
|
71
|
+
|
|
72
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
73
|
+
self.additional_properties[key] = value
|
|
74
|
+
|
|
75
|
+
def __delitem__(self, key: str) -> None:
|
|
76
|
+
del self.additional_properties[key]
|
|
77
|
+
|
|
78
|
+
def __contains__(self, key: str) -> bool:
|
|
79
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..models.o_auth_client_credentials_request_grant_type import (
|
|
10
|
+
OAuthClientCredentialsRequestGrantType,
|
|
11
|
+
)
|
|
12
|
+
from ..types import UNSET, Unset
|
|
13
|
+
|
|
14
|
+
T = TypeVar("T", bound="OAuthClientCredentialsRequest")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@_attrs_define
|
|
18
|
+
class OAuthClientCredentialsRequest:
|
|
19
|
+
"""Initial-authentication grant. Credentials may be sent via HTTP Basic (preferred) or as body fields. Per RFC 6749
|
|
20
|
+
§2.3.1, both `client_id` and `client_secret` must be provided together when not using HTTP Basic.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
grant_type (OAuthClientCredentialsRequestGrantType):
|
|
24
|
+
client_id (str | Unset): Opaque client identifier. Required when credentials are not sent via HTTP Basic.
|
|
25
|
+
client_secret (str | Unset): Plaintext client secret (prefixed `tru_cs_`). Required when credentials are not
|
|
26
|
+
sent via HTTP Basic.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
grant_type: OAuthClientCredentialsRequestGrantType
|
|
30
|
+
client_id: str | Unset = UNSET
|
|
31
|
+
client_secret: str | Unset = UNSET
|
|
32
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
33
|
+
|
|
34
|
+
def to_dict(self) -> dict[str, Any]:
|
|
35
|
+
grant_type = self.grant_type.value
|
|
36
|
+
|
|
37
|
+
client_id = self.client_id
|
|
38
|
+
|
|
39
|
+
client_secret = self.client_secret
|
|
40
|
+
|
|
41
|
+
field_dict: dict[str, Any] = {}
|
|
42
|
+
field_dict.update(self.additional_properties)
|
|
43
|
+
field_dict.update(
|
|
44
|
+
{
|
|
45
|
+
"grant_type": grant_type,
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
if client_id is not UNSET:
|
|
49
|
+
field_dict["client_id"] = client_id
|
|
50
|
+
if client_secret is not UNSET:
|
|
51
|
+
field_dict["client_secret"] = client_secret
|
|
52
|
+
|
|
53
|
+
return field_dict
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
57
|
+
d = dict(src_dict)
|
|
58
|
+
grant_type = OAuthClientCredentialsRequestGrantType(d.pop("grant_type"))
|
|
59
|
+
|
|
60
|
+
client_id = d.pop("client_id", UNSET)
|
|
61
|
+
|
|
62
|
+
client_secret = d.pop("client_secret", UNSET)
|
|
63
|
+
|
|
64
|
+
o_auth_client_credentials_request = cls(
|
|
65
|
+
grant_type=grant_type,
|
|
66
|
+
client_id=client_id,
|
|
67
|
+
client_secret=client_secret,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
o_auth_client_credentials_request.additional_properties = d
|
|
71
|
+
return o_auth_client_credentials_request
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def additional_keys(self) -> list[str]:
|
|
75
|
+
return list(self.additional_properties.keys())
|
|
76
|
+
|
|
77
|
+
def __getitem__(self, key: str) -> Any:
|
|
78
|
+
return self.additional_properties[key]
|
|
79
|
+
|
|
80
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
81
|
+
self.additional_properties[key] = value
|
|
82
|
+
|
|
83
|
+
def __delitem__(self, key: str) -> None:
|
|
84
|
+
del self.additional_properties[key]
|
|
85
|
+
|
|
86
|
+
def __contains__(self, key: str) -> bool:
|
|
87
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..models.o_auth_error_response_error import OAuthErrorResponseError
|
|
10
|
+
from ..types import UNSET, Unset
|
|
11
|
+
|
|
12
|
+
T = TypeVar("T", bound="OAuthErrorResponse")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@_attrs_define
|
|
16
|
+
class OAuthErrorResponse:
|
|
17
|
+
"""RFC 6749 §5.2 error envelope.
|
|
18
|
+
|
|
19
|
+
Attributes:
|
|
20
|
+
error (OAuthErrorResponseError): Machine-readable error code.
|
|
21
|
+
error_description (str | Unset): Human-readable description suitable for logging.
|
|
22
|
+
error_uri (str | Unset): Optional URI to a page describing the error.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
error: OAuthErrorResponseError
|
|
26
|
+
error_description: str | Unset = UNSET
|
|
27
|
+
error_uri: str | Unset = UNSET
|
|
28
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
29
|
+
|
|
30
|
+
def to_dict(self) -> dict[str, Any]:
|
|
31
|
+
error = self.error.value
|
|
32
|
+
|
|
33
|
+
error_description = self.error_description
|
|
34
|
+
|
|
35
|
+
error_uri = self.error_uri
|
|
36
|
+
|
|
37
|
+
field_dict: dict[str, Any] = {}
|
|
38
|
+
field_dict.update(self.additional_properties)
|
|
39
|
+
field_dict.update(
|
|
40
|
+
{
|
|
41
|
+
"error": error,
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
if error_description is not UNSET:
|
|
45
|
+
field_dict["error_description"] = error_description
|
|
46
|
+
if error_uri is not UNSET:
|
|
47
|
+
field_dict["error_uri"] = error_uri
|
|
48
|
+
|
|
49
|
+
return field_dict
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
53
|
+
d = dict(src_dict)
|
|
54
|
+
error = OAuthErrorResponseError(d.pop("error"))
|
|
55
|
+
|
|
56
|
+
error_description = d.pop("error_description", UNSET)
|
|
57
|
+
|
|
58
|
+
error_uri = d.pop("error_uri", UNSET)
|
|
59
|
+
|
|
60
|
+
o_auth_error_response = cls(
|
|
61
|
+
error=error,
|
|
62
|
+
error_description=error_description,
|
|
63
|
+
error_uri=error_uri,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
o_auth_error_response.additional_properties = d
|
|
67
|
+
return o_auth_error_response
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def additional_keys(self) -> list[str]:
|
|
71
|
+
return list(self.additional_properties.keys())
|
|
72
|
+
|
|
73
|
+
def __getitem__(self, key: str) -> Any:
|
|
74
|
+
return self.additional_properties[key]
|
|
75
|
+
|
|
76
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
77
|
+
self.additional_properties[key] = value
|
|
78
|
+
|
|
79
|
+
def __delitem__(self, key: str) -> None:
|
|
80
|
+
del self.additional_properties[key]
|
|
81
|
+
|
|
82
|
+
def __contains__(self, key: str) -> bool:
|
|
83
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class OAuthErrorResponseError(str, Enum):
|
|
5
|
+
INVALID_CLIENT = "invalid_client"
|
|
6
|
+
INVALID_GRANT = "invalid_grant"
|
|
7
|
+
INVALID_REQUEST = "invalid_request"
|
|
8
|
+
UNSUPPORTED_GRANT_TYPE = "unsupported_grant_type"
|
|
9
|
+
|
|
10
|
+
def __str__(self) -> str:
|
|
11
|
+
return str(self.value)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..models.o_auth_refresh_token_request_grant_type import (
|
|
10
|
+
OAuthRefreshTokenRequestGrantType,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="OAuthRefreshTokenRequest")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class OAuthRefreshTokenRequest:
|
|
18
|
+
"""Refresh grant. The supplied `refresh_token` is invalidated on success; the response contains a fresh refresh token
|
|
19
|
+
that must be stored atomically.
|
|
20
|
+
|
|
21
|
+
Attributes:
|
|
22
|
+
grant_type (OAuthRefreshTokenRequestGrantType):
|
|
23
|
+
refresh_token (str): The most recent refresh token issued for this `client_id`.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
grant_type: OAuthRefreshTokenRequestGrantType
|
|
27
|
+
refresh_token: str
|
|
28
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
29
|
+
|
|
30
|
+
def to_dict(self) -> dict[str, Any]:
|
|
31
|
+
grant_type = self.grant_type.value
|
|
32
|
+
|
|
33
|
+
refresh_token = self.refresh_token
|
|
34
|
+
|
|
35
|
+
field_dict: dict[str, Any] = {}
|
|
36
|
+
field_dict.update(self.additional_properties)
|
|
37
|
+
field_dict.update(
|
|
38
|
+
{
|
|
39
|
+
"grant_type": grant_type,
|
|
40
|
+
"refresh_token": refresh_token,
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return field_dict
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
48
|
+
d = dict(src_dict)
|
|
49
|
+
grant_type = OAuthRefreshTokenRequestGrantType(d.pop("grant_type"))
|
|
50
|
+
|
|
51
|
+
refresh_token = d.pop("refresh_token")
|
|
52
|
+
|
|
53
|
+
o_auth_refresh_token_request = cls(
|
|
54
|
+
grant_type=grant_type,
|
|
55
|
+
refresh_token=refresh_token,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
o_auth_refresh_token_request.additional_properties = d
|
|
59
|
+
return o_auth_refresh_token_request
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def additional_keys(self) -> list[str]:
|
|
63
|
+
return list(self.additional_properties.keys())
|
|
64
|
+
|
|
65
|
+
def __getitem__(self, key: str) -> Any:
|
|
66
|
+
return self.additional_properties[key]
|
|
67
|
+
|
|
68
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
69
|
+
self.additional_properties[key] = value
|
|
70
|
+
|
|
71
|
+
def __delitem__(self, key: str) -> None:
|
|
72
|
+
del self.additional_properties[key]
|
|
73
|
+
|
|
74
|
+
def __contains__(self, key: str) -> bool:
|
|
75
|
+
return key in self.additional_properties
|