Trendsic Platform Service

<back to all web services

UserNotificationsRequest

Requires Authentication
Requires any of the roles:Worker, Agent, Administrator, Agent, Administrator
The following routes are available for this service:
GET,OPTIONS/v1/UserNotifications/{AgentId}
DELETE,OPTIONS/v1/UserNotifications/{NotificationId}
<?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 UserNotification implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $NotificationId=0,
        /** @var int */
        public int $AgentId=0,
        /** @var string|null */
        public ?string $Description=null,
        /** @var string|null */
        public ?string $From=null,
        /** @var DateTime */
        public DateTime $CreatedDate=new DateTime(),
        /** @var string|null */
        public ?string $Type=null,
        /** @var string|null */
        public ?string $URL=null,
        /** @var string|null */
        public ?string $RefId=null,
        /** @var bool|null */
        public ?bool $IsDeleted=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['NotificationId'])) $this->NotificationId = $o['NotificationId'];
        if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['From'])) $this->From = $o['From'];
        if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
        if (isset($o['Type'])) $this->Type = $o['Type'];
        if (isset($o['URL'])) $this->URL = $o['URL'];
        if (isset($o['RefId'])) $this->RefId = $o['RefId'];
        if (isset($o['IsDeleted'])) $this->IsDeleted = $o['IsDeleted'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->NotificationId)) $o['NotificationId'] = $this->NotificationId;
        if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->From)) $o['From'] = $this->From;
        if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
        if (isset($this->Type)) $o['Type'] = $this->Type;
        if (isset($this->URL)) $o['URL'] = $this->URL;
        if (isset($this->RefId)) $o['RefId'] = $this->RefId;
        if (isset($this->IsDeleted)) $o['IsDeleted'] = $this->IsDeleted;
        return empty($o) ? new class(){} : $o;
    }
}

class UserNotificationsResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<UserNotification>|null */
        public ?array $Notifications=null,
        /** @var bool|null */
        public ?bool $Deleted=null
    ) {
    }

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

class UserNotificationsRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $AgentId=0,
        /** @var int */
        public int $NotificationId=0,
        /** @var bool|null */
        public ?bool $ShowDeleted=null
    ) {
    }

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

PHP UserNotificationsRequest 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/UserNotifications/{AgentId} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<UserNotificationsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Deleted>false</Deleted>
  <Notifications>
    <UserNotification>
      <AgentId>0</AgentId>
      <CreatedDate>0001-01-01T00:00:00</CreatedDate>
      <Description>String</Description>
      <From>String</From>
      <IsDeleted>false</IsDeleted>
      <NotificationId>0</NotificationId>
      <RefId>String</RefId>
      <Type>String</Type>
      <URL>String</URL>
    </UserNotification>
  </Notifications>
  <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>
</UserNotificationsResponse>