Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,181 changes: 1,000 additions & 181 deletions openapi.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def sync_detailed(
Share an annotation queue with users by granting them specific roles.

Users can be specified by user_id or email. If using email and the user doesn't exist
in the organization, they will be invited automatically with the 'user' role.
in the organization, annotators are invited with the organization annotator role.
Other invitations use the 'user' role.

Roles: owner, annotator

Expand Down Expand Up @@ -131,7 +132,8 @@ def sync(
Share an annotation queue with users by granting them specific roles.

Users can be specified by user_id or email. If using email and the user doesn't exist
in the organization, they will be invited automatically with the 'user' role.
in the organization, annotators are invited with the organization annotator role.
Other invitations use the 'user' role.

Roles: owner, annotator

Expand All @@ -158,7 +160,8 @@ async def asyncio_detailed(
Share an annotation queue with users by granting them specific roles.

Users can be specified by user_id or email. If using email and the user doesn't exist
in the organization, they will be invited automatically with the 'user' role.
in the organization, annotators are invited with the organization annotator role.
Other invitations use the 'user' role.

Roles: owner, annotator

Expand Down Expand Up @@ -189,7 +192,8 @@ async def asyncio(
Share an annotation queue with users by granting them specific roles.

Users can be specified by user_id or email. If using email and the user doesn't exist
in the organization, they will be invited automatically with the 'user' role.
in the organization, annotators are invited with the organization annotator role.
Other invitations use the 'user' role.

Roles: owner, annotator

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
from http import HTTPStatus
from typing import Any, Optional

import httpx

from galileo_core.constants.request_method import RequestMethod
from galileo_core.helpers.api_client import ApiClient
from splunk_ao.exceptions import (
AuthenticationError,
BadRequestError,
ConflictError,
ForbiddenError,
NotFoundError,
RateLimitError,
ServerError,
)
from splunk_ao.utils.headers_data import get_sdk_header

from ... import errors
from ...models.http_validation_error import HTTPValidationError
from ...types import Response


def _get_kwargs(dataset_id: str) -> dict[str, Any]:
headers: dict[str, Any] = {}

_kwargs: dict[str, Any] = {
"method": RequestMethod.HEAD,
"return_raw_response": True,
"path": "/datasets/{dataset_id}/content".format(dataset_id=dataset_id),
}

headers["Splunk-AO-SDK"] = get_sdk_header()

_kwargs["content_headers"] = headers
return _kwargs


def _parse_response(*, client: ApiClient, response: httpx.Response) -> Any | HTTPValidationError:
if response.status_code == 200:
response_200 = response.json()
return response_200

if response.status_code == 422:
response_422 = HTTPValidationError.from_dict(response.json())

return response_422

# Handle common HTTP errors with actionable messages
if response.status_code == 400:
raise BadRequestError(response.status_code, response.content)
if response.status_code == 401:
raise AuthenticationError(response.status_code, response.content)
if response.status_code == 403:
raise ForbiddenError(response.status_code, response.content)
if response.status_code == 404:
raise NotFoundError(response.status_code, response.content)
if response.status_code == 409:
raise ConflictError(response.status_code, response.content)
if response.status_code == 429:
raise RateLimitError(response.status_code, response.content)
if response.status_code >= 500:
raise ServerError(response.status_code, response.content)
raise errors.UnexpectedStatus(response.status_code, response.content)


def _build_response(*, client: ApiClient, response: httpx.Response) -> Response[Any | HTTPValidationError]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(dataset_id: str, *, client: ApiClient) -> Response[Any | HTTPValidationError]:
"""Head Dataset Content

Return the authoritative content revision without transferring dataset rows.

Args:
dataset_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Any | HTTPValidationError]
"""

kwargs = _get_kwargs(dataset_id=dataset_id)

response = client.request(**kwargs)

return _build_response(client=client, response=response)


def sync(dataset_id: str, *, client: ApiClient) -> Optional[Any | HTTPValidationError]:
"""Head Dataset Content

Return the authoritative content revision without transferring dataset rows.

Args:
dataset_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Any | HTTPValidationError
"""

return sync_detailed(dataset_id=dataset_id, client=client).parsed


async def asyncio_detailed(dataset_id: str, *, client: ApiClient) -> Response[Any | HTTPValidationError]:
"""Head Dataset Content

Return the authoritative content revision without transferring dataset rows.

Args:
dataset_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Any | HTTPValidationError]
"""

kwargs = _get_kwargs(dataset_id=dataset_id)

response = await client.arequest(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(dataset_id: str, *, client: ApiClient) -> Optional[Any | HTTPValidationError]:
"""Head Dataset Content

Return the authoritative content revision without transferring dataset rows.

Args:
dataset_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Any | HTTPValidationError
"""

return (await asyncio_detailed(dataset_id=dataset_id, client=client)).parsed
Loading