BokaMera.API.Host

<back to all web services

UpdateServicePrice

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/services/prices/{Id}Update a priceUpdate a price on a service
import Foundation
import ServiceStack

// @ValidateRequest(Validator="IsAuthenticated")
public class UpdateServicePrice : ICompany, Codable
{
    /**
    * 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 var companyId:String?

    /**
    * Id of the price
    */
    // @ApiMember(Description="Id of the price", IsRequired=true, ParameterType="path")
    public var id:Int

    /**
    * The price
    */
    // @ApiMember(Description="The price")
    public var price:Double

    /**
    * The price currency
    */
    // @ApiMember(Description="The price currency")
    public var currencyId:String

    /**
    * The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day
    */
    // @ApiMember(Description="The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day")
    public var calculationTypeId:Int

    /**
    * The price VAT in percent
    */
    // @ApiMember(Description="The price VAT in percent")
    public var vat:Double

    /**
    * The price category if price has a category
    */
    // @ApiMember(Description="The price category if price has a category")
    public var category:String

    /**
    * The valid from date for the price.
    */
    // @ApiMember(Description="The valid from date for the price.")
    public var from:Date

    /**
    * The valid to date for the price.
    */
    // @ApiMember(Description="The valid to date for the price.")
    public var to:Date

    /**
    * If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
    */
    // @ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")
    public var daysOfWeek:[Int] = []

    /**
    * If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
    */
    // @ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")
    @TimeSpan public var fromTime:TimeInterval?

    /**
    * If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.
    */
    // @ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")
    @TimeSpan public var toTime:TimeInterval?

    required public init(){}
}

public class ServicePriceResponse : Codable
{
    /**
    * The company id
    */
    // @ApiMember(Description="The company id")
    public var companyId:String

    /**
    * The price id
    */
    // @ApiMember(Description="The price id")
    public var id:Int

    /**
    * The service id
    */
    // @ApiMember(Description="The service id")
    public var serviceId:Int

    /**
    * The price
    */
    // @ApiMember(Description="The price")
    public var price:Double

    /**
    * The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day
    */
    // @ApiMember(Description="The price calculation type id, 1 = Normal, price is for the service total duration, 2 = Price is per minute, 3 = Price is per hour, 4= Price is per day")
    public var calculationTypeId:Int

    /**
    * The price currency
    */
    // @ApiMember(Description="The price currency")
    public var currencyId:String

    /**
    * The price sign
    */
    // @ApiMember(Description="The price sign")
    public var priceSign:String

    /**
    * The price VAT in percent
    */
    // @ApiMember(Description="The price VAT in percent")
    public var vat:Double

    /**
    * The price category if price has a category
    */
    // @ApiMember(Description="The price category if price has a category")
    public var category:String

    /**
    * The price text to display
    */
    // @ApiMember(Description="The price text to display")
    public var priceText:String

    /**
    * The valid from date for the price.
    */
    // @ApiMember(Description="The valid from date for the price.")
    public var from:Date

    /**
    * The valid to date for the price.
    */
    // @ApiMember(Description="The valid to date for the price.")
    public var to:Date

    /**
    * If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
    */
    // @ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")
    public var daysOfWeek:[DayOfWeekDto] = []

    /**
    * If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.
    */
    // @ApiMember(Description="If the price is only valid for specific days in week add a comma separated list of which days this day price belongs to, 1 = Monday .. 7 = Sunday. All old days connected will be removed on update.")
    @TimeSpan public var fromTime:TimeInterval?

    /**
    * If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.
    */
    // @ApiMember(Description="If the price is only valid for a specific time span during a time of day enter the FromTime and ToTime parameters.")
    @TimeSpan public var toTime:TimeInterval?

    public var service:ServiceInfoResponse
    /**
    * If the price is only valid for a specific time span
    */
    // @ApiMember(Description="If the price is only valid for a specific time span")
    public var isTimeSpecific:Bool

    /**
    * If the price is only valid for specific days of week
    */
    // @ApiMember(Description="If the price is only valid for specific days of week")
    public var isDaysOfWeekSpecific:Bool

    /**
    * If the price is Weighted
    */
    // @ApiMember(Description="If the price is Weighted")
    public var isWeighted:Bool

    required public init(){}
}

public class DayOfWeekDto : Codable
{
    public var dayOfWeekId:Int
    public var dotNetDayOfWeekId:Int
    public var dayOfWeek:String

    required public init(){}
}

public class ServiceInfoResponse : Codable
{
    public var id:Int
    public var name:String
    public var Description:String
    public var imageUrl:Uri
    public var lengthInMinutes:Int?
    public var maxNumberOfSpotsPerBooking:Int
    public var groupBooking:GroupBookingSettings
    public var multipleResource:MultipleResourceSettings
    public var isGroupBooking:Bool
    public var isPaymentEnabled:Bool

    required public init(){}
}

public class GroupBookingSettings : Codable
{
    public var active:Bool
    public var min:Int
    public var max:Int

    required public init(){}
}

public class MultipleResourceSettings : Codable
{
    public var active:Bool
    public var min:Int
    public var max:Int

    required public init(){}
}


Swift UpdateServicePrice DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

PUT /services/prices/{Id} HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	CompanyId: 00000000-0000-0000-0000-000000000000,
	Id: 0,
	Price: 0,
	CurrencyId: String,
	CalculationTypeId: 0,
	VAT: 0,
	Category: String,
	DaysOfWeek: 
	[
		0
	],
	FromTime: PT0S,
	ToTime: PT0S
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Id: 0,
	ServiceId: 0,
	Price: 0,
	CalculationTypeId: 0,
	CurrencyId: String,
	PriceSign: String,
	VAT: 0,
	Category: String,
	PriceText: String,
	DaysOfWeek: 
	[
		{
			DayOfWeekId: 0,
			DotNetDayOfWeekId: 0,
			DayOfWeek: String
		}
	],
	FromTime: PT0S,
	ToTime: PT0S,
	Service: 
	{
		Id: 0,
		Name: String,
		Description: String,
		LengthInMinutes: 0,
		MaxNumberOfSpotsPerBooking: 0,
		GroupBooking: 
		{
			Active: False,
			Min: 0,
			Max: 0
		},
		MultipleResource: 
		{
			Active: False,
			Min: 0,
			Max: 0
		},
		IsGroupBooking: False,
		IsPaymentEnabled: False
	},
	IsTimeSpecific: False,
	IsDaysOfWeekSpecific: False,
	IsWeighted: False
}