| GET,OPTIONS | /v1/customerlink/resource/{ResourceType}/{ResourceUid} |
|---|
<?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 CustomerLink implements JsonSerializable
{
public function __construct(
/** @var int */
public int $CustomerLinkId=0,
/** @var string */
public string $CustomerLinkUID='',
/** @var string|null */
public ?string $TokenHash=null,
/** @var string|null */
public ?string $ResourceType=null,
/** @var string */
public string $ResourceUid='',
/** @var string|null */
public ?string $SensitivityTier=null,
/** @var bool|null */
public ?bool $RequireOtp=null,
/** @var string|null */
public ?string $OtpChannel=null,
/** @var string|null */
public ?string $DeliveryChannels=null,
/** @var int|null */
public ?int $RecipientContactId=null,
/** @var string|null */
public ?string $RecipientEmail=null,
/** @var string|null */
public ?string $RecipientPhone=null,
/** @var bool|null */
public ?bool $SmsConsentSnapshot=null,
/** @var string */
public string $CreatedByUserId='',
/** @var int|null */
public ?int $CreatedByAgentId=null,
/** @var DateTime */
public DateTime $CreatedAtUtc=new DateTime(),
/** @var DateTime|null */
public ?DateTime $ExpiresAtUtc=null,
/** @var int|null */
public ?int $MaxViews=null,
/** @var int */
public int $ViewCount=0,
/** @var DateTime|null */
public ?DateTime $RevokedAtUtc=null,
/** @var string|null */
public ?string $RevokedByUserId=null,
/** @var string */
public string $TenantId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CustomerLinkId'])) $this->CustomerLinkId = $o['CustomerLinkId'];
if (isset($o['CustomerLinkUID'])) $this->CustomerLinkUID = $o['CustomerLinkUID'];
if (isset($o['TokenHash'])) $this->TokenHash = $o['TokenHash'];
if (isset($o['ResourceType'])) $this->ResourceType = $o['ResourceType'];
if (isset($o['ResourceUid'])) $this->ResourceUid = $o['ResourceUid'];
if (isset($o['SensitivityTier'])) $this->SensitivityTier = $o['SensitivityTier'];
if (isset($o['RequireOtp'])) $this->RequireOtp = $o['RequireOtp'];
if (isset($o['OtpChannel'])) $this->OtpChannel = $o['OtpChannel'];
if (isset($o['DeliveryChannels'])) $this->DeliveryChannels = $o['DeliveryChannels'];
if (isset($o['RecipientContactId'])) $this->RecipientContactId = $o['RecipientContactId'];
if (isset($o['RecipientEmail'])) $this->RecipientEmail = $o['RecipientEmail'];
if (isset($o['RecipientPhone'])) $this->RecipientPhone = $o['RecipientPhone'];
if (isset($o['SmsConsentSnapshot'])) $this->SmsConsentSnapshot = $o['SmsConsentSnapshot'];
if (isset($o['CreatedByUserId'])) $this->CreatedByUserId = $o['CreatedByUserId'];
if (isset($o['CreatedByAgentId'])) $this->CreatedByAgentId = $o['CreatedByAgentId'];
if (isset($o['CreatedAtUtc'])) $this->CreatedAtUtc = JsonConverters::from('DateTime', $o['CreatedAtUtc']);
if (isset($o['ExpiresAtUtc'])) $this->ExpiresAtUtc = JsonConverters::from('DateTime', $o['ExpiresAtUtc']);
if (isset($o['MaxViews'])) $this->MaxViews = $o['MaxViews'];
if (isset($o['ViewCount'])) $this->ViewCount = $o['ViewCount'];
if (isset($o['RevokedAtUtc'])) $this->RevokedAtUtc = JsonConverters::from('DateTime', $o['RevokedAtUtc']);
if (isset($o['RevokedByUserId'])) $this->RevokedByUserId = $o['RevokedByUserId'];
if (isset($o['TenantId'])) $this->TenantId = $o['TenantId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CustomerLinkId)) $o['CustomerLinkId'] = $this->CustomerLinkId;
if (isset($this->CustomerLinkUID)) $o['CustomerLinkUID'] = $this->CustomerLinkUID;
if (isset($this->TokenHash)) $o['TokenHash'] = $this->TokenHash;
if (isset($this->ResourceType)) $o['ResourceType'] = $this->ResourceType;
if (isset($this->ResourceUid)) $o['ResourceUid'] = $this->ResourceUid;
if (isset($this->SensitivityTier)) $o['SensitivityTier'] = $this->SensitivityTier;
if (isset($this->RequireOtp)) $o['RequireOtp'] = $this->RequireOtp;
if (isset($this->OtpChannel)) $o['OtpChannel'] = $this->OtpChannel;
if (isset($this->DeliveryChannels)) $o['DeliveryChannels'] = $this->DeliveryChannels;
if (isset($this->RecipientContactId)) $o['RecipientContactId'] = $this->RecipientContactId;
if (isset($this->RecipientEmail)) $o['RecipientEmail'] = $this->RecipientEmail;
if (isset($this->RecipientPhone)) $o['RecipientPhone'] = $this->RecipientPhone;
if (isset($this->SmsConsentSnapshot)) $o['SmsConsentSnapshot'] = $this->SmsConsentSnapshot;
if (isset($this->CreatedByUserId)) $o['CreatedByUserId'] = $this->CreatedByUserId;
if (isset($this->CreatedByAgentId)) $o['CreatedByAgentId'] = $this->CreatedByAgentId;
if (isset($this->CreatedAtUtc)) $o['CreatedAtUtc'] = JsonConverters::to('DateTime', $this->CreatedAtUtc);
if (isset($this->ExpiresAtUtc)) $o['ExpiresAtUtc'] = JsonConverters::to('DateTime', $this->ExpiresAtUtc);
if (isset($this->MaxViews)) $o['MaxViews'] = $this->MaxViews;
if (isset($this->ViewCount)) $o['ViewCount'] = $this->ViewCount;
if (isset($this->RevokedAtUtc)) $o['RevokedAtUtc'] = JsonConverters::to('DateTime', $this->RevokedAtUtc);
if (isset($this->RevokedByUserId)) $o['RevokedByUserId'] = $this->RevokedByUserId;
if (isset($this->TenantId)) $o['TenantId'] = $this->TenantId;
return empty($o) ? new class(){} : $o;
}
}
class CustomerLinkExtended extends CustomerLink implements JsonSerializable
{
/**
* @param int $CustomerLinkId
* @param string $CustomerLinkUID
* @param string|null $TokenHash
* @param string|null $ResourceType
* @param string $ResourceUid
* @param string|null $SensitivityTier
* @param bool|null $RequireOtp
* @param string|null $OtpChannel
* @param string|null $DeliveryChannels
* @param int|null $RecipientContactId
* @param string|null $RecipientEmail
* @param string|null $RecipientPhone
* @param bool|null $SmsConsentSnapshot
* @param string $CreatedByUserId
* @param int|null $CreatedByAgentId
* @param DateTime $CreatedAtUtc
* @param DateTime|null $ExpiresAtUtc
* @param int|null $MaxViews
* @param int $ViewCount
* @param DateTime|null $RevokedAtUtc
* @param string|null $RevokedByUserId
* @param string $TenantId
*/
public function __construct(
int $CustomerLinkId=0,
string $CustomerLinkUID='',
?string $TokenHash=null,
?string $ResourceType=null,
string $ResourceUid='',
?string $SensitivityTier=null,
?bool $RequireOtp=null,
?string $OtpChannel=null,
?string $DeliveryChannels=null,
?int $RecipientContactId=null,
?string $RecipientEmail=null,
?string $RecipientPhone=null,
?bool $SmsConsentSnapshot=null,
string $CreatedByUserId='',
?int $CreatedByAgentId=null,
DateTime $CreatedAtUtc=new DateTime(),
?DateTime $ExpiresAtUtc=null,
?int $MaxViews=null,
int $ViewCount=0,
?DateTime $RevokedAtUtc=null,
?string $RevokedByUserId=null,
string $TenantId='',
/** @var string|null */
public ?string $RecipientDisplayName=null,
/** @var string|null */
public ?string $RecipientType=null,
/** @var string|null */
public ?string $Status=null
) {
parent::__construct($CustomerLinkId,$CustomerLinkUID,$TokenHash,$ResourceType,$ResourceUid,$SensitivityTier,$RequireOtp,$OtpChannel,$DeliveryChannels,$RecipientContactId,$RecipientEmail,$RecipientPhone,$SmsConsentSnapshot,$CreatedByUserId,$CreatedByAgentId,$CreatedAtUtc,$ExpiresAtUtc,$MaxViews,$ViewCount,$RevokedAtUtc,$RevokedByUserId,$TenantId);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['RecipientDisplayName'])) $this->RecipientDisplayName = $o['RecipientDisplayName'];
if (isset($o['RecipientType'])) $this->RecipientType = $o['RecipientType'];
if (isset($o['Status'])) $this->Status = $o['Status'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->RecipientDisplayName)) $o['RecipientDisplayName'] = $this->RecipientDisplayName;
if (isset($this->RecipientType)) $o['RecipientType'] = $this->RecipientType;
if (isset($this->Status)) $o['Status'] = $this->Status;
return empty($o) ? new class(){} : $o;
}
}
class CustomerLinkListResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<CustomerLinkExtended>|null */
public ?array $Links=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Links'])) $this->Links = JsonConverters::fromArray('CustomerLinkExtended', $o['Links']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Links)) $o['Links'] = JsonConverters::toArray('CustomerLinkExtended', $this->Links);
return empty($o) ? new class(){} : $o;
}
}
class CustomerLinkListRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $ResourceType=null,
/** @var string */
public string $ResourceUid=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResourceType'])) $this->ResourceType = $o['ResourceType'];
if (isset($o['ResourceUid'])) $this->ResourceUid = $o['ResourceUid'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResourceType)) $o['ResourceType'] = $this->ResourceType;
if (isset($this->ResourceUid)) $o['ResourceUid'] = $this->ResourceUid;
return empty($o) ? new class(){} : $o;
}
}
PHP CustomerLinkListRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v1/customerlink/resource/{ResourceType}/{ResourceUid} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
Links:
[
{
RecipientDisplayName: String,
RecipientType: String,
Status: String,
CustomerLinkId: 0,
CustomerLinkUID: 00000000000000000000000000000000,
TokenHash: String,
ResourceType: String,
ResourceUid: 00000000000000000000000000000000,
SensitivityTier: String,
RequireOtp: False,
OtpChannel: String,
DeliveryChannels: String,
RecipientContactId: 0,
RecipientEmail: String,
RecipientPhone: String,
SmsConsentSnapshot: False,
CreatedByUserId: 00000000000000000000000000000000,
CreatedByAgentId: 0,
CreatedAtUtc: 0001-01-01,
ExpiresAtUtc: 0001-01-01,
MaxViews: 0,
ViewCount: 0,
RevokedAtUtc: 0001-01-01,
RevokedByUserId: 00000000000000000000000000000000,
TenantId: 00000000000000000000000000000000
}
]
}