Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /rebatecodes | Create RebateCode. | Create RebateCode. |
---|
import 'package:servicestack/servicestack.dart';
class DaysOfWeekResponse implements IConvertible
{
int? Id;
String? DayOfWeek;
String? DayOfWeekTranslation;
bool? DayOfWeekActive;
int? DayOfWeekSortOrder;
DaysOfWeekResponse({this.Id,this.DayOfWeek,this.DayOfWeekTranslation,this.DayOfWeekActive,this.DayOfWeekSortOrder});
DaysOfWeekResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
DayOfWeek = json['DayOfWeek'];
DayOfWeekTranslation = json['DayOfWeekTranslation'];
DayOfWeekActive = json['DayOfWeekActive'];
DayOfWeekSortOrder = json['DayOfWeekSortOrder'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'DayOfWeek': DayOfWeek,
'DayOfWeekTranslation': DayOfWeekTranslation,
'DayOfWeekActive': DayOfWeekActive,
'DayOfWeekSortOrder': DayOfWeekSortOrder
};
getTypeName() => "DaysOfWeekResponse";
TypeContext? context = _ctx;
}
class RebateCodeServiceResponse implements IConvertible
{
int? Id;
String? Name;
String? Description;
bool? Active;
RebateCodeServiceResponse({this.Id,this.Name,this.Description,this.Active});
RebateCodeServiceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Name = json['Name'];
Description = json['Description'];
Active = json['Active'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Name': Name,
'Description': Description,
'Active': Active
};
getTypeName() => "RebateCodeServiceResponse";
TypeContext? context = _ctx;
}
class RebateCodeCustomerResponse implements IConvertible
{
String? Id;
String? Firstname;
String? Lastname;
String? Email;
String? Phone;
String? ImageUrl;
RebateCodeCustomerResponse({this.Id,this.Firstname,this.Lastname,this.Email,this.Phone,this.ImageUrl});
RebateCodeCustomerResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Firstname = json['Firstname'];
Lastname = json['Lastname'];
Email = json['Email'];
Phone = json['Phone'];
ImageUrl = json['ImageUrl'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Firstname': Firstname,
'Lastname': Lastname,
'Email': Email,
'Phone': Phone,
'ImageUrl': ImageUrl
};
getTypeName() => "RebateCodeCustomerResponse";
TypeContext? context = _ctx;
}
class RebateCodeTypeItem implements IConvertible
{
int? Id;
String? Name;
String? Description;
RebateCodeTypeItem({this.Id,this.Name,this.Description});
RebateCodeTypeItem.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Name = json['Name'];
Description = json['Description'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Name': Name,
'Description': Description
};
getTypeName() => "RebateCodeTypeItem";
TypeContext? context = _ctx;
}
class RebateCodeTypeResponse implements IConvertible
{
ResponseStatus? ResponseStatus;
List<RebateCodeTypeItem>? RebateCodeTypeItems;
RebateCodeTypeResponse({this.ResponseStatus,this.RebateCodeTypeItems});
RebateCodeTypeResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
RebateCodeTypeItems = JsonConverters.fromJson(json['RebateCodeTypeItems'],'List<RebateCodeTypeItem>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
'RebateCodeTypeItems': JsonConverters.toJson(RebateCodeTypeItems,'List<RebateCodeTypeItem>',context!)
};
getTypeName() => "RebateCodeTypeResponse";
TypeContext? context = _ctx;
}
class RebateCodeStatusItem implements IConvertible
{
int? Id;
String? RebateCodeStatusName;
String? RebateCodeStatusDescription;
RebateCodeStatusItem({this.Id,this.RebateCodeStatusName,this.RebateCodeStatusDescription});
RebateCodeStatusItem.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
RebateCodeStatusName = json['RebateCodeStatusName'];
RebateCodeStatusDescription = json['RebateCodeStatusDescription'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'RebateCodeStatusName': RebateCodeStatusName,
'RebateCodeStatusDescription': RebateCodeStatusDescription
};
getTypeName() => "RebateCodeStatusItem";
TypeContext? context = _ctx;
}
class RebateCodeStatusResponse implements IConvertible
{
ResponseStatus? ResponseStatus;
List<RebateCodeStatusItem>? RebateCodeStatusItems;
RebateCodeStatusResponse({this.ResponseStatus,this.RebateCodeStatusItems});
RebateCodeStatusResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
RebateCodeStatusItems = JsonConverters.fromJson(json['RebateCodeStatusItems'],'List<RebateCodeStatusItem>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
'RebateCodeStatusItems': JsonConverters.toJson(RebateCodeStatusItems,'List<RebateCodeStatusItem>',context!)
};
getTypeName() => "RebateCodeStatusResponse";
TypeContext? context = _ctx;
}
class RebateCodeResponse implements IConvertible
{
int? Id;
String? CompanyId;
DateTime? ValidFrom;
DateTime? ValidTo;
/**
* 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;
String? CreatedBy;
DateTime? Created;
String? UpdatedBy;
DateTime? Updated;
String? PersonalNote;
String? RebateCodeSign;
int? RebateCodeValue;
int? RebateCodeTypeId;
String? Name;
int? RebateCodeStatusId;
String? StatusName;
int? MaxNumberOfUses;
int? MaxNumberOfUsesPerCustomer;
int? NumberOfUsesUsed;
int? NumberOfUsesPerCustomerUsed;
List<DaysOfWeekResponse>? DaysOfWeek;
List<RebateCodeServiceResponse>? Services;
List<RebateCodeCustomerResponse>? Customers;
List<RebateCodeTypeResponse>? RebateCodeTypesOptions;
List<RebateCodeStatusResponse>? RebateCodeStatusOptions;
ResponseStatus? ResponseStatus;
RebateCodeResponse({this.Id,this.CompanyId,this.ValidFrom,this.ValidTo,this.FromTime,this.ToTime,this.CreatedBy,this.Created,this.UpdatedBy,this.Updated,this.PersonalNote,this.RebateCodeSign,this.RebateCodeValue,this.RebateCodeTypeId,this.Name,this.RebateCodeStatusId,this.StatusName,this.MaxNumberOfUses,this.MaxNumberOfUsesPerCustomer,this.NumberOfUsesUsed,this.NumberOfUsesPerCustomerUsed,this.DaysOfWeek,this.Services,this.Customers,this.RebateCodeTypesOptions,this.RebateCodeStatusOptions,this.ResponseStatus});
RebateCodeResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
CompanyId = json['CompanyId'];
ValidFrom = JsonConverters.fromJson(json['ValidFrom'],'DateTime',context!);
ValidTo = JsonConverters.fromJson(json['ValidTo'],'DateTime',context!);
FromTime = JsonConverters.fromJson(json['FromTime'],'Duration',context!);
ToTime = JsonConverters.fromJson(json['ToTime'],'Duration',context!);
CreatedBy = json['CreatedBy'];
Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
UpdatedBy = json['UpdatedBy'];
Updated = JsonConverters.fromJson(json['Updated'],'DateTime',context!);
PersonalNote = json['PersonalNote'];
RebateCodeSign = json['RebateCodeSign'];
RebateCodeValue = json['RebateCodeValue'];
RebateCodeTypeId = json['RebateCodeTypeId'];
Name = json['Name'];
RebateCodeStatusId = json['RebateCodeStatusId'];
StatusName = json['StatusName'];
MaxNumberOfUses = json['MaxNumberOfUses'];
MaxNumberOfUsesPerCustomer = json['MaxNumberOfUsesPerCustomer'];
NumberOfUsesUsed = json['NumberOfUsesUsed'];
NumberOfUsesPerCustomerUsed = json['NumberOfUsesPerCustomerUsed'];
DaysOfWeek = JsonConverters.fromJson(json['DaysOfWeek'],'List<DaysOfWeekResponse>',context!);
Services = JsonConverters.fromJson(json['Services'],'List<RebateCodeServiceResponse>',context!);
Customers = JsonConverters.fromJson(json['Customers'],'List<RebateCodeCustomerResponse>',context!);
RebateCodeTypesOptions = JsonConverters.fromJson(json['RebateCodeTypesOptions'],'List<RebateCodeTypeResponse>',context!);
RebateCodeStatusOptions = JsonConverters.fromJson(json['RebateCodeStatusOptions'],'List<RebateCodeStatusResponse>',context!);
ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'CompanyId': CompanyId,
'ValidFrom': JsonConverters.toJson(ValidFrom,'DateTime',context!),
'ValidTo': JsonConverters.toJson(ValidTo,'DateTime',context!),
'FromTime': JsonConverters.toJson(FromTime,'Duration',context!),
'ToTime': JsonConverters.toJson(ToTime,'Duration',context!),
'CreatedBy': CreatedBy,
'Created': JsonConverters.toJson(Created,'DateTime',context!),
'UpdatedBy': UpdatedBy,
'Updated': JsonConverters.toJson(Updated,'DateTime',context!),
'PersonalNote': PersonalNote,
'RebateCodeSign': RebateCodeSign,
'RebateCodeValue': RebateCodeValue,
'RebateCodeTypeId': RebateCodeTypeId,
'Name': Name,
'RebateCodeStatusId': RebateCodeStatusId,
'StatusName': StatusName,
'MaxNumberOfUses': MaxNumberOfUses,
'MaxNumberOfUsesPerCustomer': MaxNumberOfUsesPerCustomer,
'NumberOfUsesUsed': NumberOfUsesUsed,
'NumberOfUsesPerCustomerUsed': NumberOfUsesPerCustomerUsed,
'DaysOfWeek': JsonConverters.toJson(DaysOfWeek,'List<DaysOfWeekResponse>',context!),
'Services': JsonConverters.toJson(Services,'List<RebateCodeServiceResponse>',context!),
'Customers': JsonConverters.toJson(Customers,'List<RebateCodeCustomerResponse>',context!),
'RebateCodeTypesOptions': JsonConverters.toJson(RebateCodeTypesOptions,'List<RebateCodeTypeResponse>',context!),
'RebateCodeStatusOptions': JsonConverters.toJson(RebateCodeStatusOptions,'List<RebateCodeStatusResponse>',context!),
'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
};
getTypeName() => "RebateCodeResponse";
TypeContext? context = _ctx;
}
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class CreateRebateCode implements IConvertible
{
/**
*
*/
// @ApiMember(Description="")
String? CompanyId;
/**
* The default value is 9999
*/
// @ApiMember(Description="The default value is 9999")
int? MaxNumberOfUses;
/**
* The default value is 1
*/
// @ApiMember(Description="The default value is 1")
int? MaxNumberOfUsesPerCustomer;
/**
*
*/
// @ApiMember(Description="", IsRequired=true)
DateTime? ValidFrom;
/**
*
*/
// @ApiMember(Description="", IsRequired=true)
DateTime? ValidTo;
/**
* 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;
/**
* 1 - Percent, 2 - Сurrency
*/
// @ApiMember(Description="1 - Percent, 2 - Сurrency", IsRequired=true)
int? RebateCodeTypeId;
/**
*
*/
// @ApiMember(Description="", IsRequired=true)
int? RebateCodeValue;
/**
* If AutoGenerateRebateCodeSign=false - more than four letters, unique among active codes
*/
// @ApiMember(Description="If AutoGenerateRebateCodeSign=false - more than four letters, unique among active codes")
String? RebateCodeSign;
/**
* AutoGenerateRebateCodeSign=true - random generate code
*/
// @ApiMember(Description="AutoGenerateRebateCodeSign=true - random generate code")
bool? AutoGenerateRebateCodeSign;
/**
*
*/
// @ApiMember(Description="")
String? PersonalNote;
/**
*
*/
// @ApiMember(Description="")
List<int>? DaysOfWeek;
/**
*
*/
// @ApiMember(Description="")
List<int>? Services;
/**
*
*/
// @ApiMember(Description="")
List<String>? Customers;
CreateRebateCode({this.CompanyId,this.MaxNumberOfUses,this.MaxNumberOfUsesPerCustomer,this.ValidFrom,this.ValidTo,this.FromTime,this.ToTime,this.RebateCodeTypeId,this.RebateCodeValue,this.RebateCodeSign,this.AutoGenerateRebateCodeSign,this.PersonalNote,this.DaysOfWeek,this.Services,this.Customers});
CreateRebateCode.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
MaxNumberOfUses = json['MaxNumberOfUses'];
MaxNumberOfUsesPerCustomer = json['MaxNumberOfUsesPerCustomer'];
ValidFrom = JsonConverters.fromJson(json['ValidFrom'],'DateTime',context!);
ValidTo = JsonConverters.fromJson(json['ValidTo'],'DateTime',context!);
FromTime = JsonConverters.fromJson(json['FromTime'],'Duration',context!);
ToTime = JsonConverters.fromJson(json['ToTime'],'Duration',context!);
RebateCodeTypeId = json['RebateCodeTypeId'];
RebateCodeValue = json['RebateCodeValue'];
RebateCodeSign = json['RebateCodeSign'];
AutoGenerateRebateCodeSign = json['AutoGenerateRebateCodeSign'];
PersonalNote = json['PersonalNote'];
DaysOfWeek = JsonConverters.fromJson(json['DaysOfWeek'],'List<int>',context!);
Services = JsonConverters.fromJson(json['Services'],'List<int>',context!);
Customers = JsonConverters.fromJson(json['Customers'],'List<String>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'MaxNumberOfUses': MaxNumberOfUses,
'MaxNumberOfUsesPerCustomer': MaxNumberOfUsesPerCustomer,
'ValidFrom': JsonConverters.toJson(ValidFrom,'DateTime',context!),
'ValidTo': JsonConverters.toJson(ValidTo,'DateTime',context!),
'FromTime': JsonConverters.toJson(FromTime,'Duration',context!),
'ToTime': JsonConverters.toJson(ToTime,'Duration',context!),
'RebateCodeTypeId': RebateCodeTypeId,
'RebateCodeValue': RebateCodeValue,
'RebateCodeSign': RebateCodeSign,
'AutoGenerateRebateCodeSign': AutoGenerateRebateCodeSign,
'PersonalNote': PersonalNote,
'DaysOfWeek': JsonConverters.toJson(DaysOfWeek,'List<int>',context!),
'Services': JsonConverters.toJson(Services,'List<int>',context!),
'Customers': JsonConverters.toJson(Customers,'List<String>',context!)
};
getTypeName() => "CreateRebateCode";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'testapi.bokamera.se', types: <String, TypeInfo> {
'DaysOfWeekResponse': TypeInfo(TypeOf.Class, create:() => DaysOfWeekResponse()),
'RebateCodeServiceResponse': TypeInfo(TypeOf.Class, create:() => RebateCodeServiceResponse()),
'RebateCodeCustomerResponse': TypeInfo(TypeOf.Class, create:() => RebateCodeCustomerResponse()),
'RebateCodeTypeItem': TypeInfo(TypeOf.Class, create:() => RebateCodeTypeItem()),
'RebateCodeTypeResponse': TypeInfo(TypeOf.Class, create:() => RebateCodeTypeResponse()),
'List<RebateCodeTypeItem>': TypeInfo(TypeOf.Class, create:() => <RebateCodeTypeItem>[]),
'RebateCodeStatusItem': TypeInfo(TypeOf.Class, create:() => RebateCodeStatusItem()),
'RebateCodeStatusResponse': TypeInfo(TypeOf.Class, create:() => RebateCodeStatusResponse()),
'List<RebateCodeStatusItem>': TypeInfo(TypeOf.Class, create:() => <RebateCodeStatusItem>[]),
'RebateCodeResponse': TypeInfo(TypeOf.Class, create:() => RebateCodeResponse()),
'List<DaysOfWeekResponse>': TypeInfo(TypeOf.Class, create:() => <DaysOfWeekResponse>[]),
'List<RebateCodeServiceResponse>': TypeInfo(TypeOf.Class, create:() => <RebateCodeServiceResponse>[]),
'List<RebateCodeCustomerResponse>': TypeInfo(TypeOf.Class, create:() => <RebateCodeCustomerResponse>[]),
'List<RebateCodeTypeResponse>': TypeInfo(TypeOf.Class, create:() => <RebateCodeTypeResponse>[]),
'List<RebateCodeStatusResponse>': TypeInfo(TypeOf.Class, create:() => <RebateCodeStatusResponse>[]),
'CreateRebateCode': TypeInfo(TypeOf.Class, create:() => CreateRebateCode()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /rebatecodes HTTP/1.1
Host: testapi.bokamera.se
Accept: application/json
Content-Type: application/json
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","MaxNumberOfUses":0,"MaxNumberOfUsesPerCustomer":0,"FromTime":"00:00:00","ToTime":"00:00:00","RebateCodeTypeId":0,"RebateCodeValue":0,"RebateCodeSign":"String","AutoGenerateRebateCodeSign":false,"PersonalNote":"String","DaysOfWeek":[0],"Services":[0],"Customers":["00000000-0000-0000-0000-000000000000"]}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Id":0,"CompanyId":"00000000-0000-0000-0000-000000000000","FromTime":"00:00:00","ToTime":"00:00:00","CreatedBy":"String","UpdatedBy":"String","PersonalNote":"String","RebateCodeSign":"String","RebateCodeValue":0,"RebateCodeTypeId":0,"Name":"String","RebateCodeStatusId":0,"StatusName":"String","MaxNumberOfUses":0,"MaxNumberOfUsesPerCustomer":0,"NumberOfUsesUsed":0,"NumberOfUsesPerCustomerUsed":0,"DaysOfWeek":[{"Id":0,"DayOfWeek":"String","DayOfWeekTranslation":"String","DayOfWeekActive":false,"DayOfWeekSortOrder":0}],"Services":[{"Id":0,"Name":"String","Description":"String","Active":false}],"Customers":[{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","ImageUrl":"String"}],"RebateCodeTypesOptions":[{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"RebateCodeTypeItems":[{"Id":0,"Name":"String","Description":"String"}]}],"RebateCodeStatusOptions":[{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"RebateCodeStatusItems":[{"Id":0,"RebateCodeStatusName":"String","RebateCodeStatusDescription":"String"}]}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}