Support.WebApi

<back to all web services

RequestSupport

The following routes are available for this service:
POST/support/request
<?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 BettingApp implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $version=null
    ) {
    }

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

class Ref implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $id='',
        /** @var string */
        public string $val=''
    ) {
    }

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

class Origin implements JsonSerializable
{
    public function __construct(
        /** @var BettingApp|null */
        public ?BettingApp $application=null,
        /** @var string|null */
        public ?string $ip=null,
        /** @var Ref|null */
        public ?Ref $organization=null,
        /** @var Ref|null */
        public ?Ref $region=null,
        /** @var Ref|null */
        public ?Ref $locationGroup=null,
        /** @var Ref|null */
        public ?Ref $location=null,
        /** @var Ref|null */
        public ?Ref $device=null,
        /** @var Ref|null */
        public ?Ref $clerk=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['application'])) $this->application = JsonConverters::from('BettingApp', $o['application']);
        if (isset($o['ip'])) $this->ip = $o['ip'];
        if (isset($o['organization'])) $this->organization = JsonConverters::from('Ref', $o['organization']);
        if (isset($o['region'])) $this->region = JsonConverters::from('Ref', $o['region']);
        if (isset($o['locationGroup'])) $this->locationGroup = JsonConverters::from('Ref', $o['locationGroup']);
        if (isset($o['location'])) $this->location = JsonConverters::from('Ref', $o['location']);
        if (isset($o['device'])) $this->device = JsonConverters::from('Ref', $o['device']);
        if (isset($o['clerk'])) $this->clerk = JsonConverters::from('Ref', $o['clerk']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->application)) $o['application'] = JsonConverters::to('BettingApp', $this->application);
        if (isset($this->ip)) $o['ip'] = $this->ip;
        if (isset($this->organization)) $o['organization'] = JsonConverters::to('Ref', $this->organization);
        if (isset($this->region)) $o['region'] = JsonConverters::to('Ref', $this->region);
        if (isset($this->locationGroup)) $o['locationGroup'] = JsonConverters::to('Ref', $this->locationGroup);
        if (isset($this->location)) $o['location'] = JsonConverters::to('Ref', $this->location);
        if (isset($this->device)) $o['device'] = JsonConverters::to('Ref', $this->device);
        if (isset($this->clerk)) $o['clerk'] = JsonConverters::to('Ref', $this->clerk);
        return empty($o) ? new class(){} : $o;
    }
}

class RequestSupport implements JsonSerializable
{
    public function __construct(
        /** @var Origin|null */
        public ?Origin $origin=null
    ) {
    }

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

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

POST /support/request HTTP/1.1 
Host: support.bettor-dual-stage.webhop.biz 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	origin: 
	{
		application: 
		{
			name: String,
			version: String
		},
		ip: String,
		organization: 
		{
			id: String,
			val: String
		},
		region: 
		{
			id: String,
			val: String
		},
		locationGroup: 
		{
			id: String,
			val: String
		},
		location: 
		{
			id: String,
			val: String
		},
		device: 
		{
			id: String,
			val: String
		},
		clerk: 
		{
			id: String,
			val: String
		}
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	errorCode: String,
	message: String,
	stackTrace: String,
	errors: 
	[
		{
			errorCode: String,
			fieldName: String,
			message: String,
			meta: 
			{
				String: String
			}
		}
	],
	meta: 
	{
		String: String
	}
}