Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
PUT | /voss/subscriptions | PUT voss subscription |
---|
import 'package:servicestack/servicestack.dart';
enum PeriodKindEnum
{
FixedTime,
AlignedToBindingPeriod,
AlignedToSubscriptionBillingPeriod,
}
enum UnitEnum
{
Day,
Month,
Year,
}
// @DataContract(Name="DiscountAgreementTimeLengthRequestDto")
class DiscountAgreementTimeLengthRequestDto implements IConvertible
{
// @DataMember(Name="unit", IsRequired=true)
UnitEnum? unit;
// @DataMember(Name="value", IsRequired=true)
int? value;
DiscountAgreementTimeLengthRequestDto({this.unit,this.value});
DiscountAgreementTimeLengthRequestDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
unit = JsonConverters.fromJson(json['Unit'],'UnitEnum',context!);
value = json['Value'];
return this;
}
Map<String, dynamic> toJson() => {
'unit': JsonConverters.toJson(unit,'UnitEnum',context!),
'value': value
};
getTypeName() => "DiscountAgreementTimeLengthRequestDto";
TypeContext? context = _ctx;
}
// @DataContract(Name="SubscriptionDiscountPeriodRequestDto")
class SubscriptionDiscountPeriodRequestDto implements IConvertible
{
// @DataMember(Name="periodKind", IsRequired=true)
PeriodKindEnum? periodKind;
// @DataMember(Name="length")
DiscountAgreementTimeLengthRequestDto? length;
// @DataMember(Name="periodIterationCount")
int? periodIterationCount;
SubscriptionDiscountPeriodRequestDto({this.periodKind,this.length,this.periodIterationCount});
SubscriptionDiscountPeriodRequestDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
periodKind = JsonConverters.fromJson(json['PeriodKind'],'PeriodKindEnum',context!);
length = JsonConverters.fromJson(json['Length'],'DiscountAgreementTimeLengthRequestDto',context!);
periodIterationCount = json['PeriodIterationCount'];
return this;
}
Map<String, dynamic> toJson() => {
'periodKind': JsonConverters.toJson(periodKind,'PeriodKindEnum',context!),
'length': JsonConverters.toJson(length,'DiscountAgreementTimeLengthRequestDto',context!),
'periodIterationCount': periodIterationCount
};
getTypeName() => "SubscriptionDiscountPeriodRequestDto";
TypeContext? context = _ctx;
}
// @DataContract(Name="SubscriptionDiscountAgreementRequestDto")
class SubscriptionDiscountAgreementRequestDto implements IConvertible
{
// @DataMember(Name="discountAgreementId", IsRequired=true)
String? discountAgreementId;
// @DataMember(Name="period")
SubscriptionDiscountPeriodRequestDto? period;
SubscriptionDiscountAgreementRequestDto({this.discountAgreementId,this.period});
SubscriptionDiscountAgreementRequestDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
discountAgreementId = json['DiscountAgreementId'];
period = JsonConverters.fromJson(json['Period'],'SubscriptionDiscountPeriodRequestDto',context!);
return this;
}
Map<String, dynamic> toJson() => {
'discountAgreementId': discountAgreementId,
'period': JsonConverters.toJson(period,'SubscriptionDiscountPeriodRequestDto',context!)
};
getTypeName() => "SubscriptionDiscountAgreementRequestDto";
TypeContext? context = _ctx;
}
enum DiscountAgreementsChangeTypeEnum
{
Prospective,
Retrospective,
}
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class UpdateVossSubscriptions implements IConvertible
{
/**
* The company id. Subscription will be fetched of this company
*/
// @ApiMember(Description="The company id. Subscription will be fetched of this company")
String? CompanyId;
/**
* Discount agreement data
*/
// @ApiMember(Description="Discount agreement data")
List<SubscriptionDiscountAgreementRequestDto>? DiscountAgreements;
/**
* Discount agreements change type controls how already occured transactions are treated <br />Retrospective - all future and past not invoiced transactions will be recalculated with new discount agreements <br />Prospective - discounts will apply only for future transactions
*/
// @ApiMember(Description=" Discount agreements change type controls how already occured transactions are treated <br />Retrospective - all future and past not invoiced transactions will be recalculated with new discount agreements <br />Prospective - discounts will apply only for future transactions\n")
DiscountAgreementsChangeTypeEnum? DiscountAgreementsChangeType;
/**
* The company id. Subscription will be fetched of this company
*/
// @ApiMember(Description="The company id. Subscription will be fetched of this company")
int? CompanyOwnerId;
UpdateVossSubscriptions({this.CompanyId,this.DiscountAgreements,this.DiscountAgreementsChangeType,this.CompanyOwnerId});
UpdateVossSubscriptions.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
DiscountAgreements = JsonConverters.fromJson(json['DiscountAgreements'],'List<SubscriptionDiscountAgreementRequestDto>',context!);
DiscountAgreementsChangeType = JsonConverters.fromJson(json['DiscountAgreementsChangeType'],'DiscountAgreementsChangeTypeEnum',context!);
CompanyOwnerId = json['CompanyOwnerId'];
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'DiscountAgreements': JsonConverters.toJson(DiscountAgreements,'List<SubscriptionDiscountAgreementRequestDto>',context!),
'DiscountAgreementsChangeType': JsonConverters.toJson(DiscountAgreementsChangeType,'DiscountAgreementsChangeTypeEnum',context!),
'CompanyOwnerId': CompanyOwnerId
};
getTypeName() => "UpdateVossSubscriptions";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'testapi.bokamera.se', types: <String, TypeInfo> {
'PeriodKindEnum': TypeInfo(TypeOf.Enum, enumValues:PeriodKindEnum.values),
'UnitEnum': TypeInfo(TypeOf.Enum, enumValues:UnitEnum.values),
'DiscountAgreementTimeLengthRequestDto': TypeInfo(TypeOf.Class, create:() => DiscountAgreementTimeLengthRequestDto()),
'SubscriptionDiscountPeriodRequestDto': TypeInfo(TypeOf.Class, create:() => SubscriptionDiscountPeriodRequestDto()),
'SubscriptionDiscountAgreementRequestDto': TypeInfo(TypeOf.Class, create:() => SubscriptionDiscountAgreementRequestDto()),
'DiscountAgreementsChangeTypeEnum': TypeInfo(TypeOf.Enum, enumValues:DiscountAgreementsChangeTypeEnum.values),
'UpdateVossSubscriptions': TypeInfo(TypeOf.Class, create:() => UpdateVossSubscriptions()),
'List<SubscriptionDiscountAgreementRequestDto>': TypeInfo(TypeOf.Class, create:() => <SubscriptionDiscountAgreementRequestDto>[]),
});
Dart UpdateVossSubscriptions DTOs
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 /voss/subscriptions HTTP/1.1
Host: testapi.bokamera.se
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"DiscountAgreements":[{}],"DiscountAgreementsChangeType":"Prospective","CompanyOwnerId":0}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {}