updates
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# File generated from our OpenAPI spec
|
||||
from importlib import import_module
|
||||
from typing_extensions import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe.radar._early_fraud_warning import (
|
||||
EarlyFraudWarning as EarlyFraudWarning,
|
||||
)
|
||||
from stripe.radar._early_fraud_warning_service import (
|
||||
EarlyFraudWarningService as EarlyFraudWarningService,
|
||||
)
|
||||
from stripe.radar._value_list import ValueList as ValueList
|
||||
from stripe.radar._value_list_item import ValueListItem as ValueListItem
|
||||
from stripe.radar._value_list_item_service import (
|
||||
ValueListItemService as ValueListItemService,
|
||||
)
|
||||
from stripe.radar._value_list_service import (
|
||||
ValueListService as ValueListService,
|
||||
)
|
||||
|
||||
# name -> (import_target, is_submodule)
|
||||
_import_map = {
|
||||
"EarlyFraudWarning": ("stripe.radar._early_fraud_warning", False),
|
||||
"EarlyFraudWarningService": (
|
||||
"stripe.radar._early_fraud_warning_service",
|
||||
False,
|
||||
),
|
||||
"ValueList": ("stripe.radar._value_list", False),
|
||||
"ValueListItem": ("stripe.radar._value_list_item", False),
|
||||
"ValueListItemService": ("stripe.radar._value_list_item_service", False),
|
||||
"ValueListService": ("stripe.radar._value_list_service", False),
|
||||
}
|
||||
if not TYPE_CHECKING:
|
||||
|
||||
def __getattr__(name):
|
||||
try:
|
||||
target, is_submodule = _import_map[name]
|
||||
module = import_module(target)
|
||||
if is_submodule:
|
||||
return module
|
||||
|
||||
return getattr(
|
||||
module,
|
||||
name,
|
||||
)
|
||||
except KeyError:
|
||||
raise AttributeError()
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,128 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# File generated from our OpenAPI spec
|
||||
from stripe._expandable_field import ExpandableField
|
||||
from stripe._list_object import ListObject
|
||||
from stripe._listable_api_resource import ListableAPIResource
|
||||
from typing import ClassVar, Optional
|
||||
from typing_extensions import Literal, Unpack, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe._charge import Charge
|
||||
from stripe._payment_intent import PaymentIntent
|
||||
from stripe.params.radar._early_fraud_warning_list_params import (
|
||||
EarlyFraudWarningListParams,
|
||||
)
|
||||
from stripe.params.radar._early_fraud_warning_retrieve_params import (
|
||||
EarlyFraudWarningRetrieveParams,
|
||||
)
|
||||
|
||||
|
||||
class EarlyFraudWarning(ListableAPIResource["EarlyFraudWarning"]):
|
||||
"""
|
||||
An early fraud warning indicates that the card issuer has notified us that a
|
||||
charge may be fraudulent.
|
||||
|
||||
Related guide: [Early fraud warnings](https://stripe.com/docs/disputes/measuring#early-fraud-warnings)
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["radar.early_fraud_warning"]] = (
|
||||
"radar.early_fraud_warning"
|
||||
)
|
||||
actionable: bool
|
||||
"""
|
||||
An EFW is actionable if it has not received a dispute and has not been fully refunded. You may wish to proactively refund a charge that receives an EFW, in order to avoid receiving a dispute later.
|
||||
"""
|
||||
charge: ExpandableField["Charge"]
|
||||
"""
|
||||
ID of the charge this early fraud warning is for, optionally expanded.
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
fraud_type: str
|
||||
"""
|
||||
The type of fraud labelled by the issuer. One of `card_never_received`, `fraudulent_card_application`, `made_with_counterfeit_card`, `made_with_lost_card`, `made_with_stolen_card`, `misc`, `unauthorized_use_of_card`.
|
||||
"""
|
||||
id: str
|
||||
"""
|
||||
Unique identifier for the object.
|
||||
"""
|
||||
livemode: bool
|
||||
"""
|
||||
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
"""
|
||||
object: Literal["radar.early_fraud_warning"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
payment_intent: Optional[ExpandableField["PaymentIntent"]]
|
||||
"""
|
||||
ID of the Payment Intent this early fraud warning is for, optionally expanded.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["EarlyFraudWarningListParams"]
|
||||
) -> ListObject["EarlyFraudWarning"]:
|
||||
"""
|
||||
Returns a list of early fraud warnings.
|
||||
"""
|
||||
result = cls._static_request(
|
||||
"get",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
)
|
||||
if not isinstance(result, ListObject):
|
||||
raise TypeError(
|
||||
"Expected list object from API, got %s"
|
||||
% (type(result).__name__)
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
async def list_async(
|
||||
cls, **params: Unpack["EarlyFraudWarningListParams"]
|
||||
) -> ListObject["EarlyFraudWarning"]:
|
||||
"""
|
||||
Returns a list of early fraud warnings.
|
||||
"""
|
||||
result = await cls._static_request_async(
|
||||
"get",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
)
|
||||
if not isinstance(result, ListObject):
|
||||
raise TypeError(
|
||||
"Expected list object from API, got %s"
|
||||
% (type(result).__name__)
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def retrieve(
|
||||
cls, id: str, **params: Unpack["EarlyFraudWarningRetrieveParams"]
|
||||
) -> "EarlyFraudWarning":
|
||||
"""
|
||||
Retrieves the details of an early fraud warning that has previously been created.
|
||||
|
||||
Please refer to the [early fraud warning](https://docs.stripe.com/api#early_fraud_warning_object) object reference for more details.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["EarlyFraudWarningRetrieveParams"]
|
||||
) -> "EarlyFraudWarning":
|
||||
"""
|
||||
Retrieves the details of an early fraud warning that has previously been created.
|
||||
|
||||
Please refer to the [early fraud warning](https://docs.stripe.com/api#early_fraud_warning_object) object reference for more details.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
@@ -0,0 +1,105 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# File generated from our OpenAPI spec
|
||||
from stripe._stripe_service import StripeService
|
||||
from stripe._util import sanitize_id
|
||||
from typing import Optional, cast
|
||||
from typing_extensions import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe._list_object import ListObject
|
||||
from stripe._request_options import RequestOptions
|
||||
from stripe.params.radar._early_fraud_warning_list_params import (
|
||||
EarlyFraudWarningListParams,
|
||||
)
|
||||
from stripe.params.radar._early_fraud_warning_retrieve_params import (
|
||||
EarlyFraudWarningRetrieveParams,
|
||||
)
|
||||
from stripe.radar._early_fraud_warning import EarlyFraudWarning
|
||||
|
||||
|
||||
class EarlyFraudWarningService(StripeService):
|
||||
def list(
|
||||
self,
|
||||
params: Optional["EarlyFraudWarningListParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[EarlyFraudWarning]":
|
||||
"""
|
||||
Returns a list of early fraud warnings.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[EarlyFraudWarning]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/radar/early_fraud_warnings",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: Optional["EarlyFraudWarningListParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[EarlyFraudWarning]":
|
||||
"""
|
||||
Returns a list of early fraud warnings.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[EarlyFraudWarning]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/radar/early_fraud_warnings",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
early_fraud_warning: str,
|
||||
params: Optional["EarlyFraudWarningRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "EarlyFraudWarning":
|
||||
"""
|
||||
Retrieves the details of an early fraud warning that has previously been created.
|
||||
|
||||
Please refer to the [early fraud warning](https://docs.stripe.com/api#early_fraud_warning_object) object reference for more details.
|
||||
"""
|
||||
return cast(
|
||||
"EarlyFraudWarning",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/radar/early_fraud_warnings/{early_fraud_warning}".format(
|
||||
early_fraud_warning=sanitize_id(early_fraud_warning),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
early_fraud_warning: str,
|
||||
params: Optional["EarlyFraudWarningRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "EarlyFraudWarning":
|
||||
"""
|
||||
Retrieves the details of an early fraud warning that has previously been created.
|
||||
|
||||
Please refer to the [early fraud warning](https://docs.stripe.com/api#early_fraud_warning_object) object reference for more details.
|
||||
"""
|
||||
return cast(
|
||||
"EarlyFraudWarning",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/radar/early_fraud_warnings/{early_fraud_warning}".format(
|
||||
early_fraud_warning=sanitize_id(early_fraud_warning),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,318 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# File generated from our OpenAPI spec
|
||||
from stripe._createable_api_resource import CreateableAPIResource
|
||||
from stripe._deletable_api_resource import DeletableAPIResource
|
||||
from stripe._list_object import ListObject
|
||||
from stripe._listable_api_resource import ListableAPIResource
|
||||
from stripe._updateable_api_resource import UpdateableAPIResource
|
||||
from stripe._util import class_method_variant, sanitize_id
|
||||
from typing import ClassVar, Dict, Optional, cast, overload
|
||||
from typing_extensions import Literal, Unpack, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe.params.radar._value_list_create_params import (
|
||||
ValueListCreateParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_delete_params import (
|
||||
ValueListDeleteParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_list_params import ValueListListParams
|
||||
from stripe.params.radar._value_list_modify_params import (
|
||||
ValueListModifyParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_retrieve_params import (
|
||||
ValueListRetrieveParams,
|
||||
)
|
||||
from stripe.radar._value_list_item import ValueListItem
|
||||
|
||||
|
||||
class ValueList(
|
||||
CreateableAPIResource["ValueList"],
|
||||
DeletableAPIResource["ValueList"],
|
||||
ListableAPIResource["ValueList"],
|
||||
UpdateableAPIResource["ValueList"],
|
||||
):
|
||||
"""
|
||||
Value lists allow you to group values together which can then be referenced in rules.
|
||||
|
||||
Related guide: [Default Stripe lists](https://stripe.com/docs/radar/lists#managing-list-items)
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["radar.value_list"]] = "radar.value_list"
|
||||
alias: str
|
||||
"""
|
||||
The name of the value list for use in rules.
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
created_by: str
|
||||
"""
|
||||
The name or email address of the user who created this value list.
|
||||
"""
|
||||
deleted: Optional[Literal[True]]
|
||||
"""
|
||||
Always true for a deleted object
|
||||
"""
|
||||
id: str
|
||||
"""
|
||||
Unique identifier for the object.
|
||||
"""
|
||||
item_type: Literal[
|
||||
"card_bin",
|
||||
"card_fingerprint",
|
||||
"case_sensitive_string",
|
||||
"country",
|
||||
"customer_id",
|
||||
"email",
|
||||
"ip_address",
|
||||
"sepa_debit_fingerprint",
|
||||
"string",
|
||||
"us_bank_account_fingerprint",
|
||||
]
|
||||
"""
|
||||
The type of items in the value list. One of `card_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, `customer_id`, `sepa_debit_fingerprint`, or `us_bank_account_fingerprint`.
|
||||
"""
|
||||
list_items: ListObject["ValueListItem"]
|
||||
"""
|
||||
List of items contained within this value list.
|
||||
"""
|
||||
livemode: bool
|
||||
"""
|
||||
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
"""
|
||||
metadata: Dict[str, str]
|
||||
"""
|
||||
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
"""
|
||||
name: str
|
||||
"""
|
||||
The name of the value list.
|
||||
"""
|
||||
object: Literal["radar.value_list"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def create(cls, **params: Unpack["ValueListCreateParams"]) -> "ValueList":
|
||||
"""
|
||||
Creates a new ValueList object, which can then be referenced in rules.
|
||||
"""
|
||||
return cast(
|
||||
"ValueList",
|
||||
cls._static_request(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def create_async(
|
||||
cls, **params: Unpack["ValueListCreateParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Creates a new ValueList object, which can then be referenced in rules.
|
||||
"""
|
||||
return cast(
|
||||
"ValueList",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _cls_delete(
|
||||
cls, sid: str, **params: Unpack["ValueListDeleteParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
|
||||
"""
|
||||
url = "%s/%s" % (cls.class_url(), sanitize_id(sid))
|
||||
return cast(
|
||||
"ValueList",
|
||||
cls._static_request(
|
||||
"delete",
|
||||
url,
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def delete(
|
||||
sid: str, **params: Unpack["ValueListDeleteParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def delete(self, **params: Unpack["ValueListDeleteParams"]) -> "ValueList":
|
||||
"""
|
||||
Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_delete")
|
||||
def delete( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["ValueListDeleteParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
|
||||
"""
|
||||
return self._request_and_refresh(
|
||||
"delete",
|
||||
self.instance_url(),
|
||||
params=params,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_delete_async(
|
||||
cls, sid: str, **params: Unpack["ValueListDeleteParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
|
||||
"""
|
||||
url = "%s/%s" % (cls.class_url(), sanitize_id(sid))
|
||||
return cast(
|
||||
"ValueList",
|
||||
await cls._static_request_async(
|
||||
"delete",
|
||||
url,
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def delete_async(
|
||||
sid: str, **params: Unpack["ValueListDeleteParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def delete_async(
|
||||
self, **params: Unpack["ValueListDeleteParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_delete_async")
|
||||
async def delete_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["ValueListDeleteParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
|
||||
"""
|
||||
return await self._request_and_refresh_async(
|
||||
"delete",
|
||||
self.instance_url(),
|
||||
params=params,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["ValueListListParams"]
|
||||
) -> ListObject["ValueList"]:
|
||||
"""
|
||||
Returns a list of ValueList objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
|
||||
"""
|
||||
result = cls._static_request(
|
||||
"get",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
)
|
||||
if not isinstance(result, ListObject):
|
||||
raise TypeError(
|
||||
"Expected list object from API, got %s"
|
||||
% (type(result).__name__)
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
async def list_async(
|
||||
cls, **params: Unpack["ValueListListParams"]
|
||||
) -> ListObject["ValueList"]:
|
||||
"""
|
||||
Returns a list of ValueList objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
|
||||
"""
|
||||
result = await cls._static_request_async(
|
||||
"get",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
)
|
||||
if not isinstance(result, ListObject):
|
||||
raise TypeError(
|
||||
"Expected list object from API, got %s"
|
||||
% (type(result).__name__)
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def modify(
|
||||
cls, id: str, **params: Unpack["ValueListModifyParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Updates a ValueList object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Note that item_type is immutable.
|
||||
"""
|
||||
url = "%s/%s" % (cls.class_url(), sanitize_id(id))
|
||||
return cast(
|
||||
"ValueList",
|
||||
cls._static_request(
|
||||
"post",
|
||||
url,
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def modify_async(
|
||||
cls, id: str, **params: Unpack["ValueListModifyParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Updates a ValueList object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Note that item_type is immutable.
|
||||
"""
|
||||
url = "%s/%s" % (cls.class_url(), sanitize_id(id))
|
||||
return cast(
|
||||
"ValueList",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
url,
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def retrieve(
|
||||
cls, id: str, **params: Unpack["ValueListRetrieveParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Retrieves a ValueList object.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["ValueListRetrieveParams"]
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Retrieves a ValueList object.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
@@ -0,0 +1,263 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# File generated from our OpenAPI spec
|
||||
from stripe._createable_api_resource import CreateableAPIResource
|
||||
from stripe._deletable_api_resource import DeletableAPIResource
|
||||
from stripe._list_object import ListObject
|
||||
from stripe._listable_api_resource import ListableAPIResource
|
||||
from stripe._util import class_method_variant, sanitize_id
|
||||
from typing import ClassVar, Optional, cast, overload
|
||||
from typing_extensions import Literal, Unpack, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe.params.radar._value_list_item_create_params import (
|
||||
ValueListItemCreateParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_item_delete_params import (
|
||||
ValueListItemDeleteParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_item_list_params import (
|
||||
ValueListItemListParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_item_retrieve_params import (
|
||||
ValueListItemRetrieveParams,
|
||||
)
|
||||
|
||||
|
||||
class ValueListItem(
|
||||
CreateableAPIResource["ValueListItem"],
|
||||
DeletableAPIResource["ValueListItem"],
|
||||
ListableAPIResource["ValueListItem"],
|
||||
):
|
||||
"""
|
||||
Value list items allow you to add specific values to a given Radar value list, which can then be used in rules.
|
||||
|
||||
Related guide: [Managing list items](https://stripe.com/docs/radar/lists#managing-list-items)
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["radar.value_list_item"]] = (
|
||||
"radar.value_list_item"
|
||||
)
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
created_by: str
|
||||
"""
|
||||
The name or email address of the user who added this item to the value list.
|
||||
"""
|
||||
deleted: Optional[Literal[True]]
|
||||
"""
|
||||
Always true for a deleted object
|
||||
"""
|
||||
id: str
|
||||
"""
|
||||
Unique identifier for the object.
|
||||
"""
|
||||
livemode: bool
|
||||
"""
|
||||
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
"""
|
||||
object: Literal["radar.value_list_item"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
value: str
|
||||
"""
|
||||
The value of the item.
|
||||
"""
|
||||
value_list: str
|
||||
"""
|
||||
The identifier of the value list this item belongs to.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def create(
|
||||
cls, **params: Unpack["ValueListItemCreateParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Creates a new ValueListItem object, which is added to the specified parent value list.
|
||||
"""
|
||||
return cast(
|
||||
"ValueListItem",
|
||||
cls._static_request(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def create_async(
|
||||
cls, **params: Unpack["ValueListItemCreateParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Creates a new ValueListItem object, which is added to the specified parent value list.
|
||||
"""
|
||||
return cast(
|
||||
"ValueListItem",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _cls_delete(
|
||||
cls, sid: str, **params: Unpack["ValueListItemDeleteParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Deletes a ValueListItem object, removing it from its parent value list.
|
||||
"""
|
||||
url = "%s/%s" % (cls.class_url(), sanitize_id(sid))
|
||||
return cast(
|
||||
"ValueListItem",
|
||||
cls._static_request(
|
||||
"delete",
|
||||
url,
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def delete(
|
||||
sid: str, **params: Unpack["ValueListItemDeleteParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Deletes a ValueListItem object, removing it from its parent value list.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def delete(
|
||||
self, **params: Unpack["ValueListItemDeleteParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Deletes a ValueListItem object, removing it from its parent value list.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_delete")
|
||||
def delete( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["ValueListItemDeleteParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Deletes a ValueListItem object, removing it from its parent value list.
|
||||
"""
|
||||
return self._request_and_refresh(
|
||||
"delete",
|
||||
self.instance_url(),
|
||||
params=params,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_delete_async(
|
||||
cls, sid: str, **params: Unpack["ValueListItemDeleteParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Deletes a ValueListItem object, removing it from its parent value list.
|
||||
"""
|
||||
url = "%s/%s" % (cls.class_url(), sanitize_id(sid))
|
||||
return cast(
|
||||
"ValueListItem",
|
||||
await cls._static_request_async(
|
||||
"delete",
|
||||
url,
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def delete_async(
|
||||
sid: str, **params: Unpack["ValueListItemDeleteParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Deletes a ValueListItem object, removing it from its parent value list.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def delete_async(
|
||||
self, **params: Unpack["ValueListItemDeleteParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Deletes a ValueListItem object, removing it from its parent value list.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_delete_async")
|
||||
async def delete_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["ValueListItemDeleteParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Deletes a ValueListItem object, removing it from its parent value list.
|
||||
"""
|
||||
return await self._request_and_refresh_async(
|
||||
"delete",
|
||||
self.instance_url(),
|
||||
params=params,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["ValueListItemListParams"]
|
||||
) -> ListObject["ValueListItem"]:
|
||||
"""
|
||||
Returns a list of ValueListItem objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
|
||||
"""
|
||||
result = cls._static_request(
|
||||
"get",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
)
|
||||
if not isinstance(result, ListObject):
|
||||
raise TypeError(
|
||||
"Expected list object from API, got %s"
|
||||
% (type(result).__name__)
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
async def list_async(
|
||||
cls, **params: Unpack["ValueListItemListParams"]
|
||||
) -> ListObject["ValueListItem"]:
|
||||
"""
|
||||
Returns a list of ValueListItem objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
|
||||
"""
|
||||
result = await cls._static_request_async(
|
||||
"get",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
)
|
||||
if not isinstance(result, ListObject):
|
||||
raise TypeError(
|
||||
"Expected list object from API, got %s"
|
||||
% (type(result).__name__)
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def retrieve(
|
||||
cls, id: str, **params: Unpack["ValueListItemRetrieveParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Retrieves a ValueListItem object.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["ValueListItemRetrieveParams"]
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Retrieves a ValueListItem object.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
@@ -0,0 +1,189 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# File generated from our OpenAPI spec
|
||||
from stripe._stripe_service import StripeService
|
||||
from stripe._util import sanitize_id
|
||||
from typing import Optional, cast
|
||||
from typing_extensions import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe._list_object import ListObject
|
||||
from stripe._request_options import RequestOptions
|
||||
from stripe.params.radar._value_list_item_create_params import (
|
||||
ValueListItemCreateParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_item_delete_params import (
|
||||
ValueListItemDeleteParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_item_list_params import (
|
||||
ValueListItemListParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_item_retrieve_params import (
|
||||
ValueListItemRetrieveParams,
|
||||
)
|
||||
from stripe.radar._value_list_item import ValueListItem
|
||||
|
||||
|
||||
class ValueListItemService(StripeService):
|
||||
def delete(
|
||||
self,
|
||||
item: str,
|
||||
params: Optional["ValueListItemDeleteParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Deletes a ValueListItem object, removing it from its parent value list.
|
||||
"""
|
||||
return cast(
|
||||
"ValueListItem",
|
||||
self._request(
|
||||
"delete",
|
||||
"/v1/radar/value_list_items/{item}".format(
|
||||
item=sanitize_id(item),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def delete_async(
|
||||
self,
|
||||
item: str,
|
||||
params: Optional["ValueListItemDeleteParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Deletes a ValueListItem object, removing it from its parent value list.
|
||||
"""
|
||||
return cast(
|
||||
"ValueListItem",
|
||||
await self._request_async(
|
||||
"delete",
|
||||
"/v1/radar/value_list_items/{item}".format(
|
||||
item=sanitize_id(item),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
item: str,
|
||||
params: Optional["ValueListItemRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Retrieves a ValueListItem object.
|
||||
"""
|
||||
return cast(
|
||||
"ValueListItem",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/radar/value_list_items/{item}".format(
|
||||
item=sanitize_id(item),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
item: str,
|
||||
params: Optional["ValueListItemRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Retrieves a ValueListItem object.
|
||||
"""
|
||||
return cast(
|
||||
"ValueListItem",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/radar/value_list_items/{item}".format(
|
||||
item=sanitize_id(item),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
params: "ValueListItemListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[ValueListItem]":
|
||||
"""
|
||||
Returns a list of ValueListItem objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[ValueListItem]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/radar/value_list_items",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: "ValueListItemListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[ValueListItem]":
|
||||
"""
|
||||
Returns a list of ValueListItem objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[ValueListItem]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/radar/value_list_items",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def create(
|
||||
self,
|
||||
params: "ValueListItemCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Creates a new ValueListItem object, which is added to the specified parent value list.
|
||||
"""
|
||||
return cast(
|
||||
"ValueListItem",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/radar/value_list_items",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
params: "ValueListItemCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueListItem":
|
||||
"""
|
||||
Creates a new ValueListItem object, which is added to the specified parent value list.
|
||||
"""
|
||||
return cast(
|
||||
"ValueListItem",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/radar/value_list_items",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,234 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# File generated from our OpenAPI spec
|
||||
from stripe._stripe_service import StripeService
|
||||
from stripe._util import sanitize_id
|
||||
from typing import Optional, cast
|
||||
from typing_extensions import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe._list_object import ListObject
|
||||
from stripe._request_options import RequestOptions
|
||||
from stripe.params.radar._value_list_create_params import (
|
||||
ValueListCreateParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_delete_params import (
|
||||
ValueListDeleteParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_list_params import ValueListListParams
|
||||
from stripe.params.radar._value_list_retrieve_params import (
|
||||
ValueListRetrieveParams,
|
||||
)
|
||||
from stripe.params.radar._value_list_update_params import (
|
||||
ValueListUpdateParams,
|
||||
)
|
||||
from stripe.radar._value_list import ValueList
|
||||
|
||||
|
||||
class ValueListService(StripeService):
|
||||
def delete(
|
||||
self,
|
||||
value_list: str,
|
||||
params: Optional["ValueListDeleteParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
|
||||
"""
|
||||
return cast(
|
||||
"ValueList",
|
||||
self._request(
|
||||
"delete",
|
||||
"/v1/radar/value_lists/{value_list}".format(
|
||||
value_list=sanitize_id(value_list),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def delete_async(
|
||||
self,
|
||||
value_list: str,
|
||||
params: Optional["ValueListDeleteParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Deletes a ValueList object, also deleting any items contained within the value list. To be deleted, a value list must not be referenced in any rules.
|
||||
"""
|
||||
return cast(
|
||||
"ValueList",
|
||||
await self._request_async(
|
||||
"delete",
|
||||
"/v1/radar/value_lists/{value_list}".format(
|
||||
value_list=sanitize_id(value_list),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
value_list: str,
|
||||
params: Optional["ValueListRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Retrieves a ValueList object.
|
||||
"""
|
||||
return cast(
|
||||
"ValueList",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/radar/value_lists/{value_list}".format(
|
||||
value_list=sanitize_id(value_list),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
value_list: str,
|
||||
params: Optional["ValueListRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Retrieves a ValueList object.
|
||||
"""
|
||||
return cast(
|
||||
"ValueList",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/radar/value_lists/{value_list}".format(
|
||||
value_list=sanitize_id(value_list),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
value_list: str,
|
||||
params: Optional["ValueListUpdateParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Updates a ValueList object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Note that item_type is immutable.
|
||||
"""
|
||||
return cast(
|
||||
"ValueList",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/radar/value_lists/{value_list}".format(
|
||||
value_list=sanitize_id(value_list),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
value_list: str,
|
||||
params: Optional["ValueListUpdateParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Updates a ValueList object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Note that item_type is immutable.
|
||||
"""
|
||||
return cast(
|
||||
"ValueList",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/radar/value_lists/{value_list}".format(
|
||||
value_list=sanitize_id(value_list),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def list(
|
||||
self,
|
||||
params: Optional["ValueListListParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[ValueList]":
|
||||
"""
|
||||
Returns a list of ValueList objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[ValueList]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/radar/value_lists",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: Optional["ValueListListParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[ValueList]":
|
||||
"""
|
||||
Returns a list of ValueList objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[ValueList]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/radar/value_lists",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def create(
|
||||
self,
|
||||
params: "ValueListCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Creates a new ValueList object, which can then be referenced in rules.
|
||||
"""
|
||||
return cast(
|
||||
"ValueList",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/radar/value_lists",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
params: "ValueListCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ValueList":
|
||||
"""
|
||||
Creates a new ValueList object, which can then be referenced in rules.
|
||||
"""
|
||||
return cast(
|
||||
"ValueList",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/radar/value_lists",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user