Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
POST | /trials/company/ | Add new trial to a company | Start a new trial to the company for the logged in user. |
---|
import 'package:servicestack/servicestack.dart';
class TrialQueryResponse implements IConvertible
{
int? Id;
String? Name;
int? TrialDays;
TrialQueryResponse({this.Id,this.Name,this.TrialDays});
TrialQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Name = json['Name'];
TrialDays = json['TrialDays'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Name': Name,
'TrialDays': TrialDays
};
getTypeName() => "TrialQueryResponse";
TypeContext? context = _ctx;
}
class CompanyTrialQueryResponse implements IConvertible
{
int? TrialTypeId;
TrialQueryResponse? TrialType;
DateTime? Started;
DateTime? Created;
DateTime? ValidTo;
bool? Active;
CompanyTrialQueryResponse({this.TrialTypeId,this.TrialType,this.Started,this.Created,this.ValidTo,this.Active});
CompanyTrialQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
TrialTypeId = json['TrialTypeId'];
TrialType = JsonConverters.fromJson(json['TrialType'],'TrialQueryResponse',context!);
Started = JsonConverters.fromJson(json['Started'],'DateTime',context!);
Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
ValidTo = JsonConverters.fromJson(json['ValidTo'],'DateTime',context!);
Active = json['Active'];
return this;
}
Map<String, dynamic> toJson() => {
'TrialTypeId': TrialTypeId,
'TrialType': JsonConverters.toJson(TrialType,'TrialQueryResponse',context!),
'Started': JsonConverters.toJson(Started,'DateTime',context!),
'Created': JsonConverters.toJson(Created,'DateTime',context!),
'ValidTo': JsonConverters.toJson(ValidTo,'DateTime',context!),
'Active': Active
};
getTypeName() => "CompanyTrialQueryResponse";
TypeContext? context = _ctx;
}
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class AddCompanyTrial 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 trial type
*/
// @ApiMember(Description="Id of the trial type", IsRequired=true)
int? TrialTypeId;
AddCompanyTrial({this.CompanyId,this.TrialTypeId});
AddCompanyTrial.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
TrialTypeId = json['TrialTypeId'];
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'TrialTypeId': TrialTypeId
};
getTypeName() => "AddCompanyTrial";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
'TrialQueryResponse': TypeInfo(TypeOf.Class, create:() => TrialQueryResponse()),
'CompanyTrialQueryResponse': TypeInfo(TypeOf.Class, create:() => CompanyTrialQueryResponse()),
'AddCompanyTrial': TypeInfo(TypeOf.Class, create:() => AddCompanyTrial()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /trials/company/ HTTP/1.1
Host: api.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<AddCompanyTrial xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
<CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
<TrialTypeId>0</TrialTypeId>
</AddCompanyTrial>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CompanyTrialQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <Active>false</Active> <Created>0001-01-01T00:00:00</Created> <Started>0001-01-01T00:00:00</Started> <TrialType> <Id>0</Id> <Name>String</Name> <TrialDays>0</TrialDays> </TrialType> <TrialTypeId>0</TrialTypeId> <ValidTo>0001-01-01T00:00:00</ValidTo> </CompanyTrialQueryResponse>