BokaMera.API.Host

<back to all web services

CompanyIncentiveQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, bookingsupplier-administrator-read, superadmin
The following routes are available for this service:
GET/companies/{CompanyId}/incentivesIt gets either incentives which are not read or engaged by the current company/administrator.
import 'package:servicestack/servicestack.dart';

class BaseModel implements IConvertible
{
    BaseModel();
    BaseModel.fromJson(Map<String, dynamic> json) : super();
    fromMap(Map<String, dynamic> json) {
        return this;
    }

    Map<String, dynamic> toJson() => {};
    getTypeName() => "BaseModel";
    TypeContext? context = _ctx;
}

enum IncentiveActionType
{
    Upgrade,
    AddOn,
    Information,
}

class IncentiveAction extends BaseModel implements IConvertible
{
    int? Id;
    IncentiveActionType? ActionType;
    String? Page;
    String? Segment;
    String? Element;

    IncentiveAction({this.Id,this.ActionType,this.Page,this.Segment,this.Element});
    IncentiveAction.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        Id = json['Id'];
        ActionType = JsonConverters.fromJson(json['ActionType'],'IncentiveActionType',context!);
        Page = json['Page'];
        Segment = json['Segment'];
        Element = json['Element'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'Id': Id,
        'ActionType': JsonConverters.toJson(ActionType,'IncentiveActionType',context!),
        'Page': Page,
        'Segment': Segment,
        'Element': Element
    });

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

class CompanyIncentiveResponse implements IConvertible
{
    int? Id;
    String? Heading;
    String? StorageUrl;
    String? SuccessButtonText;
    int? ActionId;
    int? InitialDelayInSeconds;
    int? MaxDisplayCount;
    DateTime? ValidFrom;
    DateTime? ValidTo;
    IncentiveAction? Action;
    String? Payload;

    CompanyIncentiveResponse({this.Id,this.Heading,this.StorageUrl,this.SuccessButtonText,this.ActionId,this.InitialDelayInSeconds,this.MaxDisplayCount,this.ValidFrom,this.ValidTo,this.Action,this.Payload});
    CompanyIncentiveResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Heading = json['Heading'];
        StorageUrl = json['StorageUrl'];
        SuccessButtonText = json['SuccessButtonText'];
        ActionId = json['ActionId'];
        InitialDelayInSeconds = json['InitialDelayInSeconds'];
        MaxDisplayCount = json['MaxDisplayCount'];
        ValidFrom = JsonConverters.fromJson(json['ValidFrom'],'DateTime',context!);
        ValidTo = JsonConverters.fromJson(json['ValidTo'],'DateTime',context!);
        Action = JsonConverters.fromJson(json['Action'],'IncentiveAction',context!);
        Payload = json['Payload'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Heading': Heading,
        'StorageUrl': StorageUrl,
        'SuccessButtonText': SuccessButtonText,
        'ActionId': ActionId,
        'InitialDelayInSeconds': InitialDelayInSeconds,
        'MaxDisplayCount': MaxDisplayCount,
        'ValidFrom': JsonConverters.toJson(ValidFrom,'DateTime',context!),
        'ValidTo': JsonConverters.toJson(ValidTo,'DateTime',context!),
        'Action': JsonConverters.toJson(Action,'IncentiveAction',context!),
        'Payload': Payload
    };

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

class CompanyIncentivesQueryResponse implements IConvertible
{
    List<CompanyIncentiveResponse>? Incentives;
    String? CompanyId;

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

    fromMap(Map<String, dynamic> json) {
        Incentives = JsonConverters.fromJson(json['Incentives'],'List<CompanyIncentiveResponse>',context!);
        CompanyId = json['CompanyId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Incentives': JsonConverters.toJson(Incentives,'List<CompanyIncentiveResponse>',context!),
        'CompanyId': CompanyId
    };

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

// @ValidateRequest(Validator="IsAuthenticated")
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class CompanyIncentiveQuery 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.", IsRequired=true, ParameterType="path")
    String? CompanyId;

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

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

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

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

TypeContext _ctx = TypeContext(library: 'testapi.bokamera.se', types: <String, TypeInfo> {
    'BaseModel': TypeInfo(TypeOf.Class, create:() => BaseModel()),
    'IncentiveActionType': TypeInfo(TypeOf.Enum, enumValues:IncentiveActionType.values),
    'IncentiveAction': TypeInfo(TypeOf.Class, create:() => IncentiveAction()),
    'CompanyIncentiveResponse': TypeInfo(TypeOf.Class, create:() => CompanyIncentiveResponse()),
    'CompanyIncentivesQueryResponse': TypeInfo(TypeOf.Class, create:() => CompanyIncentivesQueryResponse()),
    'List<CompanyIncentiveResponse>': TypeInfo(TypeOf.Class, create:() => <CompanyIncentiveResponse>[]),
    'CompanyIncentiveQuery': TypeInfo(TypeOf.Class, create:() => CompanyIncentiveQuery()),
});

Dart CompanyIncentiveQuery DTOs

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

HTTP + XML

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

GET /companies/{CompanyId}/incentives HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CompanyIncentivesQueryResponse 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>
  <Incentives i:nil="true" />
</CompanyIncentivesQueryResponse>