kard-financial-sdk 2.1.0__py3-none-any.whl → 2.2.1__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.
- kard/__init__.py +15 -0
- kard/core/client_wrapper.py +2 -2
- kard/transactions/__init__.py +15 -0
- kard/transactions/client.py +6 -2
- kard/transactions/raw_client.py +6 -2
- kard/transactions/types/__init__.py +20 -1
- kard/transactions/types/core_merchant.py +24 -0
- kard/transactions/types/core_transaction_attributes.py +82 -0
- kard/transactions/types/core_transaction_request.py +25 -0
- kard/transactions/types/financial_institution.py +29 -0
- kard/transactions/types/matched_transactions_attributes.py +1 -1
- kard/transactions/types/transactions.py +18 -1
- kard/transactions/types/transactions_attributes.py +3 -3
- kard/transactions/types/transactions_request_body.py +1 -0
- kard/users/__init__.py +15 -0
- kard/users/attributions/__init__.py +15 -0
- kard/users/attributions/client.py +135 -0
- kard/users/attributions/raw_client.py +193 -0
- kard/users/attributions/types/__init__.py +15 -0
- kard/users/attributions/types/activate_offer_include_option.py +5 -0
- kard/users/attributions/types/activate_offer_included.py +8 -0
- kard/users/attributions/types/activate_offer_response.py +49 -0
- kard/users/attributions/types/activate_offer_response_attributes.py +25 -0
- kard/users/attributions/types/activate_offer_response_data.py +22 -0
- kard/users/attributions/types/event_code.py +1 -1
- kard/users/attributions/types/offer_medium.py +1 -1
- kard/users/rewards/client.py +4 -8
- kard/users/rewards/raw_client.py +4 -8
- {kard_financial_sdk-2.1.0.dist-info → kard_financial_sdk-2.2.1.dist-info}/METADATA +1 -1
- {kard_financial_sdk-2.1.0.dist-info → kard_financial_sdk-2.2.1.dist-info}/RECORD +31 -22
- {kard_financial_sdk-2.1.0.dist-info → kard_financial_sdk-2.2.1.dist-info}/WHEEL +0 -0
|
@@ -6,7 +6,10 @@ from ...commons.types.organization_id import OrganizationId
|
|
|
6
6
|
from ...commons.types.user_id import UserId
|
|
7
7
|
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
8
|
from ...core.request_options import RequestOptions
|
|
9
|
+
from ..rewards.types.component_type import ComponentType
|
|
9
10
|
from .raw_client import AsyncRawAttributionsClient, RawAttributionsClient
|
|
11
|
+
from .types.activate_offer_include_option import ActivateOfferIncludeOption
|
|
12
|
+
from .types.activate_offer_response import ActivateOfferResponse
|
|
10
13
|
from .types.create_attribution_request_union import CreateAttributionRequestUnion
|
|
11
14
|
from .types.create_attribution_response import CreateAttributionResponse
|
|
12
15
|
|
|
@@ -117,6 +120,68 @@ class AttributionsClient:
|
|
|
117
120
|
_response = self._raw_client.create(organization_id, user_id, data=data, request_options=request_options)
|
|
118
121
|
return _response.data
|
|
119
122
|
|
|
123
|
+
def activate(
|
|
124
|
+
self,
|
|
125
|
+
organization_id: OrganizationId,
|
|
126
|
+
user_id: UserId,
|
|
127
|
+
offer_id: str,
|
|
128
|
+
*,
|
|
129
|
+
supported_components: typing.Optional[typing.Union[ComponentType, typing.Sequence[ComponentType]]] = None,
|
|
130
|
+
include: typing.Optional[
|
|
131
|
+
typing.Union[ActivateOfferIncludeOption, typing.Sequence[ActivateOfferIncludeOption]]
|
|
132
|
+
] = None,
|
|
133
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
134
|
+
) -> ActivateOfferResponse:
|
|
135
|
+
"""
|
|
136
|
+
Record when a user activates an offer. Creates an attribution event with eventCode=ACTIVATE and medium=CTA.
|
|
137
|
+
Optionally include the offer data by passing `include=offer`.
|
|
138
|
+
|
|
139
|
+
Parameters
|
|
140
|
+
----------
|
|
141
|
+
organization_id : OrganizationId
|
|
142
|
+
|
|
143
|
+
user_id : UserId
|
|
144
|
+
|
|
145
|
+
offer_id : str
|
|
146
|
+
The unique identifier of the offer being activated
|
|
147
|
+
|
|
148
|
+
supported_components : typing.Optional[typing.Union[ComponentType, typing.Sequence[ComponentType]]]
|
|
149
|
+
UI component types to include in the offer response (when include=offer).
|
|
150
|
+
|
|
151
|
+
include : typing.Optional[typing.Union[ActivateOfferIncludeOption, typing.Sequence[ActivateOfferIncludeOption]]]
|
|
152
|
+
Related resources to include in the response. Allowed value is `offer`.
|
|
153
|
+
|
|
154
|
+
request_options : typing.Optional[RequestOptions]
|
|
155
|
+
Request-specific configuration.
|
|
156
|
+
|
|
157
|
+
Returns
|
|
158
|
+
-------
|
|
159
|
+
ActivateOfferResponse
|
|
160
|
+
|
|
161
|
+
Examples
|
|
162
|
+
--------
|
|
163
|
+
from kard import KardApi
|
|
164
|
+
|
|
165
|
+
client = KardApi(
|
|
166
|
+
client_id="YOUR_CLIENT_ID",
|
|
167
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
168
|
+
)
|
|
169
|
+
client.users.attributions.activate(
|
|
170
|
+
organization_id="organization-123",
|
|
171
|
+
user_id="user-123",
|
|
172
|
+
offer_id="offer-456",
|
|
173
|
+
)
|
|
174
|
+
"""
|
|
175
|
+
_response = self._raw_client.activate(
|
|
176
|
+
organization_id,
|
|
177
|
+
user_id,
|
|
178
|
+
offer_id,
|
|
179
|
+
supported_components=supported_components,
|
|
180
|
+
include=include,
|
|
181
|
+
request_options=request_options,
|
|
182
|
+
)
|
|
183
|
+
return _response.data
|
|
184
|
+
|
|
120
185
|
|
|
121
186
|
class AsyncAttributionsClient:
|
|
122
187
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -227,3 +292,73 @@ class AsyncAttributionsClient:
|
|
|
227
292
|
"""
|
|
228
293
|
_response = await self._raw_client.create(organization_id, user_id, data=data, request_options=request_options)
|
|
229
294
|
return _response.data
|
|
295
|
+
|
|
296
|
+
async def activate(
|
|
297
|
+
self,
|
|
298
|
+
organization_id: OrganizationId,
|
|
299
|
+
user_id: UserId,
|
|
300
|
+
offer_id: str,
|
|
301
|
+
*,
|
|
302
|
+
supported_components: typing.Optional[typing.Union[ComponentType, typing.Sequence[ComponentType]]] = None,
|
|
303
|
+
include: typing.Optional[
|
|
304
|
+
typing.Union[ActivateOfferIncludeOption, typing.Sequence[ActivateOfferIncludeOption]]
|
|
305
|
+
] = None,
|
|
306
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
307
|
+
) -> ActivateOfferResponse:
|
|
308
|
+
"""
|
|
309
|
+
Record when a user activates an offer. Creates an attribution event with eventCode=ACTIVATE and medium=CTA.
|
|
310
|
+
Optionally include the offer data by passing `include=offer`.
|
|
311
|
+
|
|
312
|
+
Parameters
|
|
313
|
+
----------
|
|
314
|
+
organization_id : OrganizationId
|
|
315
|
+
|
|
316
|
+
user_id : UserId
|
|
317
|
+
|
|
318
|
+
offer_id : str
|
|
319
|
+
The unique identifier of the offer being activated
|
|
320
|
+
|
|
321
|
+
supported_components : typing.Optional[typing.Union[ComponentType, typing.Sequence[ComponentType]]]
|
|
322
|
+
UI component types to include in the offer response (when include=offer).
|
|
323
|
+
|
|
324
|
+
include : typing.Optional[typing.Union[ActivateOfferIncludeOption, typing.Sequence[ActivateOfferIncludeOption]]]
|
|
325
|
+
Related resources to include in the response. Allowed value is `offer`.
|
|
326
|
+
|
|
327
|
+
request_options : typing.Optional[RequestOptions]
|
|
328
|
+
Request-specific configuration.
|
|
329
|
+
|
|
330
|
+
Returns
|
|
331
|
+
-------
|
|
332
|
+
ActivateOfferResponse
|
|
333
|
+
|
|
334
|
+
Examples
|
|
335
|
+
--------
|
|
336
|
+
import asyncio
|
|
337
|
+
|
|
338
|
+
from kard import AsyncKardApi
|
|
339
|
+
|
|
340
|
+
client = AsyncKardApi(
|
|
341
|
+
client_id="YOUR_CLIENT_ID",
|
|
342
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
async def main() -> None:
|
|
347
|
+
await client.users.attributions.activate(
|
|
348
|
+
organization_id="organization-123",
|
|
349
|
+
user_id="user-123",
|
|
350
|
+
offer_id="offer-456",
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
asyncio.run(main())
|
|
355
|
+
"""
|
|
356
|
+
_response = await self._raw_client.activate(
|
|
357
|
+
organization_id,
|
|
358
|
+
user_id,
|
|
359
|
+
offer_id,
|
|
360
|
+
supported_components=supported_components,
|
|
361
|
+
include=include,
|
|
362
|
+
request_options=request_options,
|
|
363
|
+
)
|
|
364
|
+
return _response.data
|
|
@@ -16,6 +16,9 @@ from ...core.jsonable_encoder import jsonable_encoder
|
|
|
16
16
|
from ...core.pydantic_utilities import parse_obj_as
|
|
17
17
|
from ...core.request_options import RequestOptions
|
|
18
18
|
from ...core.serialization import convert_and_respect_annotation_metadata
|
|
19
|
+
from ..rewards.types.component_type import ComponentType
|
|
20
|
+
from .types.activate_offer_include_option import ActivateOfferIncludeOption
|
|
21
|
+
from .types.activate_offer_response import ActivateOfferResponse
|
|
19
22
|
from .types.create_attribution_request_union import CreateAttributionRequestUnion
|
|
20
23
|
from .types.create_attribution_response import CreateAttributionResponse
|
|
21
24
|
|
|
@@ -118,6 +121,101 @@ class RawAttributionsClient:
|
|
|
118
121
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
119
122
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
120
123
|
|
|
124
|
+
def activate(
|
|
125
|
+
self,
|
|
126
|
+
organization_id: OrganizationId,
|
|
127
|
+
user_id: UserId,
|
|
128
|
+
offer_id: str,
|
|
129
|
+
*,
|
|
130
|
+
supported_components: typing.Optional[typing.Union[ComponentType, typing.Sequence[ComponentType]]] = None,
|
|
131
|
+
include: typing.Optional[
|
|
132
|
+
typing.Union[ActivateOfferIncludeOption, typing.Sequence[ActivateOfferIncludeOption]]
|
|
133
|
+
] = None,
|
|
134
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
135
|
+
) -> HttpResponse[ActivateOfferResponse]:
|
|
136
|
+
"""
|
|
137
|
+
Record when a user activates an offer. Creates an attribution event with eventCode=ACTIVATE and medium=CTA.
|
|
138
|
+
Optionally include the offer data by passing `include=offer`.
|
|
139
|
+
|
|
140
|
+
Parameters
|
|
141
|
+
----------
|
|
142
|
+
organization_id : OrganizationId
|
|
143
|
+
|
|
144
|
+
user_id : UserId
|
|
145
|
+
|
|
146
|
+
offer_id : str
|
|
147
|
+
The unique identifier of the offer being activated
|
|
148
|
+
|
|
149
|
+
supported_components : typing.Optional[typing.Union[ComponentType, typing.Sequence[ComponentType]]]
|
|
150
|
+
UI component types to include in the offer response (when include=offer).
|
|
151
|
+
|
|
152
|
+
include : typing.Optional[typing.Union[ActivateOfferIncludeOption, typing.Sequence[ActivateOfferIncludeOption]]]
|
|
153
|
+
Related resources to include in the response. Allowed value is `offer`.
|
|
154
|
+
|
|
155
|
+
request_options : typing.Optional[RequestOptions]
|
|
156
|
+
Request-specific configuration.
|
|
157
|
+
|
|
158
|
+
Returns
|
|
159
|
+
-------
|
|
160
|
+
HttpResponse[ActivateOfferResponse]
|
|
161
|
+
"""
|
|
162
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
163
|
+
f"v2/issuers/{jsonable_encoder(organization_id)}/users/{jsonable_encoder(user_id)}/attributions/offers/{jsonable_encoder(offer_id)}/activate",
|
|
164
|
+
method="POST",
|
|
165
|
+
params={
|
|
166
|
+
"supportedComponents": supported_components,
|
|
167
|
+
"include": include,
|
|
168
|
+
},
|
|
169
|
+
request_options=request_options,
|
|
170
|
+
)
|
|
171
|
+
try:
|
|
172
|
+
if 200 <= _response.status_code < 300:
|
|
173
|
+
_data = typing.cast(
|
|
174
|
+
ActivateOfferResponse,
|
|
175
|
+
parse_obj_as(
|
|
176
|
+
type_=ActivateOfferResponse, # type: ignore
|
|
177
|
+
object_=_response.json(),
|
|
178
|
+
),
|
|
179
|
+
)
|
|
180
|
+
return HttpResponse(response=_response, data=_data)
|
|
181
|
+
if _response.status_code == 401:
|
|
182
|
+
raise UnauthorizedError(
|
|
183
|
+
headers=dict(_response.headers),
|
|
184
|
+
body=typing.cast(
|
|
185
|
+
ErrorResponse,
|
|
186
|
+
parse_obj_as(
|
|
187
|
+
type_=ErrorResponse, # type: ignore
|
|
188
|
+
object_=_response.json(),
|
|
189
|
+
),
|
|
190
|
+
),
|
|
191
|
+
)
|
|
192
|
+
if _response.status_code == 500:
|
|
193
|
+
raise InternalServerError(
|
|
194
|
+
headers=dict(_response.headers),
|
|
195
|
+
body=typing.cast(
|
|
196
|
+
ErrorResponse,
|
|
197
|
+
parse_obj_as(
|
|
198
|
+
type_=ErrorResponse, # type: ignore
|
|
199
|
+
object_=_response.json(),
|
|
200
|
+
),
|
|
201
|
+
),
|
|
202
|
+
)
|
|
203
|
+
if _response.status_code == 400:
|
|
204
|
+
raise InvalidRequest(
|
|
205
|
+
headers=dict(_response.headers),
|
|
206
|
+
body=typing.cast(
|
|
207
|
+
ErrorResponse,
|
|
208
|
+
parse_obj_as(
|
|
209
|
+
type_=ErrorResponse, # type: ignore
|
|
210
|
+
object_=_response.json(),
|
|
211
|
+
),
|
|
212
|
+
),
|
|
213
|
+
)
|
|
214
|
+
_response_json = _response.json()
|
|
215
|
+
except JSONDecodeError:
|
|
216
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
217
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
218
|
+
|
|
121
219
|
|
|
122
220
|
class AsyncRawAttributionsClient:
|
|
123
221
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -213,3 +311,98 @@ class AsyncRawAttributionsClient:
|
|
|
213
311
|
except JSONDecodeError:
|
|
214
312
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
215
313
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
314
|
+
|
|
315
|
+
async def activate(
|
|
316
|
+
self,
|
|
317
|
+
organization_id: OrganizationId,
|
|
318
|
+
user_id: UserId,
|
|
319
|
+
offer_id: str,
|
|
320
|
+
*,
|
|
321
|
+
supported_components: typing.Optional[typing.Union[ComponentType, typing.Sequence[ComponentType]]] = None,
|
|
322
|
+
include: typing.Optional[
|
|
323
|
+
typing.Union[ActivateOfferIncludeOption, typing.Sequence[ActivateOfferIncludeOption]]
|
|
324
|
+
] = None,
|
|
325
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
326
|
+
) -> AsyncHttpResponse[ActivateOfferResponse]:
|
|
327
|
+
"""
|
|
328
|
+
Record when a user activates an offer. Creates an attribution event with eventCode=ACTIVATE and medium=CTA.
|
|
329
|
+
Optionally include the offer data by passing `include=offer`.
|
|
330
|
+
|
|
331
|
+
Parameters
|
|
332
|
+
----------
|
|
333
|
+
organization_id : OrganizationId
|
|
334
|
+
|
|
335
|
+
user_id : UserId
|
|
336
|
+
|
|
337
|
+
offer_id : str
|
|
338
|
+
The unique identifier of the offer being activated
|
|
339
|
+
|
|
340
|
+
supported_components : typing.Optional[typing.Union[ComponentType, typing.Sequence[ComponentType]]]
|
|
341
|
+
UI component types to include in the offer response (when include=offer).
|
|
342
|
+
|
|
343
|
+
include : typing.Optional[typing.Union[ActivateOfferIncludeOption, typing.Sequence[ActivateOfferIncludeOption]]]
|
|
344
|
+
Related resources to include in the response. Allowed value is `offer`.
|
|
345
|
+
|
|
346
|
+
request_options : typing.Optional[RequestOptions]
|
|
347
|
+
Request-specific configuration.
|
|
348
|
+
|
|
349
|
+
Returns
|
|
350
|
+
-------
|
|
351
|
+
AsyncHttpResponse[ActivateOfferResponse]
|
|
352
|
+
"""
|
|
353
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
354
|
+
f"v2/issuers/{jsonable_encoder(organization_id)}/users/{jsonable_encoder(user_id)}/attributions/offers/{jsonable_encoder(offer_id)}/activate",
|
|
355
|
+
method="POST",
|
|
356
|
+
params={
|
|
357
|
+
"supportedComponents": supported_components,
|
|
358
|
+
"include": include,
|
|
359
|
+
},
|
|
360
|
+
request_options=request_options,
|
|
361
|
+
)
|
|
362
|
+
try:
|
|
363
|
+
if 200 <= _response.status_code < 300:
|
|
364
|
+
_data = typing.cast(
|
|
365
|
+
ActivateOfferResponse,
|
|
366
|
+
parse_obj_as(
|
|
367
|
+
type_=ActivateOfferResponse, # type: ignore
|
|
368
|
+
object_=_response.json(),
|
|
369
|
+
),
|
|
370
|
+
)
|
|
371
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
372
|
+
if _response.status_code == 401:
|
|
373
|
+
raise UnauthorizedError(
|
|
374
|
+
headers=dict(_response.headers),
|
|
375
|
+
body=typing.cast(
|
|
376
|
+
ErrorResponse,
|
|
377
|
+
parse_obj_as(
|
|
378
|
+
type_=ErrorResponse, # type: ignore
|
|
379
|
+
object_=_response.json(),
|
|
380
|
+
),
|
|
381
|
+
),
|
|
382
|
+
)
|
|
383
|
+
if _response.status_code == 500:
|
|
384
|
+
raise InternalServerError(
|
|
385
|
+
headers=dict(_response.headers),
|
|
386
|
+
body=typing.cast(
|
|
387
|
+
ErrorResponse,
|
|
388
|
+
parse_obj_as(
|
|
389
|
+
type_=ErrorResponse, # type: ignore
|
|
390
|
+
object_=_response.json(),
|
|
391
|
+
),
|
|
392
|
+
),
|
|
393
|
+
)
|
|
394
|
+
if _response.status_code == 400:
|
|
395
|
+
raise InvalidRequest(
|
|
396
|
+
headers=dict(_response.headers),
|
|
397
|
+
body=typing.cast(
|
|
398
|
+
ErrorResponse,
|
|
399
|
+
parse_obj_as(
|
|
400
|
+
type_=ErrorResponse, # type: ignore
|
|
401
|
+
object_=_response.json(),
|
|
402
|
+
),
|
|
403
|
+
),
|
|
404
|
+
)
|
|
405
|
+
_response_json = _response.json()
|
|
406
|
+
except JSONDecodeError:
|
|
407
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
408
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -6,6 +6,11 @@ import typing
|
|
|
6
6
|
from importlib import import_module
|
|
7
7
|
|
|
8
8
|
if typing.TYPE_CHECKING:
|
|
9
|
+
from .activate_offer_include_option import ActivateOfferIncludeOption
|
|
10
|
+
from .activate_offer_included import ActivateOfferIncluded
|
|
11
|
+
from .activate_offer_response import ActivateOfferResponse
|
|
12
|
+
from .activate_offer_response_attributes import ActivateOfferResponseAttributes
|
|
13
|
+
from .activate_offer_response_data import ActivateOfferResponseData
|
|
9
14
|
from .create_attribution_request_object import CreateAttributionRequestObject
|
|
10
15
|
from .create_attribution_request_union import (
|
|
11
16
|
CreateAttributionRequestUnion,
|
|
@@ -21,6 +26,11 @@ if typing.TYPE_CHECKING:
|
|
|
21
26
|
from .offer_attribution_request import OfferAttributionRequest
|
|
22
27
|
from .offer_medium import OfferMedium
|
|
23
28
|
_dynamic_imports: typing.Dict[str, str] = {
|
|
29
|
+
"ActivateOfferIncludeOption": ".activate_offer_include_option",
|
|
30
|
+
"ActivateOfferIncluded": ".activate_offer_included",
|
|
31
|
+
"ActivateOfferResponse": ".activate_offer_response",
|
|
32
|
+
"ActivateOfferResponseAttributes": ".activate_offer_response_attributes",
|
|
33
|
+
"ActivateOfferResponseData": ".activate_offer_response_data",
|
|
24
34
|
"CreateAttributionRequestObject": ".create_attribution_request_object",
|
|
25
35
|
"CreateAttributionRequestUnion": ".create_attribution_request_union",
|
|
26
36
|
"CreateAttributionRequestUnion_NotificationAttribution": ".create_attribution_request_union",
|
|
@@ -58,6 +68,11 @@ def __dir__():
|
|
|
58
68
|
|
|
59
69
|
|
|
60
70
|
__all__ = [
|
|
71
|
+
"ActivateOfferIncludeOption",
|
|
72
|
+
"ActivateOfferIncluded",
|
|
73
|
+
"ActivateOfferResponse",
|
|
74
|
+
"ActivateOfferResponseAttributes",
|
|
75
|
+
"ActivateOfferResponseData",
|
|
61
76
|
"CreateAttributionRequestObject",
|
|
62
77
|
"CreateAttributionRequestUnion",
|
|
63
78
|
"CreateAttributionRequestUnion_NotificationAttribution",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ...rewards.types.category_included import CategoryIncluded
|
|
6
|
+
from ...rewards.types.offer_data_union import OfferDataUnion
|
|
7
|
+
|
|
8
|
+
ActivateOfferIncluded = typing.Union[OfferDataUnion, CategoryIncluded]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
from .activate_offer_included import ActivateOfferIncluded
|
|
8
|
+
from .activate_offer_response_data import ActivateOfferResponseData
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ActivateOfferResponse(UniversalBaseModel):
|
|
12
|
+
"""
|
|
13
|
+
Examples
|
|
14
|
+
--------
|
|
15
|
+
import datetime
|
|
16
|
+
|
|
17
|
+
from kard.users.attributions import (
|
|
18
|
+
ActivateOfferResponse,
|
|
19
|
+
ActivateOfferResponseAttributes,
|
|
20
|
+
ActivateOfferResponseData,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
ActivateOfferResponse(
|
|
24
|
+
data=ActivateOfferResponseData(
|
|
25
|
+
type="offerAttribution",
|
|
26
|
+
id="c94a93a7-beb9-4e58-960c-2c812f849398",
|
|
27
|
+
attributes=ActivateOfferResponseAttributes(
|
|
28
|
+
entity_id="offer-456",
|
|
29
|
+
event_code="ACTIVATE",
|
|
30
|
+
medium="CTA",
|
|
31
|
+
event_date=datetime.datetime.fromisoformat(
|
|
32
|
+
"2025-01-01 00:00:00+00:00",
|
|
33
|
+
),
|
|
34
|
+
),
|
|
35
|
+
),
|
|
36
|
+
)
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
data: ActivateOfferResponseData
|
|
40
|
+
included: typing.Optional[typing.List[ActivateOfferIncluded]] = None
|
|
41
|
+
|
|
42
|
+
if IS_PYDANTIC_V2:
|
|
43
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
44
|
+
else:
|
|
45
|
+
|
|
46
|
+
class Config:
|
|
47
|
+
frozen = True
|
|
48
|
+
smart_union = True
|
|
49
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
import pydantic
|
|
7
|
+
import typing_extensions
|
|
8
|
+
from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
9
|
+
from ....core.serialization import FieldMetadata
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ActivateOfferResponseAttributes(UniversalBaseModel):
|
|
13
|
+
entity_id: typing_extensions.Annotated[str, FieldMetadata(alias="entityId")]
|
|
14
|
+
event_code: typing_extensions.Annotated[str, FieldMetadata(alias="eventCode")]
|
|
15
|
+
medium: str
|
|
16
|
+
event_date: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="eventDate")]
|
|
17
|
+
|
|
18
|
+
if IS_PYDANTIC_V2:
|
|
19
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
20
|
+
else:
|
|
21
|
+
|
|
22
|
+
class Config:
|
|
23
|
+
frozen = True
|
|
24
|
+
smart_union = True
|
|
25
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
from .activate_offer_response_attributes import ActivateOfferResponseAttributes
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ActivateOfferResponseData(UniversalBaseModel):
|
|
11
|
+
type: str
|
|
12
|
+
id: str
|
|
13
|
+
attributes: ActivateOfferResponseAttributes
|
|
14
|
+
|
|
15
|
+
if IS_PYDANTIC_V2:
|
|
16
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class Config:
|
|
20
|
+
frozen = True
|
|
21
|
+
smart_union = True
|
|
22
|
+
extra = pydantic.Extra.allow
|
kard/users/rewards/client.py
CHANGED
|
@@ -51,8 +51,7 @@ class RewardsClient:
|
|
|
51
51
|
"""
|
|
52
52
|
Retrieve national brand offers that a specified user is eligible for. Call this endpoint to build out your
|
|
53
53
|
[targeted offers UX experience](/2024-10-01/api/getting-started#b-discover-a-lapsed-customer-clo). Local offers details
|
|
54
|
-
can be found by calling the [Get Eligible Locations](/2024-10-01/api/rewards/locations)
|
|
55
|
-
`includeLocal` query parameter.<br/>
|
|
54
|
+
can be found by calling the [Get Eligible Locations](/2024-10-01/api/rewards/locations).<br/>
|
|
56
55
|
<b>Required scopes:</b> `rewards:read`
|
|
57
56
|
|
|
58
57
|
Parameters
|
|
@@ -143,8 +142,7 @@ class RewardsClient:
|
|
|
143
142
|
request_options: typing.Optional[RequestOptions] = None,
|
|
144
143
|
) -> LocationsResponseObject:
|
|
145
144
|
"""
|
|
146
|
-
Retrieve national and local geographic locations that a specified user has eligible in-store offers at.
|
|
147
|
-
include local locations, add the `includeLocal` query parameter to your api call. Use this endpoint to build
|
|
145
|
+
Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
148
146
|
out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
149
147
|
that Longitude and Latitude fields are prioritized over State, City and Zipcode and are the recommended search
|
|
150
148
|
pattern.<br/>
|
|
@@ -269,8 +267,7 @@ class AsyncRewardsClient:
|
|
|
269
267
|
"""
|
|
270
268
|
Retrieve national brand offers that a specified user is eligible for. Call this endpoint to build out your
|
|
271
269
|
[targeted offers UX experience](/2024-10-01/api/getting-started#b-discover-a-lapsed-customer-clo). Local offers details
|
|
272
|
-
can be found by calling the [Get Eligible Locations](/2024-10-01/api/rewards/locations)
|
|
273
|
-
`includeLocal` query parameter.<br/>
|
|
270
|
+
can be found by calling the [Get Eligible Locations](/2024-10-01/api/rewards/locations).<br/>
|
|
274
271
|
<b>Required scopes:</b> `rewards:read`
|
|
275
272
|
|
|
276
273
|
Parameters
|
|
@@ -369,8 +366,7 @@ class AsyncRewardsClient:
|
|
|
369
366
|
request_options: typing.Optional[RequestOptions] = None,
|
|
370
367
|
) -> LocationsResponseObject:
|
|
371
368
|
"""
|
|
372
|
-
Retrieve national and local geographic locations that a specified user has eligible in-store offers at.
|
|
373
|
-
include local locations, add the `includeLocal` query parameter to your api call. Use this endpoint to build
|
|
369
|
+
Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
374
370
|
out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
375
371
|
that Longitude and Latitude fields are prioritized over State, City and Zipcode and are the recommended search
|
|
376
372
|
pattern.<br/>
|
kard/users/rewards/raw_client.py
CHANGED
|
@@ -49,8 +49,7 @@ class RawRewardsClient:
|
|
|
49
49
|
"""
|
|
50
50
|
Retrieve national brand offers that a specified user is eligible for. Call this endpoint to build out your
|
|
51
51
|
[targeted offers UX experience](/2024-10-01/api/getting-started#b-discover-a-lapsed-customer-clo). Local offers details
|
|
52
|
-
can be found by calling the [Get Eligible Locations](/2024-10-01/api/rewards/locations)
|
|
53
|
-
`includeLocal` query parameter.<br/>
|
|
52
|
+
can be found by calling the [Get Eligible Locations](/2024-10-01/api/rewards/locations).<br/>
|
|
54
53
|
<b>Required scopes:</b> `rewards:read`
|
|
55
54
|
|
|
56
55
|
Parameters
|
|
@@ -184,8 +183,7 @@ class RawRewardsClient:
|
|
|
184
183
|
request_options: typing.Optional[RequestOptions] = None,
|
|
185
184
|
) -> HttpResponse[LocationsResponseObject]:
|
|
186
185
|
"""
|
|
187
|
-
Retrieve national and local geographic locations that a specified user has eligible in-store offers at.
|
|
188
|
-
include local locations, add the `includeLocal` query parameter to your api call. Use this endpoint to build
|
|
186
|
+
Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
189
187
|
out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
190
188
|
that Longitude and Latitude fields are prioritized over State, City and Zipcode and are the recommended search
|
|
191
189
|
pattern.<br/>
|
|
@@ -340,8 +338,7 @@ class AsyncRawRewardsClient:
|
|
|
340
338
|
"""
|
|
341
339
|
Retrieve national brand offers that a specified user is eligible for. Call this endpoint to build out your
|
|
342
340
|
[targeted offers UX experience](/2024-10-01/api/getting-started#b-discover-a-lapsed-customer-clo). Local offers details
|
|
343
|
-
can be found by calling the [Get Eligible Locations](/2024-10-01/api/rewards/locations)
|
|
344
|
-
`includeLocal` query parameter.<br/>
|
|
341
|
+
can be found by calling the [Get Eligible Locations](/2024-10-01/api/rewards/locations).<br/>
|
|
345
342
|
<b>Required scopes:</b> `rewards:read`
|
|
346
343
|
|
|
347
344
|
Parameters
|
|
@@ -475,8 +472,7 @@ class AsyncRawRewardsClient:
|
|
|
475
472
|
request_options: typing.Optional[RequestOptions] = None,
|
|
476
473
|
) -> AsyncHttpResponse[LocationsResponseObject]:
|
|
477
474
|
"""
|
|
478
|
-
Retrieve national and local geographic locations that a specified user has eligible in-store offers at.
|
|
479
|
-
include local locations, add the `includeLocal` query parameter to your api call. Use this endpoint to build
|
|
475
|
+
Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
480
476
|
out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
481
477
|
that Longitude and Latitude fields are prioritized over State, City and Zipcode and are the recommended search
|
|
482
478
|
pattern.<br/>
|