robosystems-client 0.2.10__py3-none-any.whl → 0.2.11__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.
Files changed (27) hide show
  1. robosystems_client/api/billing/__init__.py +1 -0
  2. robosystems_client/api/billing/cancel_subscription.py +173 -0
  3. robosystems_client/api/billing/create_checkout_session.py +230 -0
  4. robosystems_client/api/billing/get_billing_customer.py +143 -0
  5. robosystems_client/api/billing/get_checkout_status.py +221 -0
  6. robosystems_client/api/billing/get_subscription.py +165 -0
  7. robosystems_client/api/billing/get_upcoming_invoice.py +157 -0
  8. robosystems_client/api/billing/list_invoices.py +181 -0
  9. robosystems_client/api/billing/list_subscriptions.py +152 -0
  10. robosystems_client/api/billing/update_payment_method.py +182 -0
  11. robosystems_client/models/__init__.py +24 -0
  12. robosystems_client/models/billing_customer.py +128 -0
  13. robosystems_client/models/checkout_response.py +87 -0
  14. robosystems_client/models/checkout_status_response.py +130 -0
  15. robosystems_client/models/create_checkout_request.py +88 -0
  16. robosystems_client/models/create_checkout_request_resource_config.py +44 -0
  17. robosystems_client/models/invoice.py +244 -0
  18. robosystems_client/models/invoice_line_item.py +118 -0
  19. robosystems_client/models/invoices_response.py +90 -0
  20. robosystems_client/models/payment_method.py +158 -0
  21. robosystems_client/models/upcoming_invoice.py +128 -0
  22. robosystems_client/models/update_payment_method_request.py +60 -0
  23. robosystems_client/models/update_payment_method_response.py +74 -0
  24. {robosystems_client-0.2.10.dist-info → robosystems_client-0.2.11.dist-info}/METADATA +1 -1
  25. {robosystems_client-0.2.10.dist-info → robosystems_client-0.2.11.dist-info}/RECORD +27 -5
  26. {robosystems_client-0.2.10.dist-info → robosystems_client-0.2.11.dist-info}/WHEEL +0 -0
  27. {robosystems_client-0.2.10.dist-info → robosystems_client-0.2.11.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,173 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.graph_subscription_response import GraphSubscriptionResponse
9
+ from ...models.http_validation_error import HTTPValidationError
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ subscription_id: str,
15
+ ) -> dict[str, Any]:
16
+ _kwargs: dict[str, Any] = {
17
+ "method": "post",
18
+ "url": f"/v1/billing/subscriptions/{subscription_id}/cancel",
19
+ }
20
+
21
+ return _kwargs
22
+
23
+
24
+ def _parse_response(
25
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
26
+ ) -> Optional[Union[GraphSubscriptionResponse, HTTPValidationError]]:
27
+ if response.status_code == 200:
28
+ response_200 = GraphSubscriptionResponse.from_dict(response.json())
29
+
30
+ return response_200
31
+
32
+ if response.status_code == 422:
33
+ response_422 = HTTPValidationError.from_dict(response.json())
34
+
35
+ return response_422
36
+
37
+ if client.raise_on_unexpected_status:
38
+ raise errors.UnexpectedStatus(response.status_code, response.content)
39
+ else:
40
+ return None
41
+
42
+
43
+ def _build_response(
44
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
45
+ ) -> Response[Union[GraphSubscriptionResponse, HTTPValidationError]]:
46
+ return Response(
47
+ status_code=HTTPStatus(response.status_code),
48
+ content=response.content,
49
+ headers=response.headers,
50
+ parsed=_parse_response(client=client, response=response),
51
+ )
52
+
53
+
54
+ def sync_detailed(
55
+ subscription_id: str,
56
+ *,
57
+ client: AuthenticatedClient,
58
+ ) -> Response[Union[GraphSubscriptionResponse, HTTPValidationError]]:
59
+ """Cancel Subscription
60
+
61
+ Cancel a subscription.
62
+
63
+ The subscription will remain active until the end of the current billing period.
64
+
65
+ Args:
66
+ subscription_id (str):
67
+
68
+ Raises:
69
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
70
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
71
+
72
+ Returns:
73
+ Response[Union[GraphSubscriptionResponse, HTTPValidationError]]
74
+ """
75
+
76
+ kwargs = _get_kwargs(
77
+ subscription_id=subscription_id,
78
+ )
79
+
80
+ response = client.get_httpx_client().request(
81
+ **kwargs,
82
+ )
83
+
84
+ return _build_response(client=client, response=response)
85
+
86
+
87
+ def sync(
88
+ subscription_id: str,
89
+ *,
90
+ client: AuthenticatedClient,
91
+ ) -> Optional[Union[GraphSubscriptionResponse, HTTPValidationError]]:
92
+ """Cancel Subscription
93
+
94
+ Cancel a subscription.
95
+
96
+ The subscription will remain active until the end of the current billing period.
97
+
98
+ Args:
99
+ subscription_id (str):
100
+
101
+ Raises:
102
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
103
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
104
+
105
+ Returns:
106
+ Union[GraphSubscriptionResponse, HTTPValidationError]
107
+ """
108
+
109
+ return sync_detailed(
110
+ subscription_id=subscription_id,
111
+ client=client,
112
+ ).parsed
113
+
114
+
115
+ async def asyncio_detailed(
116
+ subscription_id: str,
117
+ *,
118
+ client: AuthenticatedClient,
119
+ ) -> Response[Union[GraphSubscriptionResponse, HTTPValidationError]]:
120
+ """Cancel Subscription
121
+
122
+ Cancel a subscription.
123
+
124
+ The subscription will remain active until the end of the current billing period.
125
+
126
+ Args:
127
+ subscription_id (str):
128
+
129
+ Raises:
130
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
131
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
132
+
133
+ Returns:
134
+ Response[Union[GraphSubscriptionResponse, HTTPValidationError]]
135
+ """
136
+
137
+ kwargs = _get_kwargs(
138
+ subscription_id=subscription_id,
139
+ )
140
+
141
+ response = await client.get_async_httpx_client().request(**kwargs)
142
+
143
+ return _build_response(client=client, response=response)
144
+
145
+
146
+ async def asyncio(
147
+ subscription_id: str,
148
+ *,
149
+ client: AuthenticatedClient,
150
+ ) -> Optional[Union[GraphSubscriptionResponse, HTTPValidationError]]:
151
+ """Cancel Subscription
152
+
153
+ Cancel a subscription.
154
+
155
+ The subscription will remain active until the end of the current billing period.
156
+
157
+ Args:
158
+ subscription_id (str):
159
+
160
+ Raises:
161
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
162
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
163
+
164
+ Returns:
165
+ Union[GraphSubscriptionResponse, HTTPValidationError]
166
+ """
167
+
168
+ return (
169
+ await asyncio_detailed(
170
+ subscription_id=subscription_id,
171
+ client=client,
172
+ )
173
+ ).parsed
@@ -0,0 +1,230 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.checkout_response import CheckoutResponse
9
+ from ...models.create_checkout_request import CreateCheckoutRequest
10
+ from ...models.http_validation_error import HTTPValidationError
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ *,
16
+ body: CreateCheckoutRequest,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "post",
22
+ "url": "/v1/billing/checkout",
23
+ }
24
+
25
+ _kwargs["json"] = body.to_dict()
26
+
27
+ headers["Content-Type"] = "application/json"
28
+
29
+ _kwargs["headers"] = headers
30
+ return _kwargs
31
+
32
+
33
+ def _parse_response(
34
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
35
+ ) -> Optional[Union[CheckoutResponse, HTTPValidationError]]:
36
+ if response.status_code == 201:
37
+ response_201 = CheckoutResponse.from_dict(response.json())
38
+
39
+ return response_201
40
+
41
+ if response.status_code == 422:
42
+ response_422 = HTTPValidationError.from_dict(response.json())
43
+
44
+ return response_422
45
+
46
+ if client.raise_on_unexpected_status:
47
+ raise errors.UnexpectedStatus(response.status_code, response.content)
48
+ else:
49
+ return None
50
+
51
+
52
+ def _build_response(
53
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
54
+ ) -> Response[Union[CheckoutResponse, HTTPValidationError]]:
55
+ return Response(
56
+ status_code=HTTPStatus(response.status_code),
57
+ content=response.content,
58
+ headers=response.headers,
59
+ parsed=_parse_response(client=client, response=response),
60
+ )
61
+
62
+
63
+ def sync_detailed(
64
+ *,
65
+ client: AuthenticatedClient,
66
+ body: CreateCheckoutRequest,
67
+ ) -> Response[Union[CheckoutResponse, HTTPValidationError]]:
68
+ """Create Payment Checkout Session
69
+
70
+ Create a Stripe checkout session for collecting payment method.
71
+
72
+ This endpoint is used when a user needs to add a payment method before
73
+ provisioning resources. It creates a pending subscription and redirects
74
+ the user to Stripe Checkout to collect payment details.
75
+
76
+ **Flow:**
77
+ 1. User tries to create a graph but has no payment method
78
+ 2. Frontend calls this endpoint with graph configuration
79
+ 3. Backend creates a subscription in PENDING_PAYMENT status
80
+ 4. Returns Stripe Checkout URL
81
+ 5. User completes payment on Stripe
82
+ 6. Webhook activates subscription and provisions resource
83
+
84
+ **Enterprise customers** (with invoice_billing_enabled) should not call this endpoint.
85
+
86
+ Args:
87
+ body (CreateCheckoutRequest): Request to create a checkout session for payment collection.
88
+
89
+ Raises:
90
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
91
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
92
+
93
+ Returns:
94
+ Response[Union[CheckoutResponse, HTTPValidationError]]
95
+ """
96
+
97
+ kwargs = _get_kwargs(
98
+ body=body,
99
+ )
100
+
101
+ response = client.get_httpx_client().request(
102
+ **kwargs,
103
+ )
104
+
105
+ return _build_response(client=client, response=response)
106
+
107
+
108
+ def sync(
109
+ *,
110
+ client: AuthenticatedClient,
111
+ body: CreateCheckoutRequest,
112
+ ) -> Optional[Union[CheckoutResponse, HTTPValidationError]]:
113
+ """Create Payment Checkout Session
114
+
115
+ Create a Stripe checkout session for collecting payment method.
116
+
117
+ This endpoint is used when a user needs to add a payment method before
118
+ provisioning resources. It creates a pending subscription and redirects
119
+ the user to Stripe Checkout to collect payment details.
120
+
121
+ **Flow:**
122
+ 1. User tries to create a graph but has no payment method
123
+ 2. Frontend calls this endpoint with graph configuration
124
+ 3. Backend creates a subscription in PENDING_PAYMENT status
125
+ 4. Returns Stripe Checkout URL
126
+ 5. User completes payment on Stripe
127
+ 6. Webhook activates subscription and provisions resource
128
+
129
+ **Enterprise customers** (with invoice_billing_enabled) should not call this endpoint.
130
+
131
+ Args:
132
+ body (CreateCheckoutRequest): Request to create a checkout session for payment collection.
133
+
134
+ Raises:
135
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
136
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
137
+
138
+ Returns:
139
+ Union[CheckoutResponse, HTTPValidationError]
140
+ """
141
+
142
+ return sync_detailed(
143
+ client=client,
144
+ body=body,
145
+ ).parsed
146
+
147
+
148
+ async def asyncio_detailed(
149
+ *,
150
+ client: AuthenticatedClient,
151
+ body: CreateCheckoutRequest,
152
+ ) -> Response[Union[CheckoutResponse, HTTPValidationError]]:
153
+ """Create Payment Checkout Session
154
+
155
+ Create a Stripe checkout session for collecting payment method.
156
+
157
+ This endpoint is used when a user needs to add a payment method before
158
+ provisioning resources. It creates a pending subscription and redirects
159
+ the user to Stripe Checkout to collect payment details.
160
+
161
+ **Flow:**
162
+ 1. User tries to create a graph but has no payment method
163
+ 2. Frontend calls this endpoint with graph configuration
164
+ 3. Backend creates a subscription in PENDING_PAYMENT status
165
+ 4. Returns Stripe Checkout URL
166
+ 5. User completes payment on Stripe
167
+ 6. Webhook activates subscription and provisions resource
168
+
169
+ **Enterprise customers** (with invoice_billing_enabled) should not call this endpoint.
170
+
171
+ Args:
172
+ body (CreateCheckoutRequest): Request to create a checkout session for payment collection.
173
+
174
+ Raises:
175
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
176
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
177
+
178
+ Returns:
179
+ Response[Union[CheckoutResponse, HTTPValidationError]]
180
+ """
181
+
182
+ kwargs = _get_kwargs(
183
+ body=body,
184
+ )
185
+
186
+ response = await client.get_async_httpx_client().request(**kwargs)
187
+
188
+ return _build_response(client=client, response=response)
189
+
190
+
191
+ async def asyncio(
192
+ *,
193
+ client: AuthenticatedClient,
194
+ body: CreateCheckoutRequest,
195
+ ) -> Optional[Union[CheckoutResponse, HTTPValidationError]]:
196
+ """Create Payment Checkout Session
197
+
198
+ Create a Stripe checkout session for collecting payment method.
199
+
200
+ This endpoint is used when a user needs to add a payment method before
201
+ provisioning resources. It creates a pending subscription and redirects
202
+ the user to Stripe Checkout to collect payment details.
203
+
204
+ **Flow:**
205
+ 1. User tries to create a graph but has no payment method
206
+ 2. Frontend calls this endpoint with graph configuration
207
+ 3. Backend creates a subscription in PENDING_PAYMENT status
208
+ 4. Returns Stripe Checkout URL
209
+ 5. User completes payment on Stripe
210
+ 6. Webhook activates subscription and provisions resource
211
+
212
+ **Enterprise customers** (with invoice_billing_enabled) should not call this endpoint.
213
+
214
+ Args:
215
+ body (CreateCheckoutRequest): Request to create a checkout session for payment collection.
216
+
217
+ Raises:
218
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
219
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
220
+
221
+ Returns:
222
+ Union[CheckoutResponse, HTTPValidationError]
223
+ """
224
+
225
+ return (
226
+ await asyncio_detailed(
227
+ client=client,
228
+ body=body,
229
+ )
230
+ ).parsed
@@ -0,0 +1,143 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.billing_customer import BillingCustomer
9
+ from ...types import Response
10
+
11
+
12
+ def _get_kwargs() -> dict[str, Any]:
13
+ _kwargs: dict[str, Any] = {
14
+ "method": "get",
15
+ "url": "/v1/billing/customer",
16
+ }
17
+
18
+ return _kwargs
19
+
20
+
21
+ def _parse_response(
22
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
23
+ ) -> Optional[BillingCustomer]:
24
+ if response.status_code == 200:
25
+ response_200 = BillingCustomer.from_dict(response.json())
26
+
27
+ return response_200
28
+
29
+ if client.raise_on_unexpected_status:
30
+ raise errors.UnexpectedStatus(response.status_code, response.content)
31
+ else:
32
+ return None
33
+
34
+
35
+ def _build_response(
36
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
37
+ ) -> Response[BillingCustomer]:
38
+ return Response(
39
+ status_code=HTTPStatus(response.status_code),
40
+ content=response.content,
41
+ headers=response.headers,
42
+ parsed=_parse_response(client=client, response=response),
43
+ )
44
+
45
+
46
+ def sync_detailed(
47
+ *,
48
+ client: AuthenticatedClient,
49
+ ) -> Response[BillingCustomer]:
50
+ """Get Customer Info
51
+
52
+ Get billing customer information including payment methods on file.
53
+
54
+ Returns customer details, payment methods, and whether invoice billing is enabled.
55
+
56
+ Raises:
57
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
58
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
59
+
60
+ Returns:
61
+ Response[BillingCustomer]
62
+ """
63
+
64
+ kwargs = _get_kwargs()
65
+
66
+ response = client.get_httpx_client().request(
67
+ **kwargs,
68
+ )
69
+
70
+ return _build_response(client=client, response=response)
71
+
72
+
73
+ def sync(
74
+ *,
75
+ client: AuthenticatedClient,
76
+ ) -> Optional[BillingCustomer]:
77
+ """Get Customer Info
78
+
79
+ Get billing customer information including payment methods on file.
80
+
81
+ Returns customer details, payment methods, and whether invoice billing is enabled.
82
+
83
+ Raises:
84
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
85
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
86
+
87
+ Returns:
88
+ BillingCustomer
89
+ """
90
+
91
+ return sync_detailed(
92
+ client=client,
93
+ ).parsed
94
+
95
+
96
+ async def asyncio_detailed(
97
+ *,
98
+ client: AuthenticatedClient,
99
+ ) -> Response[BillingCustomer]:
100
+ """Get Customer Info
101
+
102
+ Get billing customer information including payment methods on file.
103
+
104
+ Returns customer details, payment methods, and whether invoice billing is enabled.
105
+
106
+ Raises:
107
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
108
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
109
+
110
+ Returns:
111
+ Response[BillingCustomer]
112
+ """
113
+
114
+ kwargs = _get_kwargs()
115
+
116
+ response = await client.get_async_httpx_client().request(**kwargs)
117
+
118
+ return _build_response(client=client, response=response)
119
+
120
+
121
+ async def asyncio(
122
+ *,
123
+ client: AuthenticatedClient,
124
+ ) -> Optional[BillingCustomer]:
125
+ """Get Customer Info
126
+
127
+ Get billing customer information including payment methods on file.
128
+
129
+ Returns customer details, payment methods, and whether invoice billing is enabled.
130
+
131
+ Raises:
132
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
133
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
134
+
135
+ Returns:
136
+ BillingCustomer
137
+ """
138
+
139
+ return (
140
+ await asyncio_detailed(
141
+ client=client,
142
+ )
143
+ ).parsed