tvpl.api

<back to all web services

UpdateEquipmentRequest

Requires Authentication
The following routes are available for this service:
PUT/equipment/{Id}
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Equipment:
    id: int = 0
    # @Required()
    # @StringLength(500)
    name: Optional[str] = None

    # @StringLength(1000)
    image_url: Optional[str] = None

    description: Optional[str] = None
    # @StringLength(50)
    unit: Optional[str] = None

    material_type_id: Optional[int] = None
    status: int = 0
    is_deleted: Optional[bool] = None
    approved_at: Optional[datetime.datetime] = None
    approved_by: Optional[int] = None
    created_at: Optional[datetime.datetime] = None
    created_by: Optional[int] = None
    updated_at: Optional[datetime.datetime] = None
    updated_by: Optional[int] = None
    # @Ignore()
    material_type_name: Optional[str] = None

    # @Ignore()
    created_by_name: Optional[str] = None

    # @Ignore()
    approved_by_name: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class UpdateEquipmentRequest:
    id: int = 0
    name: Optional[str] = None
    image_url: Optional[str] = None
    description: Optional[str] = None
    unit: Optional[str] = None
    material_type_id: Optional[int] = None

Python UpdateEquipmentRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

PUT /equipment/{Id} HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	id: 0,
	name: String,
	imageUrl: String,
	description: String,
	unit: String,
	materialTypeId: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	id: 0,
	name: String,
	imageUrl: String,
	description: String,
	unit: String,
	materialTypeId: 0,
	status: 0,
	isDeleted: False,
	approvedAt: "0001-01-01T00:00:00.0000000+07:06",
	approvedBy: 0,
	createdAt: "0001-01-01T00:00:00.0000000+07:06",
	createdBy: 0,
	updatedAt: "0001-01-01T00:00:00.0000000+07:06",
	updatedBy: 0,
	materialTypeName: String,
	createdByName: String,
	approvedByName: String
}