GET | /RestApi/sitefinity/data-intelligence/leadscore |
---|
<?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 LeadScoreRequestDto 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 LeadScoreState : string
{
case Inactive = 'Inactive';
case Active = 'Active';
case ToBeDeleted = 'ToBeDeleted';
}
class LeadScoreLevel implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string|null */
public ?string $Name=null,
/** @var int */
public int $Threshold=0,
/** @var bool|null */
public ?bool $SendNotification=null,
/** @var string|null */
public ?string $Email=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['Threshold'])) $this->Threshold = $o['Threshold'];
if (isset($o['SendNotification'])) $this->SendNotification = $o['SendNotification'];
if (isset($o['Email'])) $this->Email = $o['Email'];
}
/** @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->Threshold)) $o['Threshold'] = $this->Threshold;
if (isset($this->SendNotification)) $o['SendNotification'] = $this->SendNotification;
if (isset($this->Email)) $o['Email'] = $this->Email;
return empty($o) ? new class(){} : $o;
}
}
class LeadScore implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string|null */
public ?string $Name=null,
/** @var LeadScoreState|null */
public ?LeadScoreState $State=null,
/** @var array<LeadScoreLevel>|null */
public ?array $Levels=null,
/** @var array<string,string>|null */
public ?array $Fields=null,
/** @var DateTime|null */
public ?DateTime $CreatedOn=null,
/** @var string|null */
public ?string $CreatedByUserId=null,
/** @var DateTime|null */
public ?DateTime $ModifiedOn=null,
/** @var string|null */
public ?string $ModifiedByUserId=null,
/** @var DateTime|null */
public ?DateTime $ToBeReinitializedAt=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('LeadScoreState', $o['State']);
if (isset($o['Levels'])) $this->Levels = JsonConverters::fromArray('LeadScoreLevel', $o['Levels']);
if (isset($o['Fields'])) $this->Fields = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Fields']);
if (isset($o['CreatedOn'])) $this->CreatedOn = JsonConverters::from('DateTime', $o['CreatedOn']);
if (isset($o['CreatedByUserId'])) $this->CreatedByUserId = $o['CreatedByUserId'];
if (isset($o['ModifiedOn'])) $this->ModifiedOn = JsonConverters::from('DateTime', $o['ModifiedOn']);
if (isset($o['ModifiedByUserId'])) $this->ModifiedByUserId = $o['ModifiedByUserId'];
if (isset($o['ToBeReinitializedAt'])) $this->ToBeReinitializedAt = JsonConverters::from('DateTime', $o['ToBeReinitializedAt']);
}
/** @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('LeadScoreState', $this->State);
if (isset($this->Levels)) $o['Levels'] = JsonConverters::toArray('LeadScoreLevel', $this->Levels);
if (isset($this->Fields)) $o['Fields'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Fields);
if (isset($this->CreatedOn)) $o['CreatedOn'] = JsonConverters::to('DateTime', $this->CreatedOn);
if (isset($this->CreatedByUserId)) $o['CreatedByUserId'] = $this->CreatedByUserId;
if (isset($this->ModifiedOn)) $o['ModifiedOn'] = JsonConverters::to('DateTime', $this->ModifiedOn);
if (isset($this->ModifiedByUserId)) $o['ModifiedByUserId'] = $this->ModifiedByUserId;
if (isset($this->ToBeReinitializedAt)) $o['ToBeReinitializedAt'] = JsonConverters::to('DateTime', $this->ToBeReinitializedAt);
return empty($o) ? new class(){} : $o;
}
}
class LeadScoreListViewModel implements JsonSerializable
{
public function __construct(
/** @var array<LeadScore>|null */
public ?array $LeadScores=null,
/** @var string|null */
public ?string $DecAppUrl=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['LeadScores'])) $this->LeadScores = JsonConverters::fromArray('LeadScore', $o['LeadScores']);
if (isset($o['DecAppUrl'])) $this->DecAppUrl = $o['DecAppUrl'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->LeadScores)) $o['LeadScores'] = JsonConverters::toArray('LeadScore', $this->LeadScores);
if (isset($this->DecAppUrl)) $o['DecAppUrl'] = $this->DecAppUrl;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /RestApi/sitefinity/data-intelligence/leadscore HTTP/1.1 Host: www.asg.com.au Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"DecAppUrl":"String"}