Skip to content

Commit 5082a49

Browse files
feat: add CouponsService and refactor usage services
Introduced CouponsService for managing coupon-related operations, including creation, retrieval, and performance metrics. Refactored existing usage services by consolidating multiple services into a single UsageService, streamlining the API surface. Removed deprecated services and updated the client initialization accordingly. Updated SDK manifest to reflect these changes.
1 parent 40adfb6 commit 5082a49

19 files changed

Lines changed: 174 additions & 227 deletions

lomi/client.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ def __init__(
3939
self.accounts = AccountsService(self)
4040
self.charges = ChargesService(self)
4141
self.checkout_sessions = CheckoutSessionsService(self)
42+
self.coupons = CouponsService(self)
4243
self.customers = CustomersService(self)
43-
self.discount_coupons = DiscountCouponsService(self)
4444
self.disputes = DisputesService(self)
4545
self.logs = LogsService(self)
4646
self.merchants = MerchantsService(self)
4747
self.meters = MetersService(self)
48-
self.organization = OrganizationService(self)
4948
self.organizations = OrganizationsService(self)
5049
self.payment_links = PaymentLinksService(self)
5150
self.payment_requests = PaymentRequestsService(self)
@@ -57,10 +56,7 @@ def __init__(
5756
self.settlements = SettlementsService(self)
5857
self.subscriptions = SubscriptionsService(self)
5958
self.transactions = TransactionsService(self)
60-
self.usage_billing = UsageBillingService(self)
61-
self.usage_events = UsageEventsService(self)
62-
self.usage_subscriptions = UsageSubscriptionsService(self)
63-
self.webhook_delivery_logs = WebhookDeliveryLogsService(self)
59+
self.usage = UsageService(self)
6460
self.webhooks = WebhooksService(self)
6561

6662
def _request(

lomi/sdk_python_methods.json

Lines changed: 51 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"generatedAt": "2026-07-08T16:57:23.487Z",
2+
"generatedAt": "2026-08-25T23:42:26.816Z",
33
"language": "python",
44
"naming": "ts_method_names_manifest_pep8_sdk_methods_are_snake_case_in_code",
55
"sdk": {
@@ -22,24 +22,25 @@
2222
"list",
2323
"listAll"
2424
],
25+
"coupons": [
26+
"create",
27+
"get",
28+
"getPerformance",
29+
"list",
30+
"listAll"
31+
],
2532
"customers": [
2633
"create",
27-
"createPortalLaunchSession",
34+
"createPortalSession",
2835
"delete",
2936
"get",
3037
"getPortalAudit",
38+
"getSubscriptions",
3139
"getTransactions",
3240
"list",
3341
"listAll",
3442
"update"
3543
],
36-
"discountCoupons": [
37-
"create",
38-
"get",
39-
"getPerformance",
40-
"list",
41-
"listAll"
42-
],
4344
"disputes": [
4445
"get",
4546
"list",
@@ -64,15 +65,13 @@
6465
"listAll",
6566
"update"
6667
],
67-
"organization": [
68-
"getSettings",
69-
"updateSettings"
70-
],
7168
"organizations": [
7269
"get",
7370
"getMetrics",
71+
"getRadarSettings",
7472
"list",
75-
"listAll"
73+
"listAll",
74+
"updateRadarSettings"
7675
],
7776
"paymentLinks": [
7877
"create",
@@ -115,53 +114,47 @@
115114
"listAssessments"
116115
],
117116
"settlements": [
117+
"createInstant",
118118
"findAll",
119119
"findAllAll",
120-
"findTransactions"
120+
"findTransactions",
121+
"getInstant"
121122
],
122123
"subscriptions": [
123124
"cancel",
124125
"changePlan",
125-
"findByCustomer",
126126
"get",
127+
"getUsage",
127128
"list",
128129
"listAll",
129-
"uncancel",
130+
"resume",
130131
"update"
131132
],
132133
"transactions": [
133134
"get",
134135
"list",
135136
"listAll"
136137
],
137-
"usageBilling": [
138+
"usage": [
138139
"checkEntitlement",
140+
"create",
139141
"createEntitlement",
142+
"createSubscription",
143+
"get",
140144
"getRevenue",
141-
"getSubscriptionUsage",
142145
"grantCredits",
143-
"listPeriods"
144-
],
145-
"usageEvents": [
146-
"create",
147-
"get",
148-
"list",
149-
"listAll"
150-
],
151-
"usageSubscriptions": [
152-
"create"
153-
],
154-
"webhookDeliveryLogs": [
155-
"get",
156146
"list",
157-
"listAll"
147+
"listAll",
148+
"listPeriods"
158149
],
159150
"webhooks": [
160151
"create",
161152
"delete",
162153
"get",
154+
"getDelivery",
163155
"list",
164156
"listAll",
157+
"listDeliveries",
165158
"retryDelivery",
166159
"test",
167160
"update",
@@ -188,24 +181,25 @@
188181
"list",
189182
"list_all"
190183
],
184+
"coupons": [
185+
"create",
186+
"get",
187+
"get_performance",
188+
"list",
189+
"list_all"
190+
],
191191
"customers": [
192192
"create",
193-
"create_portal_launch_session",
193+
"create_portal_session",
194194
"delete",
195195
"get",
196196
"get_portal_audit",
197+
"get_subscriptions",
197198
"get_transactions",
198199
"list",
199200
"list_all",
200201
"update"
201202
],
202-
"discount_coupons": [
203-
"create",
204-
"get",
205-
"get_performance",
206-
"list",
207-
"list_all"
208-
],
209203
"disputes": [
210204
"get",
211205
"list",
@@ -230,15 +224,13 @@
230224
"list_all",
231225
"update"
232226
],
233-
"organization": [
234-
"get_settings",
235-
"update_settings"
236-
],
237227
"organizations": [
238228
"get",
239229
"get_metrics",
230+
"get_radar_settings",
240231
"list",
241-
"list_all"
232+
"list_all",
233+
"update_radar_settings"
242234
],
243235
"payment_links": [
244236
"create",
@@ -281,53 +273,47 @@
281273
"list_assessments"
282274
],
283275
"settlements": [
276+
"create_instant",
284277
"find_all",
285278
"find_all_all",
286-
"find_transactions"
279+
"find_transactions",
280+
"get_instant"
287281
],
288282
"subscriptions": [
289283
"cancel",
290284
"change_plan",
291-
"find_by_customer",
292285
"get",
286+
"get_usage",
293287
"list",
294288
"list_all",
295-
"uncancel",
289+
"resume",
296290
"update"
297291
],
298292
"transactions": [
299293
"get",
300294
"list",
301295
"list_all"
302296
],
303-
"usage_billing": [
297+
"usage": [
304298
"check_entitlement",
299+
"create",
305300
"create_entitlement",
301+
"create_subscription",
302+
"get",
306303
"get_revenue",
307-
"get_subscription_usage",
308304
"grant_credits",
309-
"list_periods"
310-
],
311-
"usage_events": [
312-
"create",
313-
"get",
314-
"list",
315-
"list_all"
316-
],
317-
"usage_subscriptions": [
318-
"create"
319-
],
320-
"webhook_delivery_logs": [
321-
"get",
322305
"list",
323-
"list_all"
306+
"list_all",
307+
"list_periods"
324308
],
325309
"webhooks": [
326310
"create",
327311
"delete",
328312
"get",
313+
"get_delivery",
329314
"list",
330315
"list_all",
316+
"list_deliveries",
331317
"retry_delivery",
332318
"test",
333319
"update",

lomi/services/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
from .accounts import AccountsService
22
from .charges import ChargesService
33
from .checkout_sessions import CheckoutSessionsService
4+
from .coupons import CouponsService
45
from .customers import CustomersService
5-
from .discount_coupons import DiscountCouponsService
66
from .disputes import DisputesService
77
from .logs import LogsService
88
from .merchants import MerchantsService
99
from .meters import MetersService
10-
from .organization import OrganizationService
1110
from .organizations import OrganizationsService
1211
from .payment_links import PaymentLinksService
1312
from .payment_requests import PaymentRequestsService
@@ -19,8 +18,5 @@
1918
from .settlements import SettlementsService
2019
from .subscriptions import SubscriptionsService
2120
from .transactions import TransactionsService
22-
from .usage_billing import UsageBillingService
23-
from .usage_events import UsageEventsService
24-
from .usage_subscriptions import UsageSubscriptionsService
25-
from .webhook_delivery_logs import WebhookDeliveryLogsService
21+
from .usage import UsageService
2622
from .webhooks import WebhooksService

lomi/services/accounts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class AccountsService(ClientBase):
1010

1111
def check_balance(self, currency: str) -> Any:
1212
"""Vérifier le solde disponible"""
13-
path = "/accounts/balance/check/{currency}"
13+
path = "/accounts/balance/{currency}"
1414
path = path.replace("{currency}", str(currency))
1515
return self._request("GET", path)
1616

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
from ..client_base import ClientBase
66

77

8-
class DiscountCouponsService(ClientBase):
8+
class CouponsService(ClientBase):
99
"""Public merchant API — generated from OpenAPI allowlist."""
1010

1111
def create(self) -> Any:
1212
"""Créer un coupon"""
13-
path = "/discount-coupons"
13+
path = "/coupons"
1414
return self._request("POST", path)
1515

1616
def get(self, id: str) -> Any:
1717
"""Obtenir un coupon par ID"""
18-
path = "/discount-coupons/{id}"
18+
path = "/coupons/{id}"
1919
path = path.replace("{id}", str(id))
2020
return self._request("GET", path)
2121

2222
def get_performance(self, id: str) -> Any:
2323
"""Indicateurs de performance du coupon"""
24-
path = "/discount-coupons/{id}/performance"
24+
path = "/coupons/{id}/performance"
2525
path = path.replace("{id}", str(id))
2626
return self._request("GET", path)
2727

2828
def list(self) -> Any:
2929
"""Lister les coupons"""
30-
path = "/discount-coupons"
30+
path = "/coupons"
3131
return self._request("GET", path)
3232

lomi/services/customers.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ def create(self, body: Optional[Dict[str, Any]] = None) -> Any:
1313
path = "/customers"
1414
return self._request("POST", path, data=body)
1515

16-
def create_portal_launch_session(self, id: str, body: Optional[Dict[str, Any]] = None) -> Any:
16+
def create_portal_session(self, id: str, body: Optional[Dict[str, Any]] = None) -> Any:
1717
"""Créer une session de lancement du portail client"""
18-
path = "/customers/{id}/portal-launch-session"
18+
path = "/customers/{id}/portal"
1919
path = path.replace("{id}", str(id))
2020
return self._request("POST", path, data=body)
2121

@@ -37,6 +37,12 @@ def get_portal_audit(self, id: str, params: Optional[Dict[str, Any]] = None) ->
3737
path = path.replace("{id}", str(id))
3838
return self._request("GET", path, params=params)
3939

40+
def get_subscriptions(self, id: str) -> Any:
41+
"""Abonnements d’un client"""
42+
path = "/customers/{id}/subscriptions"
43+
path = path.replace("{id}", str(id))
44+
return self._request("GET", path)
45+
4046
def get_transactions(self, id: str) -> Any:
4147
"""Transactions du client"""
4248
path = "/customers/{id}/transactions"

lomi/services/logs.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
class LogsService(ClientBase):
99
"""Public merchant API — generated from OpenAPI allowlist."""
1010

11-
def get(self, type: str, id: str) -> Any:
11+
def get(self, id: str, params: Optional[Dict[str, Any]] = None) -> Any:
1212
"""Get a log entry"""
13-
path = "/logs/{type}/{id}"
14-
path = path.replace("{type}", str(type))
13+
path = "/logs/{id}"
1514
path = path.replace("{id}", str(id))
16-
return self._request("GET", path)
15+
return self._request("GET", path, params=params)
1716

1817
def list(self, params: Optional[Dict[str, Any]] = None) -> Any:
1918
"""List logs"""

0 commit comments

Comments
 (0)