Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /resourcetypes | Add a new resourcetype | Add a new resourcetype to the company of the currently logged in user, only administrators are allowed to add resourcetypes. |
---|
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)
@ValidateRequest(Validator="IsAuthenticated")
public static class CreateResourceType implements ICompany
{
/**
* 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.")
public UUID CompanyId = null;
/**
* The resourcetype name
*/
@ApiMember(Description="The resourcetype name")
public String Name = null;
/**
* The resources to be included
*/
@ApiMember(Description="The resources to be included")
public ArrayList<AddResourceTypeResource> Resources = null;
/**
* The resourcetype description
*/
@ApiMember(Description="The resourcetype description")
public String Description = null;
/**
* If resourcetype is active or not
*/
@ApiMember(Description="If resourcetype is active or not")
public Boolean Active = null;
public UUID getCompanyId() { return CompanyId; }
public CreateResourceType setCompanyId(UUID value) { this.CompanyId = value; return this; }
public String getName() { return Name; }
public CreateResourceType setName(String value) { this.Name = value; return this; }
public ArrayList<AddResourceTypeResource> getResources() { return Resources; }
public CreateResourceType setResources(ArrayList<AddResourceTypeResource> value) { this.Resources = value; return this; }
public String getDescription() { return Description; }
public CreateResourceType setDescription(String value) { this.Description = value; return this; }
public Boolean isActive() { return Active; }
public CreateResourceType setActive(Boolean value) { this.Active = value; return this; }
}
public static class AddResourceTypeResource
{
/**
* The resource id
*/
@ApiMember(Description="The resource id")
public Integer Id = null;
/**
* The priority of the resource. If no priority is set it will take random resource when booking a time.
*/
@ApiMember(Description="The priority of the resource. If no priority is set it will take random resource when booking a time.")
public Integer Priority = null;
public Integer getId() { return Id; }
public AddResourceTypeResource setId(Integer value) { this.Id = value; return this; }
public Integer getPriority() { return Priority; }
public AddResourceTypeResource setPriority(Integer value) { this.Priority = value; return this; }
}
public static class ResourceTypeQueryResponse
{
/**
* The resourcetype id
*/
@ApiMember(Description="The resourcetype id")
public Integer Id = null;
/**
* The resourcetype name
*/
@ApiMember(Description="The resourcetype name")
public String Name = null;
/**
* The resourcetype description
*/
@ApiMember(Description="The resourcetype description")
public String Description = null;
/**
* The resources in the resourcetype. Only shows active resources if not admin.
*/
@ApiMember(Description="The resources in the resourcetype. Only shows active resources if not admin.")
public ArrayList<ResourceTypeResource> Resources = null;
/**
* If resourcetype is active or not
*/
@ApiMember(Description="If resourcetype is active or not")
public Boolean Active = 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 Integer getId() { return Id; }
public ResourceTypeQueryResponse setId(Integer value) { this.Id = value; return this; }
public String getName() { return Name; }
public ResourceTypeQueryResponse setName(String value) { this.Name = value; return this; }
public String getDescription() { return Description; }
public ResourceTypeQueryResponse setDescription(String value) { this.Description = value; return this; }
public ArrayList<ResourceTypeResource> getResources() { return Resources; }
public ResourceTypeQueryResponse setResources(ArrayList<ResourceTypeResource> value) { this.Resources = value; return this; }
public Boolean isActive() { return Active; }
public ResourceTypeQueryResponse setActive(Boolean value) { this.Active = value; return this; }
public Date getCreated() { return Created; }
public ResourceTypeQueryResponse setCreated(Date value) { this.Created = value; return this; }
public Date getUpdated() { return Updated; }
public ResourceTypeQueryResponse setUpdated(Date value) { this.Updated = value; return this; }
}
public static class ResourceTypeResource
{
/**
* 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 status
*/
@ApiMember(Description="The resource status")
public Boolean Active = null;
/**
* The resource description
*/
@ApiMember(Description="The resource description")
public String Description = null;
/**
* The resource email
*/
@ApiMember(Description="The resource email")
public String Email = null;
/**
* The resource phone
*/
@ApiMember(Description="The resource phone")
public String Phone = null;
/**
* The resource color
*/
@ApiMember(Description="The resource color")
public String Color = null;
/**
* The resource image
*/
@ApiMember(Description="The resource image")
public Uri ImageUrl = null;
/**
* The priority of the resource
*/
@ApiMember(Description="The priority of the resource")
public Integer Priority = null;
/**
* If the resource want to receive email notifications
*/
@ApiMember(Description="If the resource want to receive email notifications")
public Boolean EmailNotification = null;
/**
* If the resource want to receive sms notifications
*/
@ApiMember(Description="If the resource want to receive sms notifications")
public Boolean SMSNotification = null;
/**
* If the resource want to receive email reminders
*/
@ApiMember(Description="If the resource want to receive email reminders")
public Boolean EmailReminder = null;
/**
* If the resource want to receive sms reminders
*/
@ApiMember(Description="If the resource want to receive sms reminders")
public Boolean SMSReminder = null;
public Integer getId() { return Id; }
public ResourceTypeResource setId(Integer value) { this.Id = value; return this; }
public String getName() { return Name; }
public ResourceTypeResource setName(String value) { this.Name = value; return this; }
public Boolean isActive() { return Active; }
public ResourceTypeResource setActive(Boolean value) { this.Active = value; return this; }
public String getDescription() { return Description; }
public ResourceTypeResource setDescription(String value) { this.Description = value; return this; }
public String getEmail() { return Email; }
public ResourceTypeResource setEmail(String value) { this.Email = value; return this; }
public String getPhone() { return Phone; }
public ResourceTypeResource setPhone(String value) { this.Phone = value; return this; }
public String getColor() { return Color; }
public ResourceTypeResource setColor(String value) { this.Color = value; return this; }
public Uri getImageUrl() { return ImageUrl; }
public ResourceTypeResource setImageUrl(Uri value) { this.ImageUrl = value; return this; }
public Integer getPriority() { return Priority; }
public ResourceTypeResource setPriority(Integer value) { this.Priority = value; return this; }
public Boolean isEmailNotification() { return EmailNotification; }
public ResourceTypeResource setEmailNotification(Boolean value) { this.EmailNotification = value; return this; }
public Boolean isSmsNotification() { return SMSNotification; }
public ResourceTypeResource setSmsNotification(Boolean value) { this.SMSNotification = value; return this; }
public Boolean isEmailReminder() { return EmailReminder; }
public ResourceTypeResource setEmailReminder(Boolean value) { this.EmailReminder = value; return this; }
public Boolean isSmsReminder() { return SMSReminder; }
public ResourceTypeResource setSmsReminder(Boolean value) { this.SMSReminder = value; return this; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /resourcetypes HTTP/1.1
Host: api.bokamera.se
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","Name":"String","Resources":[{"Id":0,"Priority":0}],"Description":"String","Active":false}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"Id":0,"Name":"String","Description":"String","Resources":[{"Id":0,"Name":"String","Active":false,"Description":"String","Email":"String","Phone":"String","Color":"String","Priority":0,"EmailNotification":false,"SMSNotification":false,"EmailReminder":false,"SMSReminder":false}],"Active":false}