BokaMera.API.Host

<back to all web services

ResyncAllBookingsToCodelock

The following routes are available for this service:
POST/codelock/resyncAdd settings for code lock of the company of the currently logged in user.
<?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 ResyncAllBookingsToCodelock implements ICompany, JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $CompanyId=null,
        /** @var string|null */
        public ?string $Secret=null
    ) {
    }

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

interface IVirtualDirectory
{
}

/**
 * @property IVirtualDirectory|null $RootDirectory
 * @property string|null $VirtualPathSeparator
 * @property string|null $RealPathSeparator
 */
interface IVirtualPathProvider
{
}

/**
 * @property IVirtualPathProvider|null $VirtualPathProvider
 * @property string|null $Extension
 * @property int $Length
 */
interface IVirtualFile
{
}

// @Flags()
enum CacheControl : int
{
    case None = 0;
    case Public = 1;
    case Private = 2;
    case MustRevalidate = 4;
    case NoCache = 8;
    case NoStore = 16;
    case NoTransform = 32;
    case ProxyRevalidate = 64;
}

interface IContentTypeWriter
{
}

/**
 * @property Object|null $OriginalResponse
 * @property IRequest|null $Request
 * @property int $StatusCode
 * @property string|null $StatusDescription
 * @property string|null $ContentType
 * @property ByteArray|null $OutputStream
 * @property Object|null $Dto
 * @property bool $UseBufferedStream
 * @property bool $IsClosed
 * @property bool $KeepAlive
 * @property bool $HasStarted
 * @property array<string,Object>|null $Items
 */
interface IResponse
{
}

// @Flags()
enum RequestAttributes : int
{
    case None = 0;
    case Localhost = 1;
    case LocalSubnet = 2;
    case External = 4;
    case Secure = 8;
    case InSecure = 16;
    case AnySecurityMode = 24;
    case HttpHead = 32;
    case HttpGet = 64;
    case HttpPost = 128;
    case HttpPut = 256;
    case HttpDelete = 512;
    case HttpPatch = 1024;
    case HttpOptions = 2048;
    case HttpOther = 4096;
    case AnyHttpMethod = 8160;
    case OneWay = 8192;
    case Reply = 16384;
    case AnyCallStyle = 24576;
    case Soap11 = 32768;
    case Soap12 = 65536;
    case Xml = 131072;
    case Json = 262144;
    case Jsv = 524288;
    case ProtoBuf = 1048576;
    case Csv = 2097152;
    case Html = 4194304;
    case Jsonl = 8388608;
    case MsgPack = 16777216;
    case FormatOther = 33554432;
    case AnyFormat = 67076096;
    case Http = 67108864;
    case MessageQueue = 134217728;
    case Tcp = 268435456;
    case Grpc = 536870912;
    case EndpointOther = 1073741824;
    case AnyEndpoint = 2080374784;
    case InProcess = -2147483648;
    case InternalNetworkAccess = -2147483645;
    case AnyNetworkAccessType = -2147483641;
    case Any = -1;
}

/**
 * @property bool $AcceptsBrotli
 * @property bool $AcceptsDeflate
 * @property bool $AcceptsGzip
 */
interface IRequestPreferences
{
}

/**
 * @property Object|null $OriginalRequest
 * @property IResponse|null $Response
 * @property string|null $OperationName
 * @property string|null $Verb
 * @property RequestAttributes $RequestAttributes
 * @property IRequestPreferences|null $RequestPreferences
 * @property Object|null $Dto
 * @property string|null $ContentType
 * @property bool $IsLocal
 * @property string|null $UserAgent
 * @property array<string,Cookie>|null $Cookies
 * @property string|null $ResponseContentType
 * @property bool $HasExplicitResponseContentType
 * @property array<string,Object>|null $Items
 * @property NameValueCollection|null $Headers
 * @property NameValueCollection|null $QueryString
 * @property NameValueCollection|null $FormData
 * @property bool $UseBufferedStream
 * @property string|null $RawUrl
 * @property string|null $AbsoluteUri
 * @property string|null $UserHostAddress
 * @property string|null $RemoteIp
 * @property string|null $Authorization
 * @property bool $IsSecureConnection
 * @property string[]|null $AcceptTypes
 * @property string|null $PathInfo
 * @property string|null $OriginalPathInfo
 * @property ByteArray|null $InputStream
 * @property int $ContentLength
 * @property IHttpFile[]|null $Files
 * @property string|null $UrlReferrer
 */
interface IRequest
{
}

class HttpResult implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $ResponseText=null,
        /** @var ByteArray|null */
        public ?ByteArray $ResponseStream=null,
        /** @var FileInfo|null */
        public ?FileInfo $FileInfo=null,
        /** @var IVirtualFile|null */
        public ?IVirtualFile $VirtualFile=null,
        /** @var string|null */
        public ?string $ContentType=null,
        /** @var array<string,string>|null */
        public ?array $Headers=null,
        /** @var array<Cookie>|null */
        public ?array $Cookies=null,
        /** @var string|null */
        public ?string $ETag=null,
        /** @var DateInterval|null */
        public ?DateInterval $Age=null,
        /** @var DateInterval|null */
        public ?DateInterval $MaxAge=null,
        /** @var DateTime|null */
        public ?DateTime $Expires=null,
        /** @var DateTime|null */
        public ?DateTime $LastModified=null,
        /** @var CacheControl|null */
        public ?CacheControl $CacheControl=null,
        /** @var Func<IDisposable>|null */
        public ?Func $ResultScope=null,
        /** @var bool|null */
        public ?bool $AllowsPartialResponse=null,
        /** @var array<string,string>|null */
        public ?array $Options=null,
        /** @var int */
        public int $Status=0,
        /** @var HttpStatusCode|null */
        public ?HttpStatusCode $StatusCode=null,
        /** @var string|null */
        public ?string $StatusDescription=null,
        /** @var Object|null */
        public ?Object $Response=null,
        /** @var IContentTypeWriter|null */
        public ?IContentTypeWriter $ResponseFilter=null,
        /** @var IRequest|null */
        public ?IRequest $RequestContext=null,
        /** @var string|null */
        public ?string $View=null,
        /** @var string|null */
        public ?string $Template=null,
        /** @var int */
        public int $PaddingLength=0,
        /** @var bool|null */
        public ?bool $IsPartialRequest=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseText'])) $this->ResponseText = $o['ResponseText'];
        if (isset($o['ResponseStream'])) $this->ResponseStream = JsonConverters::from('ByteArray', $o['ResponseStream']);
        if (isset($o['FileInfo'])) $this->FileInfo = JsonConverters::from('FileInfo', $o['FileInfo']);
        if (isset($o['VirtualFile'])) $this->VirtualFile = JsonConverters::from('IVirtualFile', $o['VirtualFile']);
        if (isset($o['ContentType'])) $this->ContentType = $o['ContentType'];
        if (isset($o['Headers'])) $this->Headers = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Headers']);
        if (isset($o['Cookies'])) $this->Cookies = JsonConverters::fromArray('Cookie', $o['Cookies']);
        if (isset($o['ETag'])) $this->ETag = $o['ETag'];
        if (isset($o['Age'])) $this->Age = JsonConverters::from('TimeSpan', $o['Age']);
        if (isset($o['MaxAge'])) $this->MaxAge = JsonConverters::from('TimeSpan', $o['MaxAge']);
        if (isset($o['Expires'])) $this->Expires = JsonConverters::from('DateTime', $o['Expires']);
        if (isset($o['LastModified'])) $this->LastModified = JsonConverters::from('DateTime', $o['LastModified']);
        if (isset($o['CacheControl'])) $this->CacheControl = JsonConverters::from('CacheControl', $o['CacheControl']);
        if (isset($o['ResultScope'])) $this->ResultScope = JsonConverters::from(JsonConverters::context('Func',genericArgs:['IDisposable']), $o['ResultScope']);
        if (isset($o['AllowsPartialResponse'])) $this->AllowsPartialResponse = $o['AllowsPartialResponse'];
        if (isset($o['Options'])) $this->Options = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Options']);
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['StatusCode'])) $this->StatusCode = JsonConverters::from('HttpStatusCode', $o['StatusCode']);
        if (isset($o['StatusDescription'])) $this->StatusDescription = $o['StatusDescription'];
        if (isset($o['Response'])) $this->Response = JsonConverters::from('Object', $o['Response']);
        if (isset($o['ResponseFilter'])) $this->ResponseFilter = JsonConverters::from('IContentTypeWriter', $o['ResponseFilter']);
        if (isset($o['RequestContext'])) $this->RequestContext = JsonConverters::from('IRequest', $o['RequestContext']);
        if (isset($o['View'])) $this->View = $o['View'];
        if (isset($o['Template'])) $this->Template = $o['Template'];
        if (isset($o['PaddingLength'])) $this->PaddingLength = $o['PaddingLength'];
        if (isset($o['IsPartialRequest'])) $this->IsPartialRequest = $o['IsPartialRequest'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseText)) $o['ResponseText'] = $this->ResponseText;
        if (isset($this->ResponseStream)) $o['ResponseStream'] = JsonConverters::to('ByteArray', $this->ResponseStream);
        if (isset($this->FileInfo)) $o['FileInfo'] = JsonConverters::to('FileInfo', $this->FileInfo);
        if (isset($this->VirtualFile)) $o['VirtualFile'] = JsonConverters::to('IVirtualFile', $this->VirtualFile);
        if (isset($this->ContentType)) $o['ContentType'] = $this->ContentType;
        if (isset($this->Headers)) $o['Headers'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Headers);
        if (isset($this->Cookies)) $o['Cookies'] = JsonConverters::toArray('Cookie', $this->Cookies);
        if (isset($this->ETag)) $o['ETag'] = $this->ETag;
        if (isset($this->Age)) $o['Age'] = JsonConverters::to('TimeSpan', $this->Age);
        if (isset($this->MaxAge)) $o['MaxAge'] = JsonConverters::to('TimeSpan', $this->MaxAge);
        if (isset($this->Expires)) $o['Expires'] = JsonConverters::to('DateTime', $this->Expires);
        if (isset($this->LastModified)) $o['LastModified'] = JsonConverters::to('DateTime', $this->LastModified);
        if (isset($this->CacheControl)) $o['CacheControl'] = JsonConverters::to('CacheControl', $this->CacheControl);
        if (isset($this->ResultScope)) $o['ResultScope'] = JsonConverters::to(JsonConverters::context('Func',genericArgs:['IDisposable']), $this->ResultScope);
        if (isset($this->AllowsPartialResponse)) $o['AllowsPartialResponse'] = $this->AllowsPartialResponse;
        if (isset($this->Options)) $o['Options'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Options);
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->StatusCode)) $o['StatusCode'] = JsonConverters::to('HttpStatusCode', $this->StatusCode);
        if (isset($this->StatusDescription)) $o['StatusDescription'] = $this->StatusDescription;
        if (isset($this->Response)) $o['Response'] = JsonConverters::to('Object', $this->Response);
        if (isset($this->ResponseFilter)) $o['ResponseFilter'] = JsonConverters::to('IContentTypeWriter', $this->ResponseFilter);
        if (isset($this->RequestContext)) $o['RequestContext'] = JsonConverters::to('IRequest', $this->RequestContext);
        if (isset($this->View)) $o['View'] = $this->View;
        if (isset($this->Template)) $o['Template'] = $this->Template;
        if (isset($this->PaddingLength)) $o['PaddingLength'] = $this->PaddingLength;
        if (isset($this->IsPartialRequest)) $o['IsPartialRequest'] = $this->IsPartialRequest;
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @property string|null $Name
 * @property string|null $FileName
 * @property int $ContentLength
 * @property string|null $ContentType
 * @property ByteArray|null $InputStream
 */
interface IHttpFile
{
}

PHP ResyncAllBookingsToCodelock 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.

POST /codelock/resync HTTP/1.1 
Host: api.bokamera.se 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","Secret":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{}