| Requires any of the roles: | Agent, Administrator, Agent, Administrator, Agent, Administrator |
| GET,POST,PUT,DELETE,OPTIONS | /v1/Campaign/{CampaignId} | ||
|---|---|---|---|
| GET,POST,PUT,DELETE,OPTIONS | /v1/Campaign |
<?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};
// @Flags()
enum DeliveryChannel : int
{
case None = 0;
case Email = 1;
case Sms = 2;
}
class Campaign implements JsonSerializable
{
public function __construct(
/** @var int */
public int $CampaignId=0,
/** @var int */
public int $CampaignTypeId=0,
/** @var string|null */
public ?string $CampaignName=null,
/** @var int */
public int $AgentID=0,
/** @var string|null */
public ?string $Subject=null,
/** @var string|null */
public ?string $Template=null,
/** @var DateTime|null */
public ?DateTime $DateCreated=null,
/** @var DateTime|null */
public ?DateTime $DateDeleted=null,
/** @var string|null */
public ?string $Frequency=null,
/** @var DateTime */
public DateTime $StartDate=new DateTime(),
/** @var DateInterval|null */
public ?DateInterval $TimeOfDay=null,
/** @var DateTime|null */
public ?DateTime $LastRunAtUtc=null,
/** @var DateTime|null */
public ?DateTime $NextRunAtUtc=null,
/** @var string|null */
public ?string $TimeZoneId=null,
/** @var DayOfWeek|null */
public ?DayOfWeek $DayOfWeek=null,
/** @var int|null */
public ?int $DayOfMonth=null,
/** @var bool|null */
public ?bool $IsActive=null,
/** @var DateTime|null */
public ?DateTime $CreatedUtc=null,
/** @var DateTime|null */
public ?DateTime $UpdatedUtc=null,
/** @var DeliveryChannel|null */
public ?DeliveryChannel $Channels=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CampaignId'])) $this->CampaignId = $o['CampaignId'];
if (isset($o['CampaignTypeId'])) $this->CampaignTypeId = $o['CampaignTypeId'];
if (isset($o['CampaignName'])) $this->CampaignName = $o['CampaignName'];
if (isset($o['AgentID'])) $this->AgentID = $o['AgentID'];
if (isset($o['Subject'])) $this->Subject = $o['Subject'];
if (isset($o['Template'])) $this->Template = $o['Template'];
if (isset($o['DateCreated'])) $this->DateCreated = JsonConverters::from('DateTime', $o['DateCreated']);
if (isset($o['DateDeleted'])) $this->DateDeleted = JsonConverters::from('DateTime', $o['DateDeleted']);
if (isset($o['Frequency'])) $this->Frequency = $o['Frequency'];
if (isset($o['StartDate'])) $this->StartDate = JsonConverters::from('DateTime', $o['StartDate']);
if (isset($o['TimeOfDay'])) $this->TimeOfDay = JsonConverters::from('TimeSpan', $o['TimeOfDay']);
if (isset($o['LastRunAtUtc'])) $this->LastRunAtUtc = JsonConverters::from('DateTime', $o['LastRunAtUtc']);
if (isset($o['NextRunAtUtc'])) $this->NextRunAtUtc = JsonConverters::from('DateTime', $o['NextRunAtUtc']);
if (isset($o['TimeZoneId'])) $this->TimeZoneId = $o['TimeZoneId'];
if (isset($o['DayOfWeek'])) $this->DayOfWeek = JsonConverters::from('DayOfWeek', $o['DayOfWeek']);
if (isset($o['DayOfMonth'])) $this->DayOfMonth = $o['DayOfMonth'];
if (isset($o['IsActive'])) $this->IsActive = $o['IsActive'];
if (isset($o['CreatedUtc'])) $this->CreatedUtc = JsonConverters::from('DateTime', $o['CreatedUtc']);
if (isset($o['UpdatedUtc'])) $this->UpdatedUtc = JsonConverters::from('DateTime', $o['UpdatedUtc']);
if (isset($o['Channels'])) $this->Channels = JsonConverters::from('DeliveryChannel', $o['Channels']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CampaignId)) $o['CampaignId'] = $this->CampaignId;
if (isset($this->CampaignTypeId)) $o['CampaignTypeId'] = $this->CampaignTypeId;
if (isset($this->CampaignName)) $o['CampaignName'] = $this->CampaignName;
if (isset($this->AgentID)) $o['AgentID'] = $this->AgentID;
if (isset($this->Subject)) $o['Subject'] = $this->Subject;
if (isset($this->Template)) $o['Template'] = $this->Template;
if (isset($this->DateCreated)) $o['DateCreated'] = JsonConverters::to('DateTime', $this->DateCreated);
if (isset($this->DateDeleted)) $o['DateDeleted'] = JsonConverters::to('DateTime', $this->DateDeleted);
if (isset($this->Frequency)) $o['Frequency'] = $this->Frequency;
if (isset($this->StartDate)) $o['StartDate'] = JsonConverters::to('DateTime', $this->StartDate);
if (isset($this->TimeOfDay)) $o['TimeOfDay'] = JsonConverters::to('TimeSpan', $this->TimeOfDay);
if (isset($this->LastRunAtUtc)) $o['LastRunAtUtc'] = JsonConverters::to('DateTime', $this->LastRunAtUtc);
if (isset($this->NextRunAtUtc)) $o['NextRunAtUtc'] = JsonConverters::to('DateTime', $this->NextRunAtUtc);
if (isset($this->TimeZoneId)) $o['TimeZoneId'] = $this->TimeZoneId;
if (isset($this->DayOfWeek)) $o['DayOfWeek'] = JsonConverters::to('DayOfWeek', $this->DayOfWeek);
if (isset($this->DayOfMonth)) $o['DayOfMonth'] = $this->DayOfMonth;
if (isset($this->IsActive)) $o['IsActive'] = $this->IsActive;
if (isset($this->CreatedUtc)) $o['CreatedUtc'] = JsonConverters::to('DateTime', $this->CreatedUtc);
if (isset($this->UpdatedUtc)) $o['UpdatedUtc'] = JsonConverters::to('DateTime', $this->UpdatedUtc);
if (isset($this->Channels)) $o['Channels'] = JsonConverters::to('DeliveryChannel', $this->Channels);
return empty($o) ? new class(){} : $o;
}
}
class CampaignExtended extends Campaign implements JsonSerializable
{
/**
* @param int $CampaignId
* @param int $CampaignTypeId
* @param string|null $CampaignName
* @param int $AgentID
* @param string|null $Subject
* @param string|null $Template
* @param DateTime|null $DateCreated
* @param DateTime|null $DateDeleted
* @param string|null $Frequency
* @param DateTime $StartDate
* @param DateInterval|null $TimeOfDay
* @param DateTime|null $LastRunAtUtc
* @param DateTime|null $NextRunAtUtc
* @param string|null $TimeZoneId
* @param DayOfWeek|null $DayOfWeek
* @param int|null $DayOfMonth
* @param bool|null $IsActive
* @param DateTime|null $CreatedUtc
* @param DateTime|null $UpdatedUtc
* @param DeliveryChannel|null $Channels
*/
public function __construct(
int $CampaignId=0,
int $CampaignTypeId=0,
?string $CampaignName=null,
int $AgentID=0,
?string $Subject=null,
?string $Template=null,
?DateTime $DateCreated=null,
?DateTime $DateDeleted=null,
?string $Frequency=null,
DateTime $StartDate=new DateTime(),
?DateInterval $TimeOfDay=null,
?DateTime $LastRunAtUtc=null,
?DateTime $NextRunAtUtc=null,
?string $TimeZoneId=null,
?DayOfWeek $DayOfWeek=null,
?int $DayOfMonth=null,
?bool $IsActive=null,
?DateTime $CreatedUtc=null,
?DateTime $UpdatedUtc=null,
?DeliveryChannel $Channels=null,
/** @var string|null */
public ?string $CampaignType=null,
/** @var string|null */
public ?string $AgentName=null
) {
parent::__construct($CampaignId,$CampaignTypeId,$CampaignName,$AgentID,$Subject,$Template,$DateCreated,$DateDeleted,$Frequency,$StartDate,$TimeOfDay,$LastRunAtUtc,$NextRunAtUtc,$TimeZoneId,$DayOfWeek,$DayOfMonth,$IsActive,$CreatedUtc,$UpdatedUtc,$Channels);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['CampaignType'])) $this->CampaignType = $o['CampaignType'];
if (isset($o['AgentName'])) $this->AgentName = $o['AgentName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->CampaignType)) $o['CampaignType'] = $this->CampaignType;
if (isset($this->AgentName)) $o['AgentName'] = $this->AgentName;
return empty($o) ? new class(){} : $o;
}
}
class CampaignResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<CampaignExtended>|null */
public ?array $Campaign=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Campaign'])) $this->Campaign = JsonConverters::fromArray('CampaignExtended', $o['Campaign']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Campaign)) $o['Campaign'] = JsonConverters::toArray('CampaignExtended', $this->Campaign);
return empty($o) ? new class(){} : $o;
}
}
class CampaignRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $CampaignId=0,
/** @var array<Campaign>|null */
public ?array $Campaign=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CampaignId'])) $this->CampaignId = $o['CampaignId'];
if (isset($o['Campaign'])) $this->Campaign = JsonConverters::fromArray('Campaign', $o['Campaign']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CampaignId)) $o['CampaignId'] = $this->CampaignId;
if (isset($this->Campaign)) $o['Campaign'] = JsonConverters::toArray('Campaign', $this->Campaign);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/Campaign/{CampaignId} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"CampaignId":0,"Campaign":[{"CampaignId":0,"CampaignTypeId":0,"CampaignName":"String","AgentID":0,"Subject":"String","Template":"String","DateCreated":"0001-01-01T00:00:00.0000000","DateDeleted":"0001-01-01T00:00:00.0000000","Frequency":"String","StartDate":"0001-01-01T00:00:00.0000000","TimeOfDay":"PT0S","LastRunAtUtc":"0001-01-01T00:00:00.0000000","NextRunAtUtc":"0001-01-01T00:00:00.0000000","TimeZoneId":"String","DayOfWeek":"Sunday","DayOfMonth":0,"IsActive":false,"CreatedUtc":"0001-01-01T00:00:00.0000000","UpdatedUtc":"0001-01-01T00:00:00.0000000","Channels":0}]}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Campaign":[{"CampaignType":"String","AgentName":"String","CampaignId":0,"CampaignTypeId":0,"CampaignName":"String","AgentID":0,"Subject":"String","Template":"String","DateCreated":"0001-01-01T00:00:00.0000000","DateDeleted":"0001-01-01T00:00:00.0000000","Frequency":"String","StartDate":"0001-01-01T00:00:00.0000000","TimeOfDay":"PT0S","LastRunAtUtc":"0001-01-01T00:00:00.0000000","NextRunAtUtc":"0001-01-01T00:00:00.0000000","TimeZoneId":"String","DayOfWeek":"Sunday","DayOfMonth":0,"IsActive":false,"CreatedUtc":"0001-01-01T00:00:00.0000000","UpdatedUtc":"0001-01-01T00:00:00.0000000","Channels":0}]}