BokaMera.API.Host

<back to all web services

CompanyTrialsQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin, bookingsupplier-administrator-read
The following routes are available for this service:
GET/trials/company/Get all company started trialsGet all trials that have been started for a specific company
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;
}

// @ValidateRequest(Validator="IsAuthenticated")
class CompanyTrialsQuery implements ICompany, IConvertible
{
    /**
    * Enter the company and id you want to see the information for a resource, if blank company id and you are an admin, your company id will be used. If blank id, all resources will be shown 
    */
    // @ApiMember(Description="Enter the company and id you want to see the information for a resource, if blank company id and you are an admin, your company id will be used. If blank id, all resources will be shown ", IsRequired=true, ParameterType="query")
    String? CompanyId;

    /**
    * Trial Id
    */
    // @ApiMember(Description="Trial Id", IsRequired=true, ParameterType="query")
    int? Id;

    CompanyTrialsQuery({this.CompanyId,this.Id});
    CompanyTrialsQuery.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        Id = json['Id'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'Id': Id
    };

    getTypeName() => "CompanyTrialsQuery";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'testapi.bokamera.se', types: <String, TypeInfo> {
    'TrialQueryResponse': TypeInfo(TypeOf.Class, create:() => TrialQueryResponse()),
    'CompanyTrialQueryResponse': TypeInfo(TypeOf.Class, create:() => CompanyTrialQueryResponse()),
    'CompanyTrialsQuery': TypeInfo(TypeOf.Class, create:() => CompanyTrialsQuery()),
});

Dart CompanyTrialsQuery DTOs

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

HTTP + CSV

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

GET /trials/company/ HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"TrialTypeId":0,"TrialType":{"Id":0,"Name":"String","TrialDays":0},"Started":"0001-01-01T00:00:00","ValidTo":"0001-01-01T00:00:00","Active":false}