Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
DELETE | /resource/{Id} | Delete a resource | Delete a resource for the currently logged in user, only administrators are allowed to delete resources. |
---|
import 'package:servicestack/servicestack.dart';
class TimeException implements ITimeException, IConvertible
{
/**
* Time exception id
*/
// @ApiMember(Description="Time exception id")
int? Id;
/**
* Indicates whether or not the time exception is recurring
*/
// @ApiMember(Description="Indicates whether or not the time exception is recurring")
bool? IsRecurring;
/**
* Indicates whether the time exception is blocking the time or not
*/
// @ApiMember(Description="Indicates whether the time exception is blocking the time or not")
bool? IsBlock;
/**
* The reason of the time exception, example: Vacation, doctors appointment, ...
*/
// @ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...")
String? ReasonText;
/**
* The public reason of the time exception, example: Vacation, doctors appointment, ...
*/
// @ApiMember(Description="The public reason of the time exception, example: Vacation, doctors appointment, ...")
String? ReasonTextPublic;
/**
* Time exception start
*/
// @ApiMember(Description="Time exception start")
DateTime? From;
/**
* Time exception end
*/
// @ApiMember(Description="Time exception end")
DateTime? To;
/**
* Resources that owns this exception
*/
// @ApiMember(Description="Resources that owns this exception")
List<int>? ResourceIds;
TimeException({this.Id,this.IsRecurring,this.IsBlock,this.ReasonText,this.ReasonTextPublic,this.From,this.To,this.ResourceIds});
TimeException.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
IsRecurring = json['IsRecurring'];
IsBlock = json['IsBlock'];
ReasonText = json['ReasonText'];
ReasonTextPublic = json['ReasonTextPublic'];
From = JsonConverters.fromJson(json['From'],'DateTime',context!);
To = JsonConverters.fromJson(json['To'],'DateTime',context!);
ResourceIds = JsonConverters.fromJson(json['ResourceIds'],'List<int>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'IsRecurring': IsRecurring,
'IsBlock': IsBlock,
'ReasonText': ReasonText,
'ReasonTextPublic': ReasonTextPublic,
'From': JsonConverters.toJson(From,'DateTime',context!),
'To': JsonConverters.toJson(To,'DateTime',context!),
'ResourceIds': JsonConverters.toJson(ResourceIds,'List<int>',context!)
};
getTypeName() => "TimeException";
TypeContext? context = _ctx;
}
enum BookingStatusEnum
{
Booked,
Unbooked,
Reserved,
Canceled,
AwaitingPayment,
AwaitingPaymentNoTimeLimit,
Payed,
AwaitingPaymentRequestFromAdmin,
AwaitingPaymentFromProvider,
Invoiced,
}
class BookedCustomer implements IConvertible
{
String? Id;
String? Firstname;
String? Lastname;
String? Email;
String? Phone;
String? FacebookUserName;
String? ImageUrl;
String? CorporateIdentityNumber;
String? InvoiceAddress1;
String? InvoiceAddress2;
String? InvoiceCity;
String? InvoicePostalCode;
String? InvoiceCountryCode;
BookedCustomer({this.Id,this.Firstname,this.Lastname,this.Email,this.Phone,this.FacebookUserName,this.ImageUrl,this.CorporateIdentityNumber,this.InvoiceAddress1,this.InvoiceAddress2,this.InvoiceCity,this.InvoicePostalCode,this.InvoiceCountryCode});
BookedCustomer.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Firstname = json['Firstname'];
Lastname = json['Lastname'];
Email = json['Email'];
Phone = json['Phone'];
FacebookUserName = json['FacebookUserName'];
ImageUrl = json['ImageUrl'];
CorporateIdentityNumber = json['CorporateIdentityNumber'];
InvoiceAddress1 = json['InvoiceAddress1'];
InvoiceAddress2 = json['InvoiceAddress2'];
InvoiceCity = json['InvoiceCity'];
InvoicePostalCode = json['InvoicePostalCode'];
InvoiceCountryCode = json['InvoiceCountryCode'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Firstname': Firstname,
'Lastname': Lastname,
'Email': Email,
'Phone': Phone,
'FacebookUserName': FacebookUserName,
'ImageUrl': ImageUrl,
'CorporateIdentityNumber': CorporateIdentityNumber,
'InvoiceAddress1': InvoiceAddress1,
'InvoiceAddress2': InvoiceAddress2,
'InvoiceCity': InvoiceCity,
'InvoicePostalCode': InvoicePostalCode,
'InvoiceCountryCode': InvoiceCountryCode
};
getTypeName() => "BookedCustomer";
TypeContext? context = _ctx;
}
class BookedTime implements IBookedTime, IConvertible
{
/**
* Booking id
*/
// @ApiMember(Description="Booking id")
int? Id;
/**
* The booked service
*/
// @ApiMember(Description="The booked service")
int? ServiceId;
/**
* Booking start
*/
// @ApiMember(Description="Booking start")
DateTime? From;
/**
* Booking end
*/
// @ApiMember(Description="Booking end")
DateTime? To;
/**
* Number of booked spots
*/
// @ApiMember(Description="Number of booked spots")
int? BookedSpots;
/**
* Number of total spots for the service
*/
// @ApiMember(Description="Number of total spots for the service")
int? TotalSpots;
/**
* The pause after the booking
*/
// @ApiMember(Description="The pause after the booking")
int? PauseAfterInMinutes;
/**
* The booking status
*/
// @ApiMember(Description="The booking status")
int? StatusId;
BookingStatusEnum? Status;
/**
* The customer the booking belongs to
*/
// @ApiMember(Description="The customer the booking belongs to")
BookedCustomer? Customer;
BookedTime({this.Id,this.ServiceId,this.From,this.To,this.BookedSpots,this.TotalSpots,this.PauseAfterInMinutes,this.StatusId,this.Status,this.Customer});
BookedTime.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
ServiceId = json['ServiceId'];
From = JsonConverters.fromJson(json['From'],'DateTime',context!);
To = JsonConverters.fromJson(json['To'],'DateTime',context!);
BookedSpots = json['BookedSpots'];
TotalSpots = json['TotalSpots'];
PauseAfterInMinutes = json['PauseAfterInMinutes'];
StatusId = json['StatusId'];
Status = JsonConverters.fromJson(json['Status'],'BookingStatusEnum',context!);
Customer = JsonConverters.fromJson(json['Customer'],'BookedCustomer',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'ServiceId': ServiceId,
'From': JsonConverters.toJson(From,'DateTime',context!),
'To': JsonConverters.toJson(To,'DateTime',context!),
'BookedSpots': BookedSpots,
'TotalSpots': TotalSpots,
'PauseAfterInMinutes': PauseAfterInMinutes,
'StatusId': StatusId,
'Status': JsonConverters.toJson(Status,'BookingStatusEnum',context!),
'Customer': JsonConverters.toJson(Customer,'BookedCustomer',context!)
};
getTypeName() => "BookedTime";
TypeContext? context = _ctx;
}
class ResourceQueryResponse implements IConvertible
{
/**
* The resource id
*/
// @ApiMember(Description="The resource id")
int? Id;
/**
* The resource name
*/
// @ApiMember(Description="The resource name")
String? Name;
/**
* The resource description
*/
// @ApiMember(Description="The resource description")
String? Description;
/**
* If resource is active or not
*/
// @ApiMember(Description="If resource is active or not")
bool? Active;
/**
* The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.
*/
// @ApiMember(Description="The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.")
String? Color;
/**
* The email of the resource
*/
// @ApiMember(Description="The email of the resource")
String? Email;
/**
* The image url of the resource
*/
// @ApiMember(Description="The image url of the resource")
Uri? ImageUrl;
/**
* The mobile phone number of the resource
*/
// @ApiMember(Description="The mobile phone number of the resource")
String? MobilePhone;
/**
* Used by example code locks to know what access group the resource is assigned to
*/
// @ApiMember(Description="Used by example code locks to know what access group the resource is assigned to")
String? AccessGroup;
/**
* If the resource should receive email notification when booked
*/
// @ApiMember(Description="If the resource should receive email notification when booked")
bool? EmailNotification;
/**
* If the resource should receive SMS notification when booked
*/
// @ApiMember(Description="If the resource should receive SMS notification when booked")
bool? SMSNotification;
/**
* If the resource should receive email reminders on bookings
*/
// @ApiMember(Description="If the resource should receive email reminders on bookings")
bool? SendEmailReminder;
/**
* If the resource should receive SMS reminders on bookings
*/
// @ApiMember(Description="If the resource should receive SMS reminders on bookings")
bool? SendSMSReminder;
/**
* The resource time exceptions
*/
// @ApiMember(Description="The resource time exceptions")
List<TimeException>? Exceptions;
/**
* The resource bookings
*/
// @ApiMember(Description="The resource bookings")
List<BookedTime>? Bookings;
/**
* Then date when the resource was created
*/
// @ApiMember(Description="Then date when the resource was created")
DateTime? Created;
/**
* Then date when the resource was updated
*/
// @ApiMember(Description="Then date when the resource was updated")
DateTime? Updated;
ResponseStatus? ResponseStatus;
ResourceQueryResponse({this.Id,this.Name,this.Description,this.Active,this.Color,this.Email,this.ImageUrl,this.MobilePhone,this.AccessGroup,this.EmailNotification,this.SMSNotification,this.SendEmailReminder,this.SendSMSReminder,this.Exceptions,this.Bookings,this.Created,this.Updated,this.ResponseStatus});
ResourceQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Name = json['Name'];
Description = json['Description'];
Active = json['Active'];
Color = json['Color'];
Email = json['Email'];
ImageUrl = JsonConverters.fromJson(json['ImageUrl'],'Uri',context!);
MobilePhone = json['MobilePhone'];
AccessGroup = json['AccessGroup'];
EmailNotification = json['EmailNotification'];
SMSNotification = json['SMSNotification'];
SendEmailReminder = json['SendEmailReminder'];
SendSMSReminder = json['SendSMSReminder'];
Exceptions = JsonConverters.fromJson(json['Exceptions'],'List<TimeException>',context!);
Bookings = JsonConverters.fromJson(json['Bookings'],'List<BookedTime>',context!);
Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
Updated = JsonConverters.fromJson(json['Updated'],'DateTime',context!);
ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Name': Name,
'Description': Description,
'Active': Active,
'Color': Color,
'Email': Email,
'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!),
'MobilePhone': MobilePhone,
'AccessGroup': AccessGroup,
'EmailNotification': EmailNotification,
'SMSNotification': SMSNotification,
'SendEmailReminder': SendEmailReminder,
'SendSMSReminder': SendSMSReminder,
'Exceptions': JsonConverters.toJson(Exceptions,'List<TimeException>',context!),
'Bookings': JsonConverters.toJson(Bookings,'List<BookedTime>',context!),
'Created': JsonConverters.toJson(Created,'DateTime',context!),
'Updated': JsonConverters.toJson(Updated,'DateTime',context!),
'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
};
getTypeName() => "ResourceQueryResponse";
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)
// @ApiResponse(Description="Bookings exists that needs to be unbooked before creating this time exceptions, use the /timeexceptions/collidingevents to find which bookings and use the booking service to unbook them", StatusCode=409)
// @ValidateRequest(Validator="IsAuthenticated")
class DeleteResource implements ICompany, IConvertible
{
/**
* Enter the company id, if blank company id and you are an admin, your company id will be used.
*/
// @ApiMember(Description="Enter the company id, if blank company id and you are an admin, your company id will be used.", IsRequired=true)
String? CompanyId;
/**
* Id of the resource to delete
*/
// @ApiMember(Description="Id of the resource to delete", IsRequired=true)
int? Id;
/**
* If this equals true it will force to set the resource as active = false, this is used when bookings exists on the resource and it can't be deleted.
*/
// @ApiMember(Description="If this equals true it will force to set the resource as active = false, this is used when bookings exists on the resource and it can't be deleted. ")
bool? Force;
DeleteResource({this.CompanyId,this.Id,this.Force});
DeleteResource.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
Id = json['Id'];
Force = json['Force'];
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'Id': Id,
'Force': Force
};
getTypeName() => "DeleteResource";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
'TimeException': TypeInfo(TypeOf.Class, create:() => TimeException()),
'BookingStatusEnum': TypeInfo(TypeOf.Enum, enumValues:BookingStatusEnum.values),
'BookedCustomer': TypeInfo(TypeOf.Class, create:() => BookedCustomer()),
'BookedTime': TypeInfo(TypeOf.Class, create:() => BookedTime()),
'ResourceQueryResponse': TypeInfo(TypeOf.Class, create:() => ResourceQueryResponse()),
'Uri': TypeInfo(TypeOf.Class, create:() => Uri()),
'List<TimeException>': TypeInfo(TypeOf.Class, create:() => <TimeException>[]),
'List<BookedTime>': TypeInfo(TypeOf.Class, create:() => <BookedTime>[]),
'DeleteResource': TypeInfo(TypeOf.Class, create:() => DeleteResource()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
DELETE /resource/{Id} HTTP/1.1 Host: api.bokamera.se Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Id: 0, Name: String, Description: String, Active: False, Color: String, Email: String, MobilePhone: String, AccessGroup: String, EmailNotification: False, SMSNotification: False, SendEmailReminder: False, SendSMSReminder: False, Exceptions: [ { Id: 0, IsRecurring: False, IsBlock: False, ReasonText: String, ReasonTextPublic: String, ResourceIds: [ 0 ] } ], Bookings: [ { Id: 0, ServiceId: 0, BookedSpots: 0, TotalSpots: 0, PauseAfterInMinutes: 0, StatusId: 0, Status: Booked, Customer: { Firstname: String, Lastname: String, Email: String, Phone: String, FacebookUserName: String, ImageUrl: String, CorporateIdentityNumber: String, InvoiceAddress1: String, InvoiceAddress2: String, InvoiceCity: String, InvoicePostalCode: String, InvoiceCountryCode: String } } ], ResponseStatus: { ErrorCode: String, Message: String, StackTrace: String, Errors: [ { ErrorCode: String, FieldName: String, Message: String, Meta: { String: String } } ], Meta: { String: String } } }