payi 0.1.0a14__py3-none-any.whl → 0.1.0a16__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.
Potentially problematic release.
This version of payi might be problematic. Click here for more details.
- payi/_base_client.py +29 -42
- payi/_client.py +8 -0
- payi/_compat.py +12 -17
- payi/_files.py +4 -8
- payi/_response.py +9 -8
- payi/_types.py +3 -6
- payi/_utils/_proxy.py +1 -2
- payi/_utils/_reflection.py +1 -1
- payi/_utils/_utils.py +6 -12
- payi/_version.py +1 -1
- payi/resources/__init__.py +14 -0
- payi/resources/budgets/budgets.py +2 -2
- payi/resources/categories/resources.py +4 -4
- payi/resources/experiences/__init__.py +33 -0
- payi/resources/experiences/experiences.py +325 -0
- payi/resources/experiences/types.py +459 -0
- payi/resources/ingest.py +101 -8
- payi/types/__init__.py +5 -1
- payi/types/budget_create_params.py +1 -1
- payi/types/budget_history_response.py +3 -26
- payi/types/budget_list_params.py +7 -9
- payi/types/budget_response.py +3 -26
- payi/types/budgets/tag_create_response.py +2 -1
- payi/types/budgets/tag_delete_response.py +2 -1
- payi/types/budgets/tag_list_response.py +2 -1
- payi/types/budgets/tag_remove_response.py +2 -1
- payi/types/budgets/tag_update_response.py +2 -1
- payi/types/bulk_ingest_response.py +44 -0
- payi/types/categories/resource_create_params.py +2 -2
- payi/types/categories/resource_list_response.py +2 -1
- payi/types/category_delete_resource_response.py +2 -1
- payi/types/category_delete_response.py +2 -1
- payi/types/category_list_resources_response.py +2 -1
- payi/types/category_list_response.py +2 -1
- payi/types/category_resource_response.py +2 -2
- payi/types/experience_instance.py +13 -0
- payi/types/experiences/__init__.py +8 -0
- payi/types/experiences/experience_type.py +17 -0
- payi/types/experiences/type_create_params.py +14 -0
- payi/types/experiences/type_list_response.py +10 -0
- payi/types/experiences/type_update_params.py +14 -0
- payi/types/ingest_bulk_params.py +34 -0
- payi/types/{proxy_result.py → ingest_response.py} +17 -6
- payi/types/paged_budget_list.py +3 -26
- payi/types/total_cost_data.py +31 -0
- {payi-0.1.0a14.dist-info → payi-0.1.0a16.dist-info}/METADATA +1 -1
- payi-0.1.0a16.dist-info/RECORD +82 -0
- payi-0.1.0a14.dist-info/RECORD +0 -70
- {payi-0.1.0a14.dist-info → payi-0.1.0a16.dist-info}/WHEEL +0 -0
- {payi-0.1.0a14.dist-info → payi-0.1.0a16.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
10
|
+
from ..._utils import (
|
|
11
|
+
maybe_transform,
|
|
12
|
+
async_maybe_transform,
|
|
13
|
+
)
|
|
14
|
+
from ..._compat import cached_property
|
|
15
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
16
|
+
from ..._response import (
|
|
17
|
+
to_raw_response_wrapper,
|
|
18
|
+
to_streamed_response_wrapper,
|
|
19
|
+
async_to_raw_response_wrapper,
|
|
20
|
+
async_to_streamed_response_wrapper,
|
|
21
|
+
)
|
|
22
|
+
from ..._base_client import make_request_options
|
|
23
|
+
from ...types.experiences import type_create_params, type_update_params
|
|
24
|
+
from ...types.experiences.experience_type import ExperienceType
|
|
25
|
+
from ...types.experiences.type_list_response import TypeListResponse
|
|
26
|
+
|
|
27
|
+
__all__ = ["TypesResource", "AsyncTypesResource"]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class TypesResource(SyncAPIResource):
|
|
31
|
+
@cached_property
|
|
32
|
+
def with_raw_response(self) -> TypesResourceWithRawResponse:
|
|
33
|
+
return TypesResourceWithRawResponse(self)
|
|
34
|
+
|
|
35
|
+
@cached_property
|
|
36
|
+
def with_streaming_response(self) -> TypesResourceWithStreamingResponse:
|
|
37
|
+
return TypesResourceWithStreamingResponse(self)
|
|
38
|
+
|
|
39
|
+
def create(
|
|
40
|
+
self,
|
|
41
|
+
*,
|
|
42
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
43
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
44
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
45
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
46
|
+
extra_headers: Headers | None = None,
|
|
47
|
+
extra_query: Query | None = None,
|
|
48
|
+
extra_body: Body | None = None,
|
|
49
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
50
|
+
) -> ExperienceType:
|
|
51
|
+
"""Adds a new experience type.
|
|
52
|
+
|
|
53
|
+
Instances of this type can be created via
|
|
54
|
+
/experiences/instance.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
extra_headers: Send extra headers
|
|
58
|
+
|
|
59
|
+
extra_query: Add additional query parameters to the request
|
|
60
|
+
|
|
61
|
+
extra_body: Add additional JSON properties to the request
|
|
62
|
+
|
|
63
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
64
|
+
"""
|
|
65
|
+
return self._post(
|
|
66
|
+
"/api/v1/experiences/types",
|
|
67
|
+
body=maybe_transform(
|
|
68
|
+
{
|
|
69
|
+
"description": description,
|
|
70
|
+
"name": name,
|
|
71
|
+
},
|
|
72
|
+
type_create_params.TypeCreateParams,
|
|
73
|
+
),
|
|
74
|
+
options=make_request_options(
|
|
75
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
76
|
+
),
|
|
77
|
+
cast_to=ExperienceType,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
def retrieve(
|
|
81
|
+
self,
|
|
82
|
+
experience_type_id: int,
|
|
83
|
+
*,
|
|
84
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
85
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
86
|
+
extra_headers: Headers | None = None,
|
|
87
|
+
extra_query: Query | None = None,
|
|
88
|
+
extra_body: Body | None = None,
|
|
89
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
90
|
+
) -> ExperienceType:
|
|
91
|
+
"""
|
|
92
|
+
Get details for a specific Experience Type
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
extra_headers: Send extra headers
|
|
96
|
+
|
|
97
|
+
extra_query: Add additional query parameters to the request
|
|
98
|
+
|
|
99
|
+
extra_body: Add additional JSON properties to the request
|
|
100
|
+
|
|
101
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
102
|
+
"""
|
|
103
|
+
return self._get(
|
|
104
|
+
f"/api/v1/experiences/types/{experience_type_id}",
|
|
105
|
+
options=make_request_options(
|
|
106
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
107
|
+
),
|
|
108
|
+
cast_to=ExperienceType,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
def update(
|
|
112
|
+
self,
|
|
113
|
+
experience_type_id: int,
|
|
114
|
+
*,
|
|
115
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
116
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
117
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
118
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
119
|
+
extra_headers: Headers | None = None,
|
|
120
|
+
extra_query: Query | None = None,
|
|
121
|
+
extra_body: Body | None = None,
|
|
122
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
123
|
+
) -> ExperienceType:
|
|
124
|
+
"""
|
|
125
|
+
Updates an existing experience type.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
extra_headers: Send extra headers
|
|
129
|
+
|
|
130
|
+
extra_query: Add additional query parameters to the request
|
|
131
|
+
|
|
132
|
+
extra_body: Add additional JSON properties to the request
|
|
133
|
+
|
|
134
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
135
|
+
"""
|
|
136
|
+
return self._patch(
|
|
137
|
+
f"/api/v1/experiences/types/{experience_type_id}",
|
|
138
|
+
body=maybe_transform(
|
|
139
|
+
{
|
|
140
|
+
"description": description,
|
|
141
|
+
"name": name,
|
|
142
|
+
},
|
|
143
|
+
type_update_params.TypeUpdateParams,
|
|
144
|
+
),
|
|
145
|
+
options=make_request_options(
|
|
146
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
147
|
+
),
|
|
148
|
+
cast_to=ExperienceType,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
def list(
|
|
152
|
+
self,
|
|
153
|
+
*,
|
|
154
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
155
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
156
|
+
extra_headers: Headers | None = None,
|
|
157
|
+
extra_query: Query | None = None,
|
|
158
|
+
extra_body: Body | None = None,
|
|
159
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
160
|
+
) -> TypeListResponse:
|
|
161
|
+
"""Get all Experience Types"""
|
|
162
|
+
return self._get(
|
|
163
|
+
"/api/v1/experiences/types",
|
|
164
|
+
options=make_request_options(
|
|
165
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
166
|
+
),
|
|
167
|
+
cast_to=TypeListResponse,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
def delete(
|
|
171
|
+
self,
|
|
172
|
+
experience_type_id: int,
|
|
173
|
+
*,
|
|
174
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
175
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
176
|
+
extra_headers: Headers | None = None,
|
|
177
|
+
extra_query: Query | None = None,
|
|
178
|
+
extra_body: Body | None = None,
|
|
179
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
180
|
+
) -> ExperienceType:
|
|
181
|
+
"""Deletes an experience type.
|
|
182
|
+
|
|
183
|
+
This will remove visiblity of this type from all
|
|
184
|
+
dashboard stats.
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
extra_headers: Send extra headers
|
|
188
|
+
|
|
189
|
+
extra_query: Add additional query parameters to the request
|
|
190
|
+
|
|
191
|
+
extra_body: Add additional JSON properties to the request
|
|
192
|
+
|
|
193
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
194
|
+
"""
|
|
195
|
+
return self._delete(
|
|
196
|
+
f"/api/v1/experiences/types/{experience_type_id}",
|
|
197
|
+
options=make_request_options(
|
|
198
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
199
|
+
),
|
|
200
|
+
cast_to=ExperienceType,
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
class AsyncTypesResource(AsyncAPIResource):
|
|
205
|
+
@cached_property
|
|
206
|
+
def with_raw_response(self) -> AsyncTypesResourceWithRawResponse:
|
|
207
|
+
return AsyncTypesResourceWithRawResponse(self)
|
|
208
|
+
|
|
209
|
+
@cached_property
|
|
210
|
+
def with_streaming_response(self) -> AsyncTypesResourceWithStreamingResponse:
|
|
211
|
+
return AsyncTypesResourceWithStreamingResponse(self)
|
|
212
|
+
|
|
213
|
+
async def create(
|
|
214
|
+
self,
|
|
215
|
+
*,
|
|
216
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
217
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
218
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
219
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
220
|
+
extra_headers: Headers | None = None,
|
|
221
|
+
extra_query: Query | None = None,
|
|
222
|
+
extra_body: Body | None = None,
|
|
223
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
224
|
+
) -> ExperienceType:
|
|
225
|
+
"""Adds a new experience type.
|
|
226
|
+
|
|
227
|
+
Instances of this type can be created via
|
|
228
|
+
/experiences/instance.
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
extra_headers: Send extra headers
|
|
232
|
+
|
|
233
|
+
extra_query: Add additional query parameters to the request
|
|
234
|
+
|
|
235
|
+
extra_body: Add additional JSON properties to the request
|
|
236
|
+
|
|
237
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
238
|
+
"""
|
|
239
|
+
return await self._post(
|
|
240
|
+
"/api/v1/experiences/types",
|
|
241
|
+
body=await async_maybe_transform(
|
|
242
|
+
{
|
|
243
|
+
"description": description,
|
|
244
|
+
"name": name,
|
|
245
|
+
},
|
|
246
|
+
type_create_params.TypeCreateParams,
|
|
247
|
+
),
|
|
248
|
+
options=make_request_options(
|
|
249
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
250
|
+
),
|
|
251
|
+
cast_to=ExperienceType,
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
async def retrieve(
|
|
255
|
+
self,
|
|
256
|
+
experience_type_id: int,
|
|
257
|
+
*,
|
|
258
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
259
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
260
|
+
extra_headers: Headers | None = None,
|
|
261
|
+
extra_query: Query | None = None,
|
|
262
|
+
extra_body: Body | None = None,
|
|
263
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
264
|
+
) -> ExperienceType:
|
|
265
|
+
"""
|
|
266
|
+
Get details for a specific Experience Type
|
|
267
|
+
|
|
268
|
+
Args:
|
|
269
|
+
extra_headers: Send extra headers
|
|
270
|
+
|
|
271
|
+
extra_query: Add additional query parameters to the request
|
|
272
|
+
|
|
273
|
+
extra_body: Add additional JSON properties to the request
|
|
274
|
+
|
|
275
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
276
|
+
"""
|
|
277
|
+
return await self._get(
|
|
278
|
+
f"/api/v1/experiences/types/{experience_type_id}",
|
|
279
|
+
options=make_request_options(
|
|
280
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
281
|
+
),
|
|
282
|
+
cast_to=ExperienceType,
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
async def update(
|
|
286
|
+
self,
|
|
287
|
+
experience_type_id: int,
|
|
288
|
+
*,
|
|
289
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
290
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
291
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
292
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
293
|
+
extra_headers: Headers | None = None,
|
|
294
|
+
extra_query: Query | None = None,
|
|
295
|
+
extra_body: Body | None = None,
|
|
296
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
297
|
+
) -> ExperienceType:
|
|
298
|
+
"""
|
|
299
|
+
Updates an existing experience type.
|
|
300
|
+
|
|
301
|
+
Args:
|
|
302
|
+
extra_headers: Send extra headers
|
|
303
|
+
|
|
304
|
+
extra_query: Add additional query parameters to the request
|
|
305
|
+
|
|
306
|
+
extra_body: Add additional JSON properties to the request
|
|
307
|
+
|
|
308
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
309
|
+
"""
|
|
310
|
+
return await self._patch(
|
|
311
|
+
f"/api/v1/experiences/types/{experience_type_id}",
|
|
312
|
+
body=await async_maybe_transform(
|
|
313
|
+
{
|
|
314
|
+
"description": description,
|
|
315
|
+
"name": name,
|
|
316
|
+
},
|
|
317
|
+
type_update_params.TypeUpdateParams,
|
|
318
|
+
),
|
|
319
|
+
options=make_request_options(
|
|
320
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
321
|
+
),
|
|
322
|
+
cast_to=ExperienceType,
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
async def list(
|
|
326
|
+
self,
|
|
327
|
+
*,
|
|
328
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
329
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
330
|
+
extra_headers: Headers | None = None,
|
|
331
|
+
extra_query: Query | None = None,
|
|
332
|
+
extra_body: Body | None = None,
|
|
333
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
334
|
+
) -> TypeListResponse:
|
|
335
|
+
"""Get all Experience Types"""
|
|
336
|
+
return await self._get(
|
|
337
|
+
"/api/v1/experiences/types",
|
|
338
|
+
options=make_request_options(
|
|
339
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
340
|
+
),
|
|
341
|
+
cast_to=TypeListResponse,
|
|
342
|
+
)
|
|
343
|
+
|
|
344
|
+
async def delete(
|
|
345
|
+
self,
|
|
346
|
+
experience_type_id: int,
|
|
347
|
+
*,
|
|
348
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
349
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
350
|
+
extra_headers: Headers | None = None,
|
|
351
|
+
extra_query: Query | None = None,
|
|
352
|
+
extra_body: Body | None = None,
|
|
353
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
354
|
+
) -> ExperienceType:
|
|
355
|
+
"""Deletes an experience type.
|
|
356
|
+
|
|
357
|
+
This will remove visiblity of this type from all
|
|
358
|
+
dashboard stats.
|
|
359
|
+
|
|
360
|
+
Args:
|
|
361
|
+
extra_headers: Send extra headers
|
|
362
|
+
|
|
363
|
+
extra_query: Add additional query parameters to the request
|
|
364
|
+
|
|
365
|
+
extra_body: Add additional JSON properties to the request
|
|
366
|
+
|
|
367
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
368
|
+
"""
|
|
369
|
+
return await self._delete(
|
|
370
|
+
f"/api/v1/experiences/types/{experience_type_id}",
|
|
371
|
+
options=make_request_options(
|
|
372
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
373
|
+
),
|
|
374
|
+
cast_to=ExperienceType,
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
class TypesResourceWithRawResponse:
|
|
379
|
+
def __init__(self, types: TypesResource) -> None:
|
|
380
|
+
self._types = types
|
|
381
|
+
|
|
382
|
+
self.create = to_raw_response_wrapper(
|
|
383
|
+
types.create,
|
|
384
|
+
)
|
|
385
|
+
self.retrieve = to_raw_response_wrapper(
|
|
386
|
+
types.retrieve,
|
|
387
|
+
)
|
|
388
|
+
self.update = to_raw_response_wrapper(
|
|
389
|
+
types.update,
|
|
390
|
+
)
|
|
391
|
+
self.list = to_raw_response_wrapper(
|
|
392
|
+
types.list,
|
|
393
|
+
)
|
|
394
|
+
self.delete = to_raw_response_wrapper(
|
|
395
|
+
types.delete,
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
class AsyncTypesResourceWithRawResponse:
|
|
400
|
+
def __init__(self, types: AsyncTypesResource) -> None:
|
|
401
|
+
self._types = types
|
|
402
|
+
|
|
403
|
+
self.create = async_to_raw_response_wrapper(
|
|
404
|
+
types.create,
|
|
405
|
+
)
|
|
406
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
407
|
+
types.retrieve,
|
|
408
|
+
)
|
|
409
|
+
self.update = async_to_raw_response_wrapper(
|
|
410
|
+
types.update,
|
|
411
|
+
)
|
|
412
|
+
self.list = async_to_raw_response_wrapper(
|
|
413
|
+
types.list,
|
|
414
|
+
)
|
|
415
|
+
self.delete = async_to_raw_response_wrapper(
|
|
416
|
+
types.delete,
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
class TypesResourceWithStreamingResponse:
|
|
421
|
+
def __init__(self, types: TypesResource) -> None:
|
|
422
|
+
self._types = types
|
|
423
|
+
|
|
424
|
+
self.create = to_streamed_response_wrapper(
|
|
425
|
+
types.create,
|
|
426
|
+
)
|
|
427
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
428
|
+
types.retrieve,
|
|
429
|
+
)
|
|
430
|
+
self.update = to_streamed_response_wrapper(
|
|
431
|
+
types.update,
|
|
432
|
+
)
|
|
433
|
+
self.list = to_streamed_response_wrapper(
|
|
434
|
+
types.list,
|
|
435
|
+
)
|
|
436
|
+
self.delete = to_streamed_response_wrapper(
|
|
437
|
+
types.delete,
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
class AsyncTypesResourceWithStreamingResponse:
|
|
442
|
+
def __init__(self, types: AsyncTypesResource) -> None:
|
|
443
|
+
self._types = types
|
|
444
|
+
|
|
445
|
+
self.create = async_to_streamed_response_wrapper(
|
|
446
|
+
types.create,
|
|
447
|
+
)
|
|
448
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
449
|
+
types.retrieve,
|
|
450
|
+
)
|
|
451
|
+
self.update = async_to_streamed_response_wrapper(
|
|
452
|
+
types.update,
|
|
453
|
+
)
|
|
454
|
+
self.list = async_to_streamed_response_wrapper(
|
|
455
|
+
types.list,
|
|
456
|
+
)
|
|
457
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
458
|
+
types.delete,
|
|
459
|
+
)
|
payi/resources/ingest.py
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Union
|
|
5
|
+
from typing import Dict, Union, Iterable, cast
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
|
-
from ..types import ingest_units_params
|
|
10
|
+
from ..types import ingest_bulk_params, ingest_units_params
|
|
11
11
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
12
12
|
from .._utils import (
|
|
13
13
|
maybe_transform,
|
|
@@ -23,7 +23,8 @@ from .._response import (
|
|
|
23
23
|
async_to_streamed_response_wrapper,
|
|
24
24
|
)
|
|
25
25
|
from .._base_client import make_request_options
|
|
26
|
-
from ..types.
|
|
26
|
+
from ..types.ingest_response import IngestResponse
|
|
27
|
+
from ..types.bulk_ingest_response import BulkIngestResponse
|
|
27
28
|
|
|
28
29
|
__all__ = ["IngestResource", "AsyncIngestResource"]
|
|
29
30
|
|
|
@@ -37,6 +38,46 @@ class IngestResource(SyncAPIResource):
|
|
|
37
38
|
def with_streaming_response(self) -> IngestResourceWithStreamingResponse:
|
|
38
39
|
return IngestResourceWithStreamingResponse(self)
|
|
39
40
|
|
|
41
|
+
def bulk(
|
|
42
|
+
self,
|
|
43
|
+
*,
|
|
44
|
+
events: Iterable[ingest_bulk_params.Event],
|
|
45
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
46
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
47
|
+
extra_headers: Headers | None = None,
|
|
48
|
+
extra_query: Query | None = None,
|
|
49
|
+
extra_body: Body | None = None,
|
|
50
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
51
|
+
) -> BulkIngestResponse:
|
|
52
|
+
"""
|
|
53
|
+
Bulk Ingest
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
|
|
57
|
+
items (Iterable[IngestUnitsParams]): The items to ingest
|
|
58
|
+
|
|
59
|
+
extra_headers: Send extra headers
|
|
60
|
+
|
|
61
|
+
extra_query: Add additional query parameters to the request
|
|
62
|
+
|
|
63
|
+
extra_body: Add additional JSON properties to the request
|
|
64
|
+
|
|
65
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
66
|
+
"""
|
|
67
|
+
return self._post(
|
|
68
|
+
"/api/v1/ingest/bulk",
|
|
69
|
+
body=cast(Dict[str, object], maybe_transform(
|
|
70
|
+
{
|
|
71
|
+
"events": events,
|
|
72
|
+
},
|
|
73
|
+
ingest_bulk_params.IngestBulkParams)
|
|
74
|
+
)["events"],
|
|
75
|
+
options=make_request_options(
|
|
76
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
77
|
+
),
|
|
78
|
+
cast_to=BulkIngestResponse,
|
|
79
|
+
)
|
|
80
|
+
|
|
40
81
|
def units(
|
|
41
82
|
self,
|
|
42
83
|
*,
|
|
@@ -53,7 +94,7 @@ class IngestResource(SyncAPIResource):
|
|
|
53
94
|
extra_query: Query | None = None,
|
|
54
95
|
extra_body: Body | None = None,
|
|
55
96
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
56
|
-
) ->
|
|
97
|
+
) -> IngestResponse:
|
|
57
98
|
"""
|
|
58
99
|
Ingest a request
|
|
59
100
|
|
|
@@ -66,7 +107,7 @@ class IngestResource(SyncAPIResource):
|
|
|
66
107
|
|
|
67
108
|
output (int): The number of output units
|
|
68
109
|
|
|
69
|
-
event_timestamp: (datetime, None): The timestamp of the event. Defaults to None.
|
|
110
|
+
event_timestamp: (str, datetime, None): The timestamp of the event. Defaults to None.
|
|
70
111
|
|
|
71
112
|
budget_ids (list[str], optional): The budget IDs to associate with the request. Defaults to None.
|
|
72
113
|
|
|
@@ -125,7 +166,7 @@ class IngestResource(SyncAPIResource):
|
|
|
125
166
|
options=make_request_options(
|
|
126
167
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
127
168
|
),
|
|
128
|
-
cast_to=
|
|
169
|
+
cast_to=IngestResponse,
|
|
129
170
|
)
|
|
130
171
|
|
|
131
172
|
|
|
@@ -138,6 +179,46 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
138
179
|
def with_streaming_response(self) -> AsyncIngestResourceWithStreamingResponse:
|
|
139
180
|
return AsyncIngestResourceWithStreamingResponse(self)
|
|
140
181
|
|
|
182
|
+
async def bulk(
|
|
183
|
+
self,
|
|
184
|
+
*,
|
|
185
|
+
events: Iterable[ingest_bulk_params.Event],
|
|
186
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
187
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
188
|
+
extra_headers: Headers | None = None,
|
|
189
|
+
extra_query: Query | None = None,
|
|
190
|
+
extra_body: Body | None = None,
|
|
191
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
192
|
+
) -> BulkIngestResponse:
|
|
193
|
+
"""
|
|
194
|
+
Bulk Ingest
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
items (Iterable[IngestUnitsParams]): The items to ingest
|
|
198
|
+
|
|
199
|
+
extra_headers: Send extra headers
|
|
200
|
+
|
|
201
|
+
extra_query: Add additional query parameters to the request
|
|
202
|
+
|
|
203
|
+
extra_body: Add additional JSON properties to the request
|
|
204
|
+
|
|
205
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
206
|
+
"""
|
|
207
|
+
return await self._post(
|
|
208
|
+
"/api/v1/ingest/bulk",
|
|
209
|
+
body= cast(Dict[str, object],
|
|
210
|
+
await async_maybe_transform(
|
|
211
|
+
{
|
|
212
|
+
"events": events,
|
|
213
|
+
},
|
|
214
|
+
ingest_bulk_params.IngestBulkParams)
|
|
215
|
+
)["events"],
|
|
216
|
+
options=make_request_options(
|
|
217
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
218
|
+
),
|
|
219
|
+
cast_to=BulkIngestResponse,
|
|
220
|
+
)
|
|
221
|
+
|
|
141
222
|
async def units(
|
|
142
223
|
self,
|
|
143
224
|
*,
|
|
@@ -154,7 +235,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
154
235
|
extra_query: Query | None = None,
|
|
155
236
|
extra_body: Body | None = None,
|
|
156
237
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
157
|
-
) ->
|
|
238
|
+
) -> IngestResponse:
|
|
158
239
|
"""
|
|
159
240
|
Ingest a request
|
|
160
241
|
|
|
@@ -226,7 +307,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
226
307
|
options=make_request_options(
|
|
227
308
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
228
309
|
),
|
|
229
|
-
cast_to=
|
|
310
|
+
cast_to=IngestResponse,
|
|
230
311
|
)
|
|
231
312
|
|
|
232
313
|
|
|
@@ -234,6 +315,9 @@ class IngestResourceWithRawResponse:
|
|
|
234
315
|
def __init__(self, ingest: IngestResource) -> None:
|
|
235
316
|
self._ingest = ingest
|
|
236
317
|
|
|
318
|
+
self.bulk = to_raw_response_wrapper(
|
|
319
|
+
ingest.bulk,
|
|
320
|
+
)
|
|
237
321
|
self.units = to_raw_response_wrapper(
|
|
238
322
|
ingest.units,
|
|
239
323
|
)
|
|
@@ -243,6 +327,9 @@ class AsyncIngestResourceWithRawResponse:
|
|
|
243
327
|
def __init__(self, ingest: AsyncIngestResource) -> None:
|
|
244
328
|
self._ingest = ingest
|
|
245
329
|
|
|
330
|
+
self.bulk = async_to_raw_response_wrapper(
|
|
331
|
+
ingest.bulk,
|
|
332
|
+
)
|
|
246
333
|
self.units = async_to_raw_response_wrapper(
|
|
247
334
|
ingest.units,
|
|
248
335
|
)
|
|
@@ -252,6 +339,9 @@ class IngestResourceWithStreamingResponse:
|
|
|
252
339
|
def __init__(self, ingest: IngestResource) -> None:
|
|
253
340
|
self._ingest = ingest
|
|
254
341
|
|
|
342
|
+
self.bulk = to_streamed_response_wrapper(
|
|
343
|
+
ingest.bulk,
|
|
344
|
+
)
|
|
255
345
|
self.units = to_streamed_response_wrapper(
|
|
256
346
|
ingest.units,
|
|
257
347
|
)
|
|
@@ -261,6 +351,9 @@ class AsyncIngestResourceWithStreamingResponse:
|
|
|
261
351
|
def __init__(self, ingest: AsyncIngestResource) -> None:
|
|
262
352
|
self._ingest = ingest
|
|
263
353
|
|
|
354
|
+
self.bulk = async_to_streamed_response_wrapper(
|
|
355
|
+
ingest.bulk,
|
|
356
|
+
)
|
|
264
357
|
self.units = async_to_streamed_response_wrapper(
|
|
265
358
|
ingest.units,
|
|
266
359
|
)
|
payi/types/__init__.py
CHANGED
|
@@ -4,16 +4,20 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
from .cost_data import CostData as CostData
|
|
6
6
|
from .cost_details import CostDetails as CostDetails
|
|
7
|
-
from .proxy_result import ProxyResult as ProxyResult
|
|
8
7
|
from .requests_data import RequestsData as RequestsData
|
|
9
8
|
from .budget_response import BudgetResponse as BudgetResponse
|
|
9
|
+
from .ingest_response import IngestResponse as IngestResponse
|
|
10
|
+
from .total_cost_data import TotalCostData as TotalCostData
|
|
10
11
|
from .default_response import DefaultResponse as DefaultResponse
|
|
11
12
|
from .category_response import CategoryResponse as CategoryResponse
|
|
12
13
|
from .paged_budget_list import PagedBudgetList as PagedBudgetList
|
|
13
14
|
from .budget_list_params import BudgetListParams as BudgetListParams
|
|
15
|
+
from .ingest_bulk_params import IngestBulkParams as IngestBulkParams
|
|
16
|
+
from .experience_instance import ExperienceInstance as ExperienceInstance
|
|
14
17
|
from .ingest_units_params import IngestUnitsParams as IngestUnitsParams
|
|
15
18
|
from .budget_create_params import BudgetCreateParams as BudgetCreateParams
|
|
16
19
|
from .budget_update_params import BudgetUpdateParams as BudgetUpdateParams
|
|
20
|
+
from .bulk_ingest_response import BulkIngestResponse as BulkIngestResponse
|
|
17
21
|
from .category_list_response import CategoryListResponse as CategoryListResponse
|
|
18
22
|
from .budget_history_response import BudgetHistoryResponse as BudgetHistoryResponse
|
|
19
23
|
from .category_delete_response import CategoryDeleteResponse as CategoryDeleteResponse
|