BokaMera.API.Host

<back to all web services

UserAgreementQuery

Requires Authentication
The following routes are available for this service:
GET/users/agreementGets latest not agreed agreement with optional history
<?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 UserAgreementQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $UserId='',
        /** @var string */
        public string $AgreementId='',
        /** @var DateTime|null */
        public ?DateTime $UserAgreementCreated=null,
        /** @var bool|null */
        public ?bool $AgreedToLatest=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['UserId'])) $this->UserId = $o['UserId'];
        if (isset($o['AgreementId'])) $this->AgreementId = $o['AgreementId'];
        if (isset($o['UserAgreementCreated'])) $this->UserAgreementCreated = JsonConverters::from('DateTime', $o['UserAgreementCreated']);
        if (isset($o['AgreedToLatest'])) $this->AgreedToLatest = $o['AgreedToLatest'];
        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->UserId)) $o['UserId'] = $this->UserId;
        if (isset($this->AgreementId)) $o['AgreementId'] = $this->AgreementId;
        if (isset($this->UserAgreementCreated)) $o['UserAgreementCreated'] = JsonConverters::to('DateTime', $this->UserAgreementCreated);
        if (isset($this->AgreedToLatest)) $o['AgreedToLatest'] = $this->AgreedToLatest;
        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)
// @ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class UserAgreementQuery implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $UserId=''
    ) {
    }

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

PHP UserAgreementQuery DTOs

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

HTTP + JSV

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

GET /users/agreement HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	UserAgreementCreated: "0001-01-01T00:00:00",
	AgreedToLatest: False,
	Documents: 
	[
		String
	],
	ResponseStatus: {}
}