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 java.math.*;
import java.util.*;
import net.servicestack.client.*;
public class dtos
{
@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")
public static class DeleteResource implements ICompany
{
/**
* 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)
public UUID CompanyId = null;
/**
* Id of the resource to delete
*/
@ApiMember(Description="Id of the resource to delete", IsRequired=true)
public Integer Id = null;
/**
* 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. ")
public Boolean Force = null;
public UUID getCompanyId() { return CompanyId; }
public DeleteResource setCompanyId(UUID value) { this.CompanyId = value; return this; }
public Integer getId() { return Id; }
public DeleteResource setId(Integer value) { this.Id = value; return this; }
public Boolean isForce() { return Force; }
public DeleteResource setForce(Boolean value) { this.Force = value; return this; }
}
public static class ResourceQueryResponse
{
/**
* The resource id
*/
@ApiMember(Description="The resource id")
public Integer Id = null;
/**
* The resource name
*/
@ApiMember(Description="The resource name")
public String Name = null;
/**
* The resource description
*/
@ApiMember(Description="The resource description")
public String Description = null;
/**
* If resource is active or not
*/
@ApiMember(Description="If resource is active or not")
public Boolean Active = null;
/**
* 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.")
public String Color = null;
/**
* The email of the resource
*/
@ApiMember(Description="The email of the resource")
public String Email = null;
/**
* The image url of the resource
*/
@ApiMember(Description="The image url of the resource")
public Uri ImageUrl = null;
/**
* The mobile phone number of the resource
*/
@ApiMember(Description="The mobile phone number of the resource")
public String MobilePhone = null;
/**
* 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")
public String AccessGroup = null;
/**
* If the resource should receive email notification when booked
*/
@ApiMember(Description="If the resource should receive email notification when booked")
public Boolean EmailNotification = null;
/**
* If the resource should receive SMS notification when booked
*/
@ApiMember(Description="If the resource should receive SMS notification when booked")
public Boolean SMSNotification = null;
/**
* If the resource should receive email reminders on bookings
*/
@ApiMember(Description="If the resource should receive email reminders on bookings")
public Boolean SendEmailReminder = null;
/**
* If the resource should receive SMS reminders on bookings
*/
@ApiMember(Description="If the resource should receive SMS reminders on bookings")
public Boolean SendSMSReminder = null;
/**
* The resource time exceptions
*/
@ApiMember(Description="The resource time exceptions")
public ArrayList<TimeException> Exceptions = null;
/**
* The resource bookings
*/
@ApiMember(Description="The resource bookings")
public ArrayList<BookedTime> Bookings = null;
/**
* Then date when the resource was created
*/
@ApiMember(Description="Then date when the resource was created")
public Date Created = null;
/**
* Then date when the resource was updated
*/
@ApiMember(Description="Then date when the resource was updated")
public Date Updated = null;
public ResponseStatus ResponseStatus = null;
public Integer getId() { return Id; }
public ResourceQueryResponse setId(Integer value) { this.Id = value; return this; }
public String getName() { return Name; }
public ResourceQueryResponse setName(String value) { this.Name = value; return this; }
public String getDescription() { return Description; }
public ResourceQueryResponse setDescription(String value) { this.Description = value; return this; }
public Boolean isActive() { return Active; }
public ResourceQueryResponse setActive(Boolean value) { this.Active = value; return this; }
public String getColor() { return Color; }
public ResourceQueryResponse setColor(String value) { this.Color = value; return this; }
public String getEmail() { return Email; }
public ResourceQueryResponse setEmail(String value) { this.Email = value; return this; }
public Uri getImageUrl() { return ImageUrl; }
public ResourceQueryResponse setImageUrl(Uri value) { this.ImageUrl = value; return this; }
public String getMobilePhone() { return MobilePhone; }
public ResourceQueryResponse setMobilePhone(String value) { this.MobilePhone = value; return this; }
public String getAccessGroup() { return AccessGroup; }
public ResourceQueryResponse setAccessGroup(String value) { this.AccessGroup = value; return this; }
public Boolean isEmailNotification() { return EmailNotification; }
public ResourceQueryResponse setEmailNotification(Boolean value) { this.EmailNotification = value; return this; }
public Boolean isSmsNotification() { return SMSNotification; }
public ResourceQueryResponse setSmsNotification(Boolean value) { this.SMSNotification = value; return this; }
public Boolean isSendEmailReminder() { return SendEmailReminder; }
public ResourceQueryResponse setSendEmailReminder(Boolean value) { this.SendEmailReminder = value; return this; }
public Boolean isSendSMSReminder() { return SendSMSReminder; }
public ResourceQueryResponse setSendSMSReminder(Boolean value) { this.SendSMSReminder = value; return this; }
public ArrayList<TimeException> getExceptions() { return Exceptions; }
public ResourceQueryResponse setExceptions(ArrayList<TimeException> value) { this.Exceptions = value; return this; }
public ArrayList<BookedTime> getBookings() { return Bookings; }
public ResourceQueryResponse setBookings(ArrayList<BookedTime> value) { this.Bookings = value; return this; }
public Date getCreated() { return Created; }
public ResourceQueryResponse setCreated(Date value) { this.Created = value; return this; }
public Date getUpdated() { return Updated; }
public ResourceQueryResponse setUpdated(Date value) { this.Updated = value; return this; }
public ResponseStatus getResponseStatus() { return ResponseStatus; }
public ResourceQueryResponse setResponseStatus(ResponseStatus value) { this.ResponseStatus = value; return this; }
}
public static class TimeException implements ITimeException
{
/**
* Time exception id
*/
@ApiMember(Description="Time exception id")
public Integer Id = null;
/**
* Indicates whether or not the time exception is recurring
*/
@ApiMember(Description="Indicates whether or not the time exception is recurring")
public Boolean IsRecurring = null;
/**
* Indicates whether the time exception is blocking the time or not
*/
@ApiMember(Description="Indicates whether the time exception is blocking the time or not")
public Boolean IsBlock = null;
/**
* The reason of the time exception, example: Vacation, doctors appointment, ...
*/
@ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...")
public String ReasonText = null;
/**
* The public reason of the time exception, example: Vacation, doctors appointment, ...
*/
@ApiMember(Description="The public reason of the time exception, example: Vacation, doctors appointment, ...")
public String ReasonTextPublic = null;
/**
* Time exception start
*/
@ApiMember(Description="Time exception start")
public Date From = null;
/**
* Time exception end
*/
@ApiMember(Description="Time exception end")
public Date To = null;
/**
* Resources that owns this exception
*/
@ApiMember(Description="Resources that owns this exception")
public ArrayList<Integer> ResourceIds = null;
public Integer getId() { return Id; }
public TimeException setId(Integer value) { this.Id = value; return this; }
public Boolean getIsRecurring() { return IsRecurring; }
public TimeException setIsRecurring(Boolean value) { this.IsRecurring = value; return this; }
public Boolean getIsBlock() { return IsBlock; }
public TimeException setIsBlock(Boolean value) { this.IsBlock = value; return this; }
public String getReasonText() { return ReasonText; }
public TimeException setReasonText(String value) { this.ReasonText = value; return this; }
public String getReasonTextPublic() { return ReasonTextPublic; }
public TimeException setReasonTextPublic(String value) { this.ReasonTextPublic = value; return this; }
public Date getFrom() { return From; }
public TimeException setFrom(Date value) { this.From = value; return this; }
public Date getTo() { return To; }
public TimeException setTo(Date value) { this.To = value; return this; }
public ArrayList<Integer> getResourceIds() { return ResourceIds; }
public TimeException setResourceIds(ArrayList<Integer> value) { this.ResourceIds = value; return this; }
}
public static class BookedTime implements IBookedTime
{
/**
* Booking id
*/
@ApiMember(Description="Booking id")
public Integer Id = null;
/**
* The booked service
*/
@ApiMember(Description="The booked service")
public Integer ServiceId = null;
/**
* Booking start
*/
@ApiMember(Description="Booking start")
public Date From = null;
/**
* Booking end
*/
@ApiMember(Description="Booking end")
public Date To = null;
/**
* Number of booked spots
*/
@ApiMember(Description="Number of booked spots")
public Integer BookedSpots = null;
/**
* Number of total spots for the service
*/
@ApiMember(Description="Number of total spots for the service")
public Integer TotalSpots = null;
/**
* The pause after the booking
*/
@ApiMember(Description="The pause after the booking")
public Integer PauseAfterInMinutes = null;
/**
* The booking status
*/
@ApiMember(Description="The booking status")
public Integer StatusId = null;
public BookingStatusEnum Status = null;
/**
* The customer the booking belongs to
*/
@ApiMember(Description="The customer the booking belongs to")
public BookedCustomer Customer = null;
public Integer getId() { return Id; }
public BookedTime setId(Integer value) { this.Id = value; return this; }
public Integer getServiceId() { return ServiceId; }
public BookedTime setServiceId(Integer value) { this.ServiceId = value; return this; }
public Date getFrom() { return From; }
public BookedTime setFrom(Date value) { this.From = value; return this; }
public Date getTo() { return To; }
public BookedTime setTo(Date value) { this.To = value; return this; }
public Integer getBookedSpots() { return BookedSpots; }
public BookedTime setBookedSpots(Integer value) { this.BookedSpots = value; return this; }
public Integer getTotalSpots() { return TotalSpots; }
public BookedTime setTotalSpots(Integer value) { this.TotalSpots = value; return this; }
public Integer getPauseAfterInMinutes() { return PauseAfterInMinutes; }
public BookedTime setPauseAfterInMinutes(Integer value) { this.PauseAfterInMinutes = value; return this; }
public Integer getStatusId() { return StatusId; }
public BookedTime setStatusId(Integer value) { this.StatusId = value; return this; }
public BookingStatusEnum getStatus() { return Status; }
public BookedTime setStatus(BookingStatusEnum value) { this.Status = value; return this; }
public BookedCustomer getCustomer() { return Customer; }
public BookedTime setCustomer(BookedCustomer value) { this.Customer = value; return this; }
}
public static enum BookingStatusEnum
{
Booked(1),
Unbooked(2),
Reserved(3),
Canceled(4),
AwaitingPayment(5),
AwaitingPaymentNoTimeLimit(6),
Payed(7),
AwaitingPaymentRequestFromAdmin(8),
AwaitingPaymentFromProvider(9),
Invoiced(10);
private final int value;
BookingStatusEnum(final int intValue) { value = intValue; }
public int getValue() { return value; }
}
public static class BookedCustomer
{
public UUID Id = null;
public String Firstname = null;
public String Lastname = null;
public String Email = null;
public String Phone = null;
public String FacebookUserName = null;
public String ImageUrl = null;
public String CorporateIdentityNumber = null;
public String InvoiceAddress1 = null;
public String InvoiceAddress2 = null;
public String InvoiceCity = null;
public String InvoicePostalCode = null;
public String InvoiceCountryCode = null;
public UUID getId() { return Id; }
public BookedCustomer setId(UUID value) { this.Id = value; return this; }
public String getFirstname() { return Firstname; }
public BookedCustomer setFirstname(String value) { this.Firstname = value; return this; }
public String getLastname() { return Lastname; }
public BookedCustomer setLastname(String value) { this.Lastname = value; return this; }
public String getEmail() { return Email; }
public BookedCustomer setEmail(String value) { this.Email = value; return this; }
public String getPhone() { return Phone; }
public BookedCustomer setPhone(String value) { this.Phone = value; return this; }
public String getFacebookUserName() { return FacebookUserName; }
public BookedCustomer setFacebookUserName(String value) { this.FacebookUserName = value; return this; }
public String getImageUrl() { return ImageUrl; }
public BookedCustomer setImageUrl(String value) { this.ImageUrl = value; return this; }
public String getCorporateIdentityNumber() { return CorporateIdentityNumber; }
public BookedCustomer setCorporateIdentityNumber(String value) { this.CorporateIdentityNumber = value; return this; }
public String getInvoiceAddress1() { return InvoiceAddress1; }
public BookedCustomer setInvoiceAddress1(String value) { this.InvoiceAddress1 = value; return this; }
public String getInvoiceAddress2() { return InvoiceAddress2; }
public BookedCustomer setInvoiceAddress2(String value) { this.InvoiceAddress2 = value; return this; }
public String getInvoiceCity() { return InvoiceCity; }
public BookedCustomer setInvoiceCity(String value) { this.InvoiceCity = value; return this; }
public String getInvoicePostalCode() { return InvoicePostalCode; }
public BookedCustomer setInvoicePostalCode(String value) { this.InvoicePostalCode = value; return this; }
public String getInvoiceCountryCode() { return InvoiceCountryCode; }
public BookedCustomer setInvoiceCountryCode(String value) { this.InvoiceCountryCode = value; return this; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
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: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ResourceQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <AccessGroup>String</AccessGroup> <Active>false</Active> <Bookings> <BookedTime> <BookedSpots>0</BookedSpots> <Customer> <CorporateIdentityNumber>String</CorporateIdentityNumber> <Email>String</Email> <FacebookUserName>String</FacebookUserName> <Firstname>String</Firstname> <Id>00000000-0000-0000-0000-000000000000</Id> <ImageUrl>String</ImageUrl> <InvoiceAddress1>String</InvoiceAddress1> <InvoiceAddress2>String</InvoiceAddress2> <InvoiceCity>String</InvoiceCity> <InvoiceCountryCode>String</InvoiceCountryCode> <InvoicePostalCode>String</InvoicePostalCode> <Lastname>String</Lastname> <Phone>String</Phone> </Customer> <From>0001-01-01T00:00:00</From> <Id>0</Id> <PauseAfterInMinutes>0</PauseAfterInMinutes> <ServiceId>0</ServiceId> <Status>Booked</Status> <StatusId>0</StatusId> <To>0001-01-01T00:00:00</To> <TotalSpots>0</TotalSpots> </BookedTime> </Bookings> <Color>String</Color> <Created>0001-01-01T00:00:00</Created> <Description>String</Description> <Email>String</Email> <EmailNotification>false</EmailNotification> <Exceptions> <TimeException> <From>0001-01-01T00:00:00</From> <Id>0</Id> <IsBlock>false</IsBlock> <IsRecurring>false</IsRecurring> <ReasonText>String</ReasonText> <ReasonTextPublic>String</ReasonTextPublic> <ResourceIds xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d4p1:int>0</d4p1:int> </ResourceIds> <To>0001-01-01T00:00:00</To> </TimeException> </Exceptions> <Id>0</Id> <ImageUrl i:nil="true" /> <MobilePhone>String</MobilePhone> <Name>String</Name> <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types"> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:Message>String</d2p1:Message> <d2p1:StackTrace>String</d2p1:StackTrace> <d2p1:Errors> <d2p1:ResponseError> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:FieldName>String</d2p1:FieldName> <d2p1:Message>String</d2p1:Message> <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </d2p1:Meta> </d2p1:ResponseError> </d2p1:Errors> <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </d2p1:Meta> </ResponseStatus> <SMSNotification>false</SMSNotification> <SendEmailReminder>false</SendEmailReminder> <SendSMSReminder>false</SendSMSReminder> <Updated>0001-01-01T00:00:00</Updated> </ResourceQueryResponse>