airbyte-agent-zendesk-support 0.18.40__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.
- airbyte_agent_zendesk_support/__init__.py +261 -0
- airbyte_agent_zendesk_support/_vendored/__init__.py +1 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/__init__.py +82 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/auth_strategies.py +1120 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/auth_template.py +135 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/cloud_utils/__init__.py +5 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/cloud_utils/client.py +213 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/connector_model_loader.py +964 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/constants.py +78 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/exceptions.py +23 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/executor/__init__.py +31 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/executor/hosted_executor.py +196 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/executor/local_executor.py +1573 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/executor/models.py +190 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/extensions.py +693 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/http/__init__.py +37 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/http/adapters/__init__.py +9 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/http/adapters/httpx_adapter.py +251 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/http/config.py +98 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/http/exceptions.py +119 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/http/protocols.py +114 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/http/response.py +104 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/http_client.py +686 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/introspection.py +262 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/logging/__init__.py +11 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/logging/logger.py +264 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/logging/types.py +92 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/observability/__init__.py +11 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/observability/config.py +179 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/observability/models.py +19 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/observability/redactor.py +81 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/observability/session.py +103 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/performance/__init__.py +6 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/performance/instrumentation.py +57 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/performance/metrics.py +93 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/schema/__init__.py +75 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/schema/base.py +161 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/schema/components.py +239 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/schema/connector.py +120 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/schema/extensions.py +109 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/schema/operations.py +146 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/schema/security.py +223 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/secrets.py +182 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/telemetry/__init__.py +10 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/telemetry/config.py +32 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/telemetry/events.py +59 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/telemetry/tracker.py +155 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/types.py +245 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/utils.py +60 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/validation.py +822 -0
- airbyte_agent_zendesk_support/connector.py +2276 -0
- airbyte_agent_zendesk_support/connector_model.py +3948 -0
- airbyte_agent_zendesk_support/models.py +790 -0
- airbyte_agent_zendesk_support/types.py +216 -0
- airbyte_agent_zendesk_support-0.18.40.dist-info/METADATA +145 -0
- airbyte_agent_zendesk_support-0.18.40.dist-info/RECORD +57 -0
- airbyte_agent_zendesk_support-0.18.40.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,2276 @@
|
|
|
1
|
+
"""
|
|
2
|
+
zendesk-support connector.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
from typing import TYPE_CHECKING, Any, Callable, TypeVar, AsyncIterator, overload
|
|
9
|
+
try:
|
|
10
|
+
from typing import Literal
|
|
11
|
+
except ImportError:
|
|
12
|
+
from typing_extensions import Literal
|
|
13
|
+
|
|
14
|
+
from .connector_model import ZendeskSupportConnectorModel
|
|
15
|
+
from ._vendored.connector_sdk.introspection import describe_entities, generate_tool_description
|
|
16
|
+
from .types import (
|
|
17
|
+
ArticleAttachmentsDownloadParams,
|
|
18
|
+
ArticleAttachmentsGetParams,
|
|
19
|
+
ArticleAttachmentsListParams,
|
|
20
|
+
ArticlesGetParams,
|
|
21
|
+
ArticlesListParams,
|
|
22
|
+
AttachmentsDownloadParams,
|
|
23
|
+
AttachmentsGetParams,
|
|
24
|
+
AutomationsGetParams,
|
|
25
|
+
AutomationsListParams,
|
|
26
|
+
BrandsGetParams,
|
|
27
|
+
BrandsListParams,
|
|
28
|
+
GroupMembershipsListParams,
|
|
29
|
+
GroupsGetParams,
|
|
30
|
+
GroupsListParams,
|
|
31
|
+
MacrosGetParams,
|
|
32
|
+
MacrosListParams,
|
|
33
|
+
OrganizationMembershipsListParams,
|
|
34
|
+
OrganizationsGetParams,
|
|
35
|
+
OrganizationsListParams,
|
|
36
|
+
SatisfactionRatingsGetParams,
|
|
37
|
+
SatisfactionRatingsListParams,
|
|
38
|
+
SlaPoliciesGetParams,
|
|
39
|
+
SlaPoliciesListParams,
|
|
40
|
+
TagsListParams,
|
|
41
|
+
TicketAuditsListParams,
|
|
42
|
+
TicketCommentsListParams,
|
|
43
|
+
TicketFieldsGetParams,
|
|
44
|
+
TicketFieldsListParams,
|
|
45
|
+
TicketFormsGetParams,
|
|
46
|
+
TicketFormsListParams,
|
|
47
|
+
TicketMetricsListParams,
|
|
48
|
+
TicketsGetParams,
|
|
49
|
+
TicketsListParams,
|
|
50
|
+
TriggersGetParams,
|
|
51
|
+
TriggersListParams,
|
|
52
|
+
UsersGetParams,
|
|
53
|
+
UsersListParams,
|
|
54
|
+
ViewsGetParams,
|
|
55
|
+
ViewsListParams,
|
|
56
|
+
)
|
|
57
|
+
if TYPE_CHECKING:
|
|
58
|
+
from .models import ZendeskSupportAuthConfig
|
|
59
|
+
# Import specific auth config classes for multi-auth isinstance checks
|
|
60
|
+
from .models import ZendeskSupportOauth20AuthConfig, ZendeskSupportApiTokenAuthConfig
|
|
61
|
+
# Import response models and envelope models at runtime
|
|
62
|
+
from .models import (
|
|
63
|
+
ZendeskSupportExecuteResult,
|
|
64
|
+
ZendeskSupportExecuteResultWithMeta,
|
|
65
|
+
TicketsListResult,
|
|
66
|
+
TicketsGetResult,
|
|
67
|
+
UsersListResult,
|
|
68
|
+
UsersGetResult,
|
|
69
|
+
OrganizationsListResult,
|
|
70
|
+
OrganizationsGetResult,
|
|
71
|
+
GroupsListResult,
|
|
72
|
+
GroupsGetResult,
|
|
73
|
+
TicketCommentsListResult,
|
|
74
|
+
AttachmentsGetResult,
|
|
75
|
+
TicketAuditsListResult,
|
|
76
|
+
TicketAuditsListResult,
|
|
77
|
+
TicketMetricsListResult,
|
|
78
|
+
TicketFieldsListResult,
|
|
79
|
+
TicketFieldsGetResult,
|
|
80
|
+
BrandsListResult,
|
|
81
|
+
BrandsGetResult,
|
|
82
|
+
ViewsListResult,
|
|
83
|
+
ViewsGetResult,
|
|
84
|
+
MacrosListResult,
|
|
85
|
+
MacrosGetResult,
|
|
86
|
+
TriggersListResult,
|
|
87
|
+
TriggersGetResult,
|
|
88
|
+
AutomationsListResult,
|
|
89
|
+
AutomationsGetResult,
|
|
90
|
+
TagsListResult,
|
|
91
|
+
SatisfactionRatingsListResult,
|
|
92
|
+
SatisfactionRatingsGetResult,
|
|
93
|
+
GroupMembershipsListResult,
|
|
94
|
+
OrganizationMembershipsListResult,
|
|
95
|
+
SlaPoliciesListResult,
|
|
96
|
+
SlaPoliciesGetResult,
|
|
97
|
+
TicketFormsListResult,
|
|
98
|
+
TicketFormsGetResult,
|
|
99
|
+
ArticlesListResult,
|
|
100
|
+
ArticlesGetResult,
|
|
101
|
+
ArticleAttachmentsListResult,
|
|
102
|
+
ArticleAttachmentsGetResult,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
# TypeVar for decorator type preservation
|
|
106
|
+
_F = TypeVar("_F", bound=Callable[..., Any])
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class ZendeskSupportConnector:
|
|
110
|
+
"""
|
|
111
|
+
Type-safe Zendesk-Support API connector.
|
|
112
|
+
|
|
113
|
+
Auto-generated from OpenAPI specification with full type safety.
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
connector_name = "zendesk-support"
|
|
117
|
+
connector_version = "0.1.4"
|
|
118
|
+
vendored_sdk_version = "0.1.0" # Version of vendored connector-sdk
|
|
119
|
+
|
|
120
|
+
# Map of (entity, action) -> has_extractors for envelope wrapping decision
|
|
121
|
+
_EXTRACTOR_MAP = {
|
|
122
|
+
("tickets", "list"): True,
|
|
123
|
+
("tickets", "get"): True,
|
|
124
|
+
("users", "list"): True,
|
|
125
|
+
("users", "get"): True,
|
|
126
|
+
("organizations", "list"): True,
|
|
127
|
+
("organizations", "get"): True,
|
|
128
|
+
("groups", "list"): True,
|
|
129
|
+
("groups", "get"): True,
|
|
130
|
+
("ticket_comments", "list"): True,
|
|
131
|
+
("attachments", "get"): True,
|
|
132
|
+
("attachments", "download"): False,
|
|
133
|
+
("ticket_audits", "list"): True,
|
|
134
|
+
("ticket_audits", "list"): True,
|
|
135
|
+
("ticket_metrics", "list"): True,
|
|
136
|
+
("ticket_fields", "list"): True,
|
|
137
|
+
("ticket_fields", "get"): True,
|
|
138
|
+
("brands", "list"): True,
|
|
139
|
+
("brands", "get"): True,
|
|
140
|
+
("views", "list"): True,
|
|
141
|
+
("views", "get"): True,
|
|
142
|
+
("macros", "list"): True,
|
|
143
|
+
("macros", "get"): True,
|
|
144
|
+
("triggers", "list"): True,
|
|
145
|
+
("triggers", "get"): True,
|
|
146
|
+
("automations", "list"): True,
|
|
147
|
+
("automations", "get"): True,
|
|
148
|
+
("tags", "list"): True,
|
|
149
|
+
("satisfaction_ratings", "list"): True,
|
|
150
|
+
("satisfaction_ratings", "get"): True,
|
|
151
|
+
("group_memberships", "list"): True,
|
|
152
|
+
("organization_memberships", "list"): True,
|
|
153
|
+
("sla_policies", "list"): True,
|
|
154
|
+
("sla_policies", "get"): True,
|
|
155
|
+
("ticket_forms", "list"): True,
|
|
156
|
+
("ticket_forms", "get"): True,
|
|
157
|
+
("articles", "list"): True,
|
|
158
|
+
("articles", "get"): True,
|
|
159
|
+
("article_attachments", "list"): True,
|
|
160
|
+
("article_attachments", "get"): True,
|
|
161
|
+
("article_attachments", "download"): False,
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
# Map of (entity, action) -> {python_param_name: api_param_name}
|
|
165
|
+
# Used to convert snake_case TypedDict keys to API parameter names in execute()
|
|
166
|
+
_PARAM_MAP = {
|
|
167
|
+
('tickets', 'list'): {'page': 'page', 'external_id': 'external_id', 'sort': 'sort'},
|
|
168
|
+
('tickets', 'get'): {'ticket_id': 'ticket_id'},
|
|
169
|
+
('users', 'list'): {'page': 'page', 'role': 'role', 'external_id': 'external_id'},
|
|
170
|
+
('users', 'get'): {'user_id': 'user_id'},
|
|
171
|
+
('organizations', 'list'): {'page': 'page'},
|
|
172
|
+
('organizations', 'get'): {'organization_id': 'organization_id'},
|
|
173
|
+
('groups', 'list'): {'page': 'page', 'exclude_deleted': 'exclude_deleted'},
|
|
174
|
+
('groups', 'get'): {'group_id': 'group_id'},
|
|
175
|
+
('ticket_comments', 'list'): {'ticket_id': 'ticket_id', 'page': 'page', 'include_inline_images': 'include_inline_images', 'sort': 'sort'},
|
|
176
|
+
('attachments', 'get'): {'attachment_id': 'attachment_id'},
|
|
177
|
+
('attachments', 'download'): {'attachment_id': 'attachment_id', 'range_header': 'range_header'},
|
|
178
|
+
('ticket_audits', 'list'): {'ticket_id': 'ticket_id', 'page': 'page'},
|
|
179
|
+
('ticket_metrics', 'list'): {'page': 'page'},
|
|
180
|
+
('ticket_fields', 'list'): {'page': 'page', 'locale': 'locale'},
|
|
181
|
+
('ticket_fields', 'get'): {'ticket_field_id': 'ticket_field_id'},
|
|
182
|
+
('brands', 'list'): {'page': 'page'},
|
|
183
|
+
('brands', 'get'): {'brand_id': 'brand_id'},
|
|
184
|
+
('views', 'list'): {'page': 'page', 'access': 'access', 'active': 'active', 'group_id': 'group_id', 'sort_by': 'sort_by', 'sort_order': 'sort_order'},
|
|
185
|
+
('views', 'get'): {'view_id': 'view_id'},
|
|
186
|
+
('macros', 'list'): {'page': 'page', 'access': 'access', 'active': 'active', 'category': 'category', 'group_id': 'group_id', 'only_viewable': 'only_viewable', 'sort_by': 'sort_by', 'sort_order': 'sort_order'},
|
|
187
|
+
('macros', 'get'): {'macro_id': 'macro_id'},
|
|
188
|
+
('triggers', 'list'): {'page': 'page', 'active': 'active', 'category_id': 'category_id', 'sort': 'sort'},
|
|
189
|
+
('triggers', 'get'): {'trigger_id': 'trigger_id'},
|
|
190
|
+
('automations', 'list'): {'page': 'page', 'active': 'active', 'sort': 'sort'},
|
|
191
|
+
('automations', 'get'): {'automation_id': 'automation_id'},
|
|
192
|
+
('tags', 'list'): {'page': 'page'},
|
|
193
|
+
('satisfaction_ratings', 'list'): {'page': 'page', 'score': 'score', 'start_time': 'start_time', 'end_time': 'end_time'},
|
|
194
|
+
('satisfaction_ratings', 'get'): {'satisfaction_rating_id': 'satisfaction_rating_id'},
|
|
195
|
+
('group_memberships', 'list'): {'page': 'page'},
|
|
196
|
+
('organization_memberships', 'list'): {'page': 'page'},
|
|
197
|
+
('sla_policies', 'list'): {'page': 'page'},
|
|
198
|
+
('sla_policies', 'get'): {'sla_policy_id': 'sla_policy_id'},
|
|
199
|
+
('ticket_forms', 'list'): {'page': 'page', 'active': 'active', 'end_user_visible': 'end_user_visible'},
|
|
200
|
+
('ticket_forms', 'get'): {'ticket_form_id': 'ticket_form_id'},
|
|
201
|
+
('articles', 'list'): {'page': 'page', 'sort_by': 'sort_by', 'sort_order': 'sort_order'},
|
|
202
|
+
('articles', 'get'): {'id': 'id'},
|
|
203
|
+
('article_attachments', 'list'): {'article_id': 'article_id', 'page': 'page'},
|
|
204
|
+
('article_attachments', 'get'): {'article_id': 'article_id', 'attachment_id': 'attachment_id'},
|
|
205
|
+
('article_attachments', 'download'): {'article_id': 'article_id', 'attachment_id': 'attachment_id', 'range_header': 'range_header'},
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
def __init__(
|
|
209
|
+
self,
|
|
210
|
+
auth_config: ZendeskSupportAuthConfig | None = None,
|
|
211
|
+
external_user_id: str | None = None,
|
|
212
|
+
airbyte_client_id: str | None = None,
|
|
213
|
+
airbyte_client_secret: str | None = None,
|
|
214
|
+
on_token_refresh: Any | None = None,
|
|
215
|
+
subdomain: str | None = None ):
|
|
216
|
+
"""
|
|
217
|
+
Initialize a new zendesk-support connector instance.
|
|
218
|
+
|
|
219
|
+
Supports both local and hosted execution modes:
|
|
220
|
+
- Local mode: Provide `auth_config` for direct API calls
|
|
221
|
+
- Hosted mode: Provide `external_user_id`, `airbyte_client_id`, and `airbyte_client_secret` for hosted execution
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
auth_config: Typed authentication configuration (required for local mode)
|
|
225
|
+
external_user_id: External user ID (required for hosted mode)
|
|
226
|
+
airbyte_client_id: Airbyte OAuth client ID (required for hosted mode)
|
|
227
|
+
airbyte_client_secret: Airbyte OAuth client secret (required for hosted mode)
|
|
228
|
+
on_token_refresh: Optional callback for OAuth2 token refresh persistence.
|
|
229
|
+
Called with new_tokens dict when tokens are refreshed. Can be sync or async.
|
|
230
|
+
Example: lambda tokens: save_to_database(tokens) subdomain: Your Zendesk subdomain
|
|
231
|
+
Examples:
|
|
232
|
+
# Local mode (direct API calls)
|
|
233
|
+
connector = ZendeskSupportConnector(auth_config=ZendeskSupportAuthConfig(access_token="...", refresh_token="..."))
|
|
234
|
+
# Hosted mode (executed on Airbyte cloud)
|
|
235
|
+
connector = ZendeskSupportConnector(
|
|
236
|
+
external_user_id="user-123",
|
|
237
|
+
airbyte_client_id="client_abc123",
|
|
238
|
+
airbyte_client_secret="secret_xyz789"
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
# Local mode with OAuth2 token refresh callback
|
|
242
|
+
def save_tokens(new_tokens: dict) -> None:
|
|
243
|
+
# Persist updated tokens to your storage (file, database, etc.)
|
|
244
|
+
with open("tokens.json", "w") as f:
|
|
245
|
+
json.dump(new_tokens, f)
|
|
246
|
+
|
|
247
|
+
connector = ZendeskSupportConnector(
|
|
248
|
+
auth_config=ZendeskSupportAuthConfig(access_token="...", refresh_token="..."),
|
|
249
|
+
on_token_refresh=save_tokens
|
|
250
|
+
)
|
|
251
|
+
"""
|
|
252
|
+
# Hosted mode: external_user_id, airbyte_client_id, and airbyte_client_secret provided
|
|
253
|
+
if external_user_id and airbyte_client_id and airbyte_client_secret:
|
|
254
|
+
from ._vendored.connector_sdk.executor import HostedExecutor
|
|
255
|
+
self._executor = HostedExecutor(
|
|
256
|
+
external_user_id=external_user_id,
|
|
257
|
+
airbyte_client_id=airbyte_client_id,
|
|
258
|
+
airbyte_client_secret=airbyte_client_secret,
|
|
259
|
+
connector_definition_id=str(ZendeskSupportConnectorModel.id),
|
|
260
|
+
)
|
|
261
|
+
else:
|
|
262
|
+
# Local mode: auth_config required
|
|
263
|
+
if not auth_config:
|
|
264
|
+
raise ValueError(
|
|
265
|
+
"Either provide (external_user_id, airbyte_client_id, airbyte_client_secret) for hosted mode "
|
|
266
|
+
"or auth_config for local mode"
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
from ._vendored.connector_sdk.executor import LocalExecutor
|
|
270
|
+
|
|
271
|
+
# Build config_values dict from server variables
|
|
272
|
+
config_values: dict[str, str] = {}
|
|
273
|
+
if subdomain:
|
|
274
|
+
config_values["subdomain"] = subdomain
|
|
275
|
+
|
|
276
|
+
# Multi-auth connector: detect auth scheme from auth_config type
|
|
277
|
+
auth_scheme: str | None = None
|
|
278
|
+
if auth_config:
|
|
279
|
+
if isinstance(auth_config, ZendeskSupportOauth20AuthConfig):
|
|
280
|
+
auth_scheme = "zendeskOAuth"
|
|
281
|
+
if isinstance(auth_config, ZendeskSupportApiTokenAuthConfig):
|
|
282
|
+
auth_scheme = "zendeskAPIToken"
|
|
283
|
+
|
|
284
|
+
self._executor = LocalExecutor(
|
|
285
|
+
model=ZendeskSupportConnectorModel,
|
|
286
|
+
auth_config=auth_config.model_dump() if auth_config else None,
|
|
287
|
+
auth_scheme=auth_scheme,
|
|
288
|
+
config_values=config_values,
|
|
289
|
+
on_token_refresh=on_token_refresh
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
# Update base_url with server variables if provided
|
|
293
|
+
base_url = self._executor.http_client.base_url
|
|
294
|
+
if subdomain:
|
|
295
|
+
base_url = base_url.replace("{subdomain}", subdomain)
|
|
296
|
+
self._executor.http_client.base_url = base_url
|
|
297
|
+
|
|
298
|
+
# Initialize entity query objects
|
|
299
|
+
self.tickets = TicketsQuery(self)
|
|
300
|
+
self.users = UsersQuery(self)
|
|
301
|
+
self.organizations = OrganizationsQuery(self)
|
|
302
|
+
self.groups = GroupsQuery(self)
|
|
303
|
+
self.ticket_comments = TicketCommentsQuery(self)
|
|
304
|
+
self.attachments = AttachmentsQuery(self)
|
|
305
|
+
self.ticket_audits = TicketAuditsQuery(self)
|
|
306
|
+
self.ticket_metrics = TicketMetricsQuery(self)
|
|
307
|
+
self.ticket_fields = TicketFieldsQuery(self)
|
|
308
|
+
self.brands = BrandsQuery(self)
|
|
309
|
+
self.views = ViewsQuery(self)
|
|
310
|
+
self.macros = MacrosQuery(self)
|
|
311
|
+
self.triggers = TriggersQuery(self)
|
|
312
|
+
self.automations = AutomationsQuery(self)
|
|
313
|
+
self.tags = TagsQuery(self)
|
|
314
|
+
self.satisfaction_ratings = SatisfactionRatingsQuery(self)
|
|
315
|
+
self.group_memberships = GroupMembershipsQuery(self)
|
|
316
|
+
self.organization_memberships = OrganizationMembershipsQuery(self)
|
|
317
|
+
self.sla_policies = SlaPoliciesQuery(self)
|
|
318
|
+
self.ticket_forms = TicketFormsQuery(self)
|
|
319
|
+
self.articles = ArticlesQuery(self)
|
|
320
|
+
self.article_attachments = ArticleAttachmentsQuery(self)
|
|
321
|
+
|
|
322
|
+
# ===== TYPED EXECUTE METHOD (Recommended Interface) =====
|
|
323
|
+
|
|
324
|
+
@overload
|
|
325
|
+
async def execute(
|
|
326
|
+
self,
|
|
327
|
+
entity: Literal["tickets"],
|
|
328
|
+
action: Literal["list"],
|
|
329
|
+
params: "TicketsListParams"
|
|
330
|
+
) -> "TicketsListResult": ...
|
|
331
|
+
|
|
332
|
+
@overload
|
|
333
|
+
async def execute(
|
|
334
|
+
self,
|
|
335
|
+
entity: Literal["tickets"],
|
|
336
|
+
action: Literal["get"],
|
|
337
|
+
params: "TicketsGetParams"
|
|
338
|
+
) -> "TicketsGetResult": ...
|
|
339
|
+
|
|
340
|
+
@overload
|
|
341
|
+
async def execute(
|
|
342
|
+
self,
|
|
343
|
+
entity: Literal["users"],
|
|
344
|
+
action: Literal["list"],
|
|
345
|
+
params: "UsersListParams"
|
|
346
|
+
) -> "UsersListResult": ...
|
|
347
|
+
|
|
348
|
+
@overload
|
|
349
|
+
async def execute(
|
|
350
|
+
self,
|
|
351
|
+
entity: Literal["users"],
|
|
352
|
+
action: Literal["get"],
|
|
353
|
+
params: "UsersGetParams"
|
|
354
|
+
) -> "UsersGetResult": ...
|
|
355
|
+
|
|
356
|
+
@overload
|
|
357
|
+
async def execute(
|
|
358
|
+
self,
|
|
359
|
+
entity: Literal["organizations"],
|
|
360
|
+
action: Literal["list"],
|
|
361
|
+
params: "OrganizationsListParams"
|
|
362
|
+
) -> "OrganizationsListResult": ...
|
|
363
|
+
|
|
364
|
+
@overload
|
|
365
|
+
async def execute(
|
|
366
|
+
self,
|
|
367
|
+
entity: Literal["organizations"],
|
|
368
|
+
action: Literal["get"],
|
|
369
|
+
params: "OrganizationsGetParams"
|
|
370
|
+
) -> "OrganizationsGetResult": ...
|
|
371
|
+
|
|
372
|
+
@overload
|
|
373
|
+
async def execute(
|
|
374
|
+
self,
|
|
375
|
+
entity: Literal["groups"],
|
|
376
|
+
action: Literal["list"],
|
|
377
|
+
params: "GroupsListParams"
|
|
378
|
+
) -> "GroupsListResult": ...
|
|
379
|
+
|
|
380
|
+
@overload
|
|
381
|
+
async def execute(
|
|
382
|
+
self,
|
|
383
|
+
entity: Literal["groups"],
|
|
384
|
+
action: Literal["get"],
|
|
385
|
+
params: "GroupsGetParams"
|
|
386
|
+
) -> "GroupsGetResult": ...
|
|
387
|
+
|
|
388
|
+
@overload
|
|
389
|
+
async def execute(
|
|
390
|
+
self,
|
|
391
|
+
entity: Literal["ticket_comments"],
|
|
392
|
+
action: Literal["list"],
|
|
393
|
+
params: "TicketCommentsListParams"
|
|
394
|
+
) -> "TicketCommentsListResult": ...
|
|
395
|
+
|
|
396
|
+
@overload
|
|
397
|
+
async def execute(
|
|
398
|
+
self,
|
|
399
|
+
entity: Literal["attachments"],
|
|
400
|
+
action: Literal["get"],
|
|
401
|
+
params: "AttachmentsGetParams"
|
|
402
|
+
) -> "AttachmentsGetResult": ...
|
|
403
|
+
|
|
404
|
+
@overload
|
|
405
|
+
async def execute(
|
|
406
|
+
self,
|
|
407
|
+
entity: Literal["attachments"],
|
|
408
|
+
action: Literal["download"],
|
|
409
|
+
params: "AttachmentsDownloadParams"
|
|
410
|
+
) -> "AsyncIterator[bytes]": ...
|
|
411
|
+
|
|
412
|
+
@overload
|
|
413
|
+
async def execute(
|
|
414
|
+
self,
|
|
415
|
+
entity: Literal["ticket_audits"],
|
|
416
|
+
action: Literal["list"],
|
|
417
|
+
params: "TicketAuditsListParams"
|
|
418
|
+
) -> "TicketAuditsListResult": ...
|
|
419
|
+
|
|
420
|
+
@overload
|
|
421
|
+
async def execute(
|
|
422
|
+
self,
|
|
423
|
+
entity: Literal["ticket_audits"],
|
|
424
|
+
action: Literal["list"],
|
|
425
|
+
params: "TicketAuditsListParams"
|
|
426
|
+
) -> "TicketAuditsListResult": ...
|
|
427
|
+
|
|
428
|
+
@overload
|
|
429
|
+
async def execute(
|
|
430
|
+
self,
|
|
431
|
+
entity: Literal["ticket_metrics"],
|
|
432
|
+
action: Literal["list"],
|
|
433
|
+
params: "TicketMetricsListParams"
|
|
434
|
+
) -> "TicketMetricsListResult": ...
|
|
435
|
+
|
|
436
|
+
@overload
|
|
437
|
+
async def execute(
|
|
438
|
+
self,
|
|
439
|
+
entity: Literal["ticket_fields"],
|
|
440
|
+
action: Literal["list"],
|
|
441
|
+
params: "TicketFieldsListParams"
|
|
442
|
+
) -> "TicketFieldsListResult": ...
|
|
443
|
+
|
|
444
|
+
@overload
|
|
445
|
+
async def execute(
|
|
446
|
+
self,
|
|
447
|
+
entity: Literal["ticket_fields"],
|
|
448
|
+
action: Literal["get"],
|
|
449
|
+
params: "TicketFieldsGetParams"
|
|
450
|
+
) -> "TicketFieldsGetResult": ...
|
|
451
|
+
|
|
452
|
+
@overload
|
|
453
|
+
async def execute(
|
|
454
|
+
self,
|
|
455
|
+
entity: Literal["brands"],
|
|
456
|
+
action: Literal["list"],
|
|
457
|
+
params: "BrandsListParams"
|
|
458
|
+
) -> "BrandsListResult": ...
|
|
459
|
+
|
|
460
|
+
@overload
|
|
461
|
+
async def execute(
|
|
462
|
+
self,
|
|
463
|
+
entity: Literal["brands"],
|
|
464
|
+
action: Literal["get"],
|
|
465
|
+
params: "BrandsGetParams"
|
|
466
|
+
) -> "BrandsGetResult": ...
|
|
467
|
+
|
|
468
|
+
@overload
|
|
469
|
+
async def execute(
|
|
470
|
+
self,
|
|
471
|
+
entity: Literal["views"],
|
|
472
|
+
action: Literal["list"],
|
|
473
|
+
params: "ViewsListParams"
|
|
474
|
+
) -> "ViewsListResult": ...
|
|
475
|
+
|
|
476
|
+
@overload
|
|
477
|
+
async def execute(
|
|
478
|
+
self,
|
|
479
|
+
entity: Literal["views"],
|
|
480
|
+
action: Literal["get"],
|
|
481
|
+
params: "ViewsGetParams"
|
|
482
|
+
) -> "ViewsGetResult": ...
|
|
483
|
+
|
|
484
|
+
@overload
|
|
485
|
+
async def execute(
|
|
486
|
+
self,
|
|
487
|
+
entity: Literal["macros"],
|
|
488
|
+
action: Literal["list"],
|
|
489
|
+
params: "MacrosListParams"
|
|
490
|
+
) -> "MacrosListResult": ...
|
|
491
|
+
|
|
492
|
+
@overload
|
|
493
|
+
async def execute(
|
|
494
|
+
self,
|
|
495
|
+
entity: Literal["macros"],
|
|
496
|
+
action: Literal["get"],
|
|
497
|
+
params: "MacrosGetParams"
|
|
498
|
+
) -> "MacrosGetResult": ...
|
|
499
|
+
|
|
500
|
+
@overload
|
|
501
|
+
async def execute(
|
|
502
|
+
self,
|
|
503
|
+
entity: Literal["triggers"],
|
|
504
|
+
action: Literal["list"],
|
|
505
|
+
params: "TriggersListParams"
|
|
506
|
+
) -> "TriggersListResult": ...
|
|
507
|
+
|
|
508
|
+
@overload
|
|
509
|
+
async def execute(
|
|
510
|
+
self,
|
|
511
|
+
entity: Literal["triggers"],
|
|
512
|
+
action: Literal["get"],
|
|
513
|
+
params: "TriggersGetParams"
|
|
514
|
+
) -> "TriggersGetResult": ...
|
|
515
|
+
|
|
516
|
+
@overload
|
|
517
|
+
async def execute(
|
|
518
|
+
self,
|
|
519
|
+
entity: Literal["automations"],
|
|
520
|
+
action: Literal["list"],
|
|
521
|
+
params: "AutomationsListParams"
|
|
522
|
+
) -> "AutomationsListResult": ...
|
|
523
|
+
|
|
524
|
+
@overload
|
|
525
|
+
async def execute(
|
|
526
|
+
self,
|
|
527
|
+
entity: Literal["automations"],
|
|
528
|
+
action: Literal["get"],
|
|
529
|
+
params: "AutomationsGetParams"
|
|
530
|
+
) -> "AutomationsGetResult": ...
|
|
531
|
+
|
|
532
|
+
@overload
|
|
533
|
+
async def execute(
|
|
534
|
+
self,
|
|
535
|
+
entity: Literal["tags"],
|
|
536
|
+
action: Literal["list"],
|
|
537
|
+
params: "TagsListParams"
|
|
538
|
+
) -> "TagsListResult": ...
|
|
539
|
+
|
|
540
|
+
@overload
|
|
541
|
+
async def execute(
|
|
542
|
+
self,
|
|
543
|
+
entity: Literal["satisfaction_ratings"],
|
|
544
|
+
action: Literal["list"],
|
|
545
|
+
params: "SatisfactionRatingsListParams"
|
|
546
|
+
) -> "SatisfactionRatingsListResult": ...
|
|
547
|
+
|
|
548
|
+
@overload
|
|
549
|
+
async def execute(
|
|
550
|
+
self,
|
|
551
|
+
entity: Literal["satisfaction_ratings"],
|
|
552
|
+
action: Literal["get"],
|
|
553
|
+
params: "SatisfactionRatingsGetParams"
|
|
554
|
+
) -> "SatisfactionRatingsGetResult": ...
|
|
555
|
+
|
|
556
|
+
@overload
|
|
557
|
+
async def execute(
|
|
558
|
+
self,
|
|
559
|
+
entity: Literal["group_memberships"],
|
|
560
|
+
action: Literal["list"],
|
|
561
|
+
params: "GroupMembershipsListParams"
|
|
562
|
+
) -> "GroupMembershipsListResult": ...
|
|
563
|
+
|
|
564
|
+
@overload
|
|
565
|
+
async def execute(
|
|
566
|
+
self,
|
|
567
|
+
entity: Literal["organization_memberships"],
|
|
568
|
+
action: Literal["list"],
|
|
569
|
+
params: "OrganizationMembershipsListParams"
|
|
570
|
+
) -> "OrganizationMembershipsListResult": ...
|
|
571
|
+
|
|
572
|
+
@overload
|
|
573
|
+
async def execute(
|
|
574
|
+
self,
|
|
575
|
+
entity: Literal["sla_policies"],
|
|
576
|
+
action: Literal["list"],
|
|
577
|
+
params: "SlaPoliciesListParams"
|
|
578
|
+
) -> "SlaPoliciesListResult": ...
|
|
579
|
+
|
|
580
|
+
@overload
|
|
581
|
+
async def execute(
|
|
582
|
+
self,
|
|
583
|
+
entity: Literal["sla_policies"],
|
|
584
|
+
action: Literal["get"],
|
|
585
|
+
params: "SlaPoliciesGetParams"
|
|
586
|
+
) -> "SlaPoliciesGetResult": ...
|
|
587
|
+
|
|
588
|
+
@overload
|
|
589
|
+
async def execute(
|
|
590
|
+
self,
|
|
591
|
+
entity: Literal["ticket_forms"],
|
|
592
|
+
action: Literal["list"],
|
|
593
|
+
params: "TicketFormsListParams"
|
|
594
|
+
) -> "TicketFormsListResult": ...
|
|
595
|
+
|
|
596
|
+
@overload
|
|
597
|
+
async def execute(
|
|
598
|
+
self,
|
|
599
|
+
entity: Literal["ticket_forms"],
|
|
600
|
+
action: Literal["get"],
|
|
601
|
+
params: "TicketFormsGetParams"
|
|
602
|
+
) -> "TicketFormsGetResult": ...
|
|
603
|
+
|
|
604
|
+
@overload
|
|
605
|
+
async def execute(
|
|
606
|
+
self,
|
|
607
|
+
entity: Literal["articles"],
|
|
608
|
+
action: Literal["list"],
|
|
609
|
+
params: "ArticlesListParams"
|
|
610
|
+
) -> "ArticlesListResult": ...
|
|
611
|
+
|
|
612
|
+
@overload
|
|
613
|
+
async def execute(
|
|
614
|
+
self,
|
|
615
|
+
entity: Literal["articles"],
|
|
616
|
+
action: Literal["get"],
|
|
617
|
+
params: "ArticlesGetParams"
|
|
618
|
+
) -> "ArticlesGetResult": ...
|
|
619
|
+
|
|
620
|
+
@overload
|
|
621
|
+
async def execute(
|
|
622
|
+
self,
|
|
623
|
+
entity: Literal["article_attachments"],
|
|
624
|
+
action: Literal["list"],
|
|
625
|
+
params: "ArticleAttachmentsListParams"
|
|
626
|
+
) -> "ArticleAttachmentsListResult": ...
|
|
627
|
+
|
|
628
|
+
@overload
|
|
629
|
+
async def execute(
|
|
630
|
+
self,
|
|
631
|
+
entity: Literal["article_attachments"],
|
|
632
|
+
action: Literal["get"],
|
|
633
|
+
params: "ArticleAttachmentsGetParams"
|
|
634
|
+
) -> "ArticleAttachmentsGetResult": ...
|
|
635
|
+
|
|
636
|
+
@overload
|
|
637
|
+
async def execute(
|
|
638
|
+
self,
|
|
639
|
+
entity: Literal["article_attachments"],
|
|
640
|
+
action: Literal["download"],
|
|
641
|
+
params: "ArticleAttachmentsDownloadParams"
|
|
642
|
+
) -> "AsyncIterator[bytes]": ...
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
@overload
|
|
646
|
+
async def execute(
|
|
647
|
+
self,
|
|
648
|
+
entity: str,
|
|
649
|
+
action: str,
|
|
650
|
+
params: dict[str, Any]
|
|
651
|
+
) -> ZendeskSupportExecuteResult[Any] | ZendeskSupportExecuteResultWithMeta[Any, Any] | Any: ...
|
|
652
|
+
|
|
653
|
+
async def execute(
|
|
654
|
+
self,
|
|
655
|
+
entity: str,
|
|
656
|
+
action: str,
|
|
657
|
+
params: dict[str, Any] | None = None
|
|
658
|
+
) -> Any:
|
|
659
|
+
"""
|
|
660
|
+
Execute an entity operation with full type safety.
|
|
661
|
+
|
|
662
|
+
This is the recommended interface for blessed connectors as it:
|
|
663
|
+
- Uses the same signature as non-blessed connectors
|
|
664
|
+
- Provides full IDE autocomplete for entity/action/params
|
|
665
|
+
- Makes migration from generic to blessed connectors seamless
|
|
666
|
+
|
|
667
|
+
Args:
|
|
668
|
+
entity: Entity name (e.g., "customers")
|
|
669
|
+
action: Operation action (e.g., "create", "get", "list")
|
|
670
|
+
params: Operation parameters (typed based on entity+action)
|
|
671
|
+
|
|
672
|
+
Returns:
|
|
673
|
+
Typed response based on the operation
|
|
674
|
+
|
|
675
|
+
Example:
|
|
676
|
+
customer = await connector.execute(
|
|
677
|
+
entity="customers",
|
|
678
|
+
action="get",
|
|
679
|
+
params={"id": "cus_123"}
|
|
680
|
+
)
|
|
681
|
+
"""
|
|
682
|
+
from ._vendored.connector_sdk.executor import ExecutionConfig
|
|
683
|
+
|
|
684
|
+
# Remap parameter names from snake_case (TypedDict keys) to API parameter names
|
|
685
|
+
if params:
|
|
686
|
+
param_map = self._PARAM_MAP.get((entity, action), {})
|
|
687
|
+
if param_map:
|
|
688
|
+
params = {param_map.get(k, k): v for k, v in params.items()}
|
|
689
|
+
|
|
690
|
+
# Use ExecutionConfig for both local and hosted executors
|
|
691
|
+
config = ExecutionConfig(
|
|
692
|
+
entity=entity,
|
|
693
|
+
action=action,
|
|
694
|
+
params=params
|
|
695
|
+
)
|
|
696
|
+
|
|
697
|
+
result = await self._executor.execute(config)
|
|
698
|
+
|
|
699
|
+
if not result.success:
|
|
700
|
+
raise RuntimeError(f"Execution failed: {result.error}")
|
|
701
|
+
|
|
702
|
+
# Check if this operation has extractors configured
|
|
703
|
+
has_extractors = self._EXTRACTOR_MAP.get((entity, action), False)
|
|
704
|
+
|
|
705
|
+
if has_extractors:
|
|
706
|
+
# With extractors - return Pydantic envelope with data and meta
|
|
707
|
+
if result.meta is not None:
|
|
708
|
+
return ZendeskSupportExecuteResultWithMeta[Any, Any](
|
|
709
|
+
data=result.data,
|
|
710
|
+
meta=result.meta
|
|
711
|
+
)
|
|
712
|
+
else:
|
|
713
|
+
return ZendeskSupportExecuteResult[Any](data=result.data)
|
|
714
|
+
else:
|
|
715
|
+
# No extractors - return raw response data
|
|
716
|
+
return result.data
|
|
717
|
+
|
|
718
|
+
# ===== INTROSPECTION METHODS =====
|
|
719
|
+
|
|
720
|
+
@classmethod
|
|
721
|
+
def describe(cls, func: _F) -> _F:
|
|
722
|
+
"""
|
|
723
|
+
Decorator that populates a function's docstring with connector capabilities.
|
|
724
|
+
|
|
725
|
+
This class method can be used as a decorator to automatically generate
|
|
726
|
+
comprehensive documentation for AI tool functions.
|
|
727
|
+
|
|
728
|
+
Usage:
|
|
729
|
+
@mcp.tool()
|
|
730
|
+
@ZendeskSupportConnector.describe
|
|
731
|
+
async def execute(entity: str, action: str, params: dict):
|
|
732
|
+
'''Execute operations.'''
|
|
733
|
+
...
|
|
734
|
+
|
|
735
|
+
The decorated function's __doc__ will be updated with:
|
|
736
|
+
- Available entities and their actions
|
|
737
|
+
- Parameter signatures with required (*) and optional (?) markers
|
|
738
|
+
- Response structure documentation
|
|
739
|
+
- Example questions (if available in OpenAPI spec)
|
|
740
|
+
|
|
741
|
+
Args:
|
|
742
|
+
func: The function to decorate
|
|
743
|
+
|
|
744
|
+
Returns:
|
|
745
|
+
The same function with updated __doc__
|
|
746
|
+
"""
|
|
747
|
+
description = generate_tool_description(ZendeskSupportConnectorModel)
|
|
748
|
+
|
|
749
|
+
original_doc = func.__doc__ or ""
|
|
750
|
+
if original_doc.strip():
|
|
751
|
+
func.__doc__ = f"{original_doc.strip()}\n{description}"
|
|
752
|
+
else:
|
|
753
|
+
func.__doc__ = description
|
|
754
|
+
|
|
755
|
+
return func
|
|
756
|
+
|
|
757
|
+
def list_entities(self) -> list[dict[str, Any]]:
|
|
758
|
+
"""
|
|
759
|
+
Get structured data about available entities, actions, and parameters.
|
|
760
|
+
|
|
761
|
+
Returns a list of entity descriptions with:
|
|
762
|
+
- entity_name: Name of the entity (e.g., "contacts", "deals")
|
|
763
|
+
- description: Entity description from the first endpoint
|
|
764
|
+
- available_actions: List of actions (e.g., ["list", "get", "create"])
|
|
765
|
+
- parameters: Dict mapping action -> list of parameter dicts
|
|
766
|
+
|
|
767
|
+
Example:
|
|
768
|
+
entities = connector.list_entities()
|
|
769
|
+
for entity in entities:
|
|
770
|
+
print(f"{entity['entity_name']}: {entity['available_actions']}")
|
|
771
|
+
"""
|
|
772
|
+
return describe_entities(ZendeskSupportConnectorModel)
|
|
773
|
+
|
|
774
|
+
def entity_schema(self, entity: str) -> dict[str, Any] | None:
|
|
775
|
+
"""
|
|
776
|
+
Get the JSON schema for an entity.
|
|
777
|
+
|
|
778
|
+
Args:
|
|
779
|
+
entity: Entity name (e.g., "contacts", "companies")
|
|
780
|
+
|
|
781
|
+
Returns:
|
|
782
|
+
JSON schema dict describing the entity structure, or None if not found.
|
|
783
|
+
|
|
784
|
+
Example:
|
|
785
|
+
schema = connector.entity_schema("contacts")
|
|
786
|
+
if schema:
|
|
787
|
+
print(f"Contact properties: {list(schema.get('properties', {}).keys())}")
|
|
788
|
+
"""
|
|
789
|
+
entity_def = next(
|
|
790
|
+
(e for e in ZendeskSupportConnectorModel.entities if e.name == entity),
|
|
791
|
+
None
|
|
792
|
+
)
|
|
793
|
+
if entity_def is None:
|
|
794
|
+
logging.getLogger(__name__).warning(
|
|
795
|
+
f"Entity '{entity}' not found. Available entities: "
|
|
796
|
+
f"{[e.name for e in ZendeskSupportConnectorModel.entities]}"
|
|
797
|
+
)
|
|
798
|
+
return entity_def.entity_schema if entity_def else None
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
class TicketsQuery:
|
|
803
|
+
"""
|
|
804
|
+
Query class for Tickets entity operations.
|
|
805
|
+
"""
|
|
806
|
+
|
|
807
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
808
|
+
"""Initialize query with connector reference."""
|
|
809
|
+
self._connector = connector
|
|
810
|
+
|
|
811
|
+
async def list(
|
|
812
|
+
self,
|
|
813
|
+
page: int | None = None,
|
|
814
|
+
external_id: str | None = None,
|
|
815
|
+
sort: str | None = None,
|
|
816
|
+
**kwargs
|
|
817
|
+
) -> TicketsListResult:
|
|
818
|
+
"""
|
|
819
|
+
Returns a list of all tickets in your account
|
|
820
|
+
|
|
821
|
+
Args:
|
|
822
|
+
page: Page number for pagination
|
|
823
|
+
external_id: Lists tickets by external id
|
|
824
|
+
sort: Sort order
|
|
825
|
+
**kwargs: Additional parameters
|
|
826
|
+
|
|
827
|
+
Returns:
|
|
828
|
+
TicketsListResult
|
|
829
|
+
"""
|
|
830
|
+
params = {k: v for k, v in {
|
|
831
|
+
"page": page,
|
|
832
|
+
"external_id": external_id,
|
|
833
|
+
"sort": sort,
|
|
834
|
+
**kwargs
|
|
835
|
+
}.items() if v is not None}
|
|
836
|
+
|
|
837
|
+
result = await self._connector.execute("tickets", "list", params)
|
|
838
|
+
# Cast generic envelope to concrete typed result
|
|
839
|
+
return TicketsListResult(
|
|
840
|
+
data=result.data,
|
|
841
|
+
meta=result.meta )
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
async def get(
|
|
846
|
+
self,
|
|
847
|
+
ticket_id: str,
|
|
848
|
+
**kwargs
|
|
849
|
+
) -> TicketsGetResult:
|
|
850
|
+
"""
|
|
851
|
+
Returns a ticket by its ID
|
|
852
|
+
|
|
853
|
+
Args:
|
|
854
|
+
ticket_id: The ID of the ticket
|
|
855
|
+
**kwargs: Additional parameters
|
|
856
|
+
|
|
857
|
+
Returns:
|
|
858
|
+
TicketsGetResult
|
|
859
|
+
"""
|
|
860
|
+
params = {k: v for k, v in {
|
|
861
|
+
"ticket_id": ticket_id,
|
|
862
|
+
**kwargs
|
|
863
|
+
}.items() if v is not None}
|
|
864
|
+
|
|
865
|
+
result = await self._connector.execute("tickets", "get", params)
|
|
866
|
+
# Cast generic envelope to concrete typed result
|
|
867
|
+
return TicketsGetResult(
|
|
868
|
+
data=result.data )
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
class UsersQuery:
|
|
873
|
+
"""
|
|
874
|
+
Query class for Users entity operations.
|
|
875
|
+
"""
|
|
876
|
+
|
|
877
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
878
|
+
"""Initialize query with connector reference."""
|
|
879
|
+
self._connector = connector
|
|
880
|
+
|
|
881
|
+
async def list(
|
|
882
|
+
self,
|
|
883
|
+
page: int | None = None,
|
|
884
|
+
role: str | None = None,
|
|
885
|
+
external_id: str | None = None,
|
|
886
|
+
**kwargs
|
|
887
|
+
) -> UsersListResult:
|
|
888
|
+
"""
|
|
889
|
+
Returns a list of all users in your account
|
|
890
|
+
|
|
891
|
+
Args:
|
|
892
|
+
page: Page number for pagination
|
|
893
|
+
role: Filter by role
|
|
894
|
+
external_id: Filter by external id
|
|
895
|
+
**kwargs: Additional parameters
|
|
896
|
+
|
|
897
|
+
Returns:
|
|
898
|
+
UsersListResult
|
|
899
|
+
"""
|
|
900
|
+
params = {k: v for k, v in {
|
|
901
|
+
"page": page,
|
|
902
|
+
"role": role,
|
|
903
|
+
"external_id": external_id,
|
|
904
|
+
**kwargs
|
|
905
|
+
}.items() if v is not None}
|
|
906
|
+
|
|
907
|
+
result = await self._connector.execute("users", "list", params)
|
|
908
|
+
# Cast generic envelope to concrete typed result
|
|
909
|
+
return UsersListResult(
|
|
910
|
+
data=result.data,
|
|
911
|
+
meta=result.meta )
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
async def get(
|
|
916
|
+
self,
|
|
917
|
+
user_id: str,
|
|
918
|
+
**kwargs
|
|
919
|
+
) -> UsersGetResult:
|
|
920
|
+
"""
|
|
921
|
+
Returns a user by their ID
|
|
922
|
+
|
|
923
|
+
Args:
|
|
924
|
+
user_id: The ID of the user
|
|
925
|
+
**kwargs: Additional parameters
|
|
926
|
+
|
|
927
|
+
Returns:
|
|
928
|
+
UsersGetResult
|
|
929
|
+
"""
|
|
930
|
+
params = {k: v for k, v in {
|
|
931
|
+
"user_id": user_id,
|
|
932
|
+
**kwargs
|
|
933
|
+
}.items() if v is not None}
|
|
934
|
+
|
|
935
|
+
result = await self._connector.execute("users", "get", params)
|
|
936
|
+
# Cast generic envelope to concrete typed result
|
|
937
|
+
return UsersGetResult(
|
|
938
|
+
data=result.data )
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
class OrganizationsQuery:
|
|
943
|
+
"""
|
|
944
|
+
Query class for Organizations entity operations.
|
|
945
|
+
"""
|
|
946
|
+
|
|
947
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
948
|
+
"""Initialize query with connector reference."""
|
|
949
|
+
self._connector = connector
|
|
950
|
+
|
|
951
|
+
async def list(
|
|
952
|
+
self,
|
|
953
|
+
page: int | None = None,
|
|
954
|
+
**kwargs
|
|
955
|
+
) -> OrganizationsListResult:
|
|
956
|
+
"""
|
|
957
|
+
Returns a list of all organizations in your account
|
|
958
|
+
|
|
959
|
+
Args:
|
|
960
|
+
page: Page number for pagination
|
|
961
|
+
**kwargs: Additional parameters
|
|
962
|
+
|
|
963
|
+
Returns:
|
|
964
|
+
OrganizationsListResult
|
|
965
|
+
"""
|
|
966
|
+
params = {k: v for k, v in {
|
|
967
|
+
"page": page,
|
|
968
|
+
**kwargs
|
|
969
|
+
}.items() if v is not None}
|
|
970
|
+
|
|
971
|
+
result = await self._connector.execute("organizations", "list", params)
|
|
972
|
+
# Cast generic envelope to concrete typed result
|
|
973
|
+
return OrganizationsListResult(
|
|
974
|
+
data=result.data,
|
|
975
|
+
meta=result.meta )
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
async def get(
|
|
980
|
+
self,
|
|
981
|
+
organization_id: str,
|
|
982
|
+
**kwargs
|
|
983
|
+
) -> OrganizationsGetResult:
|
|
984
|
+
"""
|
|
985
|
+
Returns an organization by its ID
|
|
986
|
+
|
|
987
|
+
Args:
|
|
988
|
+
organization_id: The ID of the organization
|
|
989
|
+
**kwargs: Additional parameters
|
|
990
|
+
|
|
991
|
+
Returns:
|
|
992
|
+
OrganizationsGetResult
|
|
993
|
+
"""
|
|
994
|
+
params = {k: v for k, v in {
|
|
995
|
+
"organization_id": organization_id,
|
|
996
|
+
**kwargs
|
|
997
|
+
}.items() if v is not None}
|
|
998
|
+
|
|
999
|
+
result = await self._connector.execute("organizations", "get", params)
|
|
1000
|
+
# Cast generic envelope to concrete typed result
|
|
1001
|
+
return OrganizationsGetResult(
|
|
1002
|
+
data=result.data )
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
class GroupsQuery:
|
|
1007
|
+
"""
|
|
1008
|
+
Query class for Groups entity operations.
|
|
1009
|
+
"""
|
|
1010
|
+
|
|
1011
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1012
|
+
"""Initialize query with connector reference."""
|
|
1013
|
+
self._connector = connector
|
|
1014
|
+
|
|
1015
|
+
async def list(
|
|
1016
|
+
self,
|
|
1017
|
+
page: int | None = None,
|
|
1018
|
+
exclude_deleted: bool | None = None,
|
|
1019
|
+
**kwargs
|
|
1020
|
+
) -> GroupsListResult:
|
|
1021
|
+
"""
|
|
1022
|
+
Returns a list of all groups in your account
|
|
1023
|
+
|
|
1024
|
+
Args:
|
|
1025
|
+
page: Page number for pagination
|
|
1026
|
+
exclude_deleted: Exclude deleted groups
|
|
1027
|
+
**kwargs: Additional parameters
|
|
1028
|
+
|
|
1029
|
+
Returns:
|
|
1030
|
+
GroupsListResult
|
|
1031
|
+
"""
|
|
1032
|
+
params = {k: v for k, v in {
|
|
1033
|
+
"page": page,
|
|
1034
|
+
"exclude_deleted": exclude_deleted,
|
|
1035
|
+
**kwargs
|
|
1036
|
+
}.items() if v is not None}
|
|
1037
|
+
|
|
1038
|
+
result = await self._connector.execute("groups", "list", params)
|
|
1039
|
+
# Cast generic envelope to concrete typed result
|
|
1040
|
+
return GroupsListResult(
|
|
1041
|
+
data=result.data,
|
|
1042
|
+
meta=result.meta )
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
async def get(
|
|
1047
|
+
self,
|
|
1048
|
+
group_id: str,
|
|
1049
|
+
**kwargs
|
|
1050
|
+
) -> GroupsGetResult:
|
|
1051
|
+
"""
|
|
1052
|
+
Returns a group by its ID
|
|
1053
|
+
|
|
1054
|
+
Args:
|
|
1055
|
+
group_id: The ID of the group
|
|
1056
|
+
**kwargs: Additional parameters
|
|
1057
|
+
|
|
1058
|
+
Returns:
|
|
1059
|
+
GroupsGetResult
|
|
1060
|
+
"""
|
|
1061
|
+
params = {k: v for k, v in {
|
|
1062
|
+
"group_id": group_id,
|
|
1063
|
+
**kwargs
|
|
1064
|
+
}.items() if v is not None}
|
|
1065
|
+
|
|
1066
|
+
result = await self._connector.execute("groups", "get", params)
|
|
1067
|
+
# Cast generic envelope to concrete typed result
|
|
1068
|
+
return GroupsGetResult(
|
|
1069
|
+
data=result.data )
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
class TicketCommentsQuery:
|
|
1074
|
+
"""
|
|
1075
|
+
Query class for TicketComments entity operations.
|
|
1076
|
+
"""
|
|
1077
|
+
|
|
1078
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1079
|
+
"""Initialize query with connector reference."""
|
|
1080
|
+
self._connector = connector
|
|
1081
|
+
|
|
1082
|
+
async def list(
|
|
1083
|
+
self,
|
|
1084
|
+
ticket_id: str,
|
|
1085
|
+
page: int | None = None,
|
|
1086
|
+
include_inline_images: bool | None = None,
|
|
1087
|
+
sort: str | None = None,
|
|
1088
|
+
**kwargs
|
|
1089
|
+
) -> TicketCommentsListResult:
|
|
1090
|
+
"""
|
|
1091
|
+
Returns a list of comments for a specific ticket
|
|
1092
|
+
|
|
1093
|
+
Args:
|
|
1094
|
+
ticket_id: The ID of the ticket
|
|
1095
|
+
page: Page number for pagination
|
|
1096
|
+
include_inline_images: Include inline images in the response
|
|
1097
|
+
sort: Sort order
|
|
1098
|
+
**kwargs: Additional parameters
|
|
1099
|
+
|
|
1100
|
+
Returns:
|
|
1101
|
+
TicketCommentsListResult
|
|
1102
|
+
"""
|
|
1103
|
+
params = {k: v for k, v in {
|
|
1104
|
+
"ticket_id": ticket_id,
|
|
1105
|
+
"page": page,
|
|
1106
|
+
"include_inline_images": include_inline_images,
|
|
1107
|
+
"sort": sort,
|
|
1108
|
+
**kwargs
|
|
1109
|
+
}.items() if v is not None}
|
|
1110
|
+
|
|
1111
|
+
result = await self._connector.execute("ticket_comments", "list", params)
|
|
1112
|
+
# Cast generic envelope to concrete typed result
|
|
1113
|
+
return TicketCommentsListResult(
|
|
1114
|
+
data=result.data,
|
|
1115
|
+
meta=result.meta )
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
class AttachmentsQuery:
|
|
1120
|
+
"""
|
|
1121
|
+
Query class for Attachments entity operations.
|
|
1122
|
+
"""
|
|
1123
|
+
|
|
1124
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1125
|
+
"""Initialize query with connector reference."""
|
|
1126
|
+
self._connector = connector
|
|
1127
|
+
|
|
1128
|
+
async def get(
|
|
1129
|
+
self,
|
|
1130
|
+
attachment_id: str,
|
|
1131
|
+
**kwargs
|
|
1132
|
+
) -> AttachmentsGetResult:
|
|
1133
|
+
"""
|
|
1134
|
+
Returns an attachment by its ID
|
|
1135
|
+
|
|
1136
|
+
Args:
|
|
1137
|
+
attachment_id: The ID of the attachment
|
|
1138
|
+
**kwargs: Additional parameters
|
|
1139
|
+
|
|
1140
|
+
Returns:
|
|
1141
|
+
AttachmentsGetResult
|
|
1142
|
+
"""
|
|
1143
|
+
params = {k: v for k, v in {
|
|
1144
|
+
"attachment_id": attachment_id,
|
|
1145
|
+
**kwargs
|
|
1146
|
+
}.items() if v is not None}
|
|
1147
|
+
|
|
1148
|
+
result = await self._connector.execute("attachments", "get", params)
|
|
1149
|
+
# Cast generic envelope to concrete typed result
|
|
1150
|
+
return AttachmentsGetResult(
|
|
1151
|
+
data=result.data )
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
async def download(
|
|
1156
|
+
self,
|
|
1157
|
+
attachment_id: str,
|
|
1158
|
+
range_header: str | None = None,
|
|
1159
|
+
**kwargs
|
|
1160
|
+
) -> AsyncIterator[bytes]:
|
|
1161
|
+
"""
|
|
1162
|
+
Downloads the file content of a ticket attachment
|
|
1163
|
+
|
|
1164
|
+
Args:
|
|
1165
|
+
attachment_id: The ID of the attachment
|
|
1166
|
+
range_header: Optional Range header for partial downloads (e.g., 'bytes=0-99')
|
|
1167
|
+
**kwargs: Additional parameters
|
|
1168
|
+
|
|
1169
|
+
Returns:
|
|
1170
|
+
AsyncIterator[bytes]
|
|
1171
|
+
"""
|
|
1172
|
+
params = {k: v for k, v in {
|
|
1173
|
+
"attachment_id": attachment_id,
|
|
1174
|
+
"range_header": range_header,
|
|
1175
|
+
**kwargs
|
|
1176
|
+
}.items() if v is not None}
|
|
1177
|
+
|
|
1178
|
+
result = await self._connector.execute("attachments", "download", params)
|
|
1179
|
+
return result
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
async def download_local(
|
|
1183
|
+
self,
|
|
1184
|
+
attachment_id: str,
|
|
1185
|
+
path: str,
|
|
1186
|
+
range_header: str | None = None,
|
|
1187
|
+
**kwargs
|
|
1188
|
+
) -> Path:
|
|
1189
|
+
"""
|
|
1190
|
+
Downloads the file content of a ticket attachment and save to file.
|
|
1191
|
+
|
|
1192
|
+
Args:
|
|
1193
|
+
attachment_id: The ID of the attachment
|
|
1194
|
+
range_header: Optional Range header for partial downloads (e.g., 'bytes=0-99')
|
|
1195
|
+
path: File path to save downloaded content
|
|
1196
|
+
**kwargs: Additional parameters
|
|
1197
|
+
|
|
1198
|
+
Returns:
|
|
1199
|
+
str: Path to the downloaded file
|
|
1200
|
+
"""
|
|
1201
|
+
from ._vendored.connector_sdk import save_download
|
|
1202
|
+
|
|
1203
|
+
# Get the async iterator
|
|
1204
|
+
content_iterator = await self.download(
|
|
1205
|
+
attachment_id=attachment_id,
|
|
1206
|
+
range_header=range_header,
|
|
1207
|
+
**kwargs
|
|
1208
|
+
)
|
|
1209
|
+
|
|
1210
|
+
return await save_download(content_iterator, path)
|
|
1211
|
+
|
|
1212
|
+
|
|
1213
|
+
class TicketAuditsQuery:
|
|
1214
|
+
"""
|
|
1215
|
+
Query class for TicketAudits entity operations.
|
|
1216
|
+
"""
|
|
1217
|
+
|
|
1218
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1219
|
+
"""Initialize query with connector reference."""
|
|
1220
|
+
self._connector = connector
|
|
1221
|
+
|
|
1222
|
+
async def list(
|
|
1223
|
+
self,
|
|
1224
|
+
page: int | None = None,
|
|
1225
|
+
**kwargs
|
|
1226
|
+
) -> TicketAuditsListResult:
|
|
1227
|
+
"""
|
|
1228
|
+
Returns a list of all ticket audits
|
|
1229
|
+
|
|
1230
|
+
Args:
|
|
1231
|
+
page: Page number for pagination
|
|
1232
|
+
**kwargs: Additional parameters
|
|
1233
|
+
|
|
1234
|
+
Returns:
|
|
1235
|
+
TicketAuditsListResult
|
|
1236
|
+
"""
|
|
1237
|
+
params = {k: v for k, v in {
|
|
1238
|
+
"page": page,
|
|
1239
|
+
**kwargs
|
|
1240
|
+
}.items() if v is not None}
|
|
1241
|
+
|
|
1242
|
+
result = await self._connector.execute("ticket_audits", "list", params)
|
|
1243
|
+
# Cast generic envelope to concrete typed result
|
|
1244
|
+
return TicketAuditsListResult(
|
|
1245
|
+
data=result.data,
|
|
1246
|
+
meta=result.meta )
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
async def list(
|
|
1251
|
+
self,
|
|
1252
|
+
ticket_id: str,
|
|
1253
|
+
page: int | None = None,
|
|
1254
|
+
**kwargs
|
|
1255
|
+
) -> TicketAuditsListResult:
|
|
1256
|
+
"""
|
|
1257
|
+
Returns a list of audits for a specific ticket
|
|
1258
|
+
|
|
1259
|
+
Args:
|
|
1260
|
+
ticket_id: The ID of the ticket
|
|
1261
|
+
page: Page number for pagination
|
|
1262
|
+
**kwargs: Additional parameters
|
|
1263
|
+
|
|
1264
|
+
Returns:
|
|
1265
|
+
TicketAuditsListResult
|
|
1266
|
+
"""
|
|
1267
|
+
params = {k: v for k, v in {
|
|
1268
|
+
"ticket_id": ticket_id,
|
|
1269
|
+
"page": page,
|
|
1270
|
+
**kwargs
|
|
1271
|
+
}.items() if v is not None}
|
|
1272
|
+
|
|
1273
|
+
result = await self._connector.execute("ticket_audits", "list", params)
|
|
1274
|
+
# Cast generic envelope to concrete typed result
|
|
1275
|
+
return TicketAuditsListResult(
|
|
1276
|
+
data=result.data,
|
|
1277
|
+
meta=result.meta )
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
class TicketMetricsQuery:
|
|
1282
|
+
"""
|
|
1283
|
+
Query class for TicketMetrics entity operations.
|
|
1284
|
+
"""
|
|
1285
|
+
|
|
1286
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1287
|
+
"""Initialize query with connector reference."""
|
|
1288
|
+
self._connector = connector
|
|
1289
|
+
|
|
1290
|
+
async def list(
|
|
1291
|
+
self,
|
|
1292
|
+
page: int | None = None,
|
|
1293
|
+
**kwargs
|
|
1294
|
+
) -> TicketMetricsListResult:
|
|
1295
|
+
"""
|
|
1296
|
+
Returns a list of all ticket metrics
|
|
1297
|
+
|
|
1298
|
+
Args:
|
|
1299
|
+
page: Page number for pagination
|
|
1300
|
+
**kwargs: Additional parameters
|
|
1301
|
+
|
|
1302
|
+
Returns:
|
|
1303
|
+
TicketMetricsListResult
|
|
1304
|
+
"""
|
|
1305
|
+
params = {k: v for k, v in {
|
|
1306
|
+
"page": page,
|
|
1307
|
+
**kwargs
|
|
1308
|
+
}.items() if v is not None}
|
|
1309
|
+
|
|
1310
|
+
result = await self._connector.execute("ticket_metrics", "list", params)
|
|
1311
|
+
# Cast generic envelope to concrete typed result
|
|
1312
|
+
return TicketMetricsListResult(
|
|
1313
|
+
data=result.data,
|
|
1314
|
+
meta=result.meta )
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
class TicketFieldsQuery:
|
|
1319
|
+
"""
|
|
1320
|
+
Query class for TicketFields entity operations.
|
|
1321
|
+
"""
|
|
1322
|
+
|
|
1323
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1324
|
+
"""Initialize query with connector reference."""
|
|
1325
|
+
self._connector = connector
|
|
1326
|
+
|
|
1327
|
+
async def list(
|
|
1328
|
+
self,
|
|
1329
|
+
page: int | None = None,
|
|
1330
|
+
locale: str | None = None,
|
|
1331
|
+
**kwargs
|
|
1332
|
+
) -> TicketFieldsListResult:
|
|
1333
|
+
"""
|
|
1334
|
+
Returns a list of all ticket fields
|
|
1335
|
+
|
|
1336
|
+
Args:
|
|
1337
|
+
page: Page number for pagination
|
|
1338
|
+
locale: Locale for the results
|
|
1339
|
+
**kwargs: Additional parameters
|
|
1340
|
+
|
|
1341
|
+
Returns:
|
|
1342
|
+
TicketFieldsListResult
|
|
1343
|
+
"""
|
|
1344
|
+
params = {k: v for k, v in {
|
|
1345
|
+
"page": page,
|
|
1346
|
+
"locale": locale,
|
|
1347
|
+
**kwargs
|
|
1348
|
+
}.items() if v is not None}
|
|
1349
|
+
|
|
1350
|
+
result = await self._connector.execute("ticket_fields", "list", params)
|
|
1351
|
+
# Cast generic envelope to concrete typed result
|
|
1352
|
+
return TicketFieldsListResult(
|
|
1353
|
+
data=result.data,
|
|
1354
|
+
meta=result.meta )
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
async def get(
|
|
1359
|
+
self,
|
|
1360
|
+
ticket_field_id: str,
|
|
1361
|
+
**kwargs
|
|
1362
|
+
) -> TicketFieldsGetResult:
|
|
1363
|
+
"""
|
|
1364
|
+
Returns a ticket field by its ID
|
|
1365
|
+
|
|
1366
|
+
Args:
|
|
1367
|
+
ticket_field_id: The ID of the ticket field
|
|
1368
|
+
**kwargs: Additional parameters
|
|
1369
|
+
|
|
1370
|
+
Returns:
|
|
1371
|
+
TicketFieldsGetResult
|
|
1372
|
+
"""
|
|
1373
|
+
params = {k: v for k, v in {
|
|
1374
|
+
"ticket_field_id": ticket_field_id,
|
|
1375
|
+
**kwargs
|
|
1376
|
+
}.items() if v is not None}
|
|
1377
|
+
|
|
1378
|
+
result = await self._connector.execute("ticket_fields", "get", params)
|
|
1379
|
+
# Cast generic envelope to concrete typed result
|
|
1380
|
+
return TicketFieldsGetResult(
|
|
1381
|
+
data=result.data )
|
|
1382
|
+
|
|
1383
|
+
|
|
1384
|
+
|
|
1385
|
+
class BrandsQuery:
|
|
1386
|
+
"""
|
|
1387
|
+
Query class for Brands entity operations.
|
|
1388
|
+
"""
|
|
1389
|
+
|
|
1390
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1391
|
+
"""Initialize query with connector reference."""
|
|
1392
|
+
self._connector = connector
|
|
1393
|
+
|
|
1394
|
+
async def list(
|
|
1395
|
+
self,
|
|
1396
|
+
page: int | None = None,
|
|
1397
|
+
**kwargs
|
|
1398
|
+
) -> BrandsListResult:
|
|
1399
|
+
"""
|
|
1400
|
+
Returns a list of all brands for the account
|
|
1401
|
+
|
|
1402
|
+
Args:
|
|
1403
|
+
page: Page number for pagination
|
|
1404
|
+
**kwargs: Additional parameters
|
|
1405
|
+
|
|
1406
|
+
Returns:
|
|
1407
|
+
BrandsListResult
|
|
1408
|
+
"""
|
|
1409
|
+
params = {k: v for k, v in {
|
|
1410
|
+
"page": page,
|
|
1411
|
+
**kwargs
|
|
1412
|
+
}.items() if v is not None}
|
|
1413
|
+
|
|
1414
|
+
result = await self._connector.execute("brands", "list", params)
|
|
1415
|
+
# Cast generic envelope to concrete typed result
|
|
1416
|
+
return BrandsListResult(
|
|
1417
|
+
data=result.data,
|
|
1418
|
+
meta=result.meta )
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
async def get(
|
|
1423
|
+
self,
|
|
1424
|
+
brand_id: str,
|
|
1425
|
+
**kwargs
|
|
1426
|
+
) -> BrandsGetResult:
|
|
1427
|
+
"""
|
|
1428
|
+
Returns a brand by its ID
|
|
1429
|
+
|
|
1430
|
+
Args:
|
|
1431
|
+
brand_id: The ID of the brand
|
|
1432
|
+
**kwargs: Additional parameters
|
|
1433
|
+
|
|
1434
|
+
Returns:
|
|
1435
|
+
BrandsGetResult
|
|
1436
|
+
"""
|
|
1437
|
+
params = {k: v for k, v in {
|
|
1438
|
+
"brand_id": brand_id,
|
|
1439
|
+
**kwargs
|
|
1440
|
+
}.items() if v is not None}
|
|
1441
|
+
|
|
1442
|
+
result = await self._connector.execute("brands", "get", params)
|
|
1443
|
+
# Cast generic envelope to concrete typed result
|
|
1444
|
+
return BrandsGetResult(
|
|
1445
|
+
data=result.data )
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
class ViewsQuery:
|
|
1450
|
+
"""
|
|
1451
|
+
Query class for Views entity operations.
|
|
1452
|
+
"""
|
|
1453
|
+
|
|
1454
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1455
|
+
"""Initialize query with connector reference."""
|
|
1456
|
+
self._connector = connector
|
|
1457
|
+
|
|
1458
|
+
async def list(
|
|
1459
|
+
self,
|
|
1460
|
+
page: int | None = None,
|
|
1461
|
+
access: str | None = None,
|
|
1462
|
+
active: bool | None = None,
|
|
1463
|
+
group_id: int | None = None,
|
|
1464
|
+
sort_by: str | None = None,
|
|
1465
|
+
sort_order: str | None = None,
|
|
1466
|
+
**kwargs
|
|
1467
|
+
) -> ViewsListResult:
|
|
1468
|
+
"""
|
|
1469
|
+
Returns a list of all views for the account
|
|
1470
|
+
|
|
1471
|
+
Args:
|
|
1472
|
+
page: Page number for pagination
|
|
1473
|
+
access: Filter by access level
|
|
1474
|
+
active: Filter by active status
|
|
1475
|
+
group_id: Filter by group ID
|
|
1476
|
+
sort_by: Sort results
|
|
1477
|
+
sort_order: Sort order
|
|
1478
|
+
**kwargs: Additional parameters
|
|
1479
|
+
|
|
1480
|
+
Returns:
|
|
1481
|
+
ViewsListResult
|
|
1482
|
+
"""
|
|
1483
|
+
params = {k: v for k, v in {
|
|
1484
|
+
"page": page,
|
|
1485
|
+
"access": access,
|
|
1486
|
+
"active": active,
|
|
1487
|
+
"group_id": group_id,
|
|
1488
|
+
"sort_by": sort_by,
|
|
1489
|
+
"sort_order": sort_order,
|
|
1490
|
+
**kwargs
|
|
1491
|
+
}.items() if v is not None}
|
|
1492
|
+
|
|
1493
|
+
result = await self._connector.execute("views", "list", params)
|
|
1494
|
+
# Cast generic envelope to concrete typed result
|
|
1495
|
+
return ViewsListResult(
|
|
1496
|
+
data=result.data,
|
|
1497
|
+
meta=result.meta )
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
|
|
1501
|
+
async def get(
|
|
1502
|
+
self,
|
|
1503
|
+
view_id: str,
|
|
1504
|
+
**kwargs
|
|
1505
|
+
) -> ViewsGetResult:
|
|
1506
|
+
"""
|
|
1507
|
+
Returns a view by its ID
|
|
1508
|
+
|
|
1509
|
+
Args:
|
|
1510
|
+
view_id: The ID of the view
|
|
1511
|
+
**kwargs: Additional parameters
|
|
1512
|
+
|
|
1513
|
+
Returns:
|
|
1514
|
+
ViewsGetResult
|
|
1515
|
+
"""
|
|
1516
|
+
params = {k: v for k, v in {
|
|
1517
|
+
"view_id": view_id,
|
|
1518
|
+
**kwargs
|
|
1519
|
+
}.items() if v is not None}
|
|
1520
|
+
|
|
1521
|
+
result = await self._connector.execute("views", "get", params)
|
|
1522
|
+
# Cast generic envelope to concrete typed result
|
|
1523
|
+
return ViewsGetResult(
|
|
1524
|
+
data=result.data )
|
|
1525
|
+
|
|
1526
|
+
|
|
1527
|
+
|
|
1528
|
+
class MacrosQuery:
|
|
1529
|
+
"""
|
|
1530
|
+
Query class for Macros entity operations.
|
|
1531
|
+
"""
|
|
1532
|
+
|
|
1533
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1534
|
+
"""Initialize query with connector reference."""
|
|
1535
|
+
self._connector = connector
|
|
1536
|
+
|
|
1537
|
+
async def list(
|
|
1538
|
+
self,
|
|
1539
|
+
page: int | None = None,
|
|
1540
|
+
access: str | None = None,
|
|
1541
|
+
active: bool | None = None,
|
|
1542
|
+
category: int | None = None,
|
|
1543
|
+
group_id: int | None = None,
|
|
1544
|
+
only_viewable: bool | None = None,
|
|
1545
|
+
sort_by: str | None = None,
|
|
1546
|
+
sort_order: str | None = None,
|
|
1547
|
+
**kwargs
|
|
1548
|
+
) -> MacrosListResult:
|
|
1549
|
+
"""
|
|
1550
|
+
Returns a list of all macros for the account
|
|
1551
|
+
|
|
1552
|
+
Args:
|
|
1553
|
+
page: Page number for pagination
|
|
1554
|
+
access: Filter by access level
|
|
1555
|
+
active: Filter by active status
|
|
1556
|
+
category: Filter by category
|
|
1557
|
+
group_id: Filter by group ID
|
|
1558
|
+
only_viewable: Return only viewable macros
|
|
1559
|
+
sort_by: Sort results
|
|
1560
|
+
sort_order: Sort order
|
|
1561
|
+
**kwargs: Additional parameters
|
|
1562
|
+
|
|
1563
|
+
Returns:
|
|
1564
|
+
MacrosListResult
|
|
1565
|
+
"""
|
|
1566
|
+
params = {k: v for k, v in {
|
|
1567
|
+
"page": page,
|
|
1568
|
+
"access": access,
|
|
1569
|
+
"active": active,
|
|
1570
|
+
"category": category,
|
|
1571
|
+
"group_id": group_id,
|
|
1572
|
+
"only_viewable": only_viewable,
|
|
1573
|
+
"sort_by": sort_by,
|
|
1574
|
+
"sort_order": sort_order,
|
|
1575
|
+
**kwargs
|
|
1576
|
+
}.items() if v is not None}
|
|
1577
|
+
|
|
1578
|
+
result = await self._connector.execute("macros", "list", params)
|
|
1579
|
+
# Cast generic envelope to concrete typed result
|
|
1580
|
+
return MacrosListResult(
|
|
1581
|
+
data=result.data,
|
|
1582
|
+
meta=result.meta )
|
|
1583
|
+
|
|
1584
|
+
|
|
1585
|
+
|
|
1586
|
+
async def get(
|
|
1587
|
+
self,
|
|
1588
|
+
macro_id: str,
|
|
1589
|
+
**kwargs
|
|
1590
|
+
) -> MacrosGetResult:
|
|
1591
|
+
"""
|
|
1592
|
+
Returns a macro by its ID
|
|
1593
|
+
|
|
1594
|
+
Args:
|
|
1595
|
+
macro_id: The ID of the macro
|
|
1596
|
+
**kwargs: Additional parameters
|
|
1597
|
+
|
|
1598
|
+
Returns:
|
|
1599
|
+
MacrosGetResult
|
|
1600
|
+
"""
|
|
1601
|
+
params = {k: v for k, v in {
|
|
1602
|
+
"macro_id": macro_id,
|
|
1603
|
+
**kwargs
|
|
1604
|
+
}.items() if v is not None}
|
|
1605
|
+
|
|
1606
|
+
result = await self._connector.execute("macros", "get", params)
|
|
1607
|
+
# Cast generic envelope to concrete typed result
|
|
1608
|
+
return MacrosGetResult(
|
|
1609
|
+
data=result.data )
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
|
|
1613
|
+
class TriggersQuery:
|
|
1614
|
+
"""
|
|
1615
|
+
Query class for Triggers entity operations.
|
|
1616
|
+
"""
|
|
1617
|
+
|
|
1618
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1619
|
+
"""Initialize query with connector reference."""
|
|
1620
|
+
self._connector = connector
|
|
1621
|
+
|
|
1622
|
+
async def list(
|
|
1623
|
+
self,
|
|
1624
|
+
page: int | None = None,
|
|
1625
|
+
active: bool | None = None,
|
|
1626
|
+
category_id: str | None = None,
|
|
1627
|
+
sort: str | None = None,
|
|
1628
|
+
**kwargs
|
|
1629
|
+
) -> TriggersListResult:
|
|
1630
|
+
"""
|
|
1631
|
+
Returns a list of all triggers for the account
|
|
1632
|
+
|
|
1633
|
+
Args:
|
|
1634
|
+
page: Page number for pagination
|
|
1635
|
+
active: Filter by active status
|
|
1636
|
+
category_id: Filter by category ID
|
|
1637
|
+
sort: Sort results
|
|
1638
|
+
**kwargs: Additional parameters
|
|
1639
|
+
|
|
1640
|
+
Returns:
|
|
1641
|
+
TriggersListResult
|
|
1642
|
+
"""
|
|
1643
|
+
params = {k: v for k, v in {
|
|
1644
|
+
"page": page,
|
|
1645
|
+
"active": active,
|
|
1646
|
+
"category_id": category_id,
|
|
1647
|
+
"sort": sort,
|
|
1648
|
+
**kwargs
|
|
1649
|
+
}.items() if v is not None}
|
|
1650
|
+
|
|
1651
|
+
result = await self._connector.execute("triggers", "list", params)
|
|
1652
|
+
# Cast generic envelope to concrete typed result
|
|
1653
|
+
return TriggersListResult(
|
|
1654
|
+
data=result.data,
|
|
1655
|
+
meta=result.meta )
|
|
1656
|
+
|
|
1657
|
+
|
|
1658
|
+
|
|
1659
|
+
async def get(
|
|
1660
|
+
self,
|
|
1661
|
+
trigger_id: str,
|
|
1662
|
+
**kwargs
|
|
1663
|
+
) -> TriggersGetResult:
|
|
1664
|
+
"""
|
|
1665
|
+
Returns a trigger by its ID
|
|
1666
|
+
|
|
1667
|
+
Args:
|
|
1668
|
+
trigger_id: The ID of the trigger
|
|
1669
|
+
**kwargs: Additional parameters
|
|
1670
|
+
|
|
1671
|
+
Returns:
|
|
1672
|
+
TriggersGetResult
|
|
1673
|
+
"""
|
|
1674
|
+
params = {k: v for k, v in {
|
|
1675
|
+
"trigger_id": trigger_id,
|
|
1676
|
+
**kwargs
|
|
1677
|
+
}.items() if v is not None}
|
|
1678
|
+
|
|
1679
|
+
result = await self._connector.execute("triggers", "get", params)
|
|
1680
|
+
# Cast generic envelope to concrete typed result
|
|
1681
|
+
return TriggersGetResult(
|
|
1682
|
+
data=result.data )
|
|
1683
|
+
|
|
1684
|
+
|
|
1685
|
+
|
|
1686
|
+
class AutomationsQuery:
|
|
1687
|
+
"""
|
|
1688
|
+
Query class for Automations entity operations.
|
|
1689
|
+
"""
|
|
1690
|
+
|
|
1691
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1692
|
+
"""Initialize query with connector reference."""
|
|
1693
|
+
self._connector = connector
|
|
1694
|
+
|
|
1695
|
+
async def list(
|
|
1696
|
+
self,
|
|
1697
|
+
page: int | None = None,
|
|
1698
|
+
active: bool | None = None,
|
|
1699
|
+
sort: str | None = None,
|
|
1700
|
+
**kwargs
|
|
1701
|
+
) -> AutomationsListResult:
|
|
1702
|
+
"""
|
|
1703
|
+
Returns a list of all automations for the account
|
|
1704
|
+
|
|
1705
|
+
Args:
|
|
1706
|
+
page: Page number for pagination
|
|
1707
|
+
active: Filter by active status
|
|
1708
|
+
sort: Sort results
|
|
1709
|
+
**kwargs: Additional parameters
|
|
1710
|
+
|
|
1711
|
+
Returns:
|
|
1712
|
+
AutomationsListResult
|
|
1713
|
+
"""
|
|
1714
|
+
params = {k: v for k, v in {
|
|
1715
|
+
"page": page,
|
|
1716
|
+
"active": active,
|
|
1717
|
+
"sort": sort,
|
|
1718
|
+
**kwargs
|
|
1719
|
+
}.items() if v is not None}
|
|
1720
|
+
|
|
1721
|
+
result = await self._connector.execute("automations", "list", params)
|
|
1722
|
+
# Cast generic envelope to concrete typed result
|
|
1723
|
+
return AutomationsListResult(
|
|
1724
|
+
data=result.data,
|
|
1725
|
+
meta=result.meta )
|
|
1726
|
+
|
|
1727
|
+
|
|
1728
|
+
|
|
1729
|
+
async def get(
|
|
1730
|
+
self,
|
|
1731
|
+
automation_id: str,
|
|
1732
|
+
**kwargs
|
|
1733
|
+
) -> AutomationsGetResult:
|
|
1734
|
+
"""
|
|
1735
|
+
Returns an automation by its ID
|
|
1736
|
+
|
|
1737
|
+
Args:
|
|
1738
|
+
automation_id: The ID of the automation
|
|
1739
|
+
**kwargs: Additional parameters
|
|
1740
|
+
|
|
1741
|
+
Returns:
|
|
1742
|
+
AutomationsGetResult
|
|
1743
|
+
"""
|
|
1744
|
+
params = {k: v for k, v in {
|
|
1745
|
+
"automation_id": automation_id,
|
|
1746
|
+
**kwargs
|
|
1747
|
+
}.items() if v is not None}
|
|
1748
|
+
|
|
1749
|
+
result = await self._connector.execute("automations", "get", params)
|
|
1750
|
+
# Cast generic envelope to concrete typed result
|
|
1751
|
+
return AutomationsGetResult(
|
|
1752
|
+
data=result.data )
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
class TagsQuery:
|
|
1757
|
+
"""
|
|
1758
|
+
Query class for Tags entity operations.
|
|
1759
|
+
"""
|
|
1760
|
+
|
|
1761
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1762
|
+
"""Initialize query with connector reference."""
|
|
1763
|
+
self._connector = connector
|
|
1764
|
+
|
|
1765
|
+
async def list(
|
|
1766
|
+
self,
|
|
1767
|
+
page: int | None = None,
|
|
1768
|
+
**kwargs
|
|
1769
|
+
) -> TagsListResult:
|
|
1770
|
+
"""
|
|
1771
|
+
Returns a list of all tags used in the account
|
|
1772
|
+
|
|
1773
|
+
Args:
|
|
1774
|
+
page: Page number for pagination
|
|
1775
|
+
**kwargs: Additional parameters
|
|
1776
|
+
|
|
1777
|
+
Returns:
|
|
1778
|
+
TagsListResult
|
|
1779
|
+
"""
|
|
1780
|
+
params = {k: v for k, v in {
|
|
1781
|
+
"page": page,
|
|
1782
|
+
**kwargs
|
|
1783
|
+
}.items() if v is not None}
|
|
1784
|
+
|
|
1785
|
+
result = await self._connector.execute("tags", "list", params)
|
|
1786
|
+
# Cast generic envelope to concrete typed result
|
|
1787
|
+
return TagsListResult(
|
|
1788
|
+
data=result.data,
|
|
1789
|
+
meta=result.meta )
|
|
1790
|
+
|
|
1791
|
+
|
|
1792
|
+
|
|
1793
|
+
class SatisfactionRatingsQuery:
|
|
1794
|
+
"""
|
|
1795
|
+
Query class for SatisfactionRatings entity operations.
|
|
1796
|
+
"""
|
|
1797
|
+
|
|
1798
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1799
|
+
"""Initialize query with connector reference."""
|
|
1800
|
+
self._connector = connector
|
|
1801
|
+
|
|
1802
|
+
async def list(
|
|
1803
|
+
self,
|
|
1804
|
+
page: int | None = None,
|
|
1805
|
+
score: str | None = None,
|
|
1806
|
+
start_time: int | None = None,
|
|
1807
|
+
end_time: int | None = None,
|
|
1808
|
+
**kwargs
|
|
1809
|
+
) -> SatisfactionRatingsListResult:
|
|
1810
|
+
"""
|
|
1811
|
+
Returns a list of all satisfaction ratings
|
|
1812
|
+
|
|
1813
|
+
Args:
|
|
1814
|
+
page: Page number for pagination
|
|
1815
|
+
score: Filter by score
|
|
1816
|
+
start_time: Start time (Unix epoch)
|
|
1817
|
+
end_time: End time (Unix epoch)
|
|
1818
|
+
**kwargs: Additional parameters
|
|
1819
|
+
|
|
1820
|
+
Returns:
|
|
1821
|
+
SatisfactionRatingsListResult
|
|
1822
|
+
"""
|
|
1823
|
+
params = {k: v for k, v in {
|
|
1824
|
+
"page": page,
|
|
1825
|
+
"score": score,
|
|
1826
|
+
"start_time": start_time,
|
|
1827
|
+
"end_time": end_time,
|
|
1828
|
+
**kwargs
|
|
1829
|
+
}.items() if v is not None}
|
|
1830
|
+
|
|
1831
|
+
result = await self._connector.execute("satisfaction_ratings", "list", params)
|
|
1832
|
+
# Cast generic envelope to concrete typed result
|
|
1833
|
+
return SatisfactionRatingsListResult(
|
|
1834
|
+
data=result.data,
|
|
1835
|
+
meta=result.meta )
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
async def get(
|
|
1840
|
+
self,
|
|
1841
|
+
satisfaction_rating_id: str,
|
|
1842
|
+
**kwargs
|
|
1843
|
+
) -> SatisfactionRatingsGetResult:
|
|
1844
|
+
"""
|
|
1845
|
+
Returns a satisfaction rating by its ID
|
|
1846
|
+
|
|
1847
|
+
Args:
|
|
1848
|
+
satisfaction_rating_id: The ID of the satisfaction rating
|
|
1849
|
+
**kwargs: Additional parameters
|
|
1850
|
+
|
|
1851
|
+
Returns:
|
|
1852
|
+
SatisfactionRatingsGetResult
|
|
1853
|
+
"""
|
|
1854
|
+
params = {k: v for k, v in {
|
|
1855
|
+
"satisfaction_rating_id": satisfaction_rating_id,
|
|
1856
|
+
**kwargs
|
|
1857
|
+
}.items() if v is not None}
|
|
1858
|
+
|
|
1859
|
+
result = await self._connector.execute("satisfaction_ratings", "get", params)
|
|
1860
|
+
# Cast generic envelope to concrete typed result
|
|
1861
|
+
return SatisfactionRatingsGetResult(
|
|
1862
|
+
data=result.data )
|
|
1863
|
+
|
|
1864
|
+
|
|
1865
|
+
|
|
1866
|
+
class GroupMembershipsQuery:
|
|
1867
|
+
"""
|
|
1868
|
+
Query class for GroupMemberships entity operations.
|
|
1869
|
+
"""
|
|
1870
|
+
|
|
1871
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1872
|
+
"""Initialize query with connector reference."""
|
|
1873
|
+
self._connector = connector
|
|
1874
|
+
|
|
1875
|
+
async def list(
|
|
1876
|
+
self,
|
|
1877
|
+
page: int | None = None,
|
|
1878
|
+
**kwargs
|
|
1879
|
+
) -> GroupMembershipsListResult:
|
|
1880
|
+
"""
|
|
1881
|
+
Returns a list of all group memberships
|
|
1882
|
+
|
|
1883
|
+
Args:
|
|
1884
|
+
page: Page number for pagination
|
|
1885
|
+
**kwargs: Additional parameters
|
|
1886
|
+
|
|
1887
|
+
Returns:
|
|
1888
|
+
GroupMembershipsListResult
|
|
1889
|
+
"""
|
|
1890
|
+
params = {k: v for k, v in {
|
|
1891
|
+
"page": page,
|
|
1892
|
+
**kwargs
|
|
1893
|
+
}.items() if v is not None}
|
|
1894
|
+
|
|
1895
|
+
result = await self._connector.execute("group_memberships", "list", params)
|
|
1896
|
+
# Cast generic envelope to concrete typed result
|
|
1897
|
+
return GroupMembershipsListResult(
|
|
1898
|
+
data=result.data,
|
|
1899
|
+
meta=result.meta )
|
|
1900
|
+
|
|
1901
|
+
|
|
1902
|
+
|
|
1903
|
+
class OrganizationMembershipsQuery:
|
|
1904
|
+
"""
|
|
1905
|
+
Query class for OrganizationMemberships entity operations.
|
|
1906
|
+
"""
|
|
1907
|
+
|
|
1908
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1909
|
+
"""Initialize query with connector reference."""
|
|
1910
|
+
self._connector = connector
|
|
1911
|
+
|
|
1912
|
+
async def list(
|
|
1913
|
+
self,
|
|
1914
|
+
page: int | None = None,
|
|
1915
|
+
**kwargs
|
|
1916
|
+
) -> OrganizationMembershipsListResult:
|
|
1917
|
+
"""
|
|
1918
|
+
Returns a list of all organization memberships
|
|
1919
|
+
|
|
1920
|
+
Args:
|
|
1921
|
+
page: Page number for pagination
|
|
1922
|
+
**kwargs: Additional parameters
|
|
1923
|
+
|
|
1924
|
+
Returns:
|
|
1925
|
+
OrganizationMembershipsListResult
|
|
1926
|
+
"""
|
|
1927
|
+
params = {k: v for k, v in {
|
|
1928
|
+
"page": page,
|
|
1929
|
+
**kwargs
|
|
1930
|
+
}.items() if v is not None}
|
|
1931
|
+
|
|
1932
|
+
result = await self._connector.execute("organization_memberships", "list", params)
|
|
1933
|
+
# Cast generic envelope to concrete typed result
|
|
1934
|
+
return OrganizationMembershipsListResult(
|
|
1935
|
+
data=result.data,
|
|
1936
|
+
meta=result.meta )
|
|
1937
|
+
|
|
1938
|
+
|
|
1939
|
+
|
|
1940
|
+
class SlaPoliciesQuery:
|
|
1941
|
+
"""
|
|
1942
|
+
Query class for SlaPolicies entity operations.
|
|
1943
|
+
"""
|
|
1944
|
+
|
|
1945
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
1946
|
+
"""Initialize query with connector reference."""
|
|
1947
|
+
self._connector = connector
|
|
1948
|
+
|
|
1949
|
+
async def list(
|
|
1950
|
+
self,
|
|
1951
|
+
page: int | None = None,
|
|
1952
|
+
**kwargs
|
|
1953
|
+
) -> SlaPoliciesListResult:
|
|
1954
|
+
"""
|
|
1955
|
+
Returns a list of all SLA policies
|
|
1956
|
+
|
|
1957
|
+
Args:
|
|
1958
|
+
page: Page number for pagination
|
|
1959
|
+
**kwargs: Additional parameters
|
|
1960
|
+
|
|
1961
|
+
Returns:
|
|
1962
|
+
SlaPoliciesListResult
|
|
1963
|
+
"""
|
|
1964
|
+
params = {k: v for k, v in {
|
|
1965
|
+
"page": page,
|
|
1966
|
+
**kwargs
|
|
1967
|
+
}.items() if v is not None}
|
|
1968
|
+
|
|
1969
|
+
result = await self._connector.execute("sla_policies", "list", params)
|
|
1970
|
+
# Cast generic envelope to concrete typed result
|
|
1971
|
+
return SlaPoliciesListResult(
|
|
1972
|
+
data=result.data,
|
|
1973
|
+
meta=result.meta )
|
|
1974
|
+
|
|
1975
|
+
|
|
1976
|
+
|
|
1977
|
+
async def get(
|
|
1978
|
+
self,
|
|
1979
|
+
sla_policy_id: str,
|
|
1980
|
+
**kwargs
|
|
1981
|
+
) -> SlaPoliciesGetResult:
|
|
1982
|
+
"""
|
|
1983
|
+
Returns an SLA policy by its ID
|
|
1984
|
+
|
|
1985
|
+
Args:
|
|
1986
|
+
sla_policy_id: The ID of the SLA policy
|
|
1987
|
+
**kwargs: Additional parameters
|
|
1988
|
+
|
|
1989
|
+
Returns:
|
|
1990
|
+
SlaPoliciesGetResult
|
|
1991
|
+
"""
|
|
1992
|
+
params = {k: v for k, v in {
|
|
1993
|
+
"sla_policy_id": sla_policy_id,
|
|
1994
|
+
**kwargs
|
|
1995
|
+
}.items() if v is not None}
|
|
1996
|
+
|
|
1997
|
+
result = await self._connector.execute("sla_policies", "get", params)
|
|
1998
|
+
# Cast generic envelope to concrete typed result
|
|
1999
|
+
return SlaPoliciesGetResult(
|
|
2000
|
+
data=result.data )
|
|
2001
|
+
|
|
2002
|
+
|
|
2003
|
+
|
|
2004
|
+
class TicketFormsQuery:
|
|
2005
|
+
"""
|
|
2006
|
+
Query class for TicketForms entity operations.
|
|
2007
|
+
"""
|
|
2008
|
+
|
|
2009
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
2010
|
+
"""Initialize query with connector reference."""
|
|
2011
|
+
self._connector = connector
|
|
2012
|
+
|
|
2013
|
+
async def list(
|
|
2014
|
+
self,
|
|
2015
|
+
page: int | None = None,
|
|
2016
|
+
active: bool | None = None,
|
|
2017
|
+
end_user_visible: bool | None = None,
|
|
2018
|
+
**kwargs
|
|
2019
|
+
) -> TicketFormsListResult:
|
|
2020
|
+
"""
|
|
2021
|
+
Returns a list of all ticket forms for the account
|
|
2022
|
+
|
|
2023
|
+
Args:
|
|
2024
|
+
page: Page number for pagination
|
|
2025
|
+
active: Filter by active status
|
|
2026
|
+
end_user_visible: Filter by end user visibility
|
|
2027
|
+
**kwargs: Additional parameters
|
|
2028
|
+
|
|
2029
|
+
Returns:
|
|
2030
|
+
TicketFormsListResult
|
|
2031
|
+
"""
|
|
2032
|
+
params = {k: v for k, v in {
|
|
2033
|
+
"page": page,
|
|
2034
|
+
"active": active,
|
|
2035
|
+
"end_user_visible": end_user_visible,
|
|
2036
|
+
**kwargs
|
|
2037
|
+
}.items() if v is not None}
|
|
2038
|
+
|
|
2039
|
+
result = await self._connector.execute("ticket_forms", "list", params)
|
|
2040
|
+
# Cast generic envelope to concrete typed result
|
|
2041
|
+
return TicketFormsListResult(
|
|
2042
|
+
data=result.data,
|
|
2043
|
+
meta=result.meta )
|
|
2044
|
+
|
|
2045
|
+
|
|
2046
|
+
|
|
2047
|
+
async def get(
|
|
2048
|
+
self,
|
|
2049
|
+
ticket_form_id: str,
|
|
2050
|
+
**kwargs
|
|
2051
|
+
) -> TicketFormsGetResult:
|
|
2052
|
+
"""
|
|
2053
|
+
Returns a ticket form by its ID
|
|
2054
|
+
|
|
2055
|
+
Args:
|
|
2056
|
+
ticket_form_id: The ID of the ticket form
|
|
2057
|
+
**kwargs: Additional parameters
|
|
2058
|
+
|
|
2059
|
+
Returns:
|
|
2060
|
+
TicketFormsGetResult
|
|
2061
|
+
"""
|
|
2062
|
+
params = {k: v for k, v in {
|
|
2063
|
+
"ticket_form_id": ticket_form_id,
|
|
2064
|
+
**kwargs
|
|
2065
|
+
}.items() if v is not None}
|
|
2066
|
+
|
|
2067
|
+
result = await self._connector.execute("ticket_forms", "get", params)
|
|
2068
|
+
# Cast generic envelope to concrete typed result
|
|
2069
|
+
return TicketFormsGetResult(
|
|
2070
|
+
data=result.data )
|
|
2071
|
+
|
|
2072
|
+
|
|
2073
|
+
|
|
2074
|
+
class ArticlesQuery:
|
|
2075
|
+
"""
|
|
2076
|
+
Query class for Articles entity operations.
|
|
2077
|
+
"""
|
|
2078
|
+
|
|
2079
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
2080
|
+
"""Initialize query with connector reference."""
|
|
2081
|
+
self._connector = connector
|
|
2082
|
+
|
|
2083
|
+
async def list(
|
|
2084
|
+
self,
|
|
2085
|
+
page: int | None = None,
|
|
2086
|
+
sort_by: str | None = None,
|
|
2087
|
+
sort_order: str | None = None,
|
|
2088
|
+
**kwargs
|
|
2089
|
+
) -> ArticlesListResult:
|
|
2090
|
+
"""
|
|
2091
|
+
Returns a list of all articles in the Help Center
|
|
2092
|
+
|
|
2093
|
+
Args:
|
|
2094
|
+
page: Page number for pagination
|
|
2095
|
+
sort_by: Sort articles by field
|
|
2096
|
+
sort_order: Sort order
|
|
2097
|
+
**kwargs: Additional parameters
|
|
2098
|
+
|
|
2099
|
+
Returns:
|
|
2100
|
+
ArticlesListResult
|
|
2101
|
+
"""
|
|
2102
|
+
params = {k: v for k, v in {
|
|
2103
|
+
"page": page,
|
|
2104
|
+
"sort_by": sort_by,
|
|
2105
|
+
"sort_order": sort_order,
|
|
2106
|
+
**kwargs
|
|
2107
|
+
}.items() if v is not None}
|
|
2108
|
+
|
|
2109
|
+
result = await self._connector.execute("articles", "list", params)
|
|
2110
|
+
# Cast generic envelope to concrete typed result
|
|
2111
|
+
return ArticlesListResult(
|
|
2112
|
+
data=result.data,
|
|
2113
|
+
meta=result.meta )
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
|
|
2117
|
+
async def get(
|
|
2118
|
+
self,
|
|
2119
|
+
id: str | None = None,
|
|
2120
|
+
**kwargs
|
|
2121
|
+
) -> ArticlesGetResult:
|
|
2122
|
+
"""
|
|
2123
|
+
Retrieves the details of a specific article
|
|
2124
|
+
|
|
2125
|
+
Args:
|
|
2126
|
+
id: The unique ID of the article
|
|
2127
|
+
**kwargs: Additional parameters
|
|
2128
|
+
|
|
2129
|
+
Returns:
|
|
2130
|
+
ArticlesGetResult
|
|
2131
|
+
"""
|
|
2132
|
+
params = {k: v for k, v in {
|
|
2133
|
+
"id": id,
|
|
2134
|
+
**kwargs
|
|
2135
|
+
}.items() if v is not None}
|
|
2136
|
+
|
|
2137
|
+
result = await self._connector.execute("articles", "get", params)
|
|
2138
|
+
# Cast generic envelope to concrete typed result
|
|
2139
|
+
return ArticlesGetResult(
|
|
2140
|
+
data=result.data )
|
|
2141
|
+
|
|
2142
|
+
|
|
2143
|
+
|
|
2144
|
+
class ArticleAttachmentsQuery:
|
|
2145
|
+
"""
|
|
2146
|
+
Query class for ArticleAttachments entity operations.
|
|
2147
|
+
"""
|
|
2148
|
+
|
|
2149
|
+
def __init__(self, connector: ZendeskSupportConnector):
|
|
2150
|
+
"""Initialize query with connector reference."""
|
|
2151
|
+
self._connector = connector
|
|
2152
|
+
|
|
2153
|
+
async def list(
|
|
2154
|
+
self,
|
|
2155
|
+
article_id: str,
|
|
2156
|
+
page: int | None = None,
|
|
2157
|
+
**kwargs
|
|
2158
|
+
) -> ArticleAttachmentsListResult:
|
|
2159
|
+
"""
|
|
2160
|
+
Returns a list of all attachments for a specific article
|
|
2161
|
+
|
|
2162
|
+
Args:
|
|
2163
|
+
article_id: The unique ID of the article
|
|
2164
|
+
page: Page number for pagination
|
|
2165
|
+
**kwargs: Additional parameters
|
|
2166
|
+
|
|
2167
|
+
Returns:
|
|
2168
|
+
ArticleAttachmentsListResult
|
|
2169
|
+
"""
|
|
2170
|
+
params = {k: v for k, v in {
|
|
2171
|
+
"article_id": article_id,
|
|
2172
|
+
"page": page,
|
|
2173
|
+
**kwargs
|
|
2174
|
+
}.items() if v is not None}
|
|
2175
|
+
|
|
2176
|
+
result = await self._connector.execute("article_attachments", "list", params)
|
|
2177
|
+
# Cast generic envelope to concrete typed result
|
|
2178
|
+
return ArticleAttachmentsListResult(
|
|
2179
|
+
data=result.data,
|
|
2180
|
+
meta=result.meta )
|
|
2181
|
+
|
|
2182
|
+
|
|
2183
|
+
|
|
2184
|
+
async def get(
|
|
2185
|
+
self,
|
|
2186
|
+
article_id: str,
|
|
2187
|
+
attachment_id: str,
|
|
2188
|
+
**kwargs
|
|
2189
|
+
) -> ArticleAttachmentsGetResult:
|
|
2190
|
+
"""
|
|
2191
|
+
Retrieves the metadata of a specific attachment for a specific article
|
|
2192
|
+
|
|
2193
|
+
Args:
|
|
2194
|
+
article_id: The unique ID of the article
|
|
2195
|
+
attachment_id: The unique ID of the attachment
|
|
2196
|
+
**kwargs: Additional parameters
|
|
2197
|
+
|
|
2198
|
+
Returns:
|
|
2199
|
+
ArticleAttachmentsGetResult
|
|
2200
|
+
"""
|
|
2201
|
+
params = {k: v for k, v in {
|
|
2202
|
+
"article_id": article_id,
|
|
2203
|
+
"attachment_id": attachment_id,
|
|
2204
|
+
**kwargs
|
|
2205
|
+
}.items() if v is not None}
|
|
2206
|
+
|
|
2207
|
+
result = await self._connector.execute("article_attachments", "get", params)
|
|
2208
|
+
# Cast generic envelope to concrete typed result
|
|
2209
|
+
return ArticleAttachmentsGetResult(
|
|
2210
|
+
data=result.data )
|
|
2211
|
+
|
|
2212
|
+
|
|
2213
|
+
|
|
2214
|
+
async def download(
|
|
2215
|
+
self,
|
|
2216
|
+
article_id: str,
|
|
2217
|
+
attachment_id: str,
|
|
2218
|
+
range_header: str | None = None,
|
|
2219
|
+
**kwargs
|
|
2220
|
+
) -> AsyncIterator[bytes]:
|
|
2221
|
+
"""
|
|
2222
|
+
Downloads the file content of a specific attachment
|
|
2223
|
+
|
|
2224
|
+
Args:
|
|
2225
|
+
article_id: The unique ID of the article
|
|
2226
|
+
attachment_id: The unique ID of the attachment
|
|
2227
|
+
range_header: Optional Range header for partial downloads (e.g., 'bytes=0-99')
|
|
2228
|
+
**kwargs: Additional parameters
|
|
2229
|
+
|
|
2230
|
+
Returns:
|
|
2231
|
+
AsyncIterator[bytes]
|
|
2232
|
+
"""
|
|
2233
|
+
params = {k: v for k, v in {
|
|
2234
|
+
"article_id": article_id,
|
|
2235
|
+
"attachment_id": attachment_id,
|
|
2236
|
+
"range_header": range_header,
|
|
2237
|
+
**kwargs
|
|
2238
|
+
}.items() if v is not None}
|
|
2239
|
+
|
|
2240
|
+
result = await self._connector.execute("article_attachments", "download", params)
|
|
2241
|
+
return result
|
|
2242
|
+
|
|
2243
|
+
|
|
2244
|
+
async def download_local(
|
|
2245
|
+
self,
|
|
2246
|
+
article_id: str,
|
|
2247
|
+
attachment_id: str,
|
|
2248
|
+
path: str,
|
|
2249
|
+
range_header: str | None = None,
|
|
2250
|
+
**kwargs
|
|
2251
|
+
) -> Path:
|
|
2252
|
+
"""
|
|
2253
|
+
Downloads the file content of a specific attachment and save to file.
|
|
2254
|
+
|
|
2255
|
+
Args:
|
|
2256
|
+
article_id: The unique ID of the article
|
|
2257
|
+
attachment_id: The unique ID of the attachment
|
|
2258
|
+
range_header: Optional Range header for partial downloads (e.g., 'bytes=0-99')
|
|
2259
|
+
path: File path to save downloaded content
|
|
2260
|
+
**kwargs: Additional parameters
|
|
2261
|
+
|
|
2262
|
+
Returns:
|
|
2263
|
+
str: Path to the downloaded file
|
|
2264
|
+
"""
|
|
2265
|
+
from ._vendored.connector_sdk import save_download
|
|
2266
|
+
|
|
2267
|
+
# Get the async iterator
|
|
2268
|
+
content_iterator = await self.download(
|
|
2269
|
+
article_id=article_id,
|
|
2270
|
+
attachment_id=attachment_id,
|
|
2271
|
+
range_header=range_header,
|
|
2272
|
+
**kwargs
|
|
2273
|
+
)
|
|
2274
|
+
|
|
2275
|
+
return await save_download(content_iterator, path)
|
|
2276
|
+
|