<back to all web services

ConversionRequestDto

The following routes are available for this service:
GET/RestApi/sitefinity/data-intelligence/conversion
<?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 ConversionRequestDto implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Filter=null
    ) {
    }

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

enum CalculationState : string
{
    case Inactive = 'Inactive';
    case Initializing = 'Initializing';
    case Active = 'Active';
    case ToBeDeleted = 'ToBeDeleted';
    case Error = 'Error';
    case Pending = 'Pending';
    case Expired = 'Expired';
}

enum MatchingOperator : string
{
    case ExactMatch = 'ExactMatch';
    case Contains = 'Contains';
    case StartsWith = 'StartsWith';
    case EndsWith = 'EndsWith';
    case UrlStrippedMatch = 'UrlStrippedMatch';
}

class ConditionPart implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $Predicate=null,
        /** @var bool|null */
        public ?bool $IsNegated=null,
        /** @var MatchingOperator|null */
        public ?MatchingOperator $PredicateOperator=null,
        /** @var MatchingOperator|null */
        public ?MatchingOperator $ObjectOperator=null,
        /** @var array<string>|null */
        public ?array $Objects=null,
        /** @var string|null */
        public ?string $ClientAttribute=null,
        /** @var string|null */
        public ?string $ContactPropertyId=null,
        /** @var array<string,string>|null */
        public ?array $ObjectMetadata=null,
        /** @var array<string,string>|null */
        public ?array $UrlParameters=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Predicate'])) $this->Predicate = $o['Predicate'];
        if (isset($o['IsNegated'])) $this->IsNegated = $o['IsNegated'];
        if (isset($o['PredicateOperator'])) $this->PredicateOperator = JsonConverters::from('MatchingOperator', $o['PredicateOperator']);
        if (isset($o['ObjectOperator'])) $this->ObjectOperator = JsonConverters::from('MatchingOperator', $o['ObjectOperator']);
        if (isset($o['Objects'])) $this->Objects = JsonConverters::fromArray('string', $o['Objects']);
        if (isset($o['ClientAttribute'])) $this->ClientAttribute = $o['ClientAttribute'];
        if (isset($o['ContactPropertyId'])) $this->ContactPropertyId = $o['ContactPropertyId'];
        if (isset($o['ObjectMetadata'])) $this->ObjectMetadata = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['ObjectMetadata']);
        if (isset($o['UrlParameters'])) $this->UrlParameters = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['UrlParameters']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Predicate)) $o['Predicate'] = $this->Predicate;
        if (isset($this->IsNegated)) $o['IsNegated'] = $this->IsNegated;
        if (isset($this->PredicateOperator)) $o['PredicateOperator'] = JsonConverters::to('MatchingOperator', $this->PredicateOperator);
        if (isset($this->ObjectOperator)) $o['ObjectOperator'] = JsonConverters::to('MatchingOperator', $this->ObjectOperator);
        if (isset($this->Objects)) $o['Objects'] = JsonConverters::toArray('string', $this->Objects);
        if (isset($this->ClientAttribute)) $o['ClientAttribute'] = $this->ClientAttribute;
        if (isset($this->ContactPropertyId)) $o['ContactPropertyId'] = $this->ContactPropertyId;
        if (isset($this->ObjectMetadata)) $o['ObjectMetadata'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->ObjectMetadata);
        if (isset($this->UrlParameters)) $o['UrlParameters'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->UrlParameters);
        return empty($o) ? new class(){} : $o;
    }
}

class ConditionExpression implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Relation=null,
        /** @var array<ConditionPart>|null */
        public ?array $Parts=null
    ) {
    }

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

class Conversion implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var CalculationState|null */
        public ?CalculationState $State=null,
        /** @var int|null */
        public ?int $InputDays=null,
        /** @var DateTime */
        public DateTime $CreatedOn=new DateTime(),
        /** @var DateTime */
        public DateTime $ModifiedOn=new DateTime(),
        /** @var string|null */
        public ?string $CreatedByUserId=null,
        /** @var string|null */
        public ?string $ModifiedByUserId=null,
        /** @var ConditionExpression|null */
        public ?ConditionExpression $Definition=null,
        /** @var ConditionExpression|null */
        public ?ConditionExpression $ClientFilter=null,
        /** @var bool|null */
        public ?bool $CanBeModified=null,
        /** @var bool|null */
        public ?bool $CanBeDeleted=null,
        /** @var bool|null */
        public ?bool $ContentRecommendationsEnabled=null,
        /** @var DateTime|null */
        public ?DateTime $AttributionCalculatedOn=null,
        /** @var int|null */
        public ?int $DecisionTreeId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['State'])) $this->State = JsonConverters::from('CalculationState', $o['State']);
        if (isset($o['InputDays'])) $this->InputDays = $o['InputDays'];
        if (isset($o['CreatedOn'])) $this->CreatedOn = JsonConverters::from('DateTime', $o['CreatedOn']);
        if (isset($o['ModifiedOn'])) $this->ModifiedOn = JsonConverters::from('DateTime', $o['ModifiedOn']);
        if (isset($o['CreatedByUserId'])) $this->CreatedByUserId = $o['CreatedByUserId'];
        if (isset($o['ModifiedByUserId'])) $this->ModifiedByUserId = $o['ModifiedByUserId'];
        if (isset($o['Definition'])) $this->Definition = JsonConverters::from('ConditionExpression', $o['Definition']);
        if (isset($o['ClientFilter'])) $this->ClientFilter = JsonConverters::from('ConditionExpression', $o['ClientFilter']);
        if (isset($o['CanBeModified'])) $this->CanBeModified = $o['CanBeModified'];
        if (isset($o['CanBeDeleted'])) $this->CanBeDeleted = $o['CanBeDeleted'];
        if (isset($o['ContentRecommendationsEnabled'])) $this->ContentRecommendationsEnabled = $o['ContentRecommendationsEnabled'];
        if (isset($o['AttributionCalculatedOn'])) $this->AttributionCalculatedOn = JsonConverters::from('DateTime', $o['AttributionCalculatedOn']);
        if (isset($o['DecisionTreeId'])) $this->DecisionTreeId = $o['DecisionTreeId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->State)) $o['State'] = JsonConverters::to('CalculationState', $this->State);
        if (isset($this->InputDays)) $o['InputDays'] = $this->InputDays;
        if (isset($this->CreatedOn)) $o['CreatedOn'] = JsonConverters::to('DateTime', $this->CreatedOn);
        if (isset($this->ModifiedOn)) $o['ModifiedOn'] = JsonConverters::to('DateTime', $this->ModifiedOn);
        if (isset($this->CreatedByUserId)) $o['CreatedByUserId'] = $this->CreatedByUserId;
        if (isset($this->ModifiedByUserId)) $o['ModifiedByUserId'] = $this->ModifiedByUserId;
        if (isset($this->Definition)) $o['Definition'] = JsonConverters::to('ConditionExpression', $this->Definition);
        if (isset($this->ClientFilter)) $o['ClientFilter'] = JsonConverters::to('ConditionExpression', $this->ClientFilter);
        if (isset($this->CanBeModified)) $o['CanBeModified'] = $this->CanBeModified;
        if (isset($this->CanBeDeleted)) $o['CanBeDeleted'] = $this->CanBeDeleted;
        if (isset($this->ContentRecommendationsEnabled)) $o['ContentRecommendationsEnabled'] = $this->ContentRecommendationsEnabled;
        if (isset($this->AttributionCalculatedOn)) $o['AttributionCalculatedOn'] = JsonConverters::to('DateTime', $this->AttributionCalculatedOn);
        if (isset($this->DecisionTreeId)) $o['DecisionTreeId'] = $this->DecisionTreeId;
        return empty($o) ? new class(){} : $o;
    }
}

class ConversionsViewModel implements JsonSerializable
{
    public function __construct(
        /** @var array<Conversion>|null */
        public ?array $Conversions=null
    ) {
    }

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

PHP ConversionRequestDto DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /RestApi/sitefinity/data-intelligence/conversion HTTP/1.1 
Host: www.asg.com.au 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{}