Mercedes.Auth.API

<back to all web services

RefreshUserTokenRequest

UserSession
Requires Authentication
The following routes are available for this service:
POST/v1/User/RefreshTokenRefresh user token before timeout
<?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 Account implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $GasUserId=null,
        /** @var int */
        public int $UserId=0,
        /** @var array<int>|null */
        public ?array $UserRoleId=null,
        /** @var string|null */
        public ?string $UserRoleRedirectUrl=null,
        /** @var string */
        public string $UserToken='',
        /** @var string|null */
        public ?string $RetailerGroupId=null,
        /** @var DateTime */
        public DateTime $Modified=new DateTime(),
        /** @var bool|null */
        public ?bool $Exists=null,
        /** @var string|null */
        public ?string $DefaultVehicleType=null,
        /** @var string|null */
        public ?string $DefaultRetailerGssn=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['GasUserId'])) $this->GasUserId = $o['GasUserId'];
        if (isset($o['UserId'])) $this->UserId = $o['UserId'];
        if (isset($o['UserRoleId'])) $this->UserRoleId = JsonConverters::fromArray('int', $o['UserRoleId']);
        if (isset($o['UserRoleRedirectUrl'])) $this->UserRoleRedirectUrl = $o['UserRoleRedirectUrl'];
        if (isset($o['UserToken'])) $this->UserToken = $o['UserToken'];
        if (isset($o['RetailerGroupId'])) $this->RetailerGroupId = $o['RetailerGroupId'];
        if (isset($o['Modified'])) $this->Modified = JsonConverters::from('DateTime', $o['Modified']);
        if (isset($o['Exists'])) $this->Exists = $o['Exists'];
        if (isset($o['DefaultVehicleType'])) $this->DefaultVehicleType = $o['DefaultVehicleType'];
        if (isset($o['DefaultRetailerGssn'])) $this->DefaultRetailerGssn = $o['DefaultRetailerGssn'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->GasUserId)) $o['GasUserId'] = $this->GasUserId;
        if (isset($this->UserId)) $o['UserId'] = $this->UserId;
        if (isset($this->UserRoleId)) $o['UserRoleId'] = JsonConverters::toArray('int', $this->UserRoleId);
        if (isset($this->UserRoleRedirectUrl)) $o['UserRoleRedirectUrl'] = $this->UserRoleRedirectUrl;
        if (isset($this->UserToken)) $o['UserToken'] = $this->UserToken;
        if (isset($this->RetailerGroupId)) $o['RetailerGroupId'] = $this->RetailerGroupId;
        if (isset($this->Modified)) $o['Modified'] = JsonConverters::to('DateTime', $this->Modified);
        if (isset($this->Exists)) $o['Exists'] = $this->Exists;
        if (isset($this->DefaultVehicleType)) $o['DefaultVehicleType'] = $this->DefaultVehicleType;
        if (isset($this->DefaultRetailerGssn)) $o['DefaultRetailerGssn'] = $this->DefaultRetailerGssn;
        return empty($o) ? new class(){} : $o;
    }
}

class RefreshUserTokenResponse implements JsonSerializable
{
    public function __construct(
        /** @var Account|null */
        public ?Account $Account=null,
        /** @var bool|null */
        public ?bool $IsValid=null
    ) {
    }

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

class RefreshUserTokenRequest implements IPost, JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

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

POST /v1/User/RefreshToken HTTP/1.1 
Host: prod-api-auth-mb-dhc.rapp-customers.co.uk 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<RefreshUserTokenRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Auth.API.ServiceModel.UserSession" />
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<RefreshUserTokenResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Auth.API.ServiceModel.UserSession">
  <Account xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.Auth.API.Shared.POCO">
    <d2p1:DefaultRetailerGssn>String</d2p1:DefaultRetailerGssn>
    <d2p1:DefaultVehicleType>String</d2p1:DefaultVehicleType>
    <d2p1:Exists>false</d2p1:Exists>
    <d2p1:GasUserId>String</d2p1:GasUserId>
    <d2p1:Modified>0001-01-01T00:00:00</d2p1:Modified>
    <d2p1:RetailerGroupId>String</d2p1:RetailerGroupId>
    <d2p1:UserId>0</d2p1:UserId>
    <d2p1:UserRoleId xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:int>0</d3p1:int>
    </d2p1:UserRoleId>
    <d2p1:UserRoleRedirectUrl>String</d2p1:UserRoleRedirectUrl>
    <d2p1:UserToken>00000000-0000-0000-0000-000000000000</d2p1:UserToken>
  </Account>
  <IsValid>false</IsValid>
</RefreshUserTokenResponse>