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,221 @@
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_status_response import CheckoutStatusResponse
9
+ from ...models.http_validation_error import HTTPValidationError
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ session_id: str,
15
+ ) -> dict[str, Any]:
16
+ _kwargs: dict[str, Any] = {
17
+ "method": "get",
18
+ "url": f"/v1/billing/checkout/{session_id}/status",
19
+ }
20
+
21
+ return _kwargs
22
+
23
+
24
+ def _parse_response(
25
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
26
+ ) -> Optional[Union[CheckoutStatusResponse, HTTPValidationError]]:
27
+ if response.status_code == 200:
28
+ response_200 = CheckoutStatusResponse.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[CheckoutStatusResponse, 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
+ session_id: str,
56
+ *,
57
+ client: AuthenticatedClient,
58
+ ) -> Response[Union[CheckoutStatusResponse, HTTPValidationError]]:
59
+ """Get Checkout Session Status
60
+
61
+ Poll the status of a checkout session.
62
+
63
+ Frontend should poll this endpoint after user returns from Stripe Checkout
64
+ to determine when the resource is ready.
65
+
66
+ **Status Values:**
67
+ - `pending_payment`: Waiting for payment to complete
68
+ - `provisioning`: Payment confirmed, resource being created
69
+ - `completed`: Resource is ready (resource_id will be set)
70
+ - `failed`: Something went wrong (error field will be set)
71
+
72
+ **When status is 'completed':**
73
+ - For graphs: `resource_id` will be the graph_id, and `operation_id` can be used to monitor SSE
74
+ progress
75
+ - For repositories: `resource_id` will be the repository name and access is immediately available
76
+
77
+ Args:
78
+ session_id (str):
79
+
80
+ Raises:
81
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
82
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
83
+
84
+ Returns:
85
+ Response[Union[CheckoutStatusResponse, HTTPValidationError]]
86
+ """
87
+
88
+ kwargs = _get_kwargs(
89
+ session_id=session_id,
90
+ )
91
+
92
+ response = client.get_httpx_client().request(
93
+ **kwargs,
94
+ )
95
+
96
+ return _build_response(client=client, response=response)
97
+
98
+
99
+ def sync(
100
+ session_id: str,
101
+ *,
102
+ client: AuthenticatedClient,
103
+ ) -> Optional[Union[CheckoutStatusResponse, HTTPValidationError]]:
104
+ """Get Checkout Session Status
105
+
106
+ Poll the status of a checkout session.
107
+
108
+ Frontend should poll this endpoint after user returns from Stripe Checkout
109
+ to determine when the resource is ready.
110
+
111
+ **Status Values:**
112
+ - `pending_payment`: Waiting for payment to complete
113
+ - `provisioning`: Payment confirmed, resource being created
114
+ - `completed`: Resource is ready (resource_id will be set)
115
+ - `failed`: Something went wrong (error field will be set)
116
+
117
+ **When status is 'completed':**
118
+ - For graphs: `resource_id` will be the graph_id, and `operation_id` can be used to monitor SSE
119
+ progress
120
+ - For repositories: `resource_id` will be the repository name and access is immediately available
121
+
122
+ Args:
123
+ session_id (str):
124
+
125
+ Raises:
126
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
128
+
129
+ Returns:
130
+ Union[CheckoutStatusResponse, HTTPValidationError]
131
+ """
132
+
133
+ return sync_detailed(
134
+ session_id=session_id,
135
+ client=client,
136
+ ).parsed
137
+
138
+
139
+ async def asyncio_detailed(
140
+ session_id: str,
141
+ *,
142
+ client: AuthenticatedClient,
143
+ ) -> Response[Union[CheckoutStatusResponse, HTTPValidationError]]:
144
+ """Get Checkout Session Status
145
+
146
+ Poll the status of a checkout session.
147
+
148
+ Frontend should poll this endpoint after user returns from Stripe Checkout
149
+ to determine when the resource is ready.
150
+
151
+ **Status Values:**
152
+ - `pending_payment`: Waiting for payment to complete
153
+ - `provisioning`: Payment confirmed, resource being created
154
+ - `completed`: Resource is ready (resource_id will be set)
155
+ - `failed`: Something went wrong (error field will be set)
156
+
157
+ **When status is 'completed':**
158
+ - For graphs: `resource_id` will be the graph_id, and `operation_id` can be used to monitor SSE
159
+ progress
160
+ - For repositories: `resource_id` will be the repository name and access is immediately available
161
+
162
+ Args:
163
+ session_id (str):
164
+
165
+ Raises:
166
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
167
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
168
+
169
+ Returns:
170
+ Response[Union[CheckoutStatusResponse, HTTPValidationError]]
171
+ """
172
+
173
+ kwargs = _get_kwargs(
174
+ session_id=session_id,
175
+ )
176
+
177
+ response = await client.get_async_httpx_client().request(**kwargs)
178
+
179
+ return _build_response(client=client, response=response)
180
+
181
+
182
+ async def asyncio(
183
+ session_id: str,
184
+ *,
185
+ client: AuthenticatedClient,
186
+ ) -> Optional[Union[CheckoutStatusResponse, HTTPValidationError]]:
187
+ """Get Checkout Session Status
188
+
189
+ Poll the status of a checkout session.
190
+
191
+ Frontend should poll this endpoint after user returns from Stripe Checkout
192
+ to determine when the resource is ready.
193
+
194
+ **Status Values:**
195
+ - `pending_payment`: Waiting for payment to complete
196
+ - `provisioning`: Payment confirmed, resource being created
197
+ - `completed`: Resource is ready (resource_id will be set)
198
+ - `failed`: Something went wrong (error field will be set)
199
+
200
+ **When status is 'completed':**
201
+ - For graphs: `resource_id` will be the graph_id, and `operation_id` can be used to monitor SSE
202
+ progress
203
+ - For repositories: `resource_id` will be the repository name and access is immediately available
204
+
205
+ Args:
206
+ session_id (str):
207
+
208
+ Raises:
209
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
210
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
211
+
212
+ Returns:
213
+ Union[CheckoutStatusResponse, HTTPValidationError]
214
+ """
215
+
216
+ return (
217
+ await asyncio_detailed(
218
+ session_id=session_id,
219
+ client=client,
220
+ )
221
+ ).parsed
@@ -0,0 +1,165 @@
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": "get",
18
+ "url": f"/v1/billing/subscriptions/{subscription_id}",
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
+ """Get Subscription Details
60
+
61
+ Get detailed information about a specific subscription.
62
+
63
+ Args:
64
+ subscription_id (str):
65
+
66
+ Raises:
67
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
68
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
69
+
70
+ Returns:
71
+ Response[Union[GraphSubscriptionResponse, HTTPValidationError]]
72
+ """
73
+
74
+ kwargs = _get_kwargs(
75
+ subscription_id=subscription_id,
76
+ )
77
+
78
+ response = client.get_httpx_client().request(
79
+ **kwargs,
80
+ )
81
+
82
+ return _build_response(client=client, response=response)
83
+
84
+
85
+ def sync(
86
+ subscription_id: str,
87
+ *,
88
+ client: AuthenticatedClient,
89
+ ) -> Optional[Union[GraphSubscriptionResponse, HTTPValidationError]]:
90
+ """Get Subscription Details
91
+
92
+ Get detailed information about a specific subscription.
93
+
94
+ Args:
95
+ subscription_id (str):
96
+
97
+ Raises:
98
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
99
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
100
+
101
+ Returns:
102
+ Union[GraphSubscriptionResponse, HTTPValidationError]
103
+ """
104
+
105
+ return sync_detailed(
106
+ subscription_id=subscription_id,
107
+ client=client,
108
+ ).parsed
109
+
110
+
111
+ async def asyncio_detailed(
112
+ subscription_id: str,
113
+ *,
114
+ client: AuthenticatedClient,
115
+ ) -> Response[Union[GraphSubscriptionResponse, HTTPValidationError]]:
116
+ """Get Subscription Details
117
+
118
+ Get detailed information about a specific subscription.
119
+
120
+ Args:
121
+ subscription_id (str):
122
+
123
+ Raises:
124
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
125
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
126
+
127
+ Returns:
128
+ Response[Union[GraphSubscriptionResponse, HTTPValidationError]]
129
+ """
130
+
131
+ kwargs = _get_kwargs(
132
+ subscription_id=subscription_id,
133
+ )
134
+
135
+ response = await client.get_async_httpx_client().request(**kwargs)
136
+
137
+ return _build_response(client=client, response=response)
138
+
139
+
140
+ async def asyncio(
141
+ subscription_id: str,
142
+ *,
143
+ client: AuthenticatedClient,
144
+ ) -> Optional[Union[GraphSubscriptionResponse, HTTPValidationError]]:
145
+ """Get Subscription Details
146
+
147
+ Get detailed information about a specific subscription.
148
+
149
+ Args:
150
+ subscription_id (str):
151
+
152
+ Raises:
153
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
154
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
155
+
156
+ Returns:
157
+ Union[GraphSubscriptionResponse, HTTPValidationError]
158
+ """
159
+
160
+ return (
161
+ await asyncio_detailed(
162
+ subscription_id=subscription_id,
163
+ client=client,
164
+ )
165
+ ).parsed
@@ -0,0 +1,157 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union, cast
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.upcoming_invoice import UpcomingInvoice
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/invoices/upcoming",
16
+ }
17
+
18
+ return _kwargs
19
+
20
+
21
+ def _parse_response(
22
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
23
+ ) -> Optional[Union["UpcomingInvoice", None]]:
24
+ if response.status_code == 200:
25
+
26
+ def _parse_response_200(data: object) -> Union["UpcomingInvoice", None]:
27
+ if data is None:
28
+ return data
29
+ try:
30
+ if not isinstance(data, dict):
31
+ raise TypeError()
32
+ response_200_type_0 = UpcomingInvoice.from_dict(data)
33
+
34
+ return response_200_type_0
35
+ except: # noqa: E722
36
+ pass
37
+ return cast(Union["UpcomingInvoice", None], data)
38
+
39
+ response_200 = _parse_response_200(response.json())
40
+
41
+ return response_200
42
+
43
+ if client.raise_on_unexpected_status:
44
+ raise errors.UnexpectedStatus(response.status_code, response.content)
45
+ else:
46
+ return None
47
+
48
+
49
+ def _build_response(
50
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
51
+ ) -> Response[Union["UpcomingInvoice", None]]:
52
+ return Response(
53
+ status_code=HTTPStatus(response.status_code),
54
+ content=response.content,
55
+ headers=response.headers,
56
+ parsed=_parse_response(client=client, response=response),
57
+ )
58
+
59
+
60
+ def sync_detailed(
61
+ *,
62
+ client: AuthenticatedClient,
63
+ ) -> Response[Union["UpcomingInvoice", None]]:
64
+ """Get Upcoming Invoice
65
+
66
+ Get preview of the next invoice.
67
+
68
+ Returns estimated charges for the next billing period.
69
+
70
+ Raises:
71
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
72
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
73
+
74
+ Returns:
75
+ Response[Union['UpcomingInvoice', None]]
76
+ """
77
+
78
+ kwargs = _get_kwargs()
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
+ *,
89
+ client: AuthenticatedClient,
90
+ ) -> Optional[Union["UpcomingInvoice", None]]:
91
+ """Get Upcoming Invoice
92
+
93
+ Get preview of the next invoice.
94
+
95
+ Returns estimated charges for the next billing period.
96
+
97
+ Raises:
98
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
99
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
100
+
101
+ Returns:
102
+ Union['UpcomingInvoice', None]
103
+ """
104
+
105
+ return sync_detailed(
106
+ client=client,
107
+ ).parsed
108
+
109
+
110
+ async def asyncio_detailed(
111
+ *,
112
+ client: AuthenticatedClient,
113
+ ) -> Response[Union["UpcomingInvoice", None]]:
114
+ """Get Upcoming Invoice
115
+
116
+ Get preview of the next invoice.
117
+
118
+ Returns estimated charges for the next billing period.
119
+
120
+ Raises:
121
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
122
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
123
+
124
+ Returns:
125
+ Response[Union['UpcomingInvoice', None]]
126
+ """
127
+
128
+ kwargs = _get_kwargs()
129
+
130
+ response = await client.get_async_httpx_client().request(**kwargs)
131
+
132
+ return _build_response(client=client, response=response)
133
+
134
+
135
+ async def asyncio(
136
+ *,
137
+ client: AuthenticatedClient,
138
+ ) -> Optional[Union["UpcomingInvoice", None]]:
139
+ """Get Upcoming Invoice
140
+
141
+ Get preview of the next invoice.
142
+
143
+ Returns estimated charges for the next billing period.
144
+
145
+ Raises:
146
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
147
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
148
+
149
+ Returns:
150
+ Union['UpcomingInvoice', None]
151
+ """
152
+
153
+ return (
154
+ await asyncio_detailed(
155
+ client=client,
156
+ )
157
+ ).parsed