BokaMera.API.Host

<back to all web services

LogIncentiveEngage

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, bookingsupplier-administrator-read
The following routes are available for this service:
POST/company/{companyId}/incentives/{incentiveId}Logs a user interaction with an incentive.
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


enum EngagementType : int
{
    case Read = 1;
    case Success = 2;
    case Cancelled = 3;
    case CheckLater = 4;
}

// @ValidateRequest(Validator="IsAuthenticated")
// @ApiResponse(Description="You were unauthorized to call this service.", StatusCode=401)
class LogIncentiveEngage implements JsonSerializable
{
    public function __construct(
        /** @description The id of the company. If not provided, the company associated with the authenticated user will be used. */
        // @ApiMember(Description="The id of the company. If not provided, the company associated with the authenticated user will be used.", IsRequired=true, ParameterType="path")
        /** @var string */
        public string $CompanyId='',

        /** @description The id of the incentive. */
        // @ApiMember(Description="The id of the incentive.", IsRequired=true, ParameterType="path")
        /** @var int */
        public int $IncentiveId=0,

        /** @description Specifies the type of engagement (e.g., Read, Engaged) performed by the user on the incentive. */
        // @ApiMember(Description="Specifies the type of engagement (e.g., Read, Engaged) performed by the user on the incentive.", IsRequired=true)
        /** @var EngagementType|null */
        public ?EngagementType $EngagementType=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['IncentiveId'])) $this->IncentiveId = $o['IncentiveId'];
        if (isset($o['EngagementType'])) $this->EngagementType = JsonConverters::from('EngagementType', $o['EngagementType']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->IncentiveId)) $o['IncentiveId'] = $this->IncentiveId;
        if (isset($this->EngagementType)) $o['EngagementType'] = JsonConverters::to('EngagementType', $this->EngagementType);
        return empty($o) ? new class(){} : $o;
    }
}

PHP LogIncentiveEngage DTOs

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

HTTP + OTHER

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

POST /company/{companyId}/incentives/{incentiveId} HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"IncentiveId":0,"EngagementType":"Read"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{}