tango-python 0.0.1a1__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.
Files changed (94) hide show
  1. tango/__init__.py +83 -0
  2. tango/_base_client.py +2045 -0
  3. tango/_client.py +544 -0
  4. tango/_compat.py +219 -0
  5. tango/_constants.py +14 -0
  6. tango/_exceptions.py +108 -0
  7. tango/_files.py +123 -0
  8. tango/_models.py +788 -0
  9. tango/_qs.py +150 -0
  10. tango/_resource.py +43 -0
  11. tango/_response.py +824 -0
  12. tango/_streaming.py +333 -0
  13. tango/_types.py +219 -0
  14. tango/_utils/__init__.py +56 -0
  15. tango/_utils/_logs.py +25 -0
  16. tango/_utils/_proxy.py +62 -0
  17. tango/_utils/_reflection.py +42 -0
  18. tango/_utils/_streams.py +12 -0
  19. tango/_utils/_sync.py +71 -0
  20. tango/_utils/_transform.py +392 -0
  21. tango/_utils/_typing.py +120 -0
  22. tango/_utils/_utils.py +414 -0
  23. tango/_version.py +4 -0
  24. tango/lib/.keep +4 -0
  25. tango/py.typed +0 -0
  26. tango/resources/__init__.py +229 -0
  27. tango/resources/agencies.py +255 -0
  28. tango/resources/assistance_listings.py +214 -0
  29. tango/resources/bulk/__init__.py +33 -0
  30. tango/resources/bulk/bulk.py +102 -0
  31. tango/resources/bulk/entities.py +152 -0
  32. tango/resources/business_types.py +218 -0
  33. tango/resources/contracts.py +381 -0
  34. tango/resources/departments.py +210 -0
  35. tango/resources/entities.py +325 -0
  36. tango/resources/idvs/__init__.py +33 -0
  37. tango/resources/idvs/awards.py +287 -0
  38. tango/resources/idvs/idvs.py +413 -0
  39. tango/resources/naics.py +317 -0
  40. tango/resources/notices.py +391 -0
  41. tango/resources/offices.py +281 -0
  42. tango/resources/opportunities.py +420 -0
  43. tango/resources/pscs.py +210 -0
  44. tango/resources/schemas.py +398 -0
  45. tango/resources/subawards.py +313 -0
  46. tango/resources/versions.py +136 -0
  47. tango/types/__init__.py +43 -0
  48. tango/types/agency.py +17 -0
  49. tango/types/agency_list_params.py +14 -0
  50. tango/types/agency_list_response.py +10 -0
  51. tango/types/assistance_listing.py +12 -0
  52. tango/types/assistance_listing_list_response.py +10 -0
  53. tango/types/assistance_listing_retrieve_response.py +26 -0
  54. tango/types/bulk/__init__.py +3 -0
  55. tango/types/business_type.py +14 -0
  56. tango/types/business_type_list_response.py +10 -0
  57. tango/types/contract_list_params.py +78 -0
  58. tango/types/contract_list_response.py +55 -0
  59. tango/types/contract_retrieve_response.py +51 -0
  60. tango/types/department.py +16 -0
  61. tango/types/department_list_response.py +10 -0
  62. tango/types/entity_list_params.py +38 -0
  63. tango/types/entity_list_response.py +37 -0
  64. tango/types/entity_retrieve_response.py +116 -0
  65. tango/types/idv.py +102 -0
  66. tango/types/idv_list_params.py +78 -0
  67. tango/types/idv_list_response.py +27 -0
  68. tango/types/idvs/__init__.py +6 -0
  69. tango/types/idvs/award_list_params.py +55 -0
  70. tango/types/idvs/award_list_response.py +55 -0
  71. tango/types/naic_list_params.py +47 -0
  72. tango/types/naic_list_response.py +10 -0
  73. tango/types/naic_retrieve_response.py +13 -0
  74. tango/types/naics_code.py +13 -0
  75. tango/types/notice_list_params.py +81 -0
  76. tango/types/notice_list_response.py +60 -0
  77. tango/types/notice_retrieve_response.py +93 -0
  78. tango/types/office.py +15 -0
  79. tango/types/office_list_params.py +18 -0
  80. tango/types/office_list_response.py +18 -0
  81. tango/types/opportunity_list_params.py +97 -0
  82. tango/types/opportunity_list_response.py +101 -0
  83. tango/types/opportunity_retrieve_response.py +123 -0
  84. tango/types/product_service_code.py +21 -0
  85. tango/types/psc_list_response.py +10 -0
  86. tango/types/schema_retrieve_params.py +113 -0
  87. tango/types/schema_retrieve_response.py +8 -0
  88. tango/types/subaward.py +172 -0
  89. tango/types/subaward_list_params.py +33 -0
  90. tango/types/subaward_list_response.py +18 -0
  91. tango_python-0.0.1a1.dist-info/METADATA +359 -0
  92. tango_python-0.0.1a1.dist-info/RECORD +94 -0
  93. tango_python-0.0.1a1.dist-info/WHEEL +4 -0
  94. tango_python-0.0.1a1.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,381 @@
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 contract_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.contract_list_response import ContractListResponse
23
+ from ..types.contract_retrieve_response import ContractRetrieveResponse
24
+
25
+ __all__ = ["ContractsResource", "AsyncContractsResource"]
26
+
27
+
28
+ class ContractsResource(SyncAPIResource):
29
+ @cached_property
30
+ def with_raw_response(self) -> ContractsResourceWithRawResponse:
31
+ """
32
+ This property can be used as a prefix for any HTTP method call to return the
33
+ the raw response object instead of the parsed content.
34
+
35
+ For more information, see https://www.github.com/makegov/tango-python#accessing-raw-response-data-eg-headers
36
+ """
37
+ return ContractsResourceWithRawResponse(self)
38
+
39
+ @cached_property
40
+ def with_streaming_response(self) -> ContractsResourceWithStreamingResponse:
41
+ """
42
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
43
+
44
+ For more information, see https://www.github.com/makegov/tango-python#with_streaming_response
45
+ """
46
+ return ContractsResourceWithStreamingResponse(self)
47
+
48
+ def retrieve(
49
+ self,
50
+ contract_award_unique_key: str,
51
+ *,
52
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
53
+ # The extra values given here take precedence over values defined on the client or passed to this method.
54
+ extra_headers: Headers | None = None,
55
+ extra_query: Query | None = None,
56
+ extra_body: Body | None = None,
57
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
58
+ ) -> ContractRetrieveResponse:
59
+ """
60
+ API endpoint that allows contracts lookup.
61
+
62
+ Args:
63
+ extra_headers: Send extra headers
64
+
65
+ extra_query: Add additional query parameters to the request
66
+
67
+ extra_body: Add additional JSON properties to the request
68
+
69
+ timeout: Override the client-level default timeout for this request, in seconds
70
+ """
71
+ if not contract_award_unique_key:
72
+ raise ValueError(
73
+ f"Expected a non-empty value for `contract_award_unique_key` but received {contract_award_unique_key!r}"
74
+ )
75
+ return self._get(
76
+ f"/api/contracts/{contract_award_unique_key}/",
77
+ options=make_request_options(
78
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
79
+ ),
80
+ cast_to=ContractRetrieveResponse,
81
+ )
82
+
83
+ def list(
84
+ self,
85
+ *,
86
+ award_date: str | NotGiven = NOT_GIVEN,
87
+ award_date_gte: str | NotGiven = NOT_GIVEN,
88
+ award_date_lte: str | NotGiven = NOT_GIVEN,
89
+ awarding_agency: str | NotGiven = NOT_GIVEN,
90
+ fiscal_year: str | NotGiven = NOT_GIVEN,
91
+ fiscal_year_gte: str | NotGiven = NOT_GIVEN,
92
+ fiscal_year_lte: str | NotGiven = NOT_GIVEN,
93
+ funding_agency: str | NotGiven = NOT_GIVEN,
94
+ limit: int | NotGiven = NOT_GIVEN,
95
+ naics: str | NotGiven = NOT_GIVEN,
96
+ ordering: str | NotGiven = NOT_GIVEN,
97
+ page: int | NotGiven = NOT_GIVEN,
98
+ psc: str | NotGiven = NOT_GIVEN,
99
+ set_aside: str | NotGiven = NOT_GIVEN,
100
+ uei: str | NotGiven = NOT_GIVEN,
101
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
102
+ # The extra values given here take precedence over values defined on the client or passed to this method.
103
+ extra_headers: Headers | None = None,
104
+ extra_query: Query | None = None,
105
+ extra_body: Body | None = None,
106
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
107
+ ) -> ContractListResponse:
108
+ """
109
+ API endpoint that allows contracts lookup.
110
+
111
+ Args:
112
+ award_date: <details><summary>Filter by award date</summary><ul><li><span>Accepted values: <var>2024-08-01</var>, <var>2024-08</var></span></li></ul></details>
113
+
114
+ award_date_gte: <details><summary>Filter by award date</summary><ul><li><span>Accepted values: <var>2024-08-01</var></span></li></ul></details>
115
+
116
+ award_date_lte: <details><summary>Filter by award date</summary><ul><li><span>Accepted values: <var>2024-08-01</var></span></li></ul></details>
117
+
118
+ awarding_agency: <details><summary>Filter by awarding agency</summary><ul><li>Accepts any agency or department code, acronym, or (partial) name</li><li>Disjunctive with <var>|</var> or <var>OR</var></li></ul></details>
119
+
120
+ fiscal_year: <details><summary>Filter by fiscal year</summary><ul><li><span>Accepted values: <var>2024</var></span></li></ul></details>
121
+
122
+ fiscal_year_gte: <details><summary>Filter by fiscal year</summary><ul><li><span>Accepted values: <var>2024</var></span></li></ul></details>
123
+
124
+ fiscal_year_lte: <details><summary>Filter by fiscal year</summary><ul><li><span>Accepted values: <var>2024</var></span></li></ul></details>
125
+
126
+ funding_agency: <details><summary>Filter by funding agency</summary><ul><li>Accepts any agency or department code, acronym, or (partial) name</li><li>Disjunctive with <var>|</var> or <var>OR</var></li></ul></details>
127
+
128
+ limit: Number of results to return per page.
129
+
130
+ naics: <details><summary>Filter by NAICS Code</summary><ul><li><span>Accepted values: <var>541511</var>, <var>541512</var>, <var>etc.</var></span></li><li>Disjunctive with <var>|</var> or <var>OR</var></li></ul></details>
131
+
132
+ ordering: <details><summary>Order results by a field of your choice.</summary><ul><li><span>Accepted values: <var>award_date</var>, <var>obligated</var>, <var>potential_total_value</var>, <var>recipient_name</var></span></li><li>Prefix with <var>-</var> to reverse order (e.g. <var>-award_date</var>)</li></ul></details>
133
+
134
+ page: A page number within the paginated result set.
135
+
136
+ psc: <details><summary>Filter by PSC (Product Service Code)</summary><ul><li><span>Accepted values: <var>S222</var>, <var>T005</var>, <var>etc.</var></span></li><li>Disjunctive with <var>|</var> or <var>OR</var></li></ul></details>
137
+
138
+ set_aside: <details><summary>Filter by set-aside type</summary><ul><li><span>Accepted values: <var>8A</var>, <var>8AN</var>, <var>BICiv</var>, <var>EDWOSB</var>, <var>EDWOSBSS</var>, <var>HUBZONE</var>, <var>HZC</var>, <var>HZS</var>, <var>IEE</var>, <var>ISBEE</var>, <var>LAS</var>, <var>NONE</var>, <var>SB</var>, <var>SBA</var>, <var>SBP</var>, <var>SDB</var>, <var>SDVOSB</var>, <var>SDVOSBC</var>, <var>SDVOSBS</var>, <var>VOSB</var>, <var>VSA</var>, <var>VSS</var>, <var>WOSB</var>, <var>WOSBSS</var></span></li><li>Disjunctive with <var>|</var> or <var>OR</var></li></ul></details>
139
+
140
+ uei: Filter by recipient UEI (Unique Entity Identifier)
141
+
142
+ extra_headers: Send extra headers
143
+
144
+ extra_query: Add additional query parameters to the request
145
+
146
+ extra_body: Add additional JSON properties to the request
147
+
148
+ timeout: Override the client-level default timeout for this request, in seconds
149
+ """
150
+ return self._get(
151
+ "/api/contracts/",
152
+ options=make_request_options(
153
+ extra_headers=extra_headers,
154
+ extra_query=extra_query,
155
+ extra_body=extra_body,
156
+ timeout=timeout,
157
+ query=maybe_transform(
158
+ {
159
+ "award_date": award_date,
160
+ "award_date_gte": award_date_gte,
161
+ "award_date_lte": award_date_lte,
162
+ "awarding_agency": awarding_agency,
163
+ "fiscal_year": fiscal_year,
164
+ "fiscal_year_gte": fiscal_year_gte,
165
+ "fiscal_year_lte": fiscal_year_lte,
166
+ "funding_agency": funding_agency,
167
+ "limit": limit,
168
+ "naics": naics,
169
+ "ordering": ordering,
170
+ "page": page,
171
+ "psc": psc,
172
+ "set_aside": set_aside,
173
+ "uei": uei,
174
+ },
175
+ contract_list_params.ContractListParams,
176
+ ),
177
+ ),
178
+ cast_to=ContractListResponse,
179
+ )
180
+
181
+
182
+ class AsyncContractsResource(AsyncAPIResource):
183
+ @cached_property
184
+ def with_raw_response(self) -> AsyncContractsResourceWithRawResponse:
185
+ """
186
+ This property can be used as a prefix for any HTTP method call to return the
187
+ the raw response object instead of the parsed content.
188
+
189
+ For more information, see https://www.github.com/makegov/tango-python#accessing-raw-response-data-eg-headers
190
+ """
191
+ return AsyncContractsResourceWithRawResponse(self)
192
+
193
+ @cached_property
194
+ def with_streaming_response(self) -> AsyncContractsResourceWithStreamingResponse:
195
+ """
196
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
197
+
198
+ For more information, see https://www.github.com/makegov/tango-python#with_streaming_response
199
+ """
200
+ return AsyncContractsResourceWithStreamingResponse(self)
201
+
202
+ async def retrieve(
203
+ self,
204
+ contract_award_unique_key: str,
205
+ *,
206
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
207
+ # The extra values given here take precedence over values defined on the client or passed to this method.
208
+ extra_headers: Headers | None = None,
209
+ extra_query: Query | None = None,
210
+ extra_body: Body | None = None,
211
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
212
+ ) -> ContractRetrieveResponse:
213
+ """
214
+ API endpoint that allows contracts lookup.
215
+
216
+ Args:
217
+ extra_headers: Send extra headers
218
+
219
+ extra_query: Add additional query parameters to the request
220
+
221
+ extra_body: Add additional JSON properties to the request
222
+
223
+ timeout: Override the client-level default timeout for this request, in seconds
224
+ """
225
+ if not contract_award_unique_key:
226
+ raise ValueError(
227
+ f"Expected a non-empty value for `contract_award_unique_key` but received {contract_award_unique_key!r}"
228
+ )
229
+ return await self._get(
230
+ f"/api/contracts/{contract_award_unique_key}/",
231
+ options=make_request_options(
232
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
233
+ ),
234
+ cast_to=ContractRetrieveResponse,
235
+ )
236
+
237
+ async def list(
238
+ self,
239
+ *,
240
+ award_date: str | NotGiven = NOT_GIVEN,
241
+ award_date_gte: str | NotGiven = NOT_GIVEN,
242
+ award_date_lte: str | NotGiven = NOT_GIVEN,
243
+ awarding_agency: str | NotGiven = NOT_GIVEN,
244
+ fiscal_year: str | NotGiven = NOT_GIVEN,
245
+ fiscal_year_gte: str | NotGiven = NOT_GIVEN,
246
+ fiscal_year_lte: str | NotGiven = NOT_GIVEN,
247
+ funding_agency: str | NotGiven = NOT_GIVEN,
248
+ limit: int | NotGiven = NOT_GIVEN,
249
+ naics: str | NotGiven = NOT_GIVEN,
250
+ ordering: str | NotGiven = NOT_GIVEN,
251
+ page: int | NotGiven = NOT_GIVEN,
252
+ psc: str | NotGiven = NOT_GIVEN,
253
+ set_aside: str | NotGiven = NOT_GIVEN,
254
+ uei: str | NotGiven = NOT_GIVEN,
255
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
256
+ # The extra values given here take precedence over values defined on the client or passed to this method.
257
+ extra_headers: Headers | None = None,
258
+ extra_query: Query | None = None,
259
+ extra_body: Body | None = None,
260
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
261
+ ) -> ContractListResponse:
262
+ """
263
+ API endpoint that allows contracts lookup.
264
+
265
+ Args:
266
+ award_date: <details><summary>Filter by award date</summary><ul><li><span>Accepted values: <var>2024-08-01</var>, <var>2024-08</var></span></li></ul></details>
267
+
268
+ award_date_gte: <details><summary>Filter by award date</summary><ul><li><span>Accepted values: <var>2024-08-01</var></span></li></ul></details>
269
+
270
+ award_date_lte: <details><summary>Filter by award date</summary><ul><li><span>Accepted values: <var>2024-08-01</var></span></li></ul></details>
271
+
272
+ awarding_agency: <details><summary>Filter by awarding agency</summary><ul><li>Accepts any agency or department code, acronym, or (partial) name</li><li>Disjunctive with <var>|</var> or <var>OR</var></li></ul></details>
273
+
274
+ fiscal_year: <details><summary>Filter by fiscal year</summary><ul><li><span>Accepted values: <var>2024</var></span></li></ul></details>
275
+
276
+ fiscal_year_gte: <details><summary>Filter by fiscal year</summary><ul><li><span>Accepted values: <var>2024</var></span></li></ul></details>
277
+
278
+ fiscal_year_lte: <details><summary>Filter by fiscal year</summary><ul><li><span>Accepted values: <var>2024</var></span></li></ul></details>
279
+
280
+ funding_agency: <details><summary>Filter by funding agency</summary><ul><li>Accepts any agency or department code, acronym, or (partial) name</li><li>Disjunctive with <var>|</var> or <var>OR</var></li></ul></details>
281
+
282
+ limit: Number of results to return per page.
283
+
284
+ naics: <details><summary>Filter by NAICS Code</summary><ul><li><span>Accepted values: <var>541511</var>, <var>541512</var>, <var>etc.</var></span></li><li>Disjunctive with <var>|</var> or <var>OR</var></li></ul></details>
285
+
286
+ ordering: <details><summary>Order results by a field of your choice.</summary><ul><li><span>Accepted values: <var>award_date</var>, <var>obligated</var>, <var>potential_total_value</var>, <var>recipient_name</var></span></li><li>Prefix with <var>-</var> to reverse order (e.g. <var>-award_date</var>)</li></ul></details>
287
+
288
+ page: A page number within the paginated result set.
289
+
290
+ psc: <details><summary>Filter by PSC (Product Service Code)</summary><ul><li><span>Accepted values: <var>S222</var>, <var>T005</var>, <var>etc.</var></span></li><li>Disjunctive with <var>|</var> or <var>OR</var></li></ul></details>
291
+
292
+ set_aside: <details><summary>Filter by set-aside type</summary><ul><li><span>Accepted values: <var>8A</var>, <var>8AN</var>, <var>BICiv</var>, <var>EDWOSB</var>, <var>EDWOSBSS</var>, <var>HUBZONE</var>, <var>HZC</var>, <var>HZS</var>, <var>IEE</var>, <var>ISBEE</var>, <var>LAS</var>, <var>NONE</var>, <var>SB</var>, <var>SBA</var>, <var>SBP</var>, <var>SDB</var>, <var>SDVOSB</var>, <var>SDVOSBC</var>, <var>SDVOSBS</var>, <var>VOSB</var>, <var>VSA</var>, <var>VSS</var>, <var>WOSB</var>, <var>WOSBSS</var></span></li><li>Disjunctive with <var>|</var> or <var>OR</var></li></ul></details>
293
+
294
+ uei: Filter by recipient UEI (Unique Entity Identifier)
295
+
296
+ extra_headers: Send extra headers
297
+
298
+ extra_query: Add additional query parameters to the request
299
+
300
+ extra_body: Add additional JSON properties to the request
301
+
302
+ timeout: Override the client-level default timeout for this request, in seconds
303
+ """
304
+ return await self._get(
305
+ "/api/contracts/",
306
+ options=make_request_options(
307
+ extra_headers=extra_headers,
308
+ extra_query=extra_query,
309
+ extra_body=extra_body,
310
+ timeout=timeout,
311
+ query=await async_maybe_transform(
312
+ {
313
+ "award_date": award_date,
314
+ "award_date_gte": award_date_gte,
315
+ "award_date_lte": award_date_lte,
316
+ "awarding_agency": awarding_agency,
317
+ "fiscal_year": fiscal_year,
318
+ "fiscal_year_gte": fiscal_year_gte,
319
+ "fiscal_year_lte": fiscal_year_lte,
320
+ "funding_agency": funding_agency,
321
+ "limit": limit,
322
+ "naics": naics,
323
+ "ordering": ordering,
324
+ "page": page,
325
+ "psc": psc,
326
+ "set_aside": set_aside,
327
+ "uei": uei,
328
+ },
329
+ contract_list_params.ContractListParams,
330
+ ),
331
+ ),
332
+ cast_to=ContractListResponse,
333
+ )
334
+
335
+
336
+ class ContractsResourceWithRawResponse:
337
+ def __init__(self, contracts: ContractsResource) -> None:
338
+ self._contracts = contracts
339
+
340
+ self.retrieve = to_raw_response_wrapper(
341
+ contracts.retrieve,
342
+ )
343
+ self.list = to_raw_response_wrapper(
344
+ contracts.list,
345
+ )
346
+
347
+
348
+ class AsyncContractsResourceWithRawResponse:
349
+ def __init__(self, contracts: AsyncContractsResource) -> None:
350
+ self._contracts = contracts
351
+
352
+ self.retrieve = async_to_raw_response_wrapper(
353
+ contracts.retrieve,
354
+ )
355
+ self.list = async_to_raw_response_wrapper(
356
+ contracts.list,
357
+ )
358
+
359
+
360
+ class ContractsResourceWithStreamingResponse:
361
+ def __init__(self, contracts: ContractsResource) -> None:
362
+ self._contracts = contracts
363
+
364
+ self.retrieve = to_streamed_response_wrapper(
365
+ contracts.retrieve,
366
+ )
367
+ self.list = to_streamed_response_wrapper(
368
+ contracts.list,
369
+ )
370
+
371
+
372
+ class AsyncContractsResourceWithStreamingResponse:
373
+ def __init__(self, contracts: AsyncContractsResource) -> None:
374
+ self._contracts = contracts
375
+
376
+ self.retrieve = async_to_streamed_response_wrapper(
377
+ contracts.retrieve,
378
+ )
379
+ self.list = async_to_streamed_response_wrapper(
380
+ contracts.list,
381
+ )
@@ -0,0 +1,210 @@
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 NOT_GIVEN, Body, Query, Headers, NotGiven
8
+ from .._compat import cached_property
9
+ from .._resource import SyncAPIResource, AsyncAPIResource
10
+ from .._response import (
11
+ to_raw_response_wrapper,
12
+ to_streamed_response_wrapper,
13
+ async_to_raw_response_wrapper,
14
+ async_to_streamed_response_wrapper,
15
+ )
16
+ from .._base_client import make_request_options
17
+ from ..types.department import Department
18
+ from ..types.department_list_response import DepartmentListResponse
19
+
20
+ __all__ = ["DepartmentsResource", "AsyncDepartmentsResource"]
21
+
22
+
23
+ class DepartmentsResource(SyncAPIResource):
24
+ @cached_property
25
+ def with_raw_response(self) -> DepartmentsResourceWithRawResponse:
26
+ """
27
+ This property can be used as a prefix for any HTTP method call to return the
28
+ the raw response object instead of the parsed content.
29
+
30
+ For more information, see https://www.github.com/makegov/tango-python#accessing-raw-response-data-eg-headers
31
+ """
32
+ return DepartmentsResourceWithRawResponse(self)
33
+
34
+ @cached_property
35
+ def with_streaming_response(self) -> DepartmentsResourceWithStreamingResponse:
36
+ """
37
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38
+
39
+ For more information, see https://www.github.com/makegov/tango-python#with_streaming_response
40
+ """
41
+ return DepartmentsResourceWithStreamingResponse(self)
42
+
43
+ def retrieve(
44
+ self,
45
+ code: int,
46
+ *,
47
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
48
+ # The extra values given here take precedence over values defined on the client or passed to this method.
49
+ extra_headers: Headers | None = None,
50
+ extra_query: Query | None = None,
51
+ extra_body: Body | None = None,
52
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
53
+ ) -> Department:
54
+ """
55
+ API endpoint that allows departments to be viewed.
56
+
57
+ Args:
58
+ extra_headers: Send extra headers
59
+
60
+ extra_query: Add additional query parameters to the request
61
+
62
+ extra_body: Add additional JSON properties to the request
63
+
64
+ timeout: Override the client-level default timeout for this request, in seconds
65
+ """
66
+ return self._get(
67
+ f"/api/departments/{code}/",
68
+ options=make_request_options(
69
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
70
+ ),
71
+ cast_to=Department,
72
+ )
73
+
74
+ def list(
75
+ self,
76
+ *,
77
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
78
+ # The extra values given here take precedence over values defined on the client or passed to this method.
79
+ extra_headers: Headers | None = None,
80
+ extra_query: Query | None = None,
81
+ extra_body: Body | None = None,
82
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
83
+ ) -> DepartmentListResponse:
84
+ """API endpoint that allows departments to be viewed."""
85
+ return self._get(
86
+ "/api/departments/",
87
+ options=make_request_options(
88
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
89
+ ),
90
+ cast_to=DepartmentListResponse,
91
+ )
92
+
93
+
94
+ class AsyncDepartmentsResource(AsyncAPIResource):
95
+ @cached_property
96
+ def with_raw_response(self) -> AsyncDepartmentsResourceWithRawResponse:
97
+ """
98
+ This property can be used as a prefix for any HTTP method call to return the
99
+ the raw response object instead of the parsed content.
100
+
101
+ For more information, see https://www.github.com/makegov/tango-python#accessing-raw-response-data-eg-headers
102
+ """
103
+ return AsyncDepartmentsResourceWithRawResponse(self)
104
+
105
+ @cached_property
106
+ def with_streaming_response(self) -> AsyncDepartmentsResourceWithStreamingResponse:
107
+ """
108
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
109
+
110
+ For more information, see https://www.github.com/makegov/tango-python#with_streaming_response
111
+ """
112
+ return AsyncDepartmentsResourceWithStreamingResponse(self)
113
+
114
+ async def retrieve(
115
+ self,
116
+ code: int,
117
+ *,
118
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
119
+ # The extra values given here take precedence over values defined on the client or passed to this method.
120
+ extra_headers: Headers | None = None,
121
+ extra_query: Query | None = None,
122
+ extra_body: Body | None = None,
123
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
124
+ ) -> Department:
125
+ """
126
+ API endpoint that allows departments to be viewed.
127
+
128
+ Args:
129
+ extra_headers: Send extra headers
130
+
131
+ extra_query: Add additional query parameters to the request
132
+
133
+ extra_body: Add additional JSON properties to the request
134
+
135
+ timeout: Override the client-level default timeout for this request, in seconds
136
+ """
137
+ return await self._get(
138
+ f"/api/departments/{code}/",
139
+ options=make_request_options(
140
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
141
+ ),
142
+ cast_to=Department,
143
+ )
144
+
145
+ async def list(
146
+ self,
147
+ *,
148
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
149
+ # The extra values given here take precedence over values defined on the client or passed to this method.
150
+ extra_headers: Headers | None = None,
151
+ extra_query: Query | None = None,
152
+ extra_body: Body | None = None,
153
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
154
+ ) -> DepartmentListResponse:
155
+ """API endpoint that allows departments to be viewed."""
156
+ return await self._get(
157
+ "/api/departments/",
158
+ options=make_request_options(
159
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
160
+ ),
161
+ cast_to=DepartmentListResponse,
162
+ )
163
+
164
+
165
+ class DepartmentsResourceWithRawResponse:
166
+ def __init__(self, departments: DepartmentsResource) -> None:
167
+ self._departments = departments
168
+
169
+ self.retrieve = to_raw_response_wrapper(
170
+ departments.retrieve,
171
+ )
172
+ self.list = to_raw_response_wrapper(
173
+ departments.list,
174
+ )
175
+
176
+
177
+ class AsyncDepartmentsResourceWithRawResponse:
178
+ def __init__(self, departments: AsyncDepartmentsResource) -> None:
179
+ self._departments = departments
180
+
181
+ self.retrieve = async_to_raw_response_wrapper(
182
+ departments.retrieve,
183
+ )
184
+ self.list = async_to_raw_response_wrapper(
185
+ departments.list,
186
+ )
187
+
188
+
189
+ class DepartmentsResourceWithStreamingResponse:
190
+ def __init__(self, departments: DepartmentsResource) -> None:
191
+ self._departments = departments
192
+
193
+ self.retrieve = to_streamed_response_wrapper(
194
+ departments.retrieve,
195
+ )
196
+ self.list = to_streamed_response_wrapper(
197
+ departments.list,
198
+ )
199
+
200
+
201
+ class AsyncDepartmentsResourceWithStreamingResponse:
202
+ def __init__(self, departments: AsyncDepartmentsResource) -> None:
203
+ self._departments = departments
204
+
205
+ self.retrieve = async_to_streamed_response_wrapper(
206
+ departments.retrieve,
207
+ )
208
+ self.list = async_to_streamed_response_wrapper(
209
+ departments.list,
210
+ )