BokaMera.API.Host

<back to all web services

CreateUserAgreement

Requires Authentication
The following routes are available for this service:
POST/users/agreementMarks agreement as agreed for 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 CreateUserAgreementResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $UserId='',
        /** @var string */
        public string $AgreementId='',
        /** @var DateTime */
        public DateTime $UserAgreementCreated=new DateTime(),
        /** @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['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->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 CreateUserAgreement implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $UserId='',
        /** @var string */
        public string $AgreementId=''
    ) {
    }

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

PHP CreateUserAgreement 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 /users/agreement HTTP/1.1 
Host: api.bokamera.se 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"ResponseStatus":{}}