Elffuss BraidHub

kikocis/continue public

673d347e418c · 3.5 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, StrictStr
21from typing import Any, ClassVar, Dict, List, Optional
22from typing import Optional, Set
23from typing_extensions import Self
24
25class SyncSecretsRequest(BaseModel):
26 """
27 SyncSecretsRequest
28 """ # noqa: E501
29 fqsns: List[Dict[str, Any]] = Field(description="Array of Fully Qualified Secret Names to resolve")
30 org_scope_id: Optional[StrictStr] = Field(default=None, description="Organization ID to scope secret resolution to", alias="orgScopeId")
31 org_scope_slug: Optional[StrictStr] = Field(default=None, description="Organization slug to scope secret resolution to", alias="orgScopeSlug")
32 __properties: ClassVar[List[str]] = ["fqsns", "orgScopeId", "orgScopeSlug"]
33
34 model_config = ConfigDict(
35 populate_by_name=True,
36 validate_assignment=True,
37 protected_namespaces=(),
38 )
39
40
41 def to_str(self) -> str:
42 """Returns the string representation of the model using alias"""
43 return pprint.pformat(self.model_dump(by_alias=True))
44
45 def to_json(self) -> str:
46 """Returns the JSON representation of the model using alias"""
47 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48 return json.dumps(self.to_dict())
49
50 @classmethod
51 def from_json(cls, json_str: str) -> Optional[Self]:
52 """Create an instance of SyncSecretsRequest from a JSON string"""
53 return cls.from_dict(json.loads(json_str))
54
55 def to_dict(self) -> Dict[str, Any]:
56 """Return the dictionary representation of the model using alias.
57
58 This has the following differences from calling pydantic's
59 `self.model_dump(by_alias=True)`:
60
61 * `None` is only added to the output dict for nullable fields that
62 were set at model initialization. Other fields with value `None`
63 are ignored.
64 """
65 excluded_fields: Set[str] = set([
66 ])
67
68 _dict = self.model_dump(
69 by_alias=True,
70 exclude=excluded_fields,
71 exclude_none=True,
72 )
73 # set to None if org_scope_id (nullable) is None
74 # and model_fields_set contains the field
75 if self.org_scope_id is None and "org_scope_id" in self.model_fields_set:
76 _dict['orgScopeId'] = None
77
78 # set to None if org_scope_slug (nullable) is None
79 # and model_fields_set contains the field
80 if self.org_scope_slug is None and "org_scope_slug" in self.model_fields_set:
81 _dict['orgScopeSlug'] = None
82
83 return _dict
84
85 @classmethod
86 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87 """Create an instance of SyncSecretsRequest from a dict"""
88 if obj is None:
89 return None
90
91 if not isinstance(obj, dict):
92 return cls.model_validate(obj)
93
94 _obj = cls.model_validate({
95 "fqsns": obj.get("fqsns"),
96 "orgScopeId": obj.get("orgScopeId"),
97 "orgScopeSlug": obj.get("orgScopeSlug")
98 })
99 return _obj
100
101