|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | 5 | from typing import Any, Dict, cast |
| 6 | +from typing_extensions import Literal |
6 | 7 |
|
7 | 8 | import httpx |
8 | 9 |
|
|
24 | 25 | connection_create_params, |
25 | 26 | connection_submit_params, |
26 | 27 | connection_update_params, |
| 28 | + connection_timeline_params, |
27 | 29 | ) |
28 | 30 | from ..._base_client import AsyncPaginator, make_request_options |
29 | 31 | from ...types.auth.managed_auth import ManagedAuth |
30 | 32 | from ...types.auth.login_response import LoginResponse |
31 | 33 | from ...types.auth.submit_fields_response import SubmitFieldsResponse |
32 | 34 | from ...types.auth.connection_follow_response import ConnectionFollowResponse |
| 35 | +from ...types.auth.managed_auth_timeline_event import ManagedAuthTimelineEvent |
33 | 36 |
|
34 | 37 | __all__ = ["ConnectionsResource", "AsyncConnectionsResource"] |
35 | 38 |
|
@@ -554,6 +557,62 @@ def submit( |
554 | 557 | cast_to=SubmitFieldsResponse, |
555 | 558 | ) |
556 | 559 |
|
| 560 | + def timeline( |
| 561 | + self, |
| 562 | + id: str, |
| 563 | + *, |
| 564 | + limit: int | Omit = omit, |
| 565 | + offset: int | Omit = omit, |
| 566 | + type: Literal["login", "reauth", "health_check"] | Omit = omit, |
| 567 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 568 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 569 | + extra_headers: Headers | None = None, |
| 570 | + extra_query: Query | None = None, |
| 571 | + extra_body: Body | None = None, |
| 572 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 573 | + ) -> SyncOffsetPagination[ManagedAuthTimelineEvent]: |
| 574 | + """ |
| 575 | + Returns a chronological timeline of events for an auth connection — login |
| 576 | + attempts, automatic re-auth attempts, and health checks. Events are returned |
| 577 | + newest-first. |
| 578 | +
|
| 579 | + Args: |
| 580 | + limit: Maximum number of events to return |
| 581 | +
|
| 582 | + offset: Number of events to skip |
| 583 | +
|
| 584 | + type: Filter the timeline to a single event type. |
| 585 | +
|
| 586 | + extra_headers: Send extra headers |
| 587 | +
|
| 588 | + extra_query: Add additional query parameters to the request |
| 589 | +
|
| 590 | + extra_body: Add additional JSON properties to the request |
| 591 | +
|
| 592 | + timeout: Override the client-level default timeout for this request, in seconds |
| 593 | + """ |
| 594 | + if not id: |
| 595 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 596 | + return self._get_api_list( |
| 597 | + path_template("/auth/connections/{id}/timeline", id=id), |
| 598 | + page=SyncOffsetPagination[ManagedAuthTimelineEvent], |
| 599 | + options=make_request_options( |
| 600 | + extra_headers=extra_headers, |
| 601 | + extra_query=extra_query, |
| 602 | + extra_body=extra_body, |
| 603 | + timeout=timeout, |
| 604 | + query=maybe_transform( |
| 605 | + { |
| 606 | + "limit": limit, |
| 607 | + "offset": offset, |
| 608 | + "type": type, |
| 609 | + }, |
| 610 | + connection_timeline_params.ConnectionTimelineParams, |
| 611 | + ), |
| 612 | + ), |
| 613 | + model=ManagedAuthTimelineEvent, |
| 614 | + ) |
| 615 | + |
557 | 616 |
|
558 | 617 | class AsyncConnectionsResource(AsyncAPIResource): |
559 | 618 | """Create and manage auth connections for automated credential capture and login.""" |
@@ -1075,6 +1134,62 @@ async def submit( |
1075 | 1134 | cast_to=SubmitFieldsResponse, |
1076 | 1135 | ) |
1077 | 1136 |
|
| 1137 | + def timeline( |
| 1138 | + self, |
| 1139 | + id: str, |
| 1140 | + *, |
| 1141 | + limit: int | Omit = omit, |
| 1142 | + offset: int | Omit = omit, |
| 1143 | + type: Literal["login", "reauth", "health_check"] | Omit = omit, |
| 1144 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 1145 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 1146 | + extra_headers: Headers | None = None, |
| 1147 | + extra_query: Query | None = None, |
| 1148 | + extra_body: Body | None = None, |
| 1149 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 1150 | + ) -> AsyncPaginator[ManagedAuthTimelineEvent, AsyncOffsetPagination[ManagedAuthTimelineEvent]]: |
| 1151 | + """ |
| 1152 | + Returns a chronological timeline of events for an auth connection — login |
| 1153 | + attempts, automatic re-auth attempts, and health checks. Events are returned |
| 1154 | + newest-first. |
| 1155 | +
|
| 1156 | + Args: |
| 1157 | + limit: Maximum number of events to return |
| 1158 | +
|
| 1159 | + offset: Number of events to skip |
| 1160 | +
|
| 1161 | + type: Filter the timeline to a single event type. |
| 1162 | +
|
| 1163 | + extra_headers: Send extra headers |
| 1164 | +
|
| 1165 | + extra_query: Add additional query parameters to the request |
| 1166 | +
|
| 1167 | + extra_body: Add additional JSON properties to the request |
| 1168 | +
|
| 1169 | + timeout: Override the client-level default timeout for this request, in seconds |
| 1170 | + """ |
| 1171 | + if not id: |
| 1172 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 1173 | + return self._get_api_list( |
| 1174 | + path_template("/auth/connections/{id}/timeline", id=id), |
| 1175 | + page=AsyncOffsetPagination[ManagedAuthTimelineEvent], |
| 1176 | + options=make_request_options( |
| 1177 | + extra_headers=extra_headers, |
| 1178 | + extra_query=extra_query, |
| 1179 | + extra_body=extra_body, |
| 1180 | + timeout=timeout, |
| 1181 | + query=maybe_transform( |
| 1182 | + { |
| 1183 | + "limit": limit, |
| 1184 | + "offset": offset, |
| 1185 | + "type": type, |
| 1186 | + }, |
| 1187 | + connection_timeline_params.ConnectionTimelineParams, |
| 1188 | + ), |
| 1189 | + ), |
| 1190 | + model=ManagedAuthTimelineEvent, |
| 1191 | + ) |
| 1192 | + |
1078 | 1193 |
|
1079 | 1194 | class ConnectionsResourceWithRawResponse: |
1080 | 1195 | def __init__(self, connections: ConnectionsResource) -> None: |
@@ -1104,6 +1219,9 @@ def __init__(self, connections: ConnectionsResource) -> None: |
1104 | 1219 | self.submit = to_raw_response_wrapper( |
1105 | 1220 | connections.submit, |
1106 | 1221 | ) |
| 1222 | + self.timeline = to_raw_response_wrapper( |
| 1223 | + connections.timeline, |
| 1224 | + ) |
1107 | 1225 |
|
1108 | 1226 |
|
1109 | 1227 | class AsyncConnectionsResourceWithRawResponse: |
@@ -1134,6 +1252,9 @@ def __init__(self, connections: AsyncConnectionsResource) -> None: |
1134 | 1252 | self.submit = async_to_raw_response_wrapper( |
1135 | 1253 | connections.submit, |
1136 | 1254 | ) |
| 1255 | + self.timeline = async_to_raw_response_wrapper( |
| 1256 | + connections.timeline, |
| 1257 | + ) |
1137 | 1258 |
|
1138 | 1259 |
|
1139 | 1260 | class ConnectionsResourceWithStreamingResponse: |
@@ -1164,6 +1285,9 @@ def __init__(self, connections: ConnectionsResource) -> None: |
1164 | 1285 | self.submit = to_streamed_response_wrapper( |
1165 | 1286 | connections.submit, |
1166 | 1287 | ) |
| 1288 | + self.timeline = to_streamed_response_wrapper( |
| 1289 | + connections.timeline, |
| 1290 | + ) |
1167 | 1291 |
|
1168 | 1292 |
|
1169 | 1293 | class AsyncConnectionsResourceWithStreamingResponse: |
@@ -1194,3 +1318,6 @@ def __init__(self, connections: AsyncConnectionsResource) -> None: |
1194 | 1318 | self.submit = async_to_streamed_response_wrapper( |
1195 | 1319 | connections.submit, |
1196 | 1320 | ) |
| 1321 | + self.timeline = async_to_streamed_response_wrapper( |
| 1322 | + connections.timeline, |
| 1323 | + ) |
0 commit comments