Skip to content
  •  
  •  
  •  
76 changes: 70 additions & 6 deletions src/blaxel/core/client/api/agents/create_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,87 @@ def _get_kwargs(

def _parse_response(*, client: Client, response: httpx.Response) -> Union[Agent, Error] | None:
if response.status_code == 200:
response_200 = Agent.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_200 = Agent.from_dict(_response_content)

return response_200
if response.status_code == 400:
response_400 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_400 = Error.from_dict(_response_content)

return response_400
if response.status_code == 401:
response_401 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_401 = Error.from_dict(_response_content)

return response_401
if response.status_code == 403:
response_403 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_403 = Error.from_dict(_response_content)

return response_403
if response.status_code == 409:
response_409 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_409 = Error.from_dict(_response_content)

return response_409
if response.status_code == 500:
response_500 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_500 = Error.from_dict(_response_content)

return response_500
if client.raise_on_unexpected_status:
Expand Down Expand Up @@ -91,6 +151,7 @@ def sync_detailed(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down Expand Up @@ -126,6 +187,7 @@ def sync(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down Expand Up @@ -156,6 +218,7 @@ async def asyncio_detailed(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down Expand Up @@ -189,6 +252,7 @@ async def asyncio(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down
64 changes: 59 additions & 5 deletions src/blaxel/core/client/api/agents/delete_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,73 @@ def _get_kwargs(

def _parse_response(*, client: Client, response: httpx.Response) -> Union[Agent, Error] | None:
if response.status_code == 200:
response_200 = Agent.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_200 = Agent.from_dict(_response_content)

return response_200
if response.status_code == 401:
response_401 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_401 = Error.from_dict(_response_content)

return response_401
if response.status_code == 403:
response_403 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_403 = Error.from_dict(_response_content)

return response_403
if response.status_code == 404:
response_404 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_404 = Error.from_dict(_response_content)

return response_404
if response.status_code == 500:
response_500 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_500 = Error.from_dict(_response_content)

return response_500
if client.raise_on_unexpected_status:
Expand Down Expand Up @@ -72,6 +122,7 @@ def sync_detailed(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down Expand Up @@ -104,6 +155,7 @@ def sync(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down Expand Up @@ -131,6 +183,7 @@ async def asyncio_detailed(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down Expand Up @@ -161,6 +214,7 @@ async def asyncio(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down
64 changes: 59 additions & 5 deletions src/blaxel/core/client/api/agents/get_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,73 @@ def _get_kwargs(

def _parse_response(*, client: Client, response: httpx.Response) -> Union[Agent, Error] | None:
if response.status_code == 200:
response_200 = Agent.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_200 = Agent.from_dict(_response_content)

return response_200
if response.status_code == 401:
response_401 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_401 = Error.from_dict(_response_content)

return response_401
if response.status_code == 403:
response_403 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_403 = Error.from_dict(_response_content)

return response_403
if response.status_code == 404:
response_404 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_404 = Error.from_dict(_response_content)

return response_404
if response.status_code == 500:
response_500 = Error.from_dict(response.json())
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_500 = Error.from_dict(_response_content)

return response_500
if client.raise_on_unexpected_status:
Expand Down Expand Up @@ -83,6 +133,7 @@ def sync_detailed(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down Expand Up @@ -118,6 +169,7 @@ def sync(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down Expand Up @@ -148,6 +200,7 @@ async def asyncio_detailed(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down Expand Up @@ -181,6 +234,7 @@ async def asyncio(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down
16 changes: 15 additions & 1 deletion src/blaxel/core/client/api/agents/list_agent_revisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,18 @@ def _get_kwargs(

def _parse_response(*, client: Client, response: httpx.Response) -> list["RevisionMetadata"] | None:
if response.status_code == 200:
try:
_response_content = response.json()
except ValueError as exc:
if client.raise_on_unexpected_status:
raise errors.ResponseParseError(
response.status_code,
response.content,
response.headers.get("Content-Type"),
) from exc
return None
response_200 = []
_response_200 = response.json()
_response_200 = _response_content
for response_200_item_data in _response_200:
response_200_item = RevisionMetadata.from_dict(response_200_item_data)

Expand Down Expand Up @@ -59,6 +69,7 @@ def sync_detailed(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down Expand Up @@ -88,6 +99,7 @@ def sync(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand All @@ -112,6 +124,7 @@ async def asyncio_detailed(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down Expand Up @@ -139,6 +152,7 @@ async def asyncio(

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
errors.ResponseParseError: If a documented response body cannot be parsed and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Expand Down
Loading
Loading