| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._list_object import ListObject |
| 4 |
from stripe._listable_api_resource import ListableAPIResource |
| 5 |
from stripe._stripe_object import StripeObject |
| 6 |
from typing import ClassVar, List, Optional |
| 7 |
from typing_extensions import Literal, Unpack, TYPE_CHECKING |
| 8 |
|
| 9 |
if TYPE_CHECKING: |
| 10 |
from stripe.params.climate._supplier_list_params import SupplierListParams |
| 11 |
from stripe.params.climate._supplier_retrieve_params import ( |
| 12 |
SupplierRetrieveParams, |
| 13 |
) |
| 14 |
|
| 15 |
|
| 16 |
class Supplier(ListableAPIResource["Supplier"]): |
| 17 |
""" |
| 18 |
A supplier of carbon removal. |
| 19 |
""" |
| 20 |
|
| 21 |
OBJECT_NAME: ClassVar[Literal["climate.supplier"]] = "climate.supplier" |
| 22 |
|
| 23 |
class Location(StripeObject): |
| 24 |
city: Optional[str] |
| 25 |
""" |
| 26 |
The city where the supplier is located. |
| 27 |
""" |
| 28 |
country: str |
| 29 |
""" |
| 30 |
Two-letter ISO code representing the country where the supplier is located. |
| 31 |
""" |
| 32 |
latitude: Optional[float] |
| 33 |
""" |
| 34 |
The geographic latitude where the supplier is located. |
| 35 |
""" |
| 36 |
longitude: Optional[float] |
| 37 |
""" |
| 38 |
The geographic longitude where the supplier is located. |
| 39 |
""" |
| 40 |
region: Optional[str] |
| 41 |
""" |
| 42 |
The state/county/province/region where the supplier is located. |
| 43 |
""" |
| 44 |
|
| 45 |
id: str |
| 46 |
""" |
| 47 |
Unique identifier for the object. |
| 48 |
""" |
| 49 |
info_url: str |
| 50 |
""" |
| 51 |
Link to a webpage to learn more about the supplier. |
| 52 |
""" |
| 53 |
livemode: bool |
| 54 |
""" |
| 55 |
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. |
| 56 |
""" |
| 57 |
locations: List[Location] |
| 58 |
""" |
| 59 |
The locations in which this supplier operates. |
| 60 |
""" |
| 61 |
name: str |
| 62 |
""" |
| 63 |
Name of this carbon removal supplier. |
| 64 |
""" |
| 65 |
object: Literal["climate.supplier"] |
| 66 |
""" |
| 67 |
String representing the object's type. Objects of the same type share the same value. |
| 68 |
""" |
| 69 |
removal_pathway: Literal[ |
| 70 |
"biomass_carbon_removal_and_storage", |
| 71 |
"direct_air_capture", |
| 72 |
"enhanced_weathering", |
| 73 |
] |
| 74 |
""" |
| 75 |
The scientific pathway used for carbon removal. |
| 76 |
""" |
| 77 |
|
| 78 |
@classmethod |
| 79 |
def list( |
| 80 |
cls, **params: Unpack["SupplierListParams"] |
| 81 |
) -> ListObject["Supplier"]: |
| 82 |
""" |
| 83 |
Lists all available Climate supplier objects. |
| 84 |
""" |
| 85 |
result = cls._static_request( |
| 86 |
"get", |
| 87 |
cls.class_url(), |
| 88 |
params=params, |
| 89 |
) |
| 90 |
if not isinstance(result, ListObject): |
| 91 |
raise TypeError( |
| 92 |
"Expected list object from API, got %s" |
| 93 |
% (type(result).__name__) |
| 94 |
) |
| 95 |
|
| 96 |
return result |
| 97 |
|
| 98 |
@classmethod |
| 99 |
async def list_async( |
| 100 |
cls, **params: Unpack["SupplierListParams"] |
| 101 |
) -> ListObject["Supplier"]: |
| 102 |
""" |
| 103 |
Lists all available Climate supplier objects. |
| 104 |
""" |
| 105 |
result = await cls._static_request_async( |
| 106 |
"get", |
| 107 |
cls.class_url(), |
| 108 |
params=params, |
| 109 |
) |
| 110 |
if not isinstance(result, ListObject): |
| 111 |
raise TypeError( |
| 112 |
"Expected list object from API, got %s" |
| 113 |
% (type(result).__name__) |
| 114 |
) |
| 115 |
|
| 116 |
return result |
| 117 |
|
| 118 |
@classmethod |
| 119 |
def retrieve( |
| 120 |
cls, id: str, **params: Unpack["SupplierRetrieveParams"] |
| 121 |
) -> "Supplier": |
| 122 |
""" |
| 123 |
Retrieves a Climate supplier object. |
| 124 |
""" |
| 125 |
instance = cls(id, **params) |
| 126 |
instance.refresh() |
| 127 |
return instance |
| 128 |
|
| 129 |
@classmethod |
| 130 |
async def retrieve_async( |
| 131 |
cls, id: str, **params: Unpack["SupplierRetrieveParams"] |
| 132 |
) -> "Supplier": |
| 133 |
""" |
| 134 |
Retrieves a Climate supplier object. |
| 135 |
""" |
| 136 |
instance = cls(id, **params) |
| 137 |
await instance.refresh_async() |
| 138 |
return instance |
| 139 |
|
| 140 |
_inner_class_types = {"locations": Location} |