llama-cloud 0.0.3__py3-none-any.whl → 0.0.5__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.

Potentially problematic release.


This version of llama-cloud might be problematic. Click here for more details.

@@ -1,237 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
- import urllib.parse
5
- from json.decoder import JSONDecodeError
6
-
7
- from ...core.api_error import ApiError
8
- from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
- from ...core.jsonable_encoder import jsonable_encoder
10
- from ...core.remove_none_from_dict import remove_none_from_dict
11
- from ...errors.unprocessable_entity_error import UnprocessableEntityError
12
- from ...types.http_validation_error import HttpValidationError
13
-
14
- try:
15
- import pydantic
16
- if pydantic.__version__.startswith("1."):
17
- raise ImportError
18
- import pydantic.v1 as pydantic # type: ignore
19
- except ImportError:
20
- import pydantic # type: ignore
21
-
22
- # this is used as the default value for optional parameters
23
- OMIT = typing.cast(typing.Any, ...)
24
-
25
-
26
- class BillingClient:
27
- def __init__(self, *, client_wrapper: SyncClientWrapper):
28
- self._client_wrapper = client_wrapper
29
-
30
- def create_checkout_session(self, *, success_url: str, cancel_url: str) -> str:
31
- """
32
- Create a new checkout session.
33
-
34
- Parameters:
35
- - success_url: str.
36
-
37
- - cancel_url: str.
38
- ---
39
- from llama_cloud.client import LlamaCloud
40
-
41
- client = LlamaCloud(
42
- token="YOUR_TOKEN",
43
- base_url="https://yourhost.com/path/to/api",
44
- )
45
- client.billing.create_checkout_session(
46
- success_url="string",
47
- cancel_url="string",
48
- )
49
- """
50
- _response = self._client_wrapper.httpx_client.request(
51
- "POST",
52
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/billing/checkout-session"),
53
- json=jsonable_encoder({"success_url": success_url, "cancel_url": cancel_url}),
54
- headers=self._client_wrapper.get_headers(),
55
- timeout=60,
56
- )
57
- if 200 <= _response.status_code < 300:
58
- return pydantic.parse_obj_as(str, _response.json()) # type: ignore
59
- if _response.status_code == 422:
60
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
61
- try:
62
- _response_json = _response.json()
63
- except JSONDecodeError:
64
- raise ApiError(status_code=_response.status_code, body=_response.text)
65
- raise ApiError(status_code=_response.status_code, body=_response_json)
66
-
67
- def create_customer_portal_session(self, *, return_url: str) -> str:
68
- """
69
- Create a new customer portal session.
70
-
71
- Parameters:
72
- - return_url: str.
73
- ---
74
- from llama_cloud.client import LlamaCloud
75
-
76
- client = LlamaCloud(
77
- token="YOUR_TOKEN",
78
- base_url="https://yourhost.com/path/to/api",
79
- )
80
- client.billing.create_customer_portal_session(
81
- return_url="string",
82
- )
83
- """
84
- _response = self._client_wrapper.httpx_client.request(
85
- "POST",
86
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/billing/customer-portal-session"),
87
- json=jsonable_encoder({"return_url": return_url}),
88
- headers=self._client_wrapper.get_headers(),
89
- timeout=60,
90
- )
91
- if 200 <= _response.status_code < 300:
92
- return pydantic.parse_obj_as(str, _response.json()) # type: ignore
93
- if _response.status_code == 422:
94
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
95
- try:
96
- _response_json = _response.json()
97
- except JSONDecodeError:
98
- raise ApiError(status_code=_response.status_code, body=_response.text)
99
- raise ApiError(status_code=_response.status_code, body=_response_json)
100
-
101
- def stripe_webhook(self, *, stripe_signature: typing.Optional[str] = None) -> typing.Any:
102
- """
103
- Stripe webhook endpoint.
104
-
105
- Parameters:
106
- - stripe_signature: typing.Optional[str].
107
- ---
108
- from llama_cloud.client import LlamaCloud
109
-
110
- client = LlamaCloud(
111
- token="YOUR_TOKEN",
112
- base_url="https://yourhost.com/path/to/api",
113
- )
114
- client.billing.stripe_webhook()
115
- """
116
- _response = self._client_wrapper.httpx_client.request(
117
- "POST",
118
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/billing/webhook"),
119
- headers=remove_none_from_dict({**self._client_wrapper.get_headers(), "stripe-signature": stripe_signature}),
120
- timeout=60,
121
- )
122
- if 200 <= _response.status_code < 300:
123
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
124
- if _response.status_code == 422:
125
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
126
- try:
127
- _response_json = _response.json()
128
- except JSONDecodeError:
129
- raise ApiError(status_code=_response.status_code, body=_response.text)
130
- raise ApiError(status_code=_response.status_code, body=_response_json)
131
-
132
-
133
- class AsyncBillingClient:
134
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
135
- self._client_wrapper = client_wrapper
136
-
137
- async def create_checkout_session(self, *, success_url: str, cancel_url: str) -> str:
138
- """
139
- Create a new checkout session.
140
-
141
- Parameters:
142
- - success_url: str.
143
-
144
- - cancel_url: str.
145
- ---
146
- from llama_cloud.client import AsyncLlamaCloud
147
-
148
- client = AsyncLlamaCloud(
149
- token="YOUR_TOKEN",
150
- base_url="https://yourhost.com/path/to/api",
151
- )
152
- await client.billing.create_checkout_session(
153
- success_url="string",
154
- cancel_url="string",
155
- )
156
- """
157
- _response = await self._client_wrapper.httpx_client.request(
158
- "POST",
159
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/billing/checkout-session"),
160
- json=jsonable_encoder({"success_url": success_url, "cancel_url": cancel_url}),
161
- headers=self._client_wrapper.get_headers(),
162
- timeout=60,
163
- )
164
- if 200 <= _response.status_code < 300:
165
- return pydantic.parse_obj_as(str, _response.json()) # type: ignore
166
- if _response.status_code == 422:
167
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
168
- try:
169
- _response_json = _response.json()
170
- except JSONDecodeError:
171
- raise ApiError(status_code=_response.status_code, body=_response.text)
172
- raise ApiError(status_code=_response.status_code, body=_response_json)
173
-
174
- async def create_customer_portal_session(self, *, return_url: str) -> str:
175
- """
176
- Create a new customer portal session.
177
-
178
- Parameters:
179
- - return_url: str.
180
- ---
181
- from llama_cloud.client import AsyncLlamaCloud
182
-
183
- client = AsyncLlamaCloud(
184
- token="YOUR_TOKEN",
185
- base_url="https://yourhost.com/path/to/api",
186
- )
187
- await client.billing.create_customer_portal_session(
188
- return_url="string",
189
- )
190
- """
191
- _response = await self._client_wrapper.httpx_client.request(
192
- "POST",
193
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/billing/customer-portal-session"),
194
- json=jsonable_encoder({"return_url": return_url}),
195
- headers=self._client_wrapper.get_headers(),
196
- timeout=60,
197
- )
198
- if 200 <= _response.status_code < 300:
199
- return pydantic.parse_obj_as(str, _response.json()) # type: ignore
200
- if _response.status_code == 422:
201
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
202
- try:
203
- _response_json = _response.json()
204
- except JSONDecodeError:
205
- raise ApiError(status_code=_response.status_code, body=_response.text)
206
- raise ApiError(status_code=_response.status_code, body=_response_json)
207
-
208
- async def stripe_webhook(self, *, stripe_signature: typing.Optional[str] = None) -> typing.Any:
209
- """
210
- Stripe webhook endpoint.
211
-
212
- Parameters:
213
- - stripe_signature: typing.Optional[str].
214
- ---
215
- from llama_cloud.client import AsyncLlamaCloud
216
-
217
- client = AsyncLlamaCloud(
218
- token="YOUR_TOKEN",
219
- base_url="https://yourhost.com/path/to/api",
220
- )
221
- await client.billing.stripe_webhook()
222
- """
223
- _response = await self._client_wrapper.httpx_client.request(
224
- "POST",
225
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/billing/webhook"),
226
- headers=remove_none_from_dict({**self._client_wrapper.get_headers(), "stripe-signature": stripe_signature}),
227
- timeout=60,
228
- )
229
- if 200 <= _response.status_code < 300:
230
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
231
- if _response.status_code == 422:
232
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
233
- try:
234
- _response_json = _response.json()
235
- except JSONDecodeError:
236
- raise ApiError(status_code=_response.status_code, body=_response.text)
237
- raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -1,2 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-