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 'package:servicestack/servicestack.dart';
class BookingLogEventTypeResponse implements IConvertible
{
/**
* The event type id
*/
// @ApiMember(Description="The event type id")
int? Id;
/**
* The event type name
*/
// @ApiMember(Description="The event type name")
String? Name;
/**
* The event type description
*/
// @ApiMember(Description="The event type description")
String? Description;
BookingLogEventTypeResponse({this.Id,this.Name,this.Description});
BookingLogEventTypeResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Name = json['Name'];
Description = json['Description'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Name': Name,
'Description': Description
};
getTypeName() => "BookingLogEventTypeResponse";
TypeContext? context = _ctx;
}
class BookingLogQueryResponse implements IConvertible
{
/**
* The booking log id
*/
// @ApiMember(Description="The booking log id")
int? Id;
/**
* The booking id
*/
// @ApiMember(Description="The booking id")
int? BookingId;
/**
* The type of event
*/
// @ApiMember(Description="The type of event")
int? EventTypeId;
/**
* The type of event
*/
// @ApiMember(Description="The type of event")
BookingLogEventTypeResponse? EventType;
/**
* Comments that could be added to the event log item
*/
// @ApiMember(Description="Comments that could be added to the event log item")
String? Comments;
/**
* The user created the event
*/
// @ApiMember(Description="The user created the event")
String? UserName;
/**
* Then date when the event occured
*/
// @ApiMember(Description="Then date when the event occured")
DateTime? Created;
BookingLogQueryResponse({this.Id,this.BookingId,this.EventTypeId,this.EventType,this.Comments,this.UserName,this.Created});
BookingLogQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
BookingId = json['BookingId'];
EventTypeId = json['EventTypeId'];
EventType = JsonConverters.fromJson(json['EventType'],'BookingLogEventTypeResponse',context!);
Comments = json['Comments'];
UserName = json['UserName'];
Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'BookingId': BookingId,
'EventTypeId': EventTypeId,
'EventType': JsonConverters.toJson(EventType,'BookingLogEventTypeResponse',context!),
'Comments': Comments,
'UserName': UserName,
'Created': JsonConverters.toJson(Created,'DateTime',context!)
};
getTypeName() => "BookingLogQueryResponse";
TypeContext? context = _ctx;
}
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ApiResponse(Description="You have too low privilegies to call this service", StatusCode=403)
class CreateBookingLogItem implements ICompany, IConvertible
{
/**
* The company id, if empty will use the company id for the user you are logged in with.
*/
// @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
String? CompanyId;
/**
* The booking id
*/
// @ApiMember(Description="The booking id", IsRequired=true)
int? BookingId;
/**
* The type of event
*/
// @ApiMember(Description="The type of event", IsRequired=true)
int? EventTypeId;
/**
* Comments that could be added to the event log item
*/
// @ApiMember(Description="Comments that could be added to the event log item", IsRequired=true)
String? Comments;
/**
* Then date when the event occured, leave blank if current datetime
*/
// @ApiMember(Description="Then date when the event occured, leave blank if current datetime", IsRequired=true)
DateTime? Created;
CreateBookingLogItem({this.CompanyId,this.BookingId,this.EventTypeId,this.Comments,this.Created});
CreateBookingLogItem.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
BookingId = json['BookingId'];
EventTypeId = json['EventTypeId'];
Comments = json['Comments'];
Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'BookingId': BookingId,
'EventTypeId': EventTypeId,
'Comments': Comments,
'Created': JsonConverters.toJson(Created,'DateTime',context!)
};
getTypeName() => "CreateBookingLogItem";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'testapi.bokamera.se', types: <String, TypeInfo> {
'BookingLogEventTypeResponse': TypeInfo(TypeOf.Class, create:() => BookingLogEventTypeResponse()),
'BookingLogQueryResponse': TypeInfo(TypeOf.Class, create:() => BookingLogQueryResponse()),
'CreateBookingLogItem': TypeInfo(TypeOf.Class, create:() => CreateBookingLogItem()),
});
Dart CreateBookingLogItem DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /bookinglog HTTP/1.1
Host: testapi.bokamera.se
Accept: application/json
Content-Type: application/json
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: application/json Content-Length: length {"Id":0,"BookingId":0,"EventTypeId":0,"EventType":{"Id":0,"Name":"String","Description":"String"},"Comments":"String","UserName":"String"}