Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
PUT | /services/prices/{Id} | Update a price | Update a price on a service |
---|
import 'package:servicestack/servicestack.dart';
class DayOfWeekDto implements IConvertible
{
int? DayOfWeekId;
int? DotNetDayOfWeekId;
String? DayOfWeek;
DayOfWeekDto({this.DayOfWeekId,this.DotNetDayOfWeekId,this.DayOfWeek});
DayOfWeekDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
DayOfWeekId = json['DayOfWeekId'];
DotNetDayOfWeekId = json['DotNetDayOfWeekId'];
DayOfWeek = json['DayOfWeek'];
return this;
}
Map<String, dynamic> toJson() => {
'DayOfWeekId': DayOfWeekId,
'DotNetDayOfWeekId': DotNetDayOfWeekId,
'DayOfWeek': DayOfWeek
};
getTypeName() => "DayOfWeekDto";
TypeContext? context = _ctx;
}
class GroupBookingSettings implements IConvertible
{
bool? Active;
int? Min;
int? Max;
GroupBookingSettings({this.Active,this.Min,this.Max});
GroupBookingSettings.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Active = json['Active'];
Min = json['Min'];
Max = json['Max'];
return this;
}
Map<String, dynamic> toJson() => {
'Active': Active,
'Min': Min,
'Max': Max
};
getTypeName() => "GroupBookingSettings";
TypeContext? context = _ctx;
}
class MultipleResourceSettings implements IConvertible
{
bool? Active;
int? Min;
int? Max;
MultipleResourceSettings({this.Active,this.Min,this.Max});
MultipleResourceSettings.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Active = json['Active'];
Min = json['Min'];
Max = json['Max'];
return this;
}
Map<String, dynamic> toJson() => {
'Active': Active,
'Min': Min,
'Max': Max
};
getTypeName() => "MultipleResourceSettings";
TypeContext? context = _ctx;
}
class ServiceInfoResponse implements IConvertible
{
int? Id;
String? Name;
String? Description;
Uri? ImageUrl;
int? LengthInMinutes;
int? MaxNumberOfSpotsPerBooking;
int? MinNumberOfSpotsPerBooking;
GroupBookingSettings? GroupBooking;
MultipleResourceSettings? MultipleResource;
bool? IsGroupBooking;
bool? IsPaymentEnabled;
ServiceInfoResponse({this.Id,this.Name,this.Description,this.ImageUrl,this.LengthInMinutes,this.MaxNumberOfSpotsPerBooking,this.MinNumberOfSpotsPerBooking,this.GroupBooking,this.MultipleResource,this.IsGroupBooking,this.IsPaymentEnabled});
ServiceInfoResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Name = json['Name'];
Description = json['Description'];
ImageUrl = JsonConverters.fromJson(json['ImageUrl'],'Uri',context!);
LengthInMinutes = json['LengthInMinutes'];
MaxNumberOfSpotsPerBooking = json['MaxNumberOfSpotsPerBooking'];
MinNumberOfSpotsPerBooking = json['MinNumberOfSpotsPerBooking'];
GroupBooking = JsonConverters.fromJson(json['GroupBooking'],'GroupBookingSettings',context!);
MultipleResource = JsonConverters.fromJson(json['MultipleResource'],'MultipleResourceSettings',context!);
IsGroupBooking = json['IsGroupBooking'];
IsPaymentEnabled = json['IsPaymentEnabled'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Name': Name,
'Description': Description,
'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!),
'LengthInMinutes': LengthInMinutes,
'MaxNumberOfSpotsPerBooking': MaxNumberOfSpotsPerBooking,
'MinNumberOfSpotsPerBooking': MinNumberOfSpotsPerBooking,
'GroupBooking': JsonConverters.toJson(GroupBooking,'GroupBookingSettings',context!),
'MultipleResource': JsonConverters.toJson(MultipleResource,'MultipleResourceSettings',context!),
'IsGroupBooking': IsGroupBooking,
'IsPaymentEnabled': IsPaymentEnabled
};
getTypeName() => "ServiceInfoResponse";
TypeContext? context = _ctx;
}
class ServicePriceResponse implements IConvertible
{
/**
* The company id
*/
// @ApiMember(Description="The company id")
String? CompanyId;
/**
* The price id
*/
// @ApiMember(Description="The price id")
int? Id;
/**
* The service id
*/
// @ApiMember(Description="The service id")
int? ServiceId;
/**
* The price
*/
// @ApiMember(Description="The price")
double? Price;
/**
* 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")
int? CalculationTypeId;
/**
* The price currency
*/
// @ApiMember(Description="The price currency")
String? CurrencyId;
/**
* The price sign
*/
// @ApiMember(Description="The price sign")
String? PriceSign;
/**
* The price VAT in percent
*/
// @ApiMember(Description="The price VAT in percent")
double? VAT;
/**
* The price category if price has a category
*/
// @ApiMember(Description="The price category if price has a category")
String? Category;
/**
* The price text to display
*/
// @ApiMember(Description="The price text to display")
String? PriceText;
/**
* The valid from date for the price.
*/
// @ApiMember(Description="The valid from date for the price.")
DateTime? From;
/**
* The valid to date for the price.
*/
// @ApiMember(Description="The valid to date for the price.")
DateTime? To;
/**
* 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.")
List<DayOfWeekDto>? DaysOfWeek;
/**
* 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.")
Duration? FromTime;
/**
* 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.")
Duration? ToTime;
ServiceInfoResponse? Service;
/**
* If the price is only valid for a specific time span
*/
// @ApiMember(Description="If the price is only valid for a specific time span")
bool? IsTimeSpecific;
/**
* If the price is only valid for specific days of week
*/
// @ApiMember(Description="If the price is only valid for specific days of week")
bool? IsDaysOfWeekSpecific;
ServicePriceResponse({this.CompanyId,this.Id,this.ServiceId,this.Price,this.CalculationTypeId,this.CurrencyId,this.PriceSign,this.VAT,this.Category,this.PriceText,this.From,this.To,this.DaysOfWeek,this.FromTime,this.ToTime,this.Service,this.IsTimeSpecific,this.IsDaysOfWeekSpecific});
ServicePriceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
Id = json['Id'];
ServiceId = json['ServiceId'];
Price = JsonConverters.toDouble(json['Price']);
CalculationTypeId = json['CalculationTypeId'];
CurrencyId = json['CurrencyId'];
PriceSign = json['PriceSign'];
VAT = JsonConverters.toDouble(json['VAT']);
Category = json['Category'];
PriceText = json['PriceText'];
From = JsonConverters.fromJson(json['From'],'DateTime',context!);
To = JsonConverters.fromJson(json['To'],'DateTime',context!);
DaysOfWeek = JsonConverters.fromJson(json['DaysOfWeek'],'List<DayOfWeekDto>',context!);
FromTime = JsonConverters.fromJson(json['FromTime'],'Duration',context!);
ToTime = JsonConverters.fromJson(json['ToTime'],'Duration',context!);
Service = JsonConverters.fromJson(json['Service'],'ServiceInfoResponse',context!);
IsTimeSpecific = json['IsTimeSpecific'];
IsDaysOfWeekSpecific = json['IsDaysOfWeekSpecific'];
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'Id': Id,
'ServiceId': ServiceId,
'Price': Price,
'CalculationTypeId': CalculationTypeId,
'CurrencyId': CurrencyId,
'PriceSign': PriceSign,
'VAT': VAT,
'Category': Category,
'PriceText': PriceText,
'From': JsonConverters.toJson(From,'DateTime',context!),
'To': JsonConverters.toJson(To,'DateTime',context!),
'DaysOfWeek': JsonConverters.toJson(DaysOfWeek,'List<DayOfWeekDto>',context!),
'FromTime': JsonConverters.toJson(FromTime,'Duration',context!),
'ToTime': JsonConverters.toJson(ToTime,'Duration',context!),
'Service': JsonConverters.toJson(Service,'ServiceInfoResponse',context!),
'IsTimeSpecific': IsTimeSpecific,
'IsDaysOfWeekSpecific': IsDaysOfWeekSpecific
};
getTypeName() => "ServicePriceResponse";
TypeContext? context = _ctx;
}
// @ValidateRequest(Validator="IsAuthenticated")
class UpdateServicePrice implements ICompany, IConvertible
{
/**
* 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.")
String? CompanyId;
/**
* Id of the price
*/
// @ApiMember(Description="Id of the price", IsRequired=true, ParameterType="path")
int? Id;
/**
* The price
*/
// @ApiMember(Description="The price")
double? Price;
/**
* The price currency
*/
// @ApiMember(Description="The price currency")
String? CurrencyId;
/**
* 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")
int? CalculationTypeId;
/**
* The price VAT in percent
*/
// @ApiMember(Description="The price VAT in percent")
double? VAT;
/**
* The price category if price has a category
*/
// @ApiMember(Description="The price category if price has a category")
String? Category;
/**
* The valid from date for the price.
*/
// @ApiMember(Description="The valid from date for the price.")
DateTime? From;
/**
* The valid to date for the price.
*/
// @ApiMember(Description="The valid to date for the price.")
DateTime? To;
/**
* 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.")
List<int>? DaysOfWeek;
/**
* 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.")
Duration? FromTime;
/**
* 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.")
Duration? ToTime;
UpdateServicePrice({this.CompanyId,this.Id,this.Price,this.CurrencyId,this.CalculationTypeId,this.VAT,this.Category,this.From,this.To,this.DaysOfWeek,this.FromTime,this.ToTime});
UpdateServicePrice.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
Id = json['Id'];
Price = JsonConverters.toDouble(json['Price']);
CurrencyId = json['CurrencyId'];
CalculationTypeId = json['CalculationTypeId'];
VAT = JsonConverters.toDouble(json['VAT']);
Category = json['Category'];
From = JsonConverters.fromJson(json['From'],'DateTime',context!);
To = JsonConverters.fromJson(json['To'],'DateTime',context!);
DaysOfWeek = JsonConverters.fromJson(json['DaysOfWeek'],'List<int>',context!);
FromTime = JsonConverters.fromJson(json['FromTime'],'Duration',context!);
ToTime = JsonConverters.fromJson(json['ToTime'],'Duration',context!);
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'Id': Id,
'Price': Price,
'CurrencyId': CurrencyId,
'CalculationTypeId': CalculationTypeId,
'VAT': VAT,
'Category': Category,
'From': JsonConverters.toJson(From,'DateTime',context!),
'To': JsonConverters.toJson(To,'DateTime',context!),
'DaysOfWeek': JsonConverters.toJson(DaysOfWeek,'List<int>',context!),
'FromTime': JsonConverters.toJson(FromTime,'Duration',context!),
'ToTime': JsonConverters.toJson(ToTime,'Duration',context!)
};
getTypeName() => "UpdateServicePrice";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
'DayOfWeekDto': TypeInfo(TypeOf.Class, create:() => DayOfWeekDto()),
'GroupBookingSettings': TypeInfo(TypeOf.Class, create:() => GroupBookingSettings()),
'MultipleResourceSettings': TypeInfo(TypeOf.Class, create:() => MultipleResourceSettings()),
'ServiceInfoResponse': TypeInfo(TypeOf.Class, create:() => ServiceInfoResponse()),
'Uri': TypeInfo(TypeOf.Class, create:() => Uri()),
'ServicePriceResponse': TypeInfo(TypeOf.Class, create:() => ServicePriceResponse()),
'List<DayOfWeekDto>': TypeInfo(TypeOf.Class, create:() => <DayOfWeekDto>[]),
'UpdateServicePrice': TypeInfo(TypeOf.Class, create:() => UpdateServicePrice()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
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: api.bokamera.se
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","Id":0,"Price":0,"CurrencyId":"String","CalculationTypeId":0,"VAT":0,"Category":"String","DaysOfWeek":[0],"FromTime":"00:00:00","ToTime":"00:00:00"}
HTTP/1.1 200 OK Content-Type: text/jsonl 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":"00:00:00","ToTime":"00:00:00","Service":{"Id":0,"Name":"String","Description":"String","LengthInMinutes":0,"MaxNumberOfSpotsPerBooking":0,"MinNumberOfSpotsPerBooking":0,"GroupBooking":{"Active":false,"Min":0,"Max":0},"MultipleResource":{"Active":false,"Min":0,"Max":0},"IsGroupBooking":false,"IsPaymentEnabled":false},"IsTimeSpecific":false,"IsDaysOfWeekSpecific":false}