BokaMera.API.Host

<back to all web services

AgreementQuery

The following routes are available for this service:
GET/agreementsGets agreements
<?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 AgreementQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $AgreementId='',
        /** @var DateTime|null */
        public ?DateTime $AgreementCreated=null,
        /** @var array<string>|null */
        public ?array $Documents=null,
        /** @var Object|null */
        public ?Object $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['AgreementId'])) $this->AgreementId = $o['AgreementId'];
        if (isset($o['AgreementCreated'])) $this->AgreementCreated = JsonConverters::from('DateTime', $o['AgreementCreated']);
        if (isset($o['Documents'])) $this->Documents = JsonConverters::fromArray('string', $o['Documents']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('Object', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->AgreementId)) $o['AgreementId'] = $this->AgreementId;
        if (isset($this->AgreementCreated)) $o['AgreementCreated'] = JsonConverters::to('DateTime', $this->AgreementCreated);
        if (isset($this->Documents)) $o['Documents'] = JsonConverters::toArray('string', $this->Documents);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('Object', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="Returned if there is a validation error on the input parameters", StatusCode=400)
class AgreementQuery implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

PHP AgreementQuery 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 /agreements HTTP/1.1 
Host: api.bokamera.se 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<AgreementQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <AgreementCreated>0001-01-01T00:00:00</AgreementCreated>
  <AgreementId>00000000-0000-0000-0000-000000000000</AgreementId>
  <Documents xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:string>String</d2p1:string>
  </Documents>
  <ResponseStatus />
</AgreementQueryResponse>