BokaMera.API.Host

<back to all web services

CompanyUserRolesQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin, bookingsupplier-administrator-read
The following routes are available for this service:
GET/administrators/rolesGet all administrator roles avaialbleThis all roles available for the administrator.
<?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};


// @ValidateRequest(Validator="IsAuthenticated")
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class CompanyUserRolesQuery implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

class AccessKeyTypeResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $KeyType=null,
        /** @var string|null */
        public ?string $Description=null
    ) {
    }

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

// @DataContract
/**
 * @template AccessKeyTypeResponse
 */
class QueryResponse implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): QueryResponse {
        $to = new QueryResponse();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    public function __construct(
        // @DataMember(Order=1)
        /** @var int */
        public mixed $Offset=0,

        // @DataMember(Order=2)
        /** @var int */
        public mixed $Total=0,

        // @DataMember(Order=3)
        /** @var array<AccessKeyTypeResponse>|null */
        public mixed $Results=null,

        // @DataMember(Order=4)
        /** @var array<string,string>|null */
        public mixed $Meta=null,

        // @DataMember(Order=5)
        /** @var ResponseStatus|null */
        public mixed $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Offset'])) $this->Offset = $o['Offset'];
        if (isset($o['Total'])) $this->Total = $o['Total'];
        if (isset($o['Results'])) $this->Results = JsonConverters::fromArray($this->genericArgs[0], $o['Results']);
        if (isset($o['Meta'])) $this->Meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Meta']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Offset)) $o['Offset'] = $this->Offset;
        if (isset($this->Total)) $o['Total'] = $this->Total;
        if (isset($this->Results)) $o['Results'] = JsonConverters::toArray($this->genericArgs[0], $this->Results);
        if (isset($this->Meta)) $o['Meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Meta);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

PHP CompanyUserRolesQuery 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 /administrators/roles HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<QueryResponseOfCompanyUserRolesQueryResponseWg5EthtI xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <Offset>0</Offset>
  <Total>0</Total>
  <Results xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
    <d2p1:CompanyUserRolesQueryResponse>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:Name>String</d2p1:Name>
      <d2p1:RoleId>00000000-0000-0000-0000-000000000000</d2p1:RoleId>
    </d2p1:CompanyUserRolesQueryResponse>
  </Results>
  <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Meta>
  <ResponseStatus>
    <ErrorCode>String</ErrorCode>
    <Message>String</Message>
    <StackTrace>String</StackTrace>
    <Errors>
      <ResponseError>
        <ErrorCode>String</ErrorCode>
        <FieldName>String</FieldName>
        <Message>String</Message>
        <Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </Meta>
      </ResponseError>
    </Errors>
    <Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </Meta>
  </ResponseStatus>
</QueryResponseOfCompanyUserRolesQueryResponseWg5EthtI>