POST | /bookinglog | Add a new event to booking log | Add a new event to the booking of the company of the currently logged in user, only administrators are allowed to add items to event log. |
---|
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 BookingLogEventTypeResponse:
# @ApiMember(Description="The event type id")
id: int = 0
"""
The event type id
"""
# @ApiMember(Description="The event type name")
name: Optional[str] = None
"""
The event type name
"""
# @ApiMember(Description="The event type description")
description: Optional[str] = None
"""
The event type description
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BookingLogQueryResponse:
# @ApiMember(Description="The booking log id")
id: int = 0
"""
The booking log id
"""
# @ApiMember(Description="The booking id")
booking_id: int = 0
"""
The booking id
"""
# @ApiMember(Description="The type of event")
event_type_id: int = 0
"""
The type of event
"""
# @ApiMember(Description="The type of event")
event_type: Optional[BookingLogEventTypeResponse] = None
"""
The type of event
"""
# @ApiMember(Description="Comments that could be added to the event log item")
comments: Optional[str] = None
"""
Comments that could be added to the event log item
"""
# @ApiMember(Description="The user created the event")
user_name: Optional[str] = None
"""
The user created the event
"""
# @ApiMember(Description="Then date when the event occured")
created: datetime.datetime = datetime.datetime(1, 1, 1)
"""
Then date when the event occured
"""
# @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
# @ApiResponse(Description="You have too low privilegies to call this service", StatusCode=403)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateBookingLogItem(ICompany):
# @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
company_id: Optional[str] = None
"""
The company id, if empty will use the company id for the user you are logged in with.
"""
# @ApiMember(Description="The booking id", IsRequired=true)
booking_id: int = 0
"""
The booking id
"""
# @ApiMember(Description="The type of event", IsRequired=true)
event_type_id: int = 0
"""
The type of event
"""
# @ApiMember(Description="Comments that could be added to the event log item", IsRequired=true)
comments: Optional[str] = None
"""
Comments that could be added to the event log item
"""
# @ApiMember(Description="Then date when the event occured, leave blank if current datetime", IsRequired=true)
created: Optional[datetime.datetime] = None
"""
Then date when the event occured, leave blank if current datetime
"""
Python CreateBookingLogItem DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /bookinglog HTTP/1.1
Host: api.bokamera.se
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","BookingId":0,"EventTypeId":0,"Comments":"String","Created":"0001-01-01T00:00:00"}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"Id":0,"BookingId":0,"EventTypeId":0,"EventType":{"Id":0,"Name":"String","Description":"String"},"Comments":"String","UserName":"String"}