|
| 1 | +from http import HTTPStatus |
| 2 | +from typing import Any, Dict, List, Optional, Union |
| 3 | + |
| 4 | +import httpx |
| 5 | + |
| 6 | +from ... import errors |
| 7 | +from ...client import AuthenticatedClient, Client |
| 8 | +from ...models.label_model import LabelModel |
| 9 | +from ...types import UNSET, Response, Unset |
| 10 | + |
| 11 | + |
| 12 | +def _get_kwargs( |
| 13 | + *, |
| 14 | + page: Union[Unset, None, int] = UNSET, |
| 15 | + limit: Union[Unset, None, int] = UNSET, |
| 16 | + prefix: Union[Unset, None, str] = UNSET, |
| 17 | + filter_: Union[Unset, None, str] = UNSET, |
| 18 | +) -> Dict[str, Any]: |
| 19 | + pass |
| 20 | + |
| 21 | + params: Dict[str, Any] = {} |
| 22 | + params["page"] = page |
| 23 | + |
| 24 | + params["limit"] = limit |
| 25 | + |
| 26 | + params["prefix"] = prefix |
| 27 | + |
| 28 | + params["filter"] = filter_ |
| 29 | + |
| 30 | + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} |
| 31 | + |
| 32 | + return { |
| 33 | + "method": "get", |
| 34 | + "url": "api/labels/columns", |
| 35 | + "params": params, |
| 36 | + } |
| 37 | + |
| 38 | + |
| 39 | +def _parse_response( |
| 40 | + *, client: Union[AuthenticatedClient, Client], response: httpx.Response |
| 41 | +) -> Optional[List["LabelModel"]]: |
| 42 | + if response.status_code == HTTPStatus.OK: |
| 43 | + response_200 = [] |
| 44 | + _response_200 = response.json() |
| 45 | + for response_200_item_data in _response_200: |
| 46 | + response_200_item = LabelModel.from_dict(response_200_item_data) |
| 47 | + |
| 48 | + response_200.append(response_200_item) |
| 49 | + |
| 50 | + return response_200 |
| 51 | + if client.raise_on_unexpected_status: |
| 52 | + raise errors.UnexpectedStatus(response.status_code, response.content) |
| 53 | + else: |
| 54 | + return None |
| 55 | + |
| 56 | + |
| 57 | +def _build_response( |
| 58 | + *, client: Union[AuthenticatedClient, Client], response: httpx.Response |
| 59 | +) -> Response[List["LabelModel"]]: |
| 60 | + return Response( |
| 61 | + status_code=HTTPStatus(response.status_code), |
| 62 | + content=response.content, |
| 63 | + headers=response.headers, |
| 64 | + parsed=_parse_response(client=client, response=response), |
| 65 | + ) |
| 66 | + |
| 67 | + |
| 68 | +def sync_detailed( |
| 69 | + *, |
| 70 | + client: AuthenticatedClient, |
| 71 | + page: Union[Unset, None, int] = UNSET, |
| 72 | + limit: Union[Unset, None, int] = UNSET, |
| 73 | + prefix: Union[Unset, None, str] = UNSET, |
| 74 | + filter_: Union[Unset, None, str] = UNSET, |
| 75 | +) -> Response[List["LabelModel"]]: |
| 76 | + """getAllLabelsForColumns |
| 77 | +
|
| 78 | + Returns a list of all labels applied to columns, including the count of assignments to these data |
| 79 | + assets. |
| 80 | +
|
| 81 | + Args: |
| 82 | + page (Union[Unset, None, int]): |
| 83 | + limit (Union[Unset, None, int]): |
| 84 | + prefix (Union[Unset, None, str]): |
| 85 | + filter_ (Union[Unset, None, str]): |
| 86 | +
|
| 87 | + Raises: |
| 88 | + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
| 89 | + httpx.TimeoutException: If the request takes longer than Client.timeout. |
| 90 | +
|
| 91 | + Returns: |
| 92 | + Response[List['LabelModel']] |
| 93 | + """ |
| 94 | + |
| 95 | + kwargs = _get_kwargs( |
| 96 | + page=page, |
| 97 | + limit=limit, |
| 98 | + prefix=prefix, |
| 99 | + filter_=filter_, |
| 100 | + ) |
| 101 | + |
| 102 | + response = client.get_httpx_client().request( |
| 103 | + **kwargs, |
| 104 | + ) |
| 105 | + |
| 106 | + return _build_response(client=client, response=response) |
| 107 | + |
| 108 | + |
| 109 | +def sync( |
| 110 | + *, |
| 111 | + client: AuthenticatedClient, |
| 112 | + page: Union[Unset, None, int] = UNSET, |
| 113 | + limit: Union[Unset, None, int] = UNSET, |
| 114 | + prefix: Union[Unset, None, str] = UNSET, |
| 115 | + filter_: Union[Unset, None, str] = UNSET, |
| 116 | +) -> Optional[List["LabelModel"]]: |
| 117 | + """getAllLabelsForColumns |
| 118 | +
|
| 119 | + Returns a list of all labels applied to columns, including the count of assignments to these data |
| 120 | + assets. |
| 121 | +
|
| 122 | + Args: |
| 123 | + page (Union[Unset, None, int]): |
| 124 | + limit (Union[Unset, None, int]): |
| 125 | + prefix (Union[Unset, None, str]): |
| 126 | + filter_ (Union[Unset, None, str]): |
| 127 | +
|
| 128 | + Raises: |
| 129 | + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
| 130 | + httpx.TimeoutException: If the request takes longer than Client.timeout. |
| 131 | +
|
| 132 | + Returns: |
| 133 | + List['LabelModel'] |
| 134 | + """ |
| 135 | + |
| 136 | + return sync_detailed( |
| 137 | + client=client, |
| 138 | + page=page, |
| 139 | + limit=limit, |
| 140 | + prefix=prefix, |
| 141 | + filter_=filter_, |
| 142 | + ).parsed |
| 143 | + |
| 144 | + |
| 145 | +async def asyncio_detailed( |
| 146 | + *, |
| 147 | + client: AuthenticatedClient, |
| 148 | + page: Union[Unset, None, int] = UNSET, |
| 149 | + limit: Union[Unset, None, int] = UNSET, |
| 150 | + prefix: Union[Unset, None, str] = UNSET, |
| 151 | + filter_: Union[Unset, None, str] = UNSET, |
| 152 | +) -> Response[List["LabelModel"]]: |
| 153 | + """getAllLabelsForColumns |
| 154 | +
|
| 155 | + Returns a list of all labels applied to columns, including the count of assignments to these data |
| 156 | + assets. |
| 157 | +
|
| 158 | + Args: |
| 159 | + page (Union[Unset, None, int]): |
| 160 | + limit (Union[Unset, None, int]): |
| 161 | + prefix (Union[Unset, None, str]): |
| 162 | + filter_ (Union[Unset, None, str]): |
| 163 | +
|
| 164 | + Raises: |
| 165 | + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
| 166 | + httpx.TimeoutException: If the request takes longer than Client.timeout. |
| 167 | +
|
| 168 | + Returns: |
| 169 | + Response[List['LabelModel']] |
| 170 | + """ |
| 171 | + |
| 172 | + kwargs = _get_kwargs( |
| 173 | + page=page, |
| 174 | + limit=limit, |
| 175 | + prefix=prefix, |
| 176 | + filter_=filter_, |
| 177 | + ) |
| 178 | + |
| 179 | + response = await client.get_async_httpx_client().request(**kwargs) |
| 180 | + |
| 181 | + return _build_response(client=client, response=response) |
| 182 | + |
| 183 | + |
| 184 | +async def asyncio( |
| 185 | + *, |
| 186 | + client: AuthenticatedClient, |
| 187 | + page: Union[Unset, None, int] = UNSET, |
| 188 | + limit: Union[Unset, None, int] = UNSET, |
| 189 | + prefix: Union[Unset, None, str] = UNSET, |
| 190 | + filter_: Union[Unset, None, str] = UNSET, |
| 191 | +) -> Optional[List["LabelModel"]]: |
| 192 | + """getAllLabelsForColumns |
| 193 | +
|
| 194 | + Returns a list of all labels applied to columns, including the count of assignments to these data |
| 195 | + assets. |
| 196 | +
|
| 197 | + Args: |
| 198 | + page (Union[Unset, None, int]): |
| 199 | + limit (Union[Unset, None, int]): |
| 200 | + prefix (Union[Unset, None, str]): |
| 201 | + filter_ (Union[Unset, None, str]): |
| 202 | +
|
| 203 | + Raises: |
| 204 | + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. |
| 205 | + httpx.TimeoutException: If the request takes longer than Client.timeout. |
| 206 | +
|
| 207 | + Returns: |
| 208 | + List['LabelModel'] |
| 209 | + """ |
| 210 | + |
| 211 | + return ( |
| 212 | + await asyncio_detailed( |
| 213 | + client=client, |
| 214 | + page=page, |
| 215 | + limit=limit, |
| 216 | + prefix=prefix, |
| 217 | + filter_=filter_, |
| 218 | + ) |
| 219 | + ).parsed |
0 commit comments