Elffuss BraidHub

kikocis/continue public

fdb4bc65ad03 · 4.9 KiBRawPermalink
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
15from __future__ import annotations
16import pprint
17import re # noqa: F401
18import json
19
20from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
21from typing import Any, ClassVar, Dict, List, Optional
22from openapi_client.models.list_assistants200_response_inner_config_result import ListAssistants200ResponseInnerConfigResult
23from typing import Optional, Set
24from typing_extensions import Self
25
26class GetAssistant200Response(BaseModel):
27 """
28 GetAssistant200Response
29 """ # noqa: E501
30 config_result: ListAssistants200ResponseInnerConfigResult = Field(alias="configResult")
31 owner_slug: StrictStr = Field(description="Slug of the user or organization that owns the assistant", alias="ownerSlug")
32 package_slug: StrictStr = Field(description="Slug of the assistant package", alias="packageSlug")
33 icon_url: Optional[StrictStr] = Field(default=None, description="Pre-signed URL for the assistant's icon", alias="iconUrl")
34 on_prem_proxy_url: Optional[StrictStr] = Field(default=None, description="URL of the on-premises proxy if the organization uses one", alias="onPremProxyUrl")
35 use_on_prem_proxy: Optional[StrictBool] = Field(default=None, description="Whether the organization uses an on-premises proxy", alias="useOnPremProxy")
36 raw_yaml: Optional[StrictStr] = Field(default=None, description="Raw YAML configuration of the assistant", alias="rawYaml")
37 __properties: ClassVar[List[str]] = ["configResult", "ownerSlug", "packageSlug", "iconUrl", "onPremProxyUrl", "useOnPremProxy", "rawYaml"]
38
39 model_config = ConfigDict(
40 populate_by_name=True,
41 validate_assignment=True,
42 protected_namespaces=(),
43 )
44
45
46 def to_str(self) -> str:
47 """Returns the string representation of the model using alias"""
48 return pprint.pformat(self.model_dump(by_alias=True))
49
50 def to_json(self) -> str:
51 """Returns the JSON representation of the model using alias"""
52 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53 return json.dumps(self.to_dict())
54
55 @classmethod
56 def from_json(cls, json_str: str) -> Optional[Self]:
57 """Create an instance of GetAssistant200Response from a JSON string"""
58 return cls.from_dict(json.loads(json_str))
59
60 def to_dict(self) -> Dict[str, Any]:
61 """Return the dictionary representation of the model using alias.
62
63 This has the following differences from calling pydantic's
64 `self.model_dump(by_alias=True)`:
65
66 * `None` is only added to the output dict for nullable fields that
67 were set at model initialization. Other fields with value `None`
68 are ignored.
69 """
70 excluded_fields: Set[str] = set([
71 ])
72
73 _dict = self.model_dump(
74 by_alias=True,
75 exclude=excluded_fields,
76 exclude_none=True,
77 )
78 # override the default output from pydantic by calling `to_dict()` of config_result
79 if self.config_result:
80 _dict['configResult'] = self.config_result.to_dict()
81 # set to None if icon_url (nullable) is None
82 # and model_fields_set contains the field
83 if self.icon_url is None and "icon_url" in self.model_fields_set:
84 _dict['iconUrl'] = None
85
86 # set to None if on_prem_proxy_url (nullable) is None
87 # and model_fields_set contains the field
88 if self.on_prem_proxy_url is None and "on_prem_proxy_url" in self.model_fields_set:
89 _dict['onPremProxyUrl'] = None
90
91 # set to None if use_on_prem_proxy (nullable) is None
92 # and model_fields_set contains the field
93 if self.use_on_prem_proxy is None and "use_on_prem_proxy" in self.model_fields_set:
94 _dict['useOnPremProxy'] = None
95
96 return _dict
97
98 @classmethod
99 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
100 """Create an instance of GetAssistant200Response from a dict"""
101 if obj is None:
102 return None
103
104 if not isinstance(obj, dict):
105 return cls.model_validate(obj)
106
107 _obj = cls.model_validate({
108 "configResult": ListAssistants200ResponseInnerConfigResult.from_dict(obj["configResult"]) if obj.get("configResult") is not None else None,
109 "ownerSlug": obj.get("ownerSlug"),
110 "packageSlug": obj.get("packageSlug"),
111 "iconUrl": obj.get("iconUrl"),
112 "onPremProxyUrl": obj.get("onPremProxyUrl"),
113 "useOnPremProxy": obj.get("useOnPremProxy"),
114 "rawYaml": obj.get("rawYaml")
115 })
116 return _obj
117
118