Source code for annofabapi.pydantic_models.project_copy_request

"""


No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""

from __future__ import annotations

import json
import pprint
import re  # noqa: F401
from typing import Any, ClassVar, Dict, List, Set

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from typing_extensions import Self


[docs] class ProjectCopyRequest(BaseModel): """ ProjectCopyRequest """ dest_project_id: StrictStr = Field(description="プロジェクトID。[値の制約についてはこちら。](#section/API-Convention/APIID) ") dest_title: StrictStr = Field(description="コピー先プロジェクトのタイトル") dest_overview: StrictStr | None = Field(default=None, description="コピー先プロジェクトの概要") copy_inputs: StrictBool | None = Field(default=False, description="「入力データ」をコピーするかどうかを指定します。 ") copy_tasks: StrictBool | None = Field( default=False, description="「タスク」をコピーするかどうかを指定します。 この属性の値を`true`にする場合、他の属性の値を必ず次のように指定してください。 * `copy_inputs`の値を`true`とする ", ) copy_annotations: StrictBool | None = Field( default=False, description="「アノテーション」をコピーするかどうかを指定します。 この属性の値を`true`にする場合、他の属性の値を必ず次のように指定してください。 * `copy_inputs`の値を`true`とする * `copy_tasks`の値を`true`とする ", ) copy_webhooks: StrictBool | None = Field(default=False, description="「Webhook」をコピーするかどうかを指定します。 ") copy_supplementary_data: StrictBool | None = Field( default=False, description="「補助情報」をコピーするかどうかを指定します。 この属性の値を`true`にする場合、他の属性の値を必ず次のように指定してください。 * `copy_inputs`の値を`true`とする ", ) copy_instructions: StrictBool | None = Field(default=False, description="「作業ガイド」をコピーするかどうかを指定します。 ") __properties: ClassVar[List[str]] = [ "dest_project_id", "dest_title", "dest_overview", "copy_inputs", "copy_tasks", "copy_annotations", "copy_webhooks", "copy_supplementary_data", "copy_instructions", ] model_config = ConfigDict( populate_by_name=True, validate_assignment=True, protected_namespaces=(), )
[docs] def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True))
[docs] 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())
[docs] @classmethod def from_json(cls, json_str: str) -> Self | None: """Create an instance of ProjectCopyRequest from a JSON string""" return cls.from_dict(json.loads(json_str))
[docs] 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, ) return _dict
[docs] @classmethod def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None: """Create an instance of ProjectCopyRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) _obj = cls.model_validate( { "dest_project_id": obj.get("dest_project_id"), "dest_title": obj.get("dest_title"), "dest_overview": obj.get("dest_overview"), "copy_inputs": obj.get("copy_inputs") if obj.get("copy_inputs") is not None else False, "copy_tasks": obj.get("copy_tasks") if obj.get("copy_tasks") is not None else False, "copy_annotations": obj.get("copy_annotations") if obj.get("copy_annotations") is not None else False, "copy_webhooks": obj.get("copy_webhooks") if obj.get("copy_webhooks") is not None else False, "copy_supplementary_data": obj.get("copy_supplementary_data") if obj.get("copy_supplementary_data") is not None else False, "copy_instructions": obj.get("copy_instructions") if obj.get("copy_instructions") is not None else False, } ) return _obj