|
| 1 | +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +from __future__ import annotations |
| 4 | + |
| 5 | +import httpx |
| 6 | + |
| 7 | +from ..types import vehicles_for_agency_list_params |
| 8 | +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven |
| 9 | +from .._utils import ( |
| 10 | + maybe_transform, |
| 11 | + async_maybe_transform, |
| 12 | +) |
| 13 | +from .._compat import cached_property |
| 14 | +from .._resource import SyncAPIResource, AsyncAPIResource |
| 15 | +from .._response import ( |
| 16 | + to_raw_response_wrapper, |
| 17 | + to_streamed_response_wrapper, |
| 18 | + async_to_raw_response_wrapper, |
| 19 | + async_to_streamed_response_wrapper, |
| 20 | +) |
| 21 | +from .._base_client import make_request_options |
| 22 | +from ..types.vehicles_for_agency_list_response import VehiclesForAgencyListResponse |
| 23 | + |
| 24 | +__all__ = ["VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource"] |
| 25 | + |
| 26 | + |
| 27 | +class VehiclesForAgencyResource(SyncAPIResource): |
| 28 | + @cached_property |
| 29 | + def with_raw_response(self) -> VehiclesForAgencyResourceWithRawResponse: |
| 30 | + return VehiclesForAgencyResourceWithRawResponse(self) |
| 31 | + |
| 32 | + @cached_property |
| 33 | + def with_streaming_response(self) -> VehiclesForAgencyResourceWithStreamingResponse: |
| 34 | + return VehiclesForAgencyResourceWithStreamingResponse(self) |
| 35 | + |
| 36 | + def list( |
| 37 | + self, |
| 38 | + agency_id: str, |
| 39 | + *, |
| 40 | + time: str | NotGiven = NOT_GIVEN, |
| 41 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 42 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 43 | + extra_headers: Headers | None = None, |
| 44 | + extra_query: Query | None = None, |
| 45 | + extra_body: Body | None = None, |
| 46 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 47 | + ) -> VehiclesForAgencyListResponse: |
| 48 | + """ |
| 49 | + Get vehicles for a specific agency |
| 50 | +
|
| 51 | + Args: |
| 52 | + time: Specific time for querying the status (timestamp format) |
| 53 | +
|
| 54 | + extra_headers: Send extra headers |
| 55 | +
|
| 56 | + extra_query: Add additional query parameters to the request |
| 57 | +
|
| 58 | + extra_body: Add additional JSON properties to the request |
| 59 | +
|
| 60 | + timeout: Override the client-level default timeout for this request, in seconds |
| 61 | + """ |
| 62 | + if not agency_id: |
| 63 | + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") |
| 64 | + return self._get( |
| 65 | + f"/api/where/vehicles-for-agency/agencyID.json", |
| 66 | + options=make_request_options( |
| 67 | + extra_headers=extra_headers, |
| 68 | + extra_query=extra_query, |
| 69 | + extra_body=extra_body, |
| 70 | + timeout=timeout, |
| 71 | + query=maybe_transform({"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams), |
| 72 | + ), |
| 73 | + cast_to=VehiclesForAgencyListResponse, |
| 74 | + ) |
| 75 | + |
| 76 | + |
| 77 | +class AsyncVehiclesForAgencyResource(AsyncAPIResource): |
| 78 | + @cached_property |
| 79 | + def with_raw_response(self) -> AsyncVehiclesForAgencyResourceWithRawResponse: |
| 80 | + return AsyncVehiclesForAgencyResourceWithRawResponse(self) |
| 81 | + |
| 82 | + @cached_property |
| 83 | + def with_streaming_response(self) -> AsyncVehiclesForAgencyResourceWithStreamingResponse: |
| 84 | + return AsyncVehiclesForAgencyResourceWithStreamingResponse(self) |
| 85 | + |
| 86 | + async def list( |
| 87 | + self, |
| 88 | + agency_id: str, |
| 89 | + *, |
| 90 | + time: str | NotGiven = NOT_GIVEN, |
| 91 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 92 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 93 | + extra_headers: Headers | None = None, |
| 94 | + extra_query: Query | None = None, |
| 95 | + extra_body: Body | None = None, |
| 96 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 97 | + ) -> VehiclesForAgencyListResponse: |
| 98 | + """ |
| 99 | + Get vehicles for a specific agency |
| 100 | +
|
| 101 | + Args: |
| 102 | + time: Specific time for querying the status (timestamp format) |
| 103 | +
|
| 104 | + extra_headers: Send extra headers |
| 105 | +
|
| 106 | + extra_query: Add additional query parameters to the request |
| 107 | +
|
| 108 | + extra_body: Add additional JSON properties to the request |
| 109 | +
|
| 110 | + timeout: Override the client-level default timeout for this request, in seconds |
| 111 | + """ |
| 112 | + if not agency_id: |
| 113 | + raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}") |
| 114 | + return await self._get( |
| 115 | + f"/api/where/vehicles-for-agency/agencyID.json", |
| 116 | + options=make_request_options( |
| 117 | + extra_headers=extra_headers, |
| 118 | + extra_query=extra_query, |
| 119 | + extra_body=extra_body, |
| 120 | + timeout=timeout, |
| 121 | + query=await async_maybe_transform( |
| 122 | + {"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams |
| 123 | + ), |
| 124 | + ), |
| 125 | + cast_to=VehiclesForAgencyListResponse, |
| 126 | + ) |
| 127 | + |
| 128 | + |
| 129 | +class VehiclesForAgencyResourceWithRawResponse: |
| 130 | + def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: |
| 131 | + self._vehicles_for_agency = vehicles_for_agency |
| 132 | + |
| 133 | + self.list = to_raw_response_wrapper( |
| 134 | + vehicles_for_agency.list, |
| 135 | + ) |
| 136 | + |
| 137 | + |
| 138 | +class AsyncVehiclesForAgencyResourceWithRawResponse: |
| 139 | + def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: |
| 140 | + self._vehicles_for_agency = vehicles_for_agency |
| 141 | + |
| 142 | + self.list = async_to_raw_response_wrapper( |
| 143 | + vehicles_for_agency.list, |
| 144 | + ) |
| 145 | + |
| 146 | + |
| 147 | +class VehiclesForAgencyResourceWithStreamingResponse: |
| 148 | + def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None: |
| 149 | + self._vehicles_for_agency = vehicles_for_agency |
| 150 | + |
| 151 | + self.list = to_streamed_response_wrapper( |
| 152 | + vehicles_for_agency.list, |
| 153 | + ) |
| 154 | + |
| 155 | + |
| 156 | +class AsyncVehiclesForAgencyResourceWithStreamingResponse: |
| 157 | + def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None: |
| 158 | + self._vehicles_for_agency = vehicles_for_agency |
| 159 | + |
| 160 | + self.list = async_to_streamed_response_wrapper( |
| 161 | + vehicles_for_agency.list, |
| 162 | + ) |
0 commit comments