| 1 | # coding: utf-8 |
| 2 | |
| 3 | """ |
| 4 | Continue Hub IDE API |
| 5 | |
| 6 | API for Continue IDE to fetch assistants and other related information. These endpoints are primarily used by the Continue IDE extensions for VS Code and JetBrains. |
| 7 | |
| 8 | The version of the OpenAPI document: 1.0.0 |
| 9 | Generated by OpenAPI Generator (https://openapi-generator.tech) |
| 10 | |
| 11 | Do not edit the class manually. |
| 12 | """ # noqa: E501 |
| 13 | |
| 14 | import warnings |
| 15 | from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt |
| 16 | from typing import Any, Dict, List, Optional, Tuple, Union |
| 17 | from typing_extensions import Annotated |
| 18 | |
| 19 | from pydantic import Field, StrictStr, field_validator |
| 20 | from typing import List, Optional |
| 21 | from typing_extensions import Annotated |
| 22 | from openapi_client.models.list_assistants200_response_inner import ListAssistants200ResponseInner |
| 23 | |
| 24 | from openapi_client.api_client import ApiClient, RequestSerialized |
| 25 | from openapi_client.api_response import ApiResponse |
| 26 | from openapi_client.rest import RESTResponseType |
| 27 | |
| 28 | |
| 29 | class DefaultApi: |
| 30 | """NOTE: This class is auto generated by OpenAPI Generator |
| 31 | Ref: https://openapi-generator.tech |
| 32 | |
| 33 | Do not edit the class manually. |
| 34 | """ |
| 35 | |
| 36 | def __init__(self, api_client=None) -> None: |
| 37 | if api_client is None: |
| 38 | api_client = ApiClient.get_default() |
| 39 | self.api_client = api_client |
| 40 | |
| 41 | |
| 42 | @validate_call |
| 43 | def list_assistants( |
| 44 | self, |
| 45 | always_use_proxy: Annotated[Optional[StrictStr], Field(description="Whether to always use the Continue-managed proxy for model requests")] = None, |
| 46 | organization_id: Annotated[Optional[StrictStr], Field(description="ID of the organization to scope assistants to. If not provided, personal assistants are returned.")] = None, |
| 47 | _request_timeout: Union[ |
| 48 | None, |
| 49 | Annotated[StrictFloat, Field(gt=0)], |
| 50 | Tuple[ |
| 51 | Annotated[StrictFloat, Field(gt=0)], |
| 52 | Annotated[StrictFloat, Field(gt=0)] |
| 53 | ] |
| 54 | ] = None, |
| 55 | _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 56 | _content_type: Optional[StrictStr] = None, |
| 57 | _headers: Optional[Dict[StrictStr, Any]] = None, |
| 58 | _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 59 | ) -> List[ListAssistants200ResponseInner]: |
| 60 | """List assistants for IDE |
| 61 | |
| 62 | Returns a complete list of assistants available to the user, with their full configurations, icons, and other metadata needed by the IDE to display and use them. This endpoint performs a full refresh of the list of assistants, including unrolling configurations and resolving secrets. |
| 63 | |
| 64 | :param always_use_proxy: Whether to always use the Continue-managed proxy for model requests |
| 65 | :type always_use_proxy: str |
| 66 | :param organization_id: ID of the organization to scope assistants to. If not provided, personal assistants are returned. |
| 67 | :type organization_id: str |
| 68 | :param _request_timeout: timeout setting for this request. If one |
| 69 | number provided, it will be total request |
| 70 | timeout. It can also be a pair (tuple) of |
| 71 | (connection, read) timeouts. |
| 72 | :type _request_timeout: int, tuple(int, int), optional |
| 73 | :param _request_auth: set to override the auth_settings for an a single |
| 74 | request; this effectively ignores the |
| 75 | authentication in the spec for a single request. |
| 76 | :type _request_auth: dict, optional |
| 77 | :param _content_type: force content-type for the request. |
| 78 | :type _content_type: str, Optional |
| 79 | :param _headers: set to override the headers for a single |
| 80 | request; this effectively ignores the headers |
| 81 | in the spec for a single request. |
| 82 | :type _headers: dict, optional |
| 83 | :param _host_index: set to override the host_index for a single |
| 84 | request; this effectively ignores the host_index |
| 85 | in the spec for a single request. |
| 86 | :type _host_index: int, optional |
| 87 | :return: Returns the result object. |
| 88 | """ # noqa: E501 |
| 89 | |
| 90 | _param = self._list_assistants_serialize( |
| 91 | always_use_proxy=always_use_proxy, |
| 92 | organization_id=organization_id, |
| 93 | _request_auth=_request_auth, |
| 94 | _content_type=_content_type, |
| 95 | _headers=_headers, |
| 96 | _host_index=_host_index |
| 97 | ) |
| 98 | |
| 99 | _response_types_map: Dict[str, Optional[str]] = { |
| 100 | '200': "List[ListAssistants200ResponseInner]", |
| 101 | '401': "ListAssistants401Response", |
| 102 | '404': "ListAssistants404Response", |
| 103 | } |
| 104 | response_data = self.api_client.call_api( |
| 105 | *_param, |
| 106 | _request_timeout=_request_timeout |
| 107 | ) |
| 108 | response_data.read() |
| 109 | return self.api_client.response_deserialize( |
| 110 | response_data=response_data, |
| 111 | response_types_map=_response_types_map, |
| 112 | ).data |
| 113 | |
| 114 | |
| 115 | @validate_call |
| 116 | def list_assistants_with_http_info( |
| 117 | self, |
| 118 | always_use_proxy: Annotated[Optional[StrictStr], Field(description="Whether to always use the Continue-managed proxy for model requests")] = None, |
| 119 | organization_id: Annotated[Optional[StrictStr], Field(description="ID of the organization to scope assistants to. If not provided, personal assistants are returned.")] = None, |
| 120 | _request_timeout: Union[ |
| 121 | None, |
| 122 | Annotated[StrictFloat, Field(gt=0)], |
| 123 | Tuple[ |
| 124 | Annotated[StrictFloat, Field(gt=0)], |
| 125 | Annotated[StrictFloat, Field(gt=0)] |
| 126 | ] |
| 127 | ] = None, |
| 128 | _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 129 | _content_type: Optional[StrictStr] = None, |
| 130 | _headers: Optional[Dict[StrictStr, Any]] = None, |
| 131 | _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 132 | ) -> ApiResponse[List[ListAssistants200ResponseInner]]: |
| 133 | """List assistants for IDE |
| 134 | |
| 135 | Returns a complete list of assistants available to the user, with their full configurations, icons, and other metadata needed by the IDE to display and use them. This endpoint performs a full refresh of the list of assistants, including unrolling configurations and resolving secrets. |
| 136 | |
| 137 | :param always_use_proxy: Whether to always use the Continue-managed proxy for model requests |
| 138 | :type always_use_proxy: str |
| 139 | :param organization_id: ID of the organization to scope assistants to. If not provided, personal assistants are returned. |
| 140 | :type organization_id: str |
| 141 | :param _request_timeout: timeout setting for this request. If one |
| 142 | number provided, it will be total request |
| 143 | timeout. It can also be a pair (tuple) of |
| 144 | (connection, read) timeouts. |
| 145 | :type _request_timeout: int, tuple(int, int), optional |
| 146 | :param _request_auth: set to override the auth_settings for an a single |
| 147 | request; this effectively ignores the |
| 148 | authentication in the spec for a single request. |
| 149 | :type _request_auth: dict, optional |
| 150 | :param _content_type: force content-type for the request. |
| 151 | :type _content_type: str, Optional |
| 152 | :param _headers: set to override the headers for a single |
| 153 | request; this effectively ignores the headers |
| 154 | in the spec for a single request. |
| 155 | :type _headers: dict, optional |
| 156 | :param _host_index: set to override the host_index for a single |
| 157 | request; this effectively ignores the host_index |
| 158 | in the spec for a single request. |
| 159 | :type _host_index: int, optional |
| 160 | :return: Returns the result object. |
| 161 | """ # noqa: E501 |
| 162 | |
| 163 | _param = self._list_assistants_serialize( |
| 164 | always_use_proxy=always_use_proxy, |
| 165 | organization_id=organization_id, |
| 166 | _request_auth=_request_auth, |
| 167 | _content_type=_content_type, |
| 168 | _headers=_headers, |
| 169 | _host_index=_host_index |
| 170 | ) |
| 171 | |
| 172 | _response_types_map: Dict[str, Optional[str]] = { |
| 173 | '200': "List[ListAssistants200ResponseInner]", |
| 174 | '401': "ListAssistants401Response", |
| 175 | '404': "ListAssistants404Response", |
| 176 | } |
| 177 | response_data = self.api_client.call_api( |
| 178 | *_param, |
| 179 | _request_timeout=_request_timeout |
| 180 | ) |
| 181 | response_data.read() |
| 182 | return self.api_client.response_deserialize( |
| 183 | response_data=response_data, |
| 184 | response_types_map=_response_types_map, |
| 185 | ) |
| 186 | |
| 187 | |
| 188 | @validate_call |
| 189 | def list_assistants_without_preload_content( |
| 190 | self, |
| 191 | always_use_proxy: Annotated[Optional[StrictStr], Field(description="Whether to always use the Continue-managed proxy for model requests")] = None, |
| 192 | organization_id: Annotated[Optional[StrictStr], Field(description="ID of the organization to scope assistants to. If not provided, personal assistants are returned.")] = None, |
| 193 | _request_timeout: Union[ |
| 194 | None, |
| 195 | Annotated[StrictFloat, Field(gt=0)], |
| 196 | Tuple[ |
| 197 | Annotated[StrictFloat, Field(gt=0)], |
| 198 | Annotated[StrictFloat, Field(gt=0)] |
| 199 | ] |
| 200 | ] = None, |
| 201 | _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 202 | _content_type: Optional[StrictStr] = None, |
| 203 | _headers: Optional[Dict[StrictStr, Any]] = None, |
| 204 | _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 205 | ) -> RESTResponseType: |
| 206 | """List assistants for IDE |
| 207 | |
| 208 | Returns a complete list of assistants available to the user, with their full configurations, icons, and other metadata needed by the IDE to display and use them. This endpoint performs a full refresh of the list of assistants, including unrolling configurations and resolving secrets. |
| 209 | |
| 210 | :param always_use_proxy: Whether to always use the Continue-managed proxy for model requests |
| 211 | :type always_use_proxy: str |
| 212 | :param organization_id: ID of the organization to scope assistants to. If not provided, personal assistants are returned. |
| 213 | :type organization_id: str |
| 214 | :param _request_timeout: timeout setting for this request. If one |
| 215 | number provided, it will be total request |
| 216 | timeout. It can also be a pair (tuple) of |
| 217 | (connection, read) timeouts. |
| 218 | :type _request_timeout: int, tuple(int, int), optional |
| 219 | :param _request_auth: set to override the auth_settings for an a single |
| 220 | request; this effectively ignores the |
| 221 | authentication in the spec for a single request. |
| 222 | :type _request_auth: dict, optional |
| 223 | :param _content_type: force content-type for the request. |
| 224 | :type _content_type: str, Optional |
| 225 | :param _headers: set to override the headers for a single |
| 226 | request; this effectively ignores the headers |
| 227 | in the spec for a single request. |
| 228 | :type _headers: dict, optional |
| 229 | :param _host_index: set to override the host_index for a single |
| 230 | request; this effectively ignores the host_index |
| 231 | in the spec for a single request. |
| 232 | :type _host_index: int, optional |
| 233 | :return: Returns the result object. |
| 234 | """ # noqa: E501 |
| 235 | |
| 236 | _param = self._list_assistants_serialize( |
| 237 | always_use_proxy=always_use_proxy, |
| 238 | organization_id=organization_id, |
| 239 | _request_auth=_request_auth, |
| 240 | _content_type=_content_type, |
| 241 | _headers=_headers, |
| 242 | _host_index=_host_index |
| 243 | ) |
| 244 | |
| 245 | _response_types_map: Dict[str, Optional[str]] = { |
| 246 | '200': "List[ListAssistants200ResponseInner]", |
| 247 | '401': "ListAssistants401Response", |
| 248 | '404': "ListAssistants404Response", |
| 249 | } |
| 250 | response_data = self.api_client.call_api( |
| 251 | *_param, |
| 252 | _request_timeout=_request_timeout |
| 253 | ) |
| 254 | return response_data.response |
| 255 | |
| 256 | |
| 257 | def _list_assistants_serialize( |
| 258 | self, |
| 259 | always_use_proxy, |
| 260 | organization_id, |
| 261 | _request_auth, |
| 262 | _content_type, |
| 263 | _headers, |
| 264 | _host_index, |
| 265 | ) -> RequestSerialized: |
| 266 | |
| 267 | _host = None |
| 268 | |
| 269 | _collection_formats: Dict[str, str] = { |
| 270 | } |
| 271 | |
| 272 | _path_params: Dict[str, str] = {} |
| 273 | _query_params: List[Tuple[str, str]] = [] |
| 274 | _header_params: Dict[str, Optional[str]] = _headers or {} |
| 275 | _form_params: List[Tuple[str, str]] = [] |
| 276 | _files: Dict[ |
| 277 | str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] |
| 278 | ] = {} |
| 279 | _body_params: Optional[bytes] = None |
| 280 | |
| 281 | # process the path parameters |
| 282 | # process the query parameters |
| 283 | if always_use_proxy is not None: |
| 284 | |
| 285 | _query_params.append(('alwaysUseProxy', always_use_proxy)) |
| 286 | |
| 287 | if organization_id is not None: |
| 288 | |
| 289 | _query_params.append(('organizationId', organization_id)) |
| 290 | |
| 291 | # process the header parameters |
| 292 | # process the form parameters |
| 293 | # process the body parameter |
| 294 | |
| 295 | |
| 296 | # set the HTTP header `Accept` |
| 297 | if 'Accept' not in _header_params: |
| 298 | _header_params['Accept'] = self.api_client.select_header_accept( |
| 299 | [ |
| 300 | 'application/json' |
| 301 | ] |
| 302 | ) |
| 303 | |
| 304 | |
| 305 | # authentication setting |
| 306 | _auth_settings: List[str] = [ |
| 307 | 'apiKeyAuth' |
| 308 | ] |
| 309 | |
| 310 | return self.api_client.param_serialize( |
| 311 | method='GET', |
| 312 | resource_path='/ide/list-assistants', |
| 313 | path_params=_path_params, |
| 314 | query_params=_query_params, |
| 315 | header_params=_header_params, |
| 316 | body=_body_params, |
| 317 | post_params=_form_params, |
| 318 | files=_files, |
| 319 | auth_settings=_auth_settings, |
| 320 | collection_formats=_collection_formats, |
| 321 | _host=_host, |
| 322 | _request_auth=_request_auth |
| 323 | ) |
| 324 | |
| 325 | |