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