Skip to content

Commit c582d96

Browse files
committed
Rename package
1 parent d5f59d2 commit c582d96

1,713 files changed

Lines changed: 149939 additions & 72787 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ check: check/format check/lint check/types check/spell ## Run all checks.
4242
.PHONY: check/format
4343
check/format:
4444
@uv run ruff format --check
45-
@uv run mdformat --check .github griptape_cloud_python_client *.md
45+
@uv run mdformat --check .github griptape_cloud_client *.md
4646

4747
.PHONY: check/lint
4848
check/lint:

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Add to your `pyproject.toml`:
2020

2121
```toml
2222
[tool.uv.sources]
23-
griptape-cloud-python-client = { git = "https://github.com/griptape-ai/griptape-cloud-python-client", rev = "main" }
23+
griptape-cloud-client = { git = "https://github.com/griptape-ai/griptape-cloud-python-client", rev = "main" }
2424
```
2525

2626
### Using pip
File renamed without changes.
File renamed without changes.
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
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.client_error_response_content import ClientErrorResponseContent
9+
from ...models.create_api_key_request_content import CreateApiKeyRequestContent
10+
from ...models.create_api_key_response_content import CreateApiKeyResponseContent
11+
from ...models.service_error_response_content import ServiceErrorResponseContent
12+
from ...types import Response
13+
14+
15+
def _get_kwargs(
16+
user_id: str,
17+
*,
18+
body: CreateApiKeyRequestContent,
19+
) -> dict[str, Any]:
20+
headers: dict[str, Any] = {}
21+
22+
_kwargs: dict[str, Any] = {
23+
"method": "post",
24+
"url": f"/users/{user_id}/api-keys",
25+
}
26+
27+
_kwargs["json"] = body.to_dict()
28+
29+
headers["Content-Type"] = "application/json"
30+
31+
_kwargs["headers"] = headers
32+
return _kwargs
33+
34+
35+
def _parse_response(
36+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
37+
) -> Optional[Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]]:
38+
if response.status_code == 201:
39+
response_201 = CreateApiKeyResponseContent.from_dict(response.json())
40+
41+
return response_201
42+
43+
if response.status_code == 400:
44+
response_400 = ClientErrorResponseContent.from_dict(response.json())
45+
46+
return response_400
47+
48+
if response.status_code == 401:
49+
response_401 = ClientErrorResponseContent.from_dict(response.json())
50+
51+
return response_401
52+
53+
if response.status_code == 403:
54+
response_403 = ClientErrorResponseContent.from_dict(response.json())
55+
56+
return response_403
57+
58+
if response.status_code == 404:
59+
response_404 = ClientErrorResponseContent.from_dict(response.json())
60+
61+
return response_404
62+
63+
if response.status_code == 406:
64+
response_406 = ClientErrorResponseContent.from_dict(response.json())
65+
66+
return response_406
67+
68+
if response.status_code == 409:
69+
response_409 = ClientErrorResponseContent.from_dict(response.json())
70+
71+
return response_409
72+
73+
if response.status_code == 422:
74+
response_422 = ClientErrorResponseContent.from_dict(response.json())
75+
76+
return response_422
77+
78+
if response.status_code == 500:
79+
response_500 = ServiceErrorResponseContent.from_dict(response.json())
80+
81+
return response_500
82+
83+
if client.raise_on_unexpected_status:
84+
raise errors.UnexpectedStatus(response.status_code, response.content)
85+
else:
86+
return None
87+
88+
89+
def _build_response(
90+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
91+
) -> Response[Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]]:
92+
return Response(
93+
status_code=HTTPStatus(response.status_code),
94+
content=response.content,
95+
headers=response.headers,
96+
parsed=_parse_response(client=client, response=response),
97+
)
98+
99+
100+
def sync_detailed(
101+
user_id: str,
102+
*,
103+
client: Union[AuthenticatedClient, Client],
104+
body: CreateApiKeyRequestContent,
105+
) -> Response[Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]]:
106+
"""
107+
Args:
108+
user_id (str):
109+
body (CreateApiKeyRequestContent):
110+
111+
Raises:
112+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
113+
httpx.TimeoutException: If the request takes longer than Client.timeout.
114+
115+
Returns:
116+
Response[Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]]
117+
"""
118+
119+
kwargs = _get_kwargs(
120+
user_id=user_id,
121+
body=body,
122+
)
123+
124+
response = client.get_httpx_client().request(
125+
**kwargs,
126+
)
127+
128+
return _build_response(client=client, response=response)
129+
130+
131+
def sync(
132+
user_id: str,
133+
*,
134+
client: Union[AuthenticatedClient, Client],
135+
body: CreateApiKeyRequestContent,
136+
) -> Optional[Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]]:
137+
"""
138+
Args:
139+
user_id (str):
140+
body (CreateApiKeyRequestContent):
141+
142+
Raises:
143+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
144+
httpx.TimeoutException: If the request takes longer than Client.timeout.
145+
146+
Returns:
147+
Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]
148+
"""
149+
150+
return sync_detailed(
151+
user_id=user_id,
152+
client=client,
153+
body=body,
154+
).parsed
155+
156+
157+
async def asyncio_detailed(
158+
user_id: str,
159+
*,
160+
client: Union[AuthenticatedClient, Client],
161+
body: CreateApiKeyRequestContent,
162+
) -> Response[Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]]:
163+
"""
164+
Args:
165+
user_id (str):
166+
body (CreateApiKeyRequestContent):
167+
168+
Raises:
169+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
170+
httpx.TimeoutException: If the request takes longer than Client.timeout.
171+
172+
Returns:
173+
Response[Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]]
174+
"""
175+
176+
kwargs = _get_kwargs(
177+
user_id=user_id,
178+
body=body,
179+
)
180+
181+
response = await client.get_async_httpx_client().request(**kwargs)
182+
183+
return _build_response(client=client, response=response)
184+
185+
186+
async def asyncio(
187+
user_id: str,
188+
*,
189+
client: Union[AuthenticatedClient, Client],
190+
body: CreateApiKeyRequestContent,
191+
) -> Optional[Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]]:
192+
"""
193+
Args:
194+
user_id (str):
195+
body (CreateApiKeyRequestContent):
196+
197+
Raises:
198+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
199+
httpx.TimeoutException: If the request takes longer than Client.timeout.
200+
201+
Returns:
202+
Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]
203+
"""
204+
205+
return (
206+
await asyncio_detailed(
207+
user_id=user_id,
208+
client=client,
209+
body=body,
210+
)
211+
).parsed

0 commit comments

Comments
 (0)