Skip to content

Commit 04e8eb4

Browse files
committed
Rename package
1 parent d5f59d2 commit 04e8eb4

1,713 files changed

Lines changed: 157813 additions & 7613 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

‎griptape_cloud_client/__init__.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""A client library for accessing Griptape Cloud"""
2+
3+
from .client import AuthenticatedClient, Client
4+
5+
__all__ = (
6+
"AuthenticatedClient",
7+
"Client",
8+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains methods for accessing the API"""
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
from http import HTTPStatus
2+
from typing import Any
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: AuthenticatedClient | Client, response: httpx.Response
37+
) -> ClientErrorResponseContent | CreateApiKeyResponseContent | ServiceErrorResponseContent | None:
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+
return None
86+
87+
88+
def _build_response(
89+
*, client: AuthenticatedClient | Client, response: httpx.Response
90+
) -> Response[ClientErrorResponseContent | CreateApiKeyResponseContent | ServiceErrorResponseContent]:
91+
return Response(
92+
status_code=HTTPStatus(response.status_code),
93+
content=response.content,
94+
headers=response.headers,
95+
parsed=_parse_response(client=client, response=response),
96+
)
97+
98+
99+
def sync_detailed(
100+
user_id: str,
101+
*,
102+
client: AuthenticatedClient | Client,
103+
body: CreateApiKeyRequestContent,
104+
) -> Response[ClientErrorResponseContent | CreateApiKeyResponseContent | ServiceErrorResponseContent]:
105+
"""Args:
106+
user_id (str):
107+
body (CreateApiKeyRequestContent):
108+
109+
Raises:
110+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
111+
httpx.TimeoutException: If the request takes longer than Client.timeout.
112+
113+
Returns:
114+
Response[Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]]
115+
"""
116+
kwargs = _get_kwargs(
117+
user_id=user_id,
118+
body=body,
119+
)
120+
121+
response = client.get_httpx_client().request(
122+
**kwargs,
123+
)
124+
125+
return _build_response(client=client, response=response)
126+
127+
128+
def sync(
129+
user_id: str,
130+
*,
131+
client: AuthenticatedClient | Client,
132+
body: CreateApiKeyRequestContent,
133+
) -> ClientErrorResponseContent | CreateApiKeyResponseContent | ServiceErrorResponseContent | None:
134+
"""Args:
135+
user_id (str):
136+
body (CreateApiKeyRequestContent):
137+
138+
Raises:
139+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
140+
httpx.TimeoutException: If the request takes longer than Client.timeout.
141+
142+
Returns:
143+
Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]
144+
"""
145+
return sync_detailed(
146+
user_id=user_id,
147+
client=client,
148+
body=body,
149+
).parsed
150+
151+
152+
async def asyncio_detailed(
153+
user_id: str,
154+
*,
155+
client: AuthenticatedClient | Client,
156+
body: CreateApiKeyRequestContent,
157+
) -> Response[ClientErrorResponseContent | CreateApiKeyResponseContent | ServiceErrorResponseContent]:
158+
"""Args:
159+
user_id (str):
160+
body (CreateApiKeyRequestContent):
161+
162+
Raises:
163+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
164+
httpx.TimeoutException: If the request takes longer than Client.timeout.
165+
166+
Returns:
167+
Response[Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]]
168+
"""
169+
kwargs = _get_kwargs(
170+
user_id=user_id,
171+
body=body,
172+
)
173+
174+
response = await client.get_async_httpx_client().request(**kwargs)
175+
176+
return _build_response(client=client, response=response)
177+
178+
179+
async def asyncio(
180+
user_id: str,
181+
*,
182+
client: AuthenticatedClient | Client,
183+
body: CreateApiKeyRequestContent,
184+
) -> ClientErrorResponseContent | CreateApiKeyResponseContent | ServiceErrorResponseContent | None:
185+
"""Args:
186+
user_id (str):
187+
body (CreateApiKeyRequestContent):
188+
189+
Raises:
190+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
191+
httpx.TimeoutException: If the request takes longer than Client.timeout.
192+
193+
Returns:
194+
Union[ClientErrorResponseContent, CreateApiKeyResponseContent, ServiceErrorResponseContent]
195+
"""
196+
return (
197+
await asyncio_detailed(
198+
user_id=user_id,
199+
client=client,
200+
body=body,
201+
)
202+
).parsed

0 commit comments

Comments
 (0)