Skip to content

Create item request

CreateItemRequest

Bases: BaseFormItem

Create an item in a form.

Source code in pygsuite/forms/generated/create_item_request.py
class CreateItemRequest(BaseFormItem):
    """
    Create an item in a form.
    """

    def __init__(  # noqa: C901
        self,
        item: Optional["Item"] = None,
        location: Optional["Location"] = None,
        object_info: Optional[Dict] = None,
    ):
        generated: Dict = {}

        if item is not None:

            generated["item"] = item._info
        if location is not None:

            generated["location"] = location._info
        object_info = object_info or generated
        super().__init__(object_info=object_info)

    @property
    def item(self) -> "Item":
        return Item(object_info=self._info.get("item"))

    @item.setter
    def item(self, value: "Item"):
        if self._info.get("item", None) == value:
            return
        self._info["item"] = value

    @property
    def location(self) -> "Location":
        return Location(object_info=self._info.get("location"))

    @location.setter
    def location(self, value: "Location"):
        if self._info.get("location", None) == value:
            return
        self._info["location"] = value

    @property
    def wire_format(self) -> dict:
        base = "CreateItem"
        base = base[0].lower() + base[1:]

        return {base: self._info}