Skip to content

Commit acfcf91

Browse files
committed
tmp kiln server api client code
1 parent 60828b6 commit acfcf91

Some content is hidden

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

45 files changed

+3722
-34
lines changed

app/desktop/studio_server/api_client/kiln_ai_server_client/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# kiln-ai-server-client
22

3+
**Important**: This folder is automatically generated. Do not make any edits, they will be replaced on next generation.
4+
35
A client library for accessing Kiln AI FastAPI Service
46

57
## Usage
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: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
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 ...types import Response
9+
10+
11+
def _get_kwargs() -> dict[str, Any]:
12+
_kwargs: dict[str, Any] = {
13+
"method": "get",
14+
"url": "/v1/ping",
15+
}
16+
17+
return _kwargs
18+
19+
20+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None:
21+
if response.status_code == 200:
22+
response_200 = response.text
23+
return response_200
24+
25+
if client.raise_on_unexpected_status:
26+
raise errors.UnexpectedStatus(response.status_code, response.content)
27+
else:
28+
return None
29+
30+
31+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]:
32+
return Response(
33+
status_code=HTTPStatus(response.status_code),
34+
content=response.content,
35+
headers=response.headers,
36+
parsed=_parse_response(client=client, response=response),
37+
)
38+
39+
40+
def sync_detailed(
41+
*,
42+
client: AuthenticatedClient,
43+
) -> Response[str]:
44+
"""Secure Ping
45+
46+
Simple ping endpoint, with auth security.
47+
48+
Raises:
49+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
50+
httpx.TimeoutException: If the request takes longer than Client.timeout.
51+
52+
Returns:
53+
Response[str]
54+
"""
55+
56+
kwargs = _get_kwargs()
57+
58+
response = client.get_httpx_client().request(
59+
**kwargs,
60+
)
61+
62+
return _build_response(client=client, response=response)
63+
64+
65+
def sync(
66+
*,
67+
client: AuthenticatedClient,
68+
) -> str | None:
69+
"""Secure Ping
70+
71+
Simple ping endpoint, with auth security.
72+
73+
Raises:
74+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
75+
httpx.TimeoutException: If the request takes longer than Client.timeout.
76+
77+
Returns:
78+
str
79+
"""
80+
81+
return sync_detailed(
82+
client=client,
83+
).parsed
84+
85+
86+
async def asyncio_detailed(
87+
*,
88+
client: AuthenticatedClient,
89+
) -> Response[str]:
90+
"""Secure Ping
91+
92+
Simple ping endpoint, with auth security.
93+
94+
Raises:
95+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
96+
httpx.TimeoutException: If the request takes longer than Client.timeout.
97+
98+
Returns:
99+
Response[str]
100+
"""
101+
102+
kwargs = _get_kwargs()
103+
104+
response = await client.get_async_httpx_client().request(**kwargs)
105+
106+
return _build_response(client=client, response=response)
107+
108+
109+
async def asyncio(
110+
*,
111+
client: AuthenticatedClient,
112+
) -> str | None:
113+
"""Secure Ping
114+
115+
Simple ping endpoint, with auth security.
116+
117+
Raises:
118+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
119+
httpx.TimeoutException: If the request takes longer than Client.timeout.
120+
121+
Returns:
122+
str
123+
"""
124+
125+
return (
126+
await asyncio_detailed(
127+
client=client,
128+
)
129+
).parsed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
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.api_key_verification_result import ApiKeyVerificationResult
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/verify_api_key",
16+
}
17+
18+
return _kwargs
19+
20+
21+
def _parse_response(
22+
*, client: AuthenticatedClient | Client, response: httpx.Response
23+
) -> ApiKeyVerificationResult | None:
24+
if response.status_code == 200:
25+
response_200 = ApiKeyVerificationResult.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: AuthenticatedClient | Client, response: httpx.Response
37+
) -> Response[ApiKeyVerificationResult]:
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[ApiKeyVerificationResult]:
50+
"""Verify Api Key
51+
52+
Verify an API key. If auth passes, return a success response.
53+
54+
Raises:
55+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
56+
httpx.TimeoutException: If the request takes longer than Client.timeout.
57+
58+
Returns:
59+
Response[ApiKeyVerificationResult]
60+
"""
61+
62+
kwargs = _get_kwargs()
63+
64+
response = client.get_httpx_client().request(
65+
**kwargs,
66+
)
67+
68+
return _build_response(client=client, response=response)
69+
70+
71+
def sync(
72+
*,
73+
client: AuthenticatedClient,
74+
) -> ApiKeyVerificationResult | None:
75+
"""Verify Api Key
76+
77+
Verify an API key. If auth passes, return a success response.
78+
79+
Raises:
80+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
81+
httpx.TimeoutException: If the request takes longer than Client.timeout.
82+
83+
Returns:
84+
ApiKeyVerificationResult
85+
"""
86+
87+
return sync_detailed(
88+
client=client,
89+
).parsed
90+
91+
92+
async def asyncio_detailed(
93+
*,
94+
client: AuthenticatedClient,
95+
) -> Response[ApiKeyVerificationResult]:
96+
"""Verify Api Key
97+
98+
Verify an API key. If auth passes, return a success response.
99+
100+
Raises:
101+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
102+
httpx.TimeoutException: If the request takes longer than Client.timeout.
103+
104+
Returns:
105+
Response[ApiKeyVerificationResult]
106+
"""
107+
108+
kwargs = _get_kwargs()
109+
110+
response = await client.get_async_httpx_client().request(**kwargs)
111+
112+
return _build_response(client=client, response=response)
113+
114+
115+
async def asyncio(
116+
*,
117+
client: AuthenticatedClient,
118+
) -> ApiKeyVerificationResult | None:
119+
"""Verify Api Key
120+
121+
Verify an API key. If auth passes, return a success response.
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+
ApiKeyVerificationResult
129+
"""
130+
131+
return (
132+
await asyncio_detailed(
133+
client=client,
134+
)
135+
).parsed
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"""

0 commit comments

Comments
 (0)