<back to all web services

GetABTestVariations

The following routes are available for this service:
GET/RestApi/ab-testing/{id}/variations
<?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 GetABTestVariations implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id=''
    ) {
    }

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

class ABTestVariationViewModel implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $VariatonId='',
        /** @var string|null */
        public ?string $VariationName=null,
        /** @var string|null */
        public ?string $VariationLink=null,
        /** @var bool|null */
        public ?bool $IsWinner=null,
        /** @var int */
        public int $Ordinal=0
    ) {
    }

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

class ABTestVariationsViewModel implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id='',
        /** @var string|null */
        public ?string $PreviewLink=null,
        /** @var bool|null */
        public ?bool $IsPageSynced=null,
        /** @var array<ABTestVariationViewModel>|null */
        public ?array $Variations=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['PreviewLink'])) $this->PreviewLink = $o['PreviewLink'];
        if (isset($o['IsPageSynced'])) $this->IsPageSynced = $o['IsPageSynced'];
        if (isset($o['Variations'])) $this->Variations = JsonConverters::fromArray('ABTestVariationViewModel', $o['Variations']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->PreviewLink)) $o['PreviewLink'] = $this->PreviewLink;
        if (isset($this->IsPageSynced)) $o['IsPageSynced'] = $this->IsPageSynced;
        if (isset($this->Variations)) $o['Variations'] = JsonConverters::toArray('ABTestVariationViewModel', $this->Variations);
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetABTestVariations 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 /RestApi/ab-testing/{id}/variations HTTP/1.1 
Host: www.asg.com.au 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	PreviewLink: String,
	IsPageSynced: False
}