airbyte-agent-stripe 0.5.28__py3-none-any.whl → 0.5.37__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.
- airbyte_agent_stripe/__init__.py +103 -83
- airbyte_agent_stripe/_vendored/connector_sdk/connector_model_loader.py +10 -2
- airbyte_agent_stripe/_vendored/connector_sdk/constants.py +1 -1
- airbyte_agent_stripe/_vendored/connector_sdk/executor/local_executor.py +54 -4
- airbyte_agent_stripe/_vendored/connector_sdk/extensions.py +42 -3
- airbyte_agent_stripe/_vendored/connector_sdk/introspection.py +262 -0
- airbyte_agent_stripe/_vendored/connector_sdk/observability/config.py +179 -0
- airbyte_agent_stripe/_vendored/connector_sdk/observability/session.py +35 -28
- airbyte_agent_stripe/_vendored/connector_sdk/schema/components.py +2 -1
- airbyte_agent_stripe/_vendored/connector_sdk/schema/operations.py +1 -1
- airbyte_agent_stripe/_vendored/connector_sdk/schema/security.py +10 -0
- airbyte_agent_stripe/_vendored/connector_sdk/telemetry/events.py +2 -1
- airbyte_agent_stripe/_vendored/connector_sdk/telemetry/tracker.py +3 -0
- airbyte_agent_stripe/_vendored/connector_sdk/types.py +5 -1
- airbyte_agent_stripe/connector.py +379 -61
- airbyte_agent_stripe/connector_model.py +3444 -692
- airbyte_agent_stripe/models.py +926 -766
- airbyte_agent_stripe/types.py +41 -13
- {airbyte_agent_stripe-0.5.28.dist-info → airbyte_agent_stripe-0.5.37.dist-info}/METADATA +12 -16
- {airbyte_agent_stripe-0.5.28.dist-info → airbyte_agent_stripe-0.5.37.dist-info}/RECORD +21 -19
- {airbyte_agent_stripe-0.5.28.dist-info → airbyte_agent_stripe-0.5.37.dist-info}/WHEEL +0 -0
|
@@ -4,58 +4,65 @@ stripe connector.
|
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import logging
|
|
8
|
+
from typing import TYPE_CHECKING, Any, Callable, TypeVar, overload
|
|
8
9
|
try:
|
|
9
10
|
from typing import Literal
|
|
10
11
|
except ImportError:
|
|
11
12
|
from typing_extensions import Literal
|
|
12
13
|
|
|
13
14
|
from .connector_model import StripeConnectorModel
|
|
14
|
-
|
|
15
|
+
from ._vendored.connector_sdk.introspection import describe_entities, generate_tool_description
|
|
15
16
|
from .types import (
|
|
16
17
|
BalanceGetParams,
|
|
17
18
|
BalanceTransactionsGetParams,
|
|
18
19
|
BalanceTransactionsListParams,
|
|
19
20
|
BalanceTransactionsListParamsCreated,
|
|
21
|
+
ChargesApiSearchParams,
|
|
20
22
|
ChargesGetParams,
|
|
21
23
|
ChargesListParams,
|
|
22
24
|
ChargesListParamsCreated,
|
|
23
|
-
|
|
25
|
+
CustomersApiSearchParams,
|
|
26
|
+
CustomersCreateParams,
|
|
27
|
+
CustomersDeleteParams,
|
|
24
28
|
CustomersGetParams,
|
|
25
29
|
CustomersListParams,
|
|
26
30
|
CustomersListParamsCreated,
|
|
27
|
-
|
|
31
|
+
CustomersUpdateParams,
|
|
28
32
|
DisputesGetParams,
|
|
29
33
|
DisputesListParams,
|
|
30
34
|
DisputesListParamsCreated,
|
|
35
|
+
InvoicesApiSearchParams,
|
|
31
36
|
InvoicesGetParams,
|
|
32
37
|
InvoicesListParams,
|
|
33
38
|
InvoicesListParamsCreated,
|
|
34
|
-
|
|
39
|
+
PaymentIntentsApiSearchParams,
|
|
35
40
|
PaymentIntentsGetParams,
|
|
36
41
|
PaymentIntentsListParams,
|
|
37
42
|
PaymentIntentsListParamsCreated,
|
|
38
|
-
PaymentIntentsSearchParams,
|
|
39
43
|
PayoutsGetParams,
|
|
40
44
|
PayoutsListParams,
|
|
41
45
|
PayoutsListParamsArrivalDate,
|
|
42
46
|
PayoutsListParamsCreated,
|
|
47
|
+
ProductsApiSearchParams,
|
|
48
|
+
ProductsCreateParams,
|
|
49
|
+
ProductsDeleteParams,
|
|
43
50
|
ProductsGetParams,
|
|
44
51
|
ProductsListParams,
|
|
45
52
|
ProductsListParamsCreated,
|
|
46
|
-
|
|
53
|
+
ProductsUpdateParams,
|
|
54
|
+
RefundsCreateParams,
|
|
47
55
|
RefundsGetParams,
|
|
48
56
|
RefundsListParams,
|
|
49
57
|
RefundsListParamsCreated,
|
|
58
|
+
SubscriptionsApiSearchParams,
|
|
50
59
|
SubscriptionsGetParams,
|
|
51
60
|
SubscriptionsListParams,
|
|
52
61
|
SubscriptionsListParamsAutomaticTax,
|
|
53
62
|
SubscriptionsListParamsCreated,
|
|
54
63
|
SubscriptionsListParamsCurrentPeriodEnd,
|
|
55
64
|
SubscriptionsListParamsCurrentPeriodStart,
|
|
56
|
-
SubscriptionsSearchParams,
|
|
57
65
|
)
|
|
58
|
-
|
|
59
66
|
if TYPE_CHECKING:
|
|
60
67
|
from .models import StripeAuthConfig
|
|
61
68
|
# Import response models and envelope models at runtime
|
|
@@ -63,16 +70,16 @@ from .models import (
|
|
|
63
70
|
StripeExecuteResult,
|
|
64
71
|
StripeExecuteResultWithMeta,
|
|
65
72
|
CustomersListResult,
|
|
66
|
-
|
|
73
|
+
CustomersApiSearchResult,
|
|
67
74
|
InvoicesListResult,
|
|
68
75
|
ChargesListResult,
|
|
69
76
|
SubscriptionsListResult,
|
|
70
77
|
RefundsListResult,
|
|
71
78
|
ProductsListResult,
|
|
72
|
-
|
|
79
|
+
ProductsApiSearchResult,
|
|
73
80
|
BalanceTransactionsListResult,
|
|
74
81
|
PaymentIntentsListResult,
|
|
75
|
-
|
|
82
|
+
PaymentIntentsApiSearchResult,
|
|
76
83
|
DisputesListResult,
|
|
77
84
|
PayoutsListResult,
|
|
78
85
|
Balance,
|
|
@@ -80,17 +87,22 @@ from .models import (
|
|
|
80
87
|
Charge,
|
|
81
88
|
ChargeSearchResult,
|
|
82
89
|
Customer,
|
|
90
|
+
CustomerDeletedResponse,
|
|
83
91
|
Dispute,
|
|
84
92
|
Invoice,
|
|
85
93
|
InvoiceSearchResult,
|
|
86
94
|
PaymentIntent,
|
|
87
95
|
Payout,
|
|
88
96
|
Product,
|
|
97
|
+
ProductDeletedResponse,
|
|
89
98
|
Refund,
|
|
90
99
|
Subscription,
|
|
91
100
|
SubscriptionSearchResult,
|
|
92
101
|
)
|
|
93
102
|
|
|
103
|
+
# TypeVar for decorator type preservation
|
|
104
|
+
_F = TypeVar("_F", bound=Callable[..., Any])
|
|
105
|
+
|
|
94
106
|
|
|
95
107
|
class StripeConnector:
|
|
96
108
|
"""
|
|
@@ -100,34 +112,41 @@ class StripeConnector:
|
|
|
100
112
|
"""
|
|
101
113
|
|
|
102
114
|
connector_name = "stripe"
|
|
103
|
-
connector_version = "0.1.
|
|
115
|
+
connector_version = "0.1.4"
|
|
104
116
|
vendored_sdk_version = "0.1.0" # Version of vendored connector-sdk
|
|
105
117
|
|
|
106
118
|
# Map of (entity, action) -> has_extractors for envelope wrapping decision
|
|
107
119
|
_EXTRACTOR_MAP = {
|
|
108
120
|
("customers", "list"): True,
|
|
121
|
+
("customers", "create"): False,
|
|
109
122
|
("customers", "get"): False,
|
|
110
|
-
("customers", "
|
|
123
|
+
("customers", "update"): False,
|
|
124
|
+
("customers", "delete"): False,
|
|
125
|
+
("customers", "api_search"): True,
|
|
111
126
|
("invoices", "list"): True,
|
|
112
127
|
("invoices", "get"): False,
|
|
113
|
-
("invoices", "
|
|
128
|
+
("invoices", "api_search"): False,
|
|
114
129
|
("charges", "list"): True,
|
|
115
130
|
("charges", "get"): False,
|
|
116
|
-
("charges", "
|
|
131
|
+
("charges", "api_search"): False,
|
|
117
132
|
("subscriptions", "list"): True,
|
|
118
133
|
("subscriptions", "get"): False,
|
|
119
|
-
("subscriptions", "
|
|
134
|
+
("subscriptions", "api_search"): False,
|
|
120
135
|
("refunds", "list"): True,
|
|
136
|
+
("refunds", "create"): False,
|
|
121
137
|
("refunds", "get"): False,
|
|
122
138
|
("products", "list"): True,
|
|
139
|
+
("products", "create"): False,
|
|
123
140
|
("products", "get"): False,
|
|
124
|
-
("products", "
|
|
141
|
+
("products", "update"): False,
|
|
142
|
+
("products", "delete"): False,
|
|
143
|
+
("products", "api_search"): True,
|
|
125
144
|
("balance", "get"): False,
|
|
126
145
|
("balance_transactions", "list"): True,
|
|
127
146
|
("balance_transactions", "get"): False,
|
|
128
147
|
("payment_intents", "list"): True,
|
|
129
148
|
("payment_intents", "get"): False,
|
|
130
|
-
("payment_intents", "
|
|
149
|
+
("payment_intents", "api_search"): True,
|
|
131
150
|
("disputes", "list"): True,
|
|
132
151
|
("disputes", "get"): False,
|
|
133
152
|
("payouts", "list"): True,
|
|
@@ -139,26 +158,30 @@ class StripeConnector:
|
|
|
139
158
|
_PARAM_MAP = {
|
|
140
159
|
('customers', 'list'): {'limit': 'limit', 'starting_after': 'starting_after', 'ending_before': 'ending_before', 'email': 'email', 'created': 'created'},
|
|
141
160
|
('customers', 'get'): {'id': 'id'},
|
|
142
|
-
('customers', '
|
|
161
|
+
('customers', 'update'): {'id': 'id'},
|
|
162
|
+
('customers', 'delete'): {'id': 'id'},
|
|
163
|
+
('customers', 'api_search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
143
164
|
('invoices', 'list'): {'collection_method': 'collection_method', 'created': 'created', 'customer': 'customer', 'customer_account': 'customer_account', 'ending_before': 'ending_before', 'limit': 'limit', 'starting_after': 'starting_after', 'status': 'status', 'subscription': 'subscription'},
|
|
144
165
|
('invoices', 'get'): {'id': 'id'},
|
|
145
|
-
('invoices', '
|
|
166
|
+
('invoices', 'api_search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
146
167
|
('charges', 'list'): {'created': 'created', 'customer': 'customer', 'ending_before': 'ending_before', 'limit': 'limit', 'payment_intent': 'payment_intent', 'starting_after': 'starting_after'},
|
|
147
168
|
('charges', 'get'): {'id': 'id'},
|
|
148
|
-
('charges', '
|
|
169
|
+
('charges', 'api_search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
149
170
|
('subscriptions', 'list'): {'automatic_tax': 'automatic_tax', 'collection_method': 'collection_method', 'created': 'created', 'current_period_end': 'current_period_end', 'current_period_start': 'current_period_start', 'customer': 'customer', 'customer_account': 'customer_account', 'ending_before': 'ending_before', 'limit': 'limit', 'price': 'price', 'starting_after': 'starting_after', 'status': 'status'},
|
|
150
171
|
('subscriptions', 'get'): {'id': 'id'},
|
|
151
|
-
('subscriptions', '
|
|
172
|
+
('subscriptions', 'api_search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
152
173
|
('refunds', 'list'): {'charge': 'charge', 'created': 'created', 'ending_before': 'ending_before', 'limit': 'limit', 'payment_intent': 'payment_intent', 'starting_after': 'starting_after'},
|
|
153
174
|
('refunds', 'get'): {'id': 'id'},
|
|
154
175
|
('products', 'list'): {'active': 'active', 'created': 'created', 'ending_before': 'ending_before', 'ids': 'ids', 'limit': 'limit', 'shippable': 'shippable', 'starting_after': 'starting_after', 'url': 'url'},
|
|
155
176
|
('products', 'get'): {'id': 'id'},
|
|
156
|
-
('products', '
|
|
177
|
+
('products', 'update'): {'id': 'id'},
|
|
178
|
+
('products', 'delete'): {'id': 'id'},
|
|
179
|
+
('products', 'api_search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
157
180
|
('balance_transactions', 'list'): {'created': 'created', 'currency': 'currency', 'ending_before': 'ending_before', 'limit': 'limit', 'payout': 'payout', 'source': 'source', 'starting_after': 'starting_after', 'type': 'type'},
|
|
158
181
|
('balance_transactions', 'get'): {'id': 'id'},
|
|
159
182
|
('payment_intents', 'list'): {'created': 'created', 'customer': 'customer', 'customer_account': 'customer_account', 'ending_before': 'ending_before', 'limit': 'limit', 'starting_after': 'starting_after'},
|
|
160
183
|
('payment_intents', 'get'): {'id': 'id'},
|
|
161
|
-
('payment_intents', '
|
|
184
|
+
('payment_intents', 'api_search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
162
185
|
('disputes', 'list'): {'charge': 'charge', 'created': 'created', 'ending_before': 'ending_before', 'limit': 'limit', 'payment_intent': 'payment_intent', 'starting_after': 'starting_after'},
|
|
163
186
|
('disputes', 'get'): {'id': 'id'},
|
|
164
187
|
('payouts', 'list'): {'arrival_date': 'arrival_date', 'created': 'created', 'destination': 'destination', 'ending_before': 'ending_before', 'limit': 'limit', 'starting_after': 'starting_after', 'status': 'status'},
|
|
@@ -262,6 +285,14 @@ class StripeConnector:
|
|
|
262
285
|
params: "CustomersListParams"
|
|
263
286
|
) -> "CustomersListResult": ...
|
|
264
287
|
|
|
288
|
+
@overload
|
|
289
|
+
async def execute(
|
|
290
|
+
self,
|
|
291
|
+
entity: Literal["customers"],
|
|
292
|
+
action: Literal["create"],
|
|
293
|
+
params: "CustomersCreateParams"
|
|
294
|
+
) -> "Customer": ...
|
|
295
|
+
|
|
265
296
|
@overload
|
|
266
297
|
async def execute(
|
|
267
298
|
self,
|
|
@@ -274,9 +305,25 @@ class StripeConnector:
|
|
|
274
305
|
async def execute(
|
|
275
306
|
self,
|
|
276
307
|
entity: Literal["customers"],
|
|
277
|
-
action: Literal["
|
|
278
|
-
params: "
|
|
279
|
-
) -> "
|
|
308
|
+
action: Literal["update"],
|
|
309
|
+
params: "CustomersUpdateParams"
|
|
310
|
+
) -> "Customer": ...
|
|
311
|
+
|
|
312
|
+
@overload
|
|
313
|
+
async def execute(
|
|
314
|
+
self,
|
|
315
|
+
entity: Literal["customers"],
|
|
316
|
+
action: Literal["delete"],
|
|
317
|
+
params: "CustomersDeleteParams"
|
|
318
|
+
) -> "CustomerDeletedResponse": ...
|
|
319
|
+
|
|
320
|
+
@overload
|
|
321
|
+
async def execute(
|
|
322
|
+
self,
|
|
323
|
+
entity: Literal["customers"],
|
|
324
|
+
action: Literal["api_search"],
|
|
325
|
+
params: "CustomersApiSearchParams"
|
|
326
|
+
) -> "CustomersApiSearchResult": ...
|
|
280
327
|
|
|
281
328
|
@overload
|
|
282
329
|
async def execute(
|
|
@@ -298,8 +345,8 @@ class StripeConnector:
|
|
|
298
345
|
async def execute(
|
|
299
346
|
self,
|
|
300
347
|
entity: Literal["invoices"],
|
|
301
|
-
action: Literal["
|
|
302
|
-
params: "
|
|
348
|
+
action: Literal["api_search"],
|
|
349
|
+
params: "InvoicesApiSearchParams"
|
|
303
350
|
) -> "InvoiceSearchResult": ...
|
|
304
351
|
|
|
305
352
|
@overload
|
|
@@ -322,8 +369,8 @@ class StripeConnector:
|
|
|
322
369
|
async def execute(
|
|
323
370
|
self,
|
|
324
371
|
entity: Literal["charges"],
|
|
325
|
-
action: Literal["
|
|
326
|
-
params: "
|
|
372
|
+
action: Literal["api_search"],
|
|
373
|
+
params: "ChargesApiSearchParams"
|
|
327
374
|
) -> "ChargeSearchResult": ...
|
|
328
375
|
|
|
329
376
|
@overload
|
|
@@ -346,8 +393,8 @@ class StripeConnector:
|
|
|
346
393
|
async def execute(
|
|
347
394
|
self,
|
|
348
395
|
entity: Literal["subscriptions"],
|
|
349
|
-
action: Literal["
|
|
350
|
-
params: "
|
|
396
|
+
action: Literal["api_search"],
|
|
397
|
+
params: "SubscriptionsApiSearchParams"
|
|
351
398
|
) -> "SubscriptionSearchResult": ...
|
|
352
399
|
|
|
353
400
|
@overload
|
|
@@ -358,6 +405,14 @@ class StripeConnector:
|
|
|
358
405
|
params: "RefundsListParams"
|
|
359
406
|
) -> "RefundsListResult": ...
|
|
360
407
|
|
|
408
|
+
@overload
|
|
409
|
+
async def execute(
|
|
410
|
+
self,
|
|
411
|
+
entity: Literal["refunds"],
|
|
412
|
+
action: Literal["create"],
|
|
413
|
+
params: "RefundsCreateParams"
|
|
414
|
+
) -> "Refund": ...
|
|
415
|
+
|
|
361
416
|
@overload
|
|
362
417
|
async def execute(
|
|
363
418
|
self,
|
|
@@ -374,6 +429,14 @@ class StripeConnector:
|
|
|
374
429
|
params: "ProductsListParams"
|
|
375
430
|
) -> "ProductsListResult": ...
|
|
376
431
|
|
|
432
|
+
@overload
|
|
433
|
+
async def execute(
|
|
434
|
+
self,
|
|
435
|
+
entity: Literal["products"],
|
|
436
|
+
action: Literal["create"],
|
|
437
|
+
params: "ProductsCreateParams"
|
|
438
|
+
) -> "Product": ...
|
|
439
|
+
|
|
377
440
|
@overload
|
|
378
441
|
async def execute(
|
|
379
442
|
self,
|
|
@@ -386,9 +449,25 @@ class StripeConnector:
|
|
|
386
449
|
async def execute(
|
|
387
450
|
self,
|
|
388
451
|
entity: Literal["products"],
|
|
389
|
-
action: Literal["
|
|
390
|
-
params: "
|
|
391
|
-
) -> "
|
|
452
|
+
action: Literal["update"],
|
|
453
|
+
params: "ProductsUpdateParams"
|
|
454
|
+
) -> "Product": ...
|
|
455
|
+
|
|
456
|
+
@overload
|
|
457
|
+
async def execute(
|
|
458
|
+
self,
|
|
459
|
+
entity: Literal["products"],
|
|
460
|
+
action: Literal["delete"],
|
|
461
|
+
params: "ProductsDeleteParams"
|
|
462
|
+
) -> "ProductDeletedResponse": ...
|
|
463
|
+
|
|
464
|
+
@overload
|
|
465
|
+
async def execute(
|
|
466
|
+
self,
|
|
467
|
+
entity: Literal["products"],
|
|
468
|
+
action: Literal["api_search"],
|
|
469
|
+
params: "ProductsApiSearchParams"
|
|
470
|
+
) -> "ProductsApiSearchResult": ...
|
|
392
471
|
|
|
393
472
|
@overload
|
|
394
473
|
async def execute(
|
|
@@ -434,9 +513,9 @@ class StripeConnector:
|
|
|
434
513
|
async def execute(
|
|
435
514
|
self,
|
|
436
515
|
entity: Literal["payment_intents"],
|
|
437
|
-
action: Literal["
|
|
438
|
-
params: "
|
|
439
|
-
) -> "
|
|
516
|
+
action: Literal["api_search"],
|
|
517
|
+
params: "PaymentIntentsApiSearchParams"
|
|
518
|
+
) -> "PaymentIntentsApiSearchResult": ...
|
|
440
519
|
|
|
441
520
|
@overload
|
|
442
521
|
async def execute(
|
|
@@ -544,6 +623,88 @@ class StripeConnector:
|
|
|
544
623
|
# No extractors - return raw response data
|
|
545
624
|
return result.data
|
|
546
625
|
|
|
626
|
+
# ===== INTROSPECTION METHODS =====
|
|
627
|
+
|
|
628
|
+
@classmethod
|
|
629
|
+
def describe(cls, func: _F) -> _F:
|
|
630
|
+
"""
|
|
631
|
+
Decorator that populates a function's docstring with connector capabilities.
|
|
632
|
+
|
|
633
|
+
This class method can be used as a decorator to automatically generate
|
|
634
|
+
comprehensive documentation for AI tool functions.
|
|
635
|
+
|
|
636
|
+
Usage:
|
|
637
|
+
@mcp.tool()
|
|
638
|
+
@StripeConnector.describe
|
|
639
|
+
async def execute(entity: str, action: str, params: dict):
|
|
640
|
+
'''Execute operations.'''
|
|
641
|
+
...
|
|
642
|
+
|
|
643
|
+
The decorated function's __doc__ will be updated with:
|
|
644
|
+
- Available entities and their actions
|
|
645
|
+
- Parameter signatures with required (*) and optional (?) markers
|
|
646
|
+
- Response structure documentation
|
|
647
|
+
- Example questions (if available in OpenAPI spec)
|
|
648
|
+
|
|
649
|
+
Args:
|
|
650
|
+
func: The function to decorate
|
|
651
|
+
|
|
652
|
+
Returns:
|
|
653
|
+
The same function with updated __doc__
|
|
654
|
+
"""
|
|
655
|
+
description = generate_tool_description(StripeConnectorModel)
|
|
656
|
+
|
|
657
|
+
original_doc = func.__doc__ or ""
|
|
658
|
+
if original_doc.strip():
|
|
659
|
+
func.__doc__ = f"{original_doc.strip()}\n\n{description}"
|
|
660
|
+
else:
|
|
661
|
+
func.__doc__ = description
|
|
662
|
+
|
|
663
|
+
return func
|
|
664
|
+
|
|
665
|
+
def list_entities(self) -> list[dict[str, Any]]:
|
|
666
|
+
"""
|
|
667
|
+
Get structured data about available entities, actions, and parameters.
|
|
668
|
+
|
|
669
|
+
Returns a list of entity descriptions with:
|
|
670
|
+
- entity_name: Name of the entity (e.g., "contacts", "deals")
|
|
671
|
+
- description: Entity description from the first endpoint
|
|
672
|
+
- available_actions: List of actions (e.g., ["list", "get", "create"])
|
|
673
|
+
- parameters: Dict mapping action -> list of parameter dicts
|
|
674
|
+
|
|
675
|
+
Example:
|
|
676
|
+
entities = connector.list_entities()
|
|
677
|
+
for entity in entities:
|
|
678
|
+
print(f"{entity['entity_name']}: {entity['available_actions']}")
|
|
679
|
+
"""
|
|
680
|
+
return describe_entities(StripeConnectorModel)
|
|
681
|
+
|
|
682
|
+
def entity_schema(self, entity: str) -> dict[str, Any] | None:
|
|
683
|
+
"""
|
|
684
|
+
Get the JSON schema for an entity.
|
|
685
|
+
|
|
686
|
+
Args:
|
|
687
|
+
entity: Entity name (e.g., "contacts", "companies")
|
|
688
|
+
|
|
689
|
+
Returns:
|
|
690
|
+
JSON schema dict describing the entity structure, or None if not found.
|
|
691
|
+
|
|
692
|
+
Example:
|
|
693
|
+
schema = connector.entity_schema("contacts")
|
|
694
|
+
if schema:
|
|
695
|
+
print(f"Contact properties: {list(schema.get('properties', {}).keys())}")
|
|
696
|
+
"""
|
|
697
|
+
entity_def = next(
|
|
698
|
+
(e for e in StripeConnectorModel.entities if e.name == entity),
|
|
699
|
+
None
|
|
700
|
+
)
|
|
701
|
+
if entity_def is None:
|
|
702
|
+
logging.getLogger(__name__).warning(
|
|
703
|
+
f"Entity '{entity}' not found. Available entities: "
|
|
704
|
+
f"{[e.name for e in StripeConnectorModel.entities]}"
|
|
705
|
+
)
|
|
706
|
+
return entity_def.entity_schema if entity_def else None
|
|
707
|
+
|
|
547
708
|
|
|
548
709
|
|
|
549
710
|
class CustomersQuery:
|
|
@@ -595,6 +756,25 @@ class CustomersQuery:
|
|
|
595
756
|
|
|
596
757
|
|
|
597
758
|
|
|
759
|
+
async def create(
|
|
760
|
+
self,
|
|
761
|
+
**kwargs
|
|
762
|
+
) -> Customer:
|
|
763
|
+
"""
|
|
764
|
+
Creates a new customer object.
|
|
765
|
+
|
|
766
|
+
Returns:
|
|
767
|
+
Customer
|
|
768
|
+
"""
|
|
769
|
+
params = {k: v for k, v in {
|
|
770
|
+
**kwargs
|
|
771
|
+
}.items() if v is not None}
|
|
772
|
+
|
|
773
|
+
result = await self._connector.execute("customers", "create", params)
|
|
774
|
+
return result
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
|
|
598
778
|
async def get(
|
|
599
779
|
self,
|
|
600
780
|
id: str | None = None,
|
|
@@ -620,13 +800,63 @@ class CustomersQuery:
|
|
|
620
800
|
|
|
621
801
|
|
|
622
802
|
|
|
623
|
-
async def
|
|
803
|
+
async def update(
|
|
804
|
+
self,
|
|
805
|
+
id: str | None = None,
|
|
806
|
+
**kwargs
|
|
807
|
+
) -> Customer:
|
|
808
|
+
"""
|
|
809
|
+
Updates the specified customer by setting the values of the parameters passed.
|
|
810
|
+
|
|
811
|
+
Args:
|
|
812
|
+
id: The customer ID
|
|
813
|
+
**kwargs: Additional parameters
|
|
814
|
+
|
|
815
|
+
Returns:
|
|
816
|
+
Customer
|
|
817
|
+
"""
|
|
818
|
+
params = {k: v for k, v in {
|
|
819
|
+
"id": id,
|
|
820
|
+
**kwargs
|
|
821
|
+
}.items() if v is not None}
|
|
822
|
+
|
|
823
|
+
result = await self._connector.execute("customers", "update", params)
|
|
824
|
+
return result
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
async def delete(
|
|
829
|
+
self,
|
|
830
|
+
id: str | None = None,
|
|
831
|
+
**kwargs
|
|
832
|
+
) -> CustomerDeletedResponse:
|
|
833
|
+
"""
|
|
834
|
+
Permanently deletes a customer. It cannot be undone.
|
|
835
|
+
|
|
836
|
+
Args:
|
|
837
|
+
id: The customer ID
|
|
838
|
+
**kwargs: Additional parameters
|
|
839
|
+
|
|
840
|
+
Returns:
|
|
841
|
+
CustomerDeletedResponse
|
|
842
|
+
"""
|
|
843
|
+
params = {k: v for k, v in {
|
|
844
|
+
"id": id,
|
|
845
|
+
**kwargs
|
|
846
|
+
}.items() if v is not None}
|
|
847
|
+
|
|
848
|
+
result = await self._connector.execute("customers", "delete", params)
|
|
849
|
+
return result
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
async def api_search(
|
|
624
854
|
self,
|
|
625
855
|
query: str,
|
|
626
856
|
limit: int | None = None,
|
|
627
857
|
page: str | None = None,
|
|
628
858
|
**kwargs
|
|
629
|
-
) ->
|
|
859
|
+
) -> CustomersApiSearchResult:
|
|
630
860
|
"""
|
|
631
861
|
Search for customers using Stripe's Search Query Language.
|
|
632
862
|
|
|
@@ -637,7 +867,7 @@ class CustomersQuery:
|
|
|
637
867
|
**kwargs: Additional parameters
|
|
638
868
|
|
|
639
869
|
Returns:
|
|
640
|
-
|
|
870
|
+
CustomersApiSearchResult
|
|
641
871
|
"""
|
|
642
872
|
params = {k: v for k, v in {
|
|
643
873
|
"query": query,
|
|
@@ -646,9 +876,9 @@ class CustomersQuery:
|
|
|
646
876
|
**kwargs
|
|
647
877
|
}.items() if v is not None}
|
|
648
878
|
|
|
649
|
-
result = await self._connector.execute("customers", "
|
|
879
|
+
result = await self._connector.execute("customers", "api_search", params)
|
|
650
880
|
# Cast generic envelope to concrete typed result
|
|
651
|
-
return
|
|
881
|
+
return CustomersApiSearchResult(
|
|
652
882
|
data=result.data,
|
|
653
883
|
meta=result.meta )
|
|
654
884
|
|
|
@@ -740,7 +970,7 @@ class InvoicesQuery:
|
|
|
740
970
|
|
|
741
971
|
|
|
742
972
|
|
|
743
|
-
async def
|
|
973
|
+
async def api_search(
|
|
744
974
|
self,
|
|
745
975
|
query: str,
|
|
746
976
|
limit: int | None = None,
|
|
@@ -766,7 +996,7 @@ class InvoicesQuery:
|
|
|
766
996
|
**kwargs
|
|
767
997
|
}.items() if v is not None}
|
|
768
998
|
|
|
769
|
-
result = await self._connector.execute("invoices", "
|
|
999
|
+
result = await self._connector.execute("invoices", "api_search", params)
|
|
770
1000
|
return result
|
|
771
1001
|
|
|
772
1002
|
|
|
@@ -848,7 +1078,7 @@ class ChargesQuery:
|
|
|
848
1078
|
|
|
849
1079
|
|
|
850
1080
|
|
|
851
|
-
async def
|
|
1081
|
+
async def api_search(
|
|
852
1082
|
self,
|
|
853
1083
|
query: str,
|
|
854
1084
|
limit: int | None = None,
|
|
@@ -874,7 +1104,7 @@ class ChargesQuery:
|
|
|
874
1104
|
**kwargs
|
|
875
1105
|
}.items() if v is not None}
|
|
876
1106
|
|
|
877
|
-
result = await self._connector.execute("charges", "
|
|
1107
|
+
result = await self._connector.execute("charges", "api_search", params)
|
|
878
1108
|
return result
|
|
879
1109
|
|
|
880
1110
|
|
|
@@ -974,7 +1204,7 @@ class SubscriptionsQuery:
|
|
|
974
1204
|
|
|
975
1205
|
|
|
976
1206
|
|
|
977
|
-
async def
|
|
1207
|
+
async def api_search(
|
|
978
1208
|
self,
|
|
979
1209
|
query: str,
|
|
980
1210
|
limit: int | None = None,
|
|
@@ -1000,7 +1230,7 @@ class SubscriptionsQuery:
|
|
|
1000
1230
|
**kwargs
|
|
1001
1231
|
}.items() if v is not None}
|
|
1002
1232
|
|
|
1003
|
-
result = await self._connector.execute("subscriptions", "
|
|
1233
|
+
result = await self._connector.execute("subscriptions", "api_search", params)
|
|
1004
1234
|
return result
|
|
1005
1235
|
|
|
1006
1236
|
|
|
@@ -1057,6 +1287,25 @@ class RefundsQuery:
|
|
|
1057
1287
|
|
|
1058
1288
|
|
|
1059
1289
|
|
|
1290
|
+
async def create(
|
|
1291
|
+
self,
|
|
1292
|
+
**kwargs
|
|
1293
|
+
) -> Refund:
|
|
1294
|
+
"""
|
|
1295
|
+
When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it. Creating a new refund will refund a charge that has previously been created but not yet refunded.
|
|
1296
|
+
|
|
1297
|
+
Returns:
|
|
1298
|
+
Refund
|
|
1299
|
+
"""
|
|
1300
|
+
params = {k: v for k, v in {
|
|
1301
|
+
**kwargs
|
|
1302
|
+
}.items() if v is not None}
|
|
1303
|
+
|
|
1304
|
+
result = await self._connector.execute("refunds", "create", params)
|
|
1305
|
+
return result
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
|
|
1060
1309
|
async def get(
|
|
1061
1310
|
self,
|
|
1062
1311
|
id: str | None = None,
|
|
@@ -1140,6 +1389,25 @@ class ProductsQuery:
|
|
|
1140
1389
|
|
|
1141
1390
|
|
|
1142
1391
|
|
|
1392
|
+
async def create(
|
|
1393
|
+
self,
|
|
1394
|
+
**kwargs
|
|
1395
|
+
) -> Product:
|
|
1396
|
+
"""
|
|
1397
|
+
Creates a new product object. Your product's name, description, and other information will be displayed in all product and invoice displays.
|
|
1398
|
+
|
|
1399
|
+
Returns:
|
|
1400
|
+
Product
|
|
1401
|
+
"""
|
|
1402
|
+
params = {k: v for k, v in {
|
|
1403
|
+
**kwargs
|
|
1404
|
+
}.items() if v is not None}
|
|
1405
|
+
|
|
1406
|
+
result = await self._connector.execute("products", "create", params)
|
|
1407
|
+
return result
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
|
|
1143
1411
|
async def get(
|
|
1144
1412
|
self,
|
|
1145
1413
|
id: str | None = None,
|
|
@@ -1165,13 +1433,63 @@ class ProductsQuery:
|
|
|
1165
1433
|
|
|
1166
1434
|
|
|
1167
1435
|
|
|
1168
|
-
async def
|
|
1436
|
+
async def update(
|
|
1437
|
+
self,
|
|
1438
|
+
id: str | None = None,
|
|
1439
|
+
**kwargs
|
|
1440
|
+
) -> Product:
|
|
1441
|
+
"""
|
|
1442
|
+
Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
|
1443
|
+
|
|
1444
|
+
Args:
|
|
1445
|
+
id: The product ID
|
|
1446
|
+
**kwargs: Additional parameters
|
|
1447
|
+
|
|
1448
|
+
Returns:
|
|
1449
|
+
Product
|
|
1450
|
+
"""
|
|
1451
|
+
params = {k: v for k, v in {
|
|
1452
|
+
"id": id,
|
|
1453
|
+
**kwargs
|
|
1454
|
+
}.items() if v is not None}
|
|
1455
|
+
|
|
1456
|
+
result = await self._connector.execute("products", "update", params)
|
|
1457
|
+
return result
|
|
1458
|
+
|
|
1459
|
+
|
|
1460
|
+
|
|
1461
|
+
async def delete(
|
|
1462
|
+
self,
|
|
1463
|
+
id: str | None = None,
|
|
1464
|
+
**kwargs
|
|
1465
|
+
) -> ProductDeletedResponse:
|
|
1466
|
+
"""
|
|
1467
|
+
Deletes a product. Deleting a product is only possible if it has no prices associated with it.
|
|
1468
|
+
|
|
1469
|
+
Args:
|
|
1470
|
+
id: The product ID
|
|
1471
|
+
**kwargs: Additional parameters
|
|
1472
|
+
|
|
1473
|
+
Returns:
|
|
1474
|
+
ProductDeletedResponse
|
|
1475
|
+
"""
|
|
1476
|
+
params = {k: v for k, v in {
|
|
1477
|
+
"id": id,
|
|
1478
|
+
**kwargs
|
|
1479
|
+
}.items() if v is not None}
|
|
1480
|
+
|
|
1481
|
+
result = await self._connector.execute("products", "delete", params)
|
|
1482
|
+
return result
|
|
1483
|
+
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
async def api_search(
|
|
1169
1487
|
self,
|
|
1170
1488
|
query: str,
|
|
1171
1489
|
limit: int | None = None,
|
|
1172
1490
|
page: str | None = None,
|
|
1173
1491
|
**kwargs
|
|
1174
|
-
) ->
|
|
1492
|
+
) -> ProductsApiSearchResult:
|
|
1175
1493
|
"""
|
|
1176
1494
|
Search for products using Stripe's Search Query Language.
|
|
1177
1495
|
|
|
@@ -1182,7 +1500,7 @@ class ProductsQuery:
|
|
|
1182
1500
|
**kwargs: Additional parameters
|
|
1183
1501
|
|
|
1184
1502
|
Returns:
|
|
1185
|
-
|
|
1503
|
+
ProductsApiSearchResult
|
|
1186
1504
|
"""
|
|
1187
1505
|
params = {k: v for k, v in {
|
|
1188
1506
|
"query": query,
|
|
@@ -1191,9 +1509,9 @@ class ProductsQuery:
|
|
|
1191
1509
|
**kwargs
|
|
1192
1510
|
}.items() if v is not None}
|
|
1193
1511
|
|
|
1194
|
-
result = await self._connector.execute("products", "
|
|
1512
|
+
result = await self._connector.execute("products", "api_search", params)
|
|
1195
1513
|
# Cast generic envelope to concrete typed result
|
|
1196
|
-
return
|
|
1514
|
+
return ProductsApiSearchResult(
|
|
1197
1515
|
data=result.data,
|
|
1198
1516
|
meta=result.meta )
|
|
1199
1517
|
|
|
@@ -1387,13 +1705,13 @@ class PaymentIntentsQuery:
|
|
|
1387
1705
|
|
|
1388
1706
|
|
|
1389
1707
|
|
|
1390
|
-
async def
|
|
1708
|
+
async def api_search(
|
|
1391
1709
|
self,
|
|
1392
1710
|
query: str,
|
|
1393
1711
|
limit: int | None = None,
|
|
1394
1712
|
page: str | None = None,
|
|
1395
1713
|
**kwargs
|
|
1396
|
-
) ->
|
|
1714
|
+
) -> PaymentIntentsApiSearchResult:
|
|
1397
1715
|
"""
|
|
1398
1716
|
Search for payment intents using Stripe's Search Query Language.
|
|
1399
1717
|
|
|
@@ -1404,7 +1722,7 @@ class PaymentIntentsQuery:
|
|
|
1404
1722
|
**kwargs: Additional parameters
|
|
1405
1723
|
|
|
1406
1724
|
Returns:
|
|
1407
|
-
|
|
1725
|
+
PaymentIntentsApiSearchResult
|
|
1408
1726
|
"""
|
|
1409
1727
|
params = {k: v for k, v in {
|
|
1410
1728
|
"query": query,
|
|
@@ -1413,9 +1731,9 @@ class PaymentIntentsQuery:
|
|
|
1413
1731
|
**kwargs
|
|
1414
1732
|
}.items() if v is not None}
|
|
1415
1733
|
|
|
1416
|
-
result = await self._connector.execute("payment_intents", "
|
|
1734
|
+
result = await self._connector.execute("payment_intents", "api_search", params)
|
|
1417
1735
|
# Cast generic envelope to concrete typed result
|
|
1418
|
-
return
|
|
1736
|
+
return PaymentIntentsApiSearchResult(
|
|
1419
1737
|
data=result.data,
|
|
1420
1738
|
meta=result.meta )
|
|
1421
1739
|
|