Coverage for src/hush_hush/_generated/models/patch_object_request.py: 45%
49 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-16 16:01 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-16 16:01 +0000
1# Code generated by openapi-python-client from hush-hush/api/openapi.yaml; DO NOT EDIT.
3from __future__ import annotations
5from collections.abc import Mapping
6from typing import Any, TypeVar, cast
8from attrs import define as _attrs_define
9from attrs import field as _attrs_field
11from ..types import UNSET, Unset
13T = TypeVar("T", bound="PatchObjectRequest")
16@_attrs_define
17class PatchObjectRequest:
18 """At least one of `description`, `slug` or `tags` is required; a field
19 left out leaves that aspect of the object unchanged.
21 Attributes:
22 description (str | Unset): Replaces the description. An empty string clears it.
23 slug (str | Unset): Renames the object, in the same shape as `ObjectSlug`. Every
24 variant of the name moves to the new slug. It must not already
25 have objects.
26 tags (list[str] | Unset): Labels for grouping and filtering objects (`GET /objects?tag=`).
27 Free-form, 1 to 32 characters from `a-z 0-9 . _ / -`, at most 10
28 per object. Uppercase is converted to lowercase and duplicates are dropped.
29 Metadata only - never part of the sealed value. A response always
30 carries the array, empty when the object has none.
31 """
33 description: str | Unset = UNSET
34 slug: str | Unset = UNSET
35 tags: list[str] | Unset = UNSET
36 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
38 def to_dict(self) -> dict[str, Any]:
39 description = self.description
41 slug = self.slug
43 tags: list[str] | Unset = UNSET
44 if not isinstance(self.tags, Unset):
45 tags = self.tags
47 field_dict: dict[str, Any] = {}
48 field_dict.update(self.additional_properties)
49 field_dict.update({})
50 if description is not UNSET:
51 field_dict["description"] = description
52 if slug is not UNSET:
53 field_dict["slug"] = slug
54 if tags is not UNSET:
55 field_dict["tags"] = tags
57 return field_dict
59 @classmethod
60 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
61 d = dict(src_dict)
62 description = d.pop("description", UNSET)
64 slug = d.pop("slug", UNSET)
66 tags = cast(list[str], d.pop("tags", UNSET))
68 patch_object_request = cls(
69 description=description,
70 slug=slug,
71 tags=tags,
72 )
74 patch_object_request.additional_properties = d
75 return patch_object_request
77 @property
78 def additional_keys(self) -> list[str]:
79 return list(self.additional_properties.keys())
81 def __getitem__(self, key: str) -> Any:
82 return self.additional_properties[key]
84 def __setitem__(self, key: str, value: Any) -> None:
85 self.additional_properties[key] = value
87 def __delitem__(self, key: str) -> None:
88 del self.additional_properties[key]
90 def __contains__(self, key: str) -> bool:
91 return key in self.additional_properties