Debian Codegraph @

stripe/treasury/_received_credit_service.py

raw
1 # -*- coding: utf-8 -*-
2 # File generated from our OpenAPI spec
3 from stripe._stripe_service import StripeService
4 from stripe._util import sanitize_id
5 from typing import Optional, cast
6 from typing_extensions import TYPE_CHECKING
7
8 if TYPE_CHECKING:
9 from stripe._list_object import ListObject
10 from stripe._request_options import RequestOptions
11 from stripe.params.treasury._received_credit_list_params import (
12 ReceivedCreditListParams,
13 )
14 from stripe.params.treasury._received_credit_retrieve_params import (
15 ReceivedCreditRetrieveParams,
16 )
17 from stripe.treasury._received_credit import ReceivedCredit
18
19
20 class ReceivedCreditService(StripeService):
21 def list(
22 self,
23 params: "ReceivedCreditListParams",
24 options: Optional["RequestOptions"] = None,
25 ) -> "ListObject[ReceivedCredit]":
26 """
27 Returns a list of ReceivedCredits.
28 """
29 return cast(
30 "ListObject[ReceivedCredit]",
31 self._request(
32 "get",
33 "/v1/treasury/received_credits",
34 base_address="api",
35 params=params,
36 options=options,
37 ),
38 )
39
40 async def list_async(
41 self,
42 params: "ReceivedCreditListParams",
43 options: Optional["RequestOptions"] = None,
44 ) -> "ListObject[ReceivedCredit]":
45 """
46 Returns a list of ReceivedCredits.
47 """
48 return cast(
49 "ListObject[ReceivedCredit]",
50 await self._request_async(
51 "get",
52 "/v1/treasury/received_credits",
53 base_address="api",
54 params=params,
55 options=options,
56 ),
57 )
58
59 def retrieve(
60 self,
61 id: str,
62 params: Optional["ReceivedCreditRetrieveParams"] = None,
63 options: Optional["RequestOptions"] = None,
64 ) -> "ReceivedCredit":
65 """
66 Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list.
67 """
68 return cast(
69 "ReceivedCredit",
70 self._request(
71 "get",
72 "/v1/treasury/received_credits/{id}".format(
73 id=sanitize_id(id)
74 ),
75 base_address="api",
76 params=params,
77 options=options,
78 ),
79 )
80
81 async def retrieve_async(
82 self,
83 id: str,
84 params: Optional["ReceivedCreditRetrieveParams"] = None,
85 options: Optional["RequestOptions"] = None,
86 ) -> "ReceivedCredit":
87 """
88 Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list.
89 """
90 return cast(
91 "ReceivedCredit",
92 await self._request_async(
93 "get",
94 "/v1/treasury/received_credits/{id}".format(
95 id=sanitize_id(id)
96 ),
97 base_address="api",
98 params=params,
99 options=options,
100 ),
101 )