BokaMera.API.Host

<back to all web services

AddReference

The following routes are available for this service:
POST/referencesAdd referenceAdd reference
<?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};


class ReferenceQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @description The company id */
        // @ApiMember(Description="The company id")
        /** @var string */
        public string $CompanyId='',

        /** @description Id of the reference */
        // @ApiMember(Description="Id of the reference")
        /** @var string */
        public string $Id='',

        /** @description Internal Id of the reference. Example could be the Booking Id */
        // @ApiMember(Description="Internal Id of the reference. Example could be the Booking Id")
        /** @var string */
        public string $OwnerId='',

        /** @description The type of reference, you can name this parameter what you like. Example could be system_bookingid where the system is the external system */
        // @ApiMember(Description="The type of reference, you can name this parameter what you like. Example could be system_bookingid where the system is the external system")
        /** @var string|null */
        public ?string $ReferenceType=null,

        /** @description The external data. Could be a Id or a JSON object or anything */
        // @ApiMember(Description="The external data. Could be a Id or a JSON object or anything")
        /** @var string|null */
        public ?string $ExternalData=null,

        /** @description Will show when the reference was updated. */
        // @ApiMember(DataType="datetime", Description="Will show when the reference was updated.")
        /** @var DateTime */
        public DateTime $Updated=new DateTime(),

        /** @description Will show when the reference was created. */
        // @ApiMember(DataType="datetime", Description="Will show when the reference was created.")
        /** @var DateTime */
        public DateTime $Created=new DateTime(),

        /** @description Will show who created the reference. */
        // @ApiMember(DataType="datetime", Description="Will show who created the reference.")
        /** @var string|null */
        public ?string $CreatedBy=null,

        /** @description Will show who update the reference. */
        // @ApiMember(DataType="datetime", Description="Will show who update the reference.")
        /** @var string|null */
        public ?string $UpdatedBy=null,

        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['OwnerId'])) $this->OwnerId = $o['OwnerId'];
        if (isset($o['ReferenceType'])) $this->ReferenceType = $o['ReferenceType'];
        if (isset($o['ExternalData'])) $this->ExternalData = $o['ExternalData'];
        if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
        if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['UpdatedBy'])) $this->UpdatedBy = $o['UpdatedBy'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->OwnerId)) $o['OwnerId'] = $this->OwnerId;
        if (isset($this->ReferenceType)) $o['ReferenceType'] = $this->ReferenceType;
        if (isset($this->ExternalData)) $o['ExternalData'] = $this->ExternalData;
        if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
        if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->UpdatedBy)) $o['UpdatedBy'] = $this->UpdatedBy;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class AddReference implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description 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.")
        /** @var string|null */
        public ?string $CompanyId=null,

        /** @description Internal Id of the reference. Example could be the Booking Id */
        // @ApiMember(Description="Internal Id of the reference. Example could be the Booking Id")
        /** @var string */
        public string $OwnerId='',

        /** @description The type of reference, you can name this parameter what you like. Example could be system_bookingid where the system is the external system */
        // @ApiMember(Description="The type of reference, you can name this parameter what you like. Example could be system_bookingid where the system is the external system")
        /** @var string|null */
        public ?string $ReferenceType=null,

        /** @description The external data. Could be a Id or a JSON object or anything */
        // @ApiMember(Description="The external data. Could be a Id or a JSON object or anything")
        /** @var string|null */
        public ?string $ExternalData=null,

        /** @description Will show who created the reference. */
        // @ApiMember(DataType="datetime", Description="Will show who created the reference.")
        /** @var string|null */
        public ?string $CreatedBy=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['OwnerId'])) $this->OwnerId = $o['OwnerId'];
        if (isset($o['ReferenceType'])) $this->ReferenceType = $o['ReferenceType'];
        if (isset($o['ExternalData'])) $this->ExternalData = $o['ExternalData'];
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->OwnerId)) $o['OwnerId'] = $this->OwnerId;
        if (isset($this->ReferenceType)) $o['ReferenceType'] = $this->ReferenceType;
        if (isset($this->ExternalData)) $o['ExternalData'] = $this->ExternalData;
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        return empty($o) ? new class(){} : $o;
    }
}

PHP AddReference DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /references HTTP/1.1 
Host: api.bokamera.se 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","ReferenceType":"String","ExternalData":"String","CreatedBy":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"ReferenceType":"String","ExternalData":"String","CreatedBy":"String","UpdatedBy":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}