Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
PUT | /resource/{Id} | Update existing resource | Updates an existing resource if you are authorized to do so. |
---|
import Foundation
import ServiceStack
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
public class UpdateResource : ICompany, Codable
{
/**
* 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 var companyId:String?
/**
* Id of the resource
*/
// @ApiMember(Description="Id of the resource", IsRequired=true, ParameterType="path")
public var id:Int
/**
* The resource name
*/
// @ApiMember(Description="The resource name")
public var name:String
/**
* The resource description
*/
// @ApiMember(Description="The resource description")
public var Description:String
/**
* If resource is active or not
*/
// @ApiMember(Description="If resource is active or not")
public var active:Bool?
/**
* The resource color in scheduler
*/
// @ApiMember(Description="The resource color in scheduler")
public var color:String
/**
* The image url of the resource
*/
// @ApiMember(Description="The image url of the resource")
public var imageUrl:Uri
/**
* The email of the resource
*/
// @ApiMember(Description="The email of the resource")
public var email:String
/**
* The mobile phone number of the resource
*/
// @ApiMember(Description="The mobile phone number of the resource")
public var mobilePhone:String
/**
* 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 var accessGroup:String
/**
* If the resource should receive email notification when booked
*/
// @ApiMember(Description="If the resource should receive email notification when booked")
public var emailNotification:Bool?
/**
* If the resource should receive SMS notification when booked
*/
// @ApiMember(Description="If the resource should receive SMS notification when booked")
public var smsNotification:Bool?
/**
* If the resource should receive email reminders on bookings
*/
// @ApiMember(Description="If the resource should receive email reminders on bookings")
public var sendEmailReminder:Bool?
/**
* If the resource should receive SMS reminders on bookings
*/
// @ApiMember(Description="If the resource should receive SMS reminders on bookings")
public var sendSMSReminder:Bool?
/**
* If Custom Fields are added to the resource, here you will send the id and the value for each custom field to be saved
*/
// @ApiMember(Description="If Custom Fields are added to the resource, here you will send the id and the value for each custom field to be saved")
public var customFields:[AddCustomField] = []
required public init(){}
}
public class AddCustomField : Codable
{
public var id:Int
public var value:String
required public init(){}
}
public class ResourceQueryResponse : Codable
{
/**
* The resource id
*/
// @ApiMember(Description="The resource id")
public var id:Int
/**
* The resource name
*/
// @ApiMember(Description="The resource name")
public var name:String
/**
* The resource description
*/
// @ApiMember(Description="The resource description")
public var Description:String
/**
* If resource is active or not
*/
// @ApiMember(Description="If resource is active or not")
public var active:Bool
/**
* 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 var color:String
/**
* The email of the resource
*/
// @ApiMember(Description="The email of the resource")
public var email:String
/**
* The image url of the resource
*/
// @ApiMember(Description="The image url of the resource")
public var imageUrl:Uri
/**
* The mobile phone number of the resource
*/
// @ApiMember(Description="The mobile phone number of the resource")
public var mobilePhone:String
/**
* 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 var accessGroup:String
/**
* If the resource should receive email notification when booked
*/
// @ApiMember(Description="If the resource should receive email notification when booked")
public var emailNotification:Bool
/**
* If the resource should receive SMS notification when booked
*/
// @ApiMember(Description="If the resource should receive SMS notification when booked")
public var smsNotification:Bool
/**
* If the resource should receive email reminders on bookings
*/
// @ApiMember(Description="If the resource should receive email reminders on bookings")
public var sendEmailReminder:Bool?
/**
* If the resource should receive SMS reminders on bookings
*/
// @ApiMember(Description="If the resource should receive SMS reminders on bookings")
public var sendSMSReminder:Bool?
/**
* The resource time exceptions
*/
// @ApiMember(Description="The resource time exceptions")
public var exceptions:[TimeException] = []
/**
* The resource bookings
*/
// @ApiMember(Description="The resource bookings")
public var bookings:[BookedTime] = []
/**
* Then date when the resource was created
*/
// @ApiMember(Description="Then date when the resource was created")
public var created:Date
/**
* Then date when the resource was updated
*/
// @ApiMember(Description="Then date when the resource was updated")
public var updated:Date
public var responseStatus:ResponseStatus
required public init(){}
}
public class TimeException : ITimeException, Codable
{
/**
* Time exception id
*/
// @ApiMember(Description="Time exception id")
public var id:Int
/**
* Indicates whether or not the time exception is recurring
*/
// @ApiMember(Description="Indicates whether or not the time exception is recurring")
public var isRecurring:Bool
/**
* 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 var isBlock:Bool
/**
* The reason of the time exception, example: Vacation, doctors appointment, ...
*/
// @ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...")
public var reasonText:String
/**
* 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 var reasonTextPublic:String
/**
* Time exception start
*/
// @ApiMember(Description="Time exception start")
public var from:Date
/**
* Time exception end
*/
// @ApiMember(Description="Time exception end")
public var to:Date
/**
* Resources that owns this exception
*/
// @ApiMember(Description="Resources that owns this exception")
public var resourceIds:[Int] = []
required public init(){}
}
public class BookedTime : IBookedTime, Codable
{
/**
* Booking id
*/
// @ApiMember(Description="Booking id")
public var id:Int
/**
* The booked service
*/
// @ApiMember(Description="The booked service")
public var serviceId:Int
/**
* Booking start
*/
// @ApiMember(Description="Booking start")
public var from:Date
/**
* Booking end
*/
// @ApiMember(Description="Booking end")
public var to:Date
/**
* Number of booked spots
*/
// @ApiMember(Description="Number of booked spots")
public var bookedSpots:Int
/**
* Number of total spots for the service
*/
// @ApiMember(Description="Number of total spots for the service")
public var totalSpots:Int
/**
* The pause after the booking
*/
// @ApiMember(Description="The pause after the booking")
public var pauseAfterInMinutes:Int
/**
* The booking status
*/
// @ApiMember(Description="The booking status")
public var statusId:Int
public var status:BookingStatusEnum
/**
* The customer the booking belongs to
*/
// @ApiMember(Description="The customer the booking belongs to")
public var customer:BookedCustomer
required public init(){}
}
public enum BookingStatusEnum : Int, Codable
{
case Booked = 1
case Unbooked = 2
case Reserved = 3
case Canceled = 4
case AwaitingPayment = 5
case AwaitingPaymentNoTimeLimit = 6
case Payed = 7
case AwaitingPaymentRequestFromAdmin = 8
case AwaitingPaymentFromProvider = 9
case Invoiced = 10
}
public class BookedCustomer : Codable
{
public var id:String
public var firstname:String
public var lastname:String
public var email:String
public var phone:String
public var facebookUserName:String
public var imageUrl:String
public var corporateIdentityNumber:String
public var invoiceAddress1:String
public var invoiceAddress2:String
public var invoiceCity:String
public var invoicePostalCode:String
public var invoiceCountryCode:String
required public init(){}
}
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.
PUT /resource/{Id} HTTP/1.1
Host: api.bokamera.se
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","Id":0,"Name":"String","Description":"String","Active":false,"Color":"String","Email":"String","MobilePhone":"String","AccessGroup":"String","EmailNotification":false,"SMSNotification":false,"SendEmailReminder":false,"SendSMSReminder":false,"CustomFields":[{"Id":0,"Value":"String"}]}
HTTP/1.1 200 OK Content-Type: text/csv 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"}}}