Trendsic Platform Service

<back to all web services

CustomerLinkListRequest

Requires Authentication
The following routes are available for this service:
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 .xml suffix or ?format=xml

HTTP + XML

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: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CustomerLinkListResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Links>
    <CustomerLinkExtended>
      <CreatedAtUtc>0001-01-01T00:00:00</CreatedAtUtc>
      <CreatedByAgentId>0</CreatedByAgentId>
      <CreatedByUserId>00000000-0000-0000-0000-000000000000</CreatedByUserId>
      <CustomerLinkId>0</CustomerLinkId>
      <CustomerLinkUID>00000000-0000-0000-0000-000000000000</CustomerLinkUID>
      <DeliveryChannels>String</DeliveryChannels>
      <ExpiresAtUtc>0001-01-01T00:00:00</ExpiresAtUtc>
      <MaxViews>0</MaxViews>
      <OtpChannel>String</OtpChannel>
      <RecipientContactId>0</RecipientContactId>
      <RecipientEmail>String</RecipientEmail>
      <RecipientPhone>String</RecipientPhone>
      <RequireOtp>false</RequireOtp>
      <ResourceType>String</ResourceType>
      <ResourceUid>00000000-0000-0000-0000-000000000000</ResourceUid>
      <RevokedAtUtc>0001-01-01T00:00:00</RevokedAtUtc>
      <RevokedByUserId>00000000-0000-0000-0000-000000000000</RevokedByUserId>
      <SensitivityTier>String</SensitivityTier>
      <SmsConsentSnapshot>false</SmsConsentSnapshot>
      <TenantId>00000000-0000-0000-0000-000000000000</TenantId>
      <TokenHash>String</TokenHash>
      <ViewCount>0</ViewCount>
      <RecipientDisplayName>String</RecipientDisplayName>
      <RecipientType>String</RecipientType>
      <Status>String</Status>
    </CustomerLinkExtended>
  </Links>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
</CustomerLinkListResponse>