kard-financial-sdk 0.0.82__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 +579 -0
- kard/auth/__init__.py +34 -0
- kard/auth/client.py +121 -0
- kard/auth/raw_client.py +108 -0
- kard/auth/types/__init__.py +34 -0
- kard/auth/types/token_response.py +25 -0
- kard/client.py +416 -0
- kard/commons/__init__.py +120 -0
- kard/commons/errors/__init__.py +44 -0
- kard/commons/errors/conflict_error.py +11 -0
- kard/commons/errors/does_not_exist_error.py +11 -0
- kard/commons/errors/internal_server_error.py +11 -0
- kard/commons/errors/invalid_request.py +11 -0
- kard/commons/errors/unauthorized_error.py +11 -0
- kard/commons/types/__init__.py +107 -0
- kard/commons/types/category_option.py +26 -0
- kard/commons/types/commission_type.py +5 -0
- kard/commons/types/commission_value.py +28 -0
- kard/commons/types/commission_value_type.py +5 -0
- kard/commons/types/empty_object.py +17 -0
- kard/commons/types/enrolled_rewards_type.py +5 -0
- kard/commons/types/error_object.py +43 -0
- kard/commons/types/error_response.py +20 -0
- kard/commons/types/error_source.py +32 -0
- kard/commons/types/job.py +24 -0
- kard/commons/types/job_response.py +27 -0
- kard/commons/types/job_status.py +5 -0
- kard/commons/types/links.py +27 -0
- kard/commons/types/mongo_id.py +3 -0
- kard/commons/types/notification_type.py +19 -0
- kard/commons/types/organization_id.py +3 -0
- kard/commons/types/purchase_channel.py +5 -0
- kard/commons/types/relationship_data.py +24 -0
- kard/commons/types/relationship_multiple.py +20 -0
- kard/commons/types/relationship_single.py +20 -0
- kard/commons/types/resource_type.py +3 -0
- kard/commons/types/state.py +68 -0
- kard/commons/types/subscription_id.py +3 -0
- kard/commons/types/user_id.py +3 -0
- kard/core/__init__.py +105 -0
- kard/core/api_error.py +23 -0
- kard/core/client_wrapper.py +97 -0
- kard/core/datetime_utils.py +28 -0
- kard/core/file.py +67 -0
- kard/core/force_multipart.py +18 -0
- kard/core/http_client.py +613 -0
- kard/core/http_response.py +55 -0
- kard/core/http_sse/__init__.py +42 -0
- kard/core/http_sse/_api.py +112 -0
- kard/core/http_sse/_decoders.py +61 -0
- kard/core/http_sse/_exceptions.py +7 -0
- kard/core/http_sse/_models.py +17 -0
- kard/core/jsonable_encoder.py +100 -0
- kard/core/oauth_token_provider.py +73 -0
- kard/core/pydantic_utilities.py +260 -0
- kard/core/query_encoder.py +58 -0
- kard/core/remove_none_from_dict.py +11 -0
- kard/core/request_options.py +35 -0
- kard/core/serialization.py +276 -0
- kard/environment.py +8 -0
- kard/files/__init__.py +58 -0
- kard/files/client.py +213 -0
- kard/files/errors/__init__.py +34 -0
- kard/files/errors/forbidden_error.py +11 -0
- kard/files/raw_client.py +278 -0
- kard/files/types/__init__.py +53 -0
- kard/files/types/file_metadata_attribute.py +39 -0
- kard/files/types/file_metadata_with_url.py +34 -0
- kard/files/types/file_type.py +13 -0
- kard/files/types/files_metadata_sort_options.py +5 -0
- kard/files/types/get_files_metadata_response.py +71 -0
- kard/files/types/pagination_meta.py +29 -0
- kard/notifications/__init__.py +279 -0
- kard/notifications/client.py +63 -0
- kard/notifications/raw_client.py +13 -0
- kard/notifications/subscriptions/__init__.py +97 -0
- kard/notifications/subscriptions/client.py +372 -0
- kard/notifications/subscriptions/raw_client.py +581 -0
- kard/notifications/subscriptions/types/__init__.py +94 -0
- kard/notifications/subscriptions/types/create_subscription_union.py +27 -0
- kard/notifications/subscriptions/types/create_subscriptions_response_object.py +43 -0
- kard/notifications/subscriptions/types/created_subscription.py +23 -0
- kard/notifications/subscriptions/types/subscription.py +25 -0
- kard/notifications/subscriptions/types/subscription_attributes.py +35 -0
- kard/notifications/subscriptions/types/subscription_request.py +20 -0
- kard/notifications/subscriptions/types/subscription_request_attributes.py +35 -0
- kard/notifications/subscriptions/types/subscription_request_body.py +42 -0
- kard/notifications/subscriptions/types/subscription_request_union.py +26 -0
- kard/notifications/subscriptions/types/subscription_union.py +27 -0
- kard/notifications/subscriptions/types/subscriptions_response_object.py +43 -0
- kard/notifications/subscriptions/types/update_subscription_request.py +20 -0
- kard/notifications/subscriptions/types/update_subscription_request_attributes.py +39 -0
- kard/notifications/subscriptions/types/update_subscription_request_body.py +40 -0
- kard/notifications/subscriptions/types/update_subscription_request_union.py +26 -0
- kard/notifications/subscriptions/types/update_subscriptions_response_object.py +41 -0
- kard/notifications/types/__init__.py +214 -0
- kard/notifications/types/audit_update_attributes.py +88 -0
- kard/notifications/types/audit_update_data.py +27 -0
- kard/notifications/types/audit_update_relationships.py +21 -0
- kard/notifications/types/broker_amount.py +28 -0
- kard/notifications/types/broker_amount_type.py +5 -0
- kard/notifications/types/broker_asset.py +33 -0
- kard/notifications/types/broker_asset_type.py +5 -0
- kard/notifications/types/broker_operation_hours.py +30 -0
- kard/notifications/types/broker_operation_period.py +28 -0
- kard/notifications/types/broker_purchase_channel.py +5 -0
- kard/notifications/types/broker_reward.py +28 -0
- kard/notifications/types/broker_reward_type.py +5 -0
- kard/notifications/types/clawback_data.py +27 -0
- kard/notifications/types/earned_reward_approved_data.py +27 -0
- kard/notifications/types/earned_reward_attributes.py +18 -0
- kard/notifications/types/earned_reward_relationships.py +21 -0
- kard/notifications/types/earned_reward_settled_attributes.py +23 -0
- kard/notifications/types/earned_reward_settled_data.py +27 -0
- kard/notifications/types/failed_transaction_attributes.py +41 -0
- kard/notifications/types/failed_transaction_data.py +27 -0
- kard/notifications/types/failed_transaction_relationships.py +22 -0
- kard/notifications/types/location_address.py +39 -0
- kard/notifications/types/location_coordinates.py +27 -0
- kard/notifications/types/location_status.py +5 -0
- kard/notifications/types/merchant_source.py +5 -0
- kard/notifications/types/notification_data_union.py +203 -0
- kard/notifications/types/notification_metadata.py +22 -0
- kard/notifications/types/notification_payload.py +65 -0
- kard/notifications/types/offer_status.py +5 -0
- kard/notifications/types/offer_type.py +5 -0
- kard/notifications/types/reward_notification_attributes.py +48 -0
- kard/notifications/types/time_period.py +27 -0
- kard/notifications/types/transaction_relationships.py +22 -0
- kard/notifications/types/user_offer_status.py +5 -0
- kard/notifications/types/valid_transaction_attributes.py +25 -0
- kard/notifications/types/valid_transaction_commission_earned.py +21 -0
- kard/notifications/types/valid_transaction_data.py +27 -0
- kard/notifications/types/webhook_locations_attributes.py +71 -0
- kard/notifications/types/webhook_locations_data.py +27 -0
- kard/notifications/types/webhook_locations_relationships.py +20 -0
- kard/notifications/types/webhook_merchant_attributes.py +67 -0
- kard/notifications/types/webhook_merchant_data.py +27 -0
- kard/notifications/types/webhook_merchant_relationships.py +20 -0
- kard/notifications/types/webhook_offer_attributes.py +143 -0
- kard/notifications/types/webhook_offer_data.py +27 -0
- kard/notifications/types/webhook_offer_relationships.py +20 -0
- kard/notifications/types/webhook_user_offer_attributes.py +41 -0
- kard/notifications/types/webhook_user_offer_data.py +27 -0
- kard/notifications/types/webhook_user_offer_relationships.py +21 -0
- kard/ping/__init__.py +39 -0
- kard/ping/client.py +100 -0
- kard/ping/errors/__init__.py +34 -0
- kard/ping/errors/network_blocked_error.py +11 -0
- kard/ping/raw_client.py +113 -0
- kard/ping/types/__init__.py +38 -0
- kard/ping/types/network_blocked_error_body.py +34 -0
- kard/ping/types/ping_response_object.py +46 -0
- kard/py.typed +0 -0
- kard/transactions/__init__.py +212 -0
- kard/transactions/client.py +639 -0
- kard/transactions/errors/__init__.py +40 -0
- kard/transactions/errors/create_audit_multi_status.py +11 -0
- kard/transactions/errors/create_incoming_transactions_multi_status.py +11 -0
- kard/transactions/errors/fraud_multi_status.py +11 -0
- kard/transactions/raw_client.py +925 -0
- kard/transactions/types/__init__.py +199 -0
- kard/transactions/types/audit_attributes.py +44 -0
- kard/transactions/types/audit_request_data.py +20 -0
- kard/transactions/types/audit_response_attributes.py +24 -0
- kard/transactions/types/audit_response_data.py +25 -0
- kard/transactions/types/audit_status.py +5 -0
- kard/transactions/types/card_network.py +5 -0
- kard/transactions/types/commission_earned_details.py +21 -0
- kard/transactions/types/create_audit_multi_status_response.py +21 -0
- kard/transactions/types/create_audit_request_body.py +43 -0
- kard/transactions/types/create_audit_request_data_union.py +26 -0
- kard/transactions/types/create_audit_response_body.py +41 -0
- kard/transactions/types/create_audit_response_data_union.py +27 -0
- kard/transactions/types/direction_type.py +5 -0
- kard/transactions/types/fraudulent_transaction_attributes.py +24 -0
- kard/transactions/types/fraudulent_transaction_data.py +30 -0
- kard/transactions/types/fraudulent_transaction_object.py +42 -0
- kard/transactions/types/fraudulent_transaction_request_body.py +45 -0
- kard/transactions/types/fraudulent_transaction_response.py +21 -0
- kard/transactions/types/get_earned_rewards_response.py +133 -0
- kard/transactions/types/matched_transactions_attributes.py +156 -0
- kard/transactions/types/matched_transactions_request.py +25 -0
- kard/transactions/types/merchant.py +82 -0
- kard/transactions/types/payment_status.py +5 -0
- kard/transactions/types/payment_type.py +5 -0
- kard/transactions/types/processor_mid.py +26 -0
- kard/transactions/types/receipt_medium_type.py +5 -0
- kard/transactions/types/rewarded_transaction.py +27 -0
- kard/transactions/types/rewarded_transaction_attributes.py +74 -0
- kard/transactions/types/rewarded_transaction_relationships.py +22 -0
- kard/transactions/types/rewarded_transaction_status.py +5 -0
- kard/transactions/types/rewarded_transaction_union.py +29 -0
- kard/transactions/types/states.py +68 -0
- kard/transactions/types/transaction_included_resource.py +47 -0
- kard/transactions/types/transaction_merchant_attributes.py +22 -0
- kard/transactions/types/transaction_merchant_resource.py +28 -0
- kard/transactions/types/transaction_offer_attributes.py +26 -0
- kard/transactions/types/transaction_offer_resource.py +28 -0
- kard/transactions/types/transaction_payment_type.py +5 -0
- kard/transactions/types/transaction_status.py +5 -0
- kard/transactions/types/transactions.py +46 -0
- kard/transactions/types/transactions_attributes.py +198 -0
- kard/transactions/types/transactions_multi_response.py +21 -0
- kard/transactions/types/transactions_request.py +25 -0
- kard/transactions/types/transactions_request_body.py +90 -0
- kard/transactions/types/transactions_response.py +38 -0
- kard/transactions/types/transactions_response_data.py +27 -0
- kard/transactions/types/visa_mid.py +23 -0
- kard/transactions/types/visa_mid_details.py +27 -0
- kard/users/__init__.py +293 -0
- kard/users/attributions/__init__.py +73 -0
- kard/users/attributions/client.py +229 -0
- kard/users/attributions/raw_client.py +215 -0
- kard/users/attributions/types/__init__.py +73 -0
- kard/users/attributions/types/create_attribution_request_object.py +75 -0
- kard/users/attributions/types/create_attribution_request_union.py +45 -0
- kard/users/attributions/types/create_attribution_response.py +38 -0
- kard/users/attributions/types/event_code.py +5 -0
- kard/users/attributions/types/notification_attribution_attributes.py +35 -0
- kard/users/attributions/types/notification_attribution_request.py +20 -0
- kard/users/attributions/types/notification_medium.py +5 -0
- kard/users/attributions/types/offer_attribution_attributes.py +35 -0
- kard/users/attributions/types/offer_attribution_request.py +20 -0
- kard/users/attributions/types/offer_medium.py +5 -0
- kard/users/client.py +512 -0
- kard/users/errors/__init__.py +34 -0
- kard/users/errors/multi_status.py +11 -0
- kard/users/raw_client.py +783 -0
- kard/users/rewards/__init__.py +133 -0
- kard/users/rewards/client.py +448 -0
- kard/users/rewards/raw_client.py +587 -0
- kard/users/rewards/types/__init__.py +130 -0
- kard/users/rewards/types/amount.py +21 -0
- kard/users/rewards/types/amount_type.py +5 -0
- kard/users/rewards/types/asset.py +28 -0
- kard/users/rewards/types/category_data.py +18 -0
- kard/users/rewards/types/category_fields.py +23 -0
- kard/users/rewards/types/category_identifier.py +24 -0
- kard/users/rewards/types/category_included.py +21 -0
- kard/users/rewards/types/category_relationship.py +20 -0
- kard/users/rewards/types/category_relationship_object.py +20 -0
- kard/users/rewards/types/commission.py +21 -0
- kard/users/rewards/types/coordinates.py +20 -0
- kard/users/rewards/types/eligibility_location_address.py +24 -0
- kard/users/rewards/types/eligibility_location_included.py +8 -0
- kard/users/rewards/types/eligibility_offer_included.py +7 -0
- kard/users/rewards/types/eligibility_offer_relationship.py +7 -0
- kard/users/rewards/types/location_attributes.py +28 -0
- kard/users/rewards/types/location_data.py +32 -0
- kard/users/rewards/types/location_relationships.py +18 -0
- kard/users/rewards/types/location_sort_options.py +5 -0
- kard/users/rewards/types/locations_response_object.py +215 -0
- kard/users/rewards/types/offer_common_fields.py +103 -0
- kard/users/rewards/types/offer_data_union.py +30 -0
- kard/users/rewards/types/offer_relationship.py +21 -0
- kard/users/rewards/types/offer_sort_options.py +7 -0
- kard/users/rewards/types/offers_response_object.py +130 -0
- kard/users/rewards/types/operation_hours.py +23 -0
- kard/users/rewards/types/operation_period.py +21 -0
- kard/users/rewards/types/operation_time.py +20 -0
- kard/users/rewards/types/standard_offer.py +21 -0
- kard/users/rewards/types/standard_offer_core.py +26 -0
- kard/users/rewards/types/standard_offer_fields.py +18 -0
- kard/users/types/__init__.py +66 -0
- kard/users/types/create_users_multi_status_response.py +21 -0
- kard/users/types/create_users_object.py +42 -0
- kard/users/types/delete_user_response_object.py +34 -0
- kard/users/types/update_user_object.py +40 -0
- kard/users/types/user_request_attributes.py +60 -0
- kard/users/types/user_request_data.py +22 -0
- kard/users/types/user_request_data_union.py +28 -0
- kard/users/types/user_response_no_data.py +22 -0
- kard/users/types/user_response_union_no_data.py +28 -0
- kard/users/uploads/__init__.py +112 -0
- kard/users/uploads/client.py +484 -0
- kard/users/uploads/errors/__init__.py +34 -0
- kard/users/uploads/errors/upload_part_multi_status.py +13 -0
- kard/users/uploads/raw_client.py +625 -0
- kard/users/uploads/types/__init__.py +119 -0
- kard/users/uploads/types/create_upload_part_data_union.py +27 -0
- kard/users/uploads/types/create_upload_part_multi_status_response.py +21 -0
- kard/users/uploads/types/create_upload_part_request_object.py +74 -0
- kard/users/uploads/types/create_upload_part_response_data.py +25 -0
- kard/users/uploads/types/create_upload_part_response_data_union.py +27 -0
- kard/users/uploads/types/create_upload_part_response_object.py +39 -0
- kard/users/uploads/types/create_upload_request_data_union.py +26 -0
- kard/users/uploads/types/create_upload_request_object.py +36 -0
- kard/users/uploads/types/create_upload_response_data.py +25 -0
- kard/users/uploads/types/create_upload_response_data_union.py +27 -0
- kard/users/uploads/types/create_upload_response_object.py +37 -0
- kard/users/uploads/types/historical_transaction_complete_no_data.py +25 -0
- kard/users/uploads/types/start_historical_upload_no_data.py +20 -0
- kard/users/uploads/types/update_upload_request_data_union.py +27 -0
- kard/users/uploads/types/update_upload_request_object.py +37 -0
- kard/users/uploads/types/update_upload_response_data.py +25 -0
- kard/users/uploads/types/update_upload_response_data_union.py +27 -0
- kard/users/uploads/types/update_upload_response_object.py +37 -0
- kard/version.py +3 -0
- kard_financial_sdk-0.0.82.dist-info/METADATA +238 -0
- kard_financial_sdk-0.0.82.dist-info/RECORD +302 -0
- kard_financial_sdk-0.0.82.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ...commons.types.error_response import ErrorResponse
|
|
6
|
+
from ...core.api_error import ApiError
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ForbiddenError(ApiError):
|
|
10
|
+
def __init__(self, body: ErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
11
|
+
super().__init__(status_code=403, headers=headers, body=body)
|
kard/files/raw_client.py
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..commons.errors.internal_server_error import InternalServerError
|
|
7
|
+
from ..commons.errors.invalid_request import InvalidRequest
|
|
8
|
+
from ..commons.errors.unauthorized_error import UnauthorizedError
|
|
9
|
+
from ..commons.types.error_response import ErrorResponse
|
|
10
|
+
from ..commons.types.organization_id import OrganizationId
|
|
11
|
+
from ..core.api_error import ApiError
|
|
12
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
13
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
14
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
15
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
16
|
+
from ..core.request_options import RequestOptions
|
|
17
|
+
from .errors.forbidden_error import ForbiddenError
|
|
18
|
+
from .types.file_type import FileType
|
|
19
|
+
from .types.files_metadata_sort_options import FilesMetadataSortOptions
|
|
20
|
+
from .types.get_files_metadata_response import GetFilesMetadataResponse
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class RawFilesClient:
|
|
24
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
25
|
+
self._client_wrapper = client_wrapper
|
|
26
|
+
|
|
27
|
+
def get_metadata(
|
|
28
|
+
self,
|
|
29
|
+
organization_id: OrganizationId,
|
|
30
|
+
*,
|
|
31
|
+
filter_date_from: typing.Optional[str] = None,
|
|
32
|
+
filter_date_to: typing.Optional[str] = None,
|
|
33
|
+
filter_file_type: typing.Optional[FileType] = None,
|
|
34
|
+
page_size: typing.Optional[int] = None,
|
|
35
|
+
page_after: typing.Optional[str] = None,
|
|
36
|
+
page_before: typing.Optional[str] = None,
|
|
37
|
+
sort: typing.Optional[typing.Union[FilesMetadataSortOptions, typing.Sequence[FilesMetadataSortOptions]]] = None,
|
|
38
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
39
|
+
) -> HttpResponse[GetFilesMetadataResponse]:
|
|
40
|
+
"""
|
|
41
|
+
Retrieves metadata for files associated with a specific issuer/organization.
|
|
42
|
+
This endpoint supports pagination and sorting options to efficiently navigate
|
|
43
|
+
through potentially large sets of file metadata.
|
|
44
|
+
<b>Required scopes:</b> `files.read`
|
|
45
|
+
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
organization_id : OrganizationId
|
|
49
|
+
|
|
50
|
+
filter_date_from : typing.Optional[str]
|
|
51
|
+
Start date for filtering files (format ISO8601). If not provided, defaults to current date minus 1 month.
|
|
52
|
+
|
|
53
|
+
filter_date_to : typing.Optional[str]
|
|
54
|
+
End date for filtering files (format ISO8601). If not provided, defaults to current date.
|
|
55
|
+
|
|
56
|
+
filter_file_type : typing.Optional[FileType]
|
|
57
|
+
The document file type.
|
|
58
|
+
|
|
59
|
+
page_size : typing.Optional[int]
|
|
60
|
+
Number of items per page. Defaults to 10 if not specified and maximum value allowed 100 items per page.
|
|
61
|
+
|
|
62
|
+
page_after : typing.Optional[str]
|
|
63
|
+
Cursor for forward pagination (next page).
|
|
64
|
+
|
|
65
|
+
page_before : typing.Optional[str]
|
|
66
|
+
Cursor for backward pagination (previous page).
|
|
67
|
+
|
|
68
|
+
sort : typing.Optional[typing.Union[FilesMetadataSortOptions, typing.Sequence[FilesMetadataSortOptions]]]
|
|
69
|
+
If provided, response will be sorted by the specified fields. Defaults to descending sentDate, equivalent to "-sentDate"
|
|
70
|
+
|
|
71
|
+
request_options : typing.Optional[RequestOptions]
|
|
72
|
+
Request-specific configuration.
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
HttpResponse[GetFilesMetadataResponse]
|
|
77
|
+
"""
|
|
78
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
79
|
+
f"v2/issuers/{jsonable_encoder(organization_id)}/files/metadata",
|
|
80
|
+
method="GET",
|
|
81
|
+
params={
|
|
82
|
+
"filter[dateFrom]": filter_date_from,
|
|
83
|
+
"filter[dateTo]": filter_date_to,
|
|
84
|
+
"filter[fileType]": filter_file_type,
|
|
85
|
+
"page[size]": page_size,
|
|
86
|
+
"page[after]": page_after,
|
|
87
|
+
"page[before]": page_before,
|
|
88
|
+
"sort": sort,
|
|
89
|
+
},
|
|
90
|
+
request_options=request_options,
|
|
91
|
+
)
|
|
92
|
+
try:
|
|
93
|
+
if 200 <= _response.status_code < 300:
|
|
94
|
+
_data = typing.cast(
|
|
95
|
+
GetFilesMetadataResponse,
|
|
96
|
+
parse_obj_as(
|
|
97
|
+
type_=GetFilesMetadataResponse, # type: ignore
|
|
98
|
+
object_=_response.json(),
|
|
99
|
+
),
|
|
100
|
+
)
|
|
101
|
+
return HttpResponse(response=_response, data=_data)
|
|
102
|
+
if _response.status_code == 403:
|
|
103
|
+
raise ForbiddenError(
|
|
104
|
+
headers=dict(_response.headers),
|
|
105
|
+
body=typing.cast(
|
|
106
|
+
ErrorResponse,
|
|
107
|
+
parse_obj_as(
|
|
108
|
+
type_=ErrorResponse, # type: ignore
|
|
109
|
+
object_=_response.json(),
|
|
110
|
+
),
|
|
111
|
+
),
|
|
112
|
+
)
|
|
113
|
+
if _response.status_code == 500:
|
|
114
|
+
raise InternalServerError(
|
|
115
|
+
headers=dict(_response.headers),
|
|
116
|
+
body=typing.cast(
|
|
117
|
+
ErrorResponse,
|
|
118
|
+
parse_obj_as(
|
|
119
|
+
type_=ErrorResponse, # type: ignore
|
|
120
|
+
object_=_response.json(),
|
|
121
|
+
),
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
if _response.status_code == 400:
|
|
125
|
+
raise InvalidRequest(
|
|
126
|
+
headers=dict(_response.headers),
|
|
127
|
+
body=typing.cast(
|
|
128
|
+
ErrorResponse,
|
|
129
|
+
parse_obj_as(
|
|
130
|
+
type_=ErrorResponse, # type: ignore
|
|
131
|
+
object_=_response.json(),
|
|
132
|
+
),
|
|
133
|
+
),
|
|
134
|
+
)
|
|
135
|
+
if _response.status_code == 401:
|
|
136
|
+
raise UnauthorizedError(
|
|
137
|
+
headers=dict(_response.headers),
|
|
138
|
+
body=typing.cast(
|
|
139
|
+
ErrorResponse,
|
|
140
|
+
parse_obj_as(
|
|
141
|
+
type_=ErrorResponse, # type: ignore
|
|
142
|
+
object_=_response.json(),
|
|
143
|
+
),
|
|
144
|
+
),
|
|
145
|
+
)
|
|
146
|
+
_response_json = _response.json()
|
|
147
|
+
except JSONDecodeError:
|
|
148
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
149
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class AsyncRawFilesClient:
|
|
153
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
154
|
+
self._client_wrapper = client_wrapper
|
|
155
|
+
|
|
156
|
+
async def get_metadata(
|
|
157
|
+
self,
|
|
158
|
+
organization_id: OrganizationId,
|
|
159
|
+
*,
|
|
160
|
+
filter_date_from: typing.Optional[str] = None,
|
|
161
|
+
filter_date_to: typing.Optional[str] = None,
|
|
162
|
+
filter_file_type: typing.Optional[FileType] = None,
|
|
163
|
+
page_size: typing.Optional[int] = None,
|
|
164
|
+
page_after: typing.Optional[str] = None,
|
|
165
|
+
page_before: typing.Optional[str] = None,
|
|
166
|
+
sort: typing.Optional[typing.Union[FilesMetadataSortOptions, typing.Sequence[FilesMetadataSortOptions]]] = None,
|
|
167
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
168
|
+
) -> AsyncHttpResponse[GetFilesMetadataResponse]:
|
|
169
|
+
"""
|
|
170
|
+
Retrieves metadata for files associated with a specific issuer/organization.
|
|
171
|
+
This endpoint supports pagination and sorting options to efficiently navigate
|
|
172
|
+
through potentially large sets of file metadata.
|
|
173
|
+
<b>Required scopes:</b> `files.read`
|
|
174
|
+
|
|
175
|
+
Parameters
|
|
176
|
+
----------
|
|
177
|
+
organization_id : OrganizationId
|
|
178
|
+
|
|
179
|
+
filter_date_from : typing.Optional[str]
|
|
180
|
+
Start date for filtering files (format ISO8601). If not provided, defaults to current date minus 1 month.
|
|
181
|
+
|
|
182
|
+
filter_date_to : typing.Optional[str]
|
|
183
|
+
End date for filtering files (format ISO8601). If not provided, defaults to current date.
|
|
184
|
+
|
|
185
|
+
filter_file_type : typing.Optional[FileType]
|
|
186
|
+
The document file type.
|
|
187
|
+
|
|
188
|
+
page_size : typing.Optional[int]
|
|
189
|
+
Number of items per page. Defaults to 10 if not specified and maximum value allowed 100 items per page.
|
|
190
|
+
|
|
191
|
+
page_after : typing.Optional[str]
|
|
192
|
+
Cursor for forward pagination (next page).
|
|
193
|
+
|
|
194
|
+
page_before : typing.Optional[str]
|
|
195
|
+
Cursor for backward pagination (previous page).
|
|
196
|
+
|
|
197
|
+
sort : typing.Optional[typing.Union[FilesMetadataSortOptions, typing.Sequence[FilesMetadataSortOptions]]]
|
|
198
|
+
If provided, response will be sorted by the specified fields. Defaults to descending sentDate, equivalent to "-sentDate"
|
|
199
|
+
|
|
200
|
+
request_options : typing.Optional[RequestOptions]
|
|
201
|
+
Request-specific configuration.
|
|
202
|
+
|
|
203
|
+
Returns
|
|
204
|
+
-------
|
|
205
|
+
AsyncHttpResponse[GetFilesMetadataResponse]
|
|
206
|
+
"""
|
|
207
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
208
|
+
f"v2/issuers/{jsonable_encoder(organization_id)}/files/metadata",
|
|
209
|
+
method="GET",
|
|
210
|
+
params={
|
|
211
|
+
"filter[dateFrom]": filter_date_from,
|
|
212
|
+
"filter[dateTo]": filter_date_to,
|
|
213
|
+
"filter[fileType]": filter_file_type,
|
|
214
|
+
"page[size]": page_size,
|
|
215
|
+
"page[after]": page_after,
|
|
216
|
+
"page[before]": page_before,
|
|
217
|
+
"sort": sort,
|
|
218
|
+
},
|
|
219
|
+
request_options=request_options,
|
|
220
|
+
)
|
|
221
|
+
try:
|
|
222
|
+
if 200 <= _response.status_code < 300:
|
|
223
|
+
_data = typing.cast(
|
|
224
|
+
GetFilesMetadataResponse,
|
|
225
|
+
parse_obj_as(
|
|
226
|
+
type_=GetFilesMetadataResponse, # type: ignore
|
|
227
|
+
object_=_response.json(),
|
|
228
|
+
),
|
|
229
|
+
)
|
|
230
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
231
|
+
if _response.status_code == 403:
|
|
232
|
+
raise ForbiddenError(
|
|
233
|
+
headers=dict(_response.headers),
|
|
234
|
+
body=typing.cast(
|
|
235
|
+
ErrorResponse,
|
|
236
|
+
parse_obj_as(
|
|
237
|
+
type_=ErrorResponse, # type: ignore
|
|
238
|
+
object_=_response.json(),
|
|
239
|
+
),
|
|
240
|
+
),
|
|
241
|
+
)
|
|
242
|
+
if _response.status_code == 500:
|
|
243
|
+
raise InternalServerError(
|
|
244
|
+
headers=dict(_response.headers),
|
|
245
|
+
body=typing.cast(
|
|
246
|
+
ErrorResponse,
|
|
247
|
+
parse_obj_as(
|
|
248
|
+
type_=ErrorResponse, # type: ignore
|
|
249
|
+
object_=_response.json(),
|
|
250
|
+
),
|
|
251
|
+
),
|
|
252
|
+
)
|
|
253
|
+
if _response.status_code == 400:
|
|
254
|
+
raise InvalidRequest(
|
|
255
|
+
headers=dict(_response.headers),
|
|
256
|
+
body=typing.cast(
|
|
257
|
+
ErrorResponse,
|
|
258
|
+
parse_obj_as(
|
|
259
|
+
type_=ErrorResponse, # type: ignore
|
|
260
|
+
object_=_response.json(),
|
|
261
|
+
),
|
|
262
|
+
),
|
|
263
|
+
)
|
|
264
|
+
if _response.status_code == 401:
|
|
265
|
+
raise UnauthorizedError(
|
|
266
|
+
headers=dict(_response.headers),
|
|
267
|
+
body=typing.cast(
|
|
268
|
+
ErrorResponse,
|
|
269
|
+
parse_obj_as(
|
|
270
|
+
type_=ErrorResponse, # type: ignore
|
|
271
|
+
object_=_response.json(),
|
|
272
|
+
),
|
|
273
|
+
),
|
|
274
|
+
)
|
|
275
|
+
_response_json = _response.json()
|
|
276
|
+
except JSONDecodeError:
|
|
277
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
278
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .file_metadata_attribute import FileMetadataAttribute
|
|
10
|
+
from .file_metadata_with_url import FileMetadataWithUrl
|
|
11
|
+
from .file_type import FileType
|
|
12
|
+
from .files_metadata_sort_options import FilesMetadataSortOptions
|
|
13
|
+
from .get_files_metadata_response import GetFilesMetadataResponse
|
|
14
|
+
from .pagination_meta import PaginationMeta
|
|
15
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
16
|
+
"FileMetadataAttribute": ".file_metadata_attribute",
|
|
17
|
+
"FileMetadataWithUrl": ".file_metadata_with_url",
|
|
18
|
+
"FileType": ".file_type",
|
|
19
|
+
"FilesMetadataSortOptions": ".files_metadata_sort_options",
|
|
20
|
+
"GetFilesMetadataResponse": ".get_files_metadata_response",
|
|
21
|
+
"PaginationMeta": ".pagination_meta",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
26
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
27
|
+
if module_name is None:
|
|
28
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
29
|
+
try:
|
|
30
|
+
module = import_module(module_name, __package__)
|
|
31
|
+
if module_name == f".{attr_name}":
|
|
32
|
+
return module
|
|
33
|
+
else:
|
|
34
|
+
return getattr(module, attr_name)
|
|
35
|
+
except ImportError as e:
|
|
36
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
37
|
+
except AttributeError as e:
|
|
38
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def __dir__():
|
|
42
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
43
|
+
return sorted(lazy_attrs)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
__all__ = [
|
|
47
|
+
"FileMetadataAttribute",
|
|
48
|
+
"FileMetadataWithUrl",
|
|
49
|
+
"FileType",
|
|
50
|
+
"FilesMetadataSortOptions",
|
|
51
|
+
"GetFilesMetadataResponse",
|
|
52
|
+
"PaginationMeta",
|
|
53
|
+
]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
import typing_extensions
|
|
7
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
8
|
+
from ...core.serialization import FieldMetadata
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class FileMetadataAttribute(UniversalBaseModel):
|
|
12
|
+
file_name: typing_extensions.Annotated[str, FieldMetadata(alias="fileName")] = pydantic.Field()
|
|
13
|
+
"""
|
|
14
|
+
The name of the file.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
sent_at: typing_extensions.Annotated[str, FieldMetadata(alias="sentAt")] = pydantic.Field()
|
|
18
|
+
"""
|
|
19
|
+
ISO 8601 timestamp (ISO8601) when the file was originally sent/created.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
last_modified: typing_extensions.Annotated[str, FieldMetadata(alias="lastModified")] = pydantic.Field()
|
|
23
|
+
"""
|
|
24
|
+
ISO 8601 timestamp (ISO8601) when the file was last modified.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
download_url: typing_extensions.Annotated[str, FieldMetadata(alias="downloadUrl")] = pydantic.Field()
|
|
28
|
+
"""
|
|
29
|
+
Temporary URL that provides direct access to download the file for 30 minutes.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
if IS_PYDANTIC_V2:
|
|
33
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
34
|
+
else:
|
|
35
|
+
|
|
36
|
+
class Config:
|
|
37
|
+
frozen = True
|
|
38
|
+
smart_union = True
|
|
39
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,34 @@
|
|
|
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 .file_metadata_attribute import FileMetadataAttribute
|
|
8
|
+
from .file_type import FileType
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class FileMetadataWithUrl(UniversalBaseModel):
|
|
12
|
+
type: FileType = pydantic.Field()
|
|
13
|
+
"""
|
|
14
|
+
The type of the generated file.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
attributes: FileMetadataAttribute = pydantic.Field()
|
|
18
|
+
"""
|
|
19
|
+
Attributes of the filetype
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
id: str = pydantic.Field()
|
|
23
|
+
"""
|
|
24
|
+
The File ID in Kard’s system
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
if IS_PYDANTIC_V2:
|
|
28
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
29
|
+
else:
|
|
30
|
+
|
|
31
|
+
class Config:
|
|
32
|
+
frozen = True
|
|
33
|
+
smart_union = True
|
|
34
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
FileType = typing.Union[
|
|
6
|
+
typing.Literal[
|
|
7
|
+
"earnedRewardApprovedDailyReconciliationFile",
|
|
8
|
+
"earnedRewardSettledDailyReconciliationFile",
|
|
9
|
+
"validatedTransactionDailyReconciliationFile",
|
|
10
|
+
"monthlyReconciliationFile",
|
|
11
|
+
],
|
|
12
|
+
typing.Any,
|
|
13
|
+
]
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...commons.types.links import Links
|
|
7
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
8
|
+
from .file_metadata_with_url import FileMetadataWithUrl
|
|
9
|
+
from .pagination_meta import PaginationMeta
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class GetFilesMetadataResponse(UniversalBaseModel):
|
|
13
|
+
"""
|
|
14
|
+
Examples
|
|
15
|
+
--------
|
|
16
|
+
from kard.commons import Links
|
|
17
|
+
from kard.files import (
|
|
18
|
+
FileMetadataAttribute,
|
|
19
|
+
FileMetadataWithUrl,
|
|
20
|
+
GetFilesMetadataResponse,
|
|
21
|
+
PaginationMeta,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
GetFilesMetadataResponse(
|
|
25
|
+
data=[
|
|
26
|
+
FileMetadataWithUrl(
|
|
27
|
+
type="earnedRewardApprovedDailyReconciliationFile",
|
|
28
|
+
attributes=FileMetadataAttribute(
|
|
29
|
+
file_name="test-file-10.jsonl",
|
|
30
|
+
sent_at="2025-03-09T21:56:23Z",
|
|
31
|
+
last_modified="2025-03-19T21:56:23Z",
|
|
32
|
+
download_url="https://default-bucket.s3.us-east-1.amazonaws.com/test-file-10.jsonl?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Checksum-Mode=ENABLED&X-Amz-Credential=test%2F20250320%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250320T172109Z&X-Amz-Expires=1800&X-Amz-SignedHeaders=host&x-id=GetObject&X-Amz-Signature=c2a7dc6d14d0465b9ba9c24d47574a6bbcfa57856529319f25424c6bb1cf5204",
|
|
33
|
+
),
|
|
34
|
+
id="67db3d87cb70469be876c852049",
|
|
35
|
+
)
|
|
36
|
+
],
|
|
37
|
+
links=Links(
|
|
38
|
+
self_="/v2/files/issuers/0004321/metadata?page%5Bafter%5D=MjAyNS0wMy0xMFQyMTo1NjoyMy40OTY4ODda&page%5Bsize%5D=5&sort%5Bsent_at%5D=DESC",
|
|
39
|
+
prev="/v2/files/issuers/0004321/metadata?page%5Bbefore%5D=MjAyNS0wMy0wOVQyMTo1NjoyMy40OTY4ODda&page%5Bsize%5D=5&sort%5Bsent_at%5D=DESC",
|
|
40
|
+
next="/v2/files/issuers/0004321/metadata?page%5Bafter%5D=MjAyNS0wMy0wNVQyMTo1NjoyMy40OTY4ODda&page%5Bsize%5D=5&sort%5Bsent_at%5D=DESC",
|
|
41
|
+
),
|
|
42
|
+
meta=PaginationMeta(
|
|
43
|
+
page_size=5,
|
|
44
|
+
has_next_page=True,
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
data: typing.List[FileMetadataWithUrl] = pydantic.Field()
|
|
50
|
+
"""
|
|
51
|
+
List of file metadata objects with their pre-signed URLs.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
links: Links = pydantic.Field()
|
|
55
|
+
"""
|
|
56
|
+
Navigation links for paginated results.
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
meta: PaginationMeta = pydantic.Field()
|
|
60
|
+
"""
|
|
61
|
+
Metadata about the pagination status.
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
if IS_PYDANTIC_V2:
|
|
65
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
66
|
+
else:
|
|
67
|
+
|
|
68
|
+
class Config:
|
|
69
|
+
frozen = True
|
|
70
|
+
smart_union = True
|
|
71
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
import typing_extensions
|
|
7
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
8
|
+
from ...core.serialization import FieldMetadata
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class PaginationMeta(UniversalBaseModel):
|
|
12
|
+
page_size: typing_extensions.Annotated[int, FieldMetadata(alias="pageSize")] = pydantic.Field()
|
|
13
|
+
"""
|
|
14
|
+
Number of items per page.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
has_next_page: typing_extensions.Annotated[bool, FieldMetadata(alias="hasNextPage")] = pydantic.Field()
|
|
18
|
+
"""
|
|
19
|
+
Indicates if there are more pages available after the current one.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
if IS_PYDANTIC_V2:
|
|
23
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
24
|
+
else:
|
|
25
|
+
|
|
26
|
+
class Config:
|
|
27
|
+
frozen = True
|
|
28
|
+
smart_union = True
|
|
29
|
+
extra = pydantic.Extra.allow
|