# coding: utf-8 """ goose-server An AI agent The version of the OpenAPI document: 1.9.0 Contact: ai-oss-tools@block.xyz Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. """ # noqa: E501 from __future__ import annotations import pprint import re # noqa: F401 import json from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self class SessionDisplayInfo(BaseModel): """ SessionDisplayInfo """ # noqa: E501 accumulated_input_tokens: Optional[StrictInt] = Field(default=None, alias="accumulatedInputTokens") accumulated_output_tokens: Optional[StrictInt] = Field(default=None, alias="accumulatedOutputTokens") accumulated_total_tokens: Optional[StrictInt] = Field(default=None, alias="accumulatedTotalTokens") created_at: StrictStr = Field(alias="createdAt") id: StrictStr input_tokens: Optional[StrictInt] = Field(default=None, alias="inputTokens") message_count: Annotated[int, Field(strict=True, ge=0)] = Field(alias="messageCount") name: StrictStr output_tokens: Optional[StrictInt] = Field(default=None, alias="outputTokens") schedule_id: Optional[StrictStr] = Field(default=None, alias="scheduleId") total_tokens: Optional[StrictInt] = Field(default=None, alias="totalTokens") working_dir: StrictStr = Field(alias="workingDir") __properties: ClassVar[List[str]] = ["accumulatedInputTokens", "accumulatedOutputTokens", "accumulatedTotalTokens", "createdAt", "id", "inputTokens", "messageCount", "name", "outputTokens", "scheduleId", "totalTokens", "workingDir"] model_config = ConfigDict( populate_by_name=True, validate_assignment=True, protected_namespaces=(), ) def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SessionDisplayInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's `self.model_dump(by_alias=True)`: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. """ excluded_fields: Set[str] = set([ ]) _dict = self.model_dump( by_alias=True, exclude=excluded_fields, exclude_none=True, ) # set to None if accumulated_input_tokens (nullable) is None # and model_fields_set contains the field if self.accumulated_input_tokens is None and "accumulated_input_tokens" in self.model_fields_set: _dict['accumulatedInputTokens'] = None # set to None if accumulated_output_tokens (nullable) is None # and model_fields_set contains the field if self.accumulated_output_tokens is None and "accumulated_output_tokens" in self.model_fields_set: _dict['accumulatedOutputTokens'] = None # set to None if accumulated_total_tokens (nullable) is None # and model_fields_set contains the field if self.accumulated_total_tokens is None and "accumulated_total_tokens" in self.model_fields_set: _dict['accumulatedTotalTokens'] = None # set to None if input_tokens (nullable) is None # and model_fields_set contains the field if self.input_tokens is None and "input_tokens" in self.model_fields_set: _dict['inputTokens'] = None # set to None if output_tokens (nullable) is None # and model_fields_set contains the field if self.output_tokens is None and "output_tokens" in self.model_fields_set: _dict['outputTokens'] = None # set to None if schedule_id (nullable) is None # and model_fields_set contains the field if self.schedule_id is None and "schedule_id" in self.model_fields_set: _dict['scheduleId'] = None # set to None if total_tokens (nullable) is None # and model_fields_set contains the field if self.total_tokens is None and "total_tokens" in self.model_fields_set: _dict['totalTokens'] = None return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SessionDisplayInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) _obj = cls.model_validate({ "accumulatedInputTokens": obj.get("accumulatedInputTokens"), "accumulatedOutputTokens": obj.get("accumulatedOutputTokens"), "accumulatedTotalTokens": obj.get("accumulatedTotalTokens"), "createdAt": obj.get("createdAt"), "id": obj.get("id"), "inputTokens": obj.get("inputTokens"), "messageCount": obj.get("messageCount"), "name": obj.get("name"), "outputTokens": obj.get("outputTokens"), "scheduleId": obj.get("scheduleId"), "totalTokens": obj.get("totalTokens"), "workingDir": obj.get("workingDir") }) return _obj