Source code for bungieapi.generated.components.schemas.content

# generated by update to not change manually
import dataclasses as dt
import typing as t

from bungieapi.json import to_json


[docs]@dt.dataclass(frozen=True) class ContentItemPublicContract: allow_comments: t.Optional[bool] = None author: t.Optional["GeneralUser"] = None auto_english_property_fallback: t.Optional[bool] = None c_type: t.Optional[str] = None cms_path: t.Optional[str] = None comment_summary: t.Optional["CommentSummary"] = None content_id: t.Optional[int] = None creation_date: t.Optional[str] = None has_age_gate: t.Optional[bool] = None minimum_age: t.Optional[int] = None modify_date: t.Optional[str] = None properties: t.Optional[ t.Mapping[str, t.Any] ] = None # Firehose content is really a collection of metadata and "properties", which are the potentially-but-not-strictly localizable data that comprises the meat of whatever content is being shown. As Cole Porter would have crooned, "Anything Goes" with Firehose properties. They are most often strings, but they can theoretically be anything. They are JSON encoded, and could be JSON structures, simple strings, numbers etc... The Content Type of the item (cType) will describe the properties, and thus how they ought to be deserialized. rating_image_path: t.Optional[str] = None representations: t.Optional[t.Sequence["ContentRepresentation"]] = None tags: t.Optional[t.Sequence[str]] = None # NOTE: Tags will always be lower case.
[docs] def to_json(self) -> t.Mapping[str, t.Any]: return { "contentId": to_json(self.content_id), "cType": to_json(self.c_type), "cmsPath": to_json(self.cms_path), "creationDate": to_json(self.creation_date), "modifyDate": to_json(self.modify_date), "allowComments": to_json(self.allow_comments), "hasAgeGate": to_json(self.has_age_gate), "minimumAge": to_json(self.minimum_age), "ratingImagePath": to_json(self.rating_image_path), "author": to_json(self.author), "autoEnglishPropertyFallback": to_json(self.auto_english_property_fallback), "properties": to_json(self.properties), "representations": to_json(self.representations), "tags": to_json(self.tags), "commentSummary": to_json(self.comment_summary), }
[docs]@dt.dataclass(frozen=True) class ContentRepresentation: name: t.Optional[str] = None path: t.Optional[str] = None validation_string: t.Optional[str] = None
[docs] def to_json(self) -> t.Mapping[str, t.Any]: return { "name": to_json(self.name), "path": to_json(self.path), "validationString": to_json(self.validation_string), }
[docs]@dt.dataclass(frozen=True) class CommentSummary: comment_count: t.Optional[int] = None topic_id: t.Optional[int] = None
[docs] def to_json(self) -> t.Mapping[str, t.Any]: return { "topicId": to_json(self.topic_id), "commentCount": to_json(self.comment_count), }
# imported at the end to do not case circular imports for type annotations from bungieapi.generated.components.schemas.user import GeneralUser # noqa: E402