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 .other suffix or ?format=other

HTTP + OTHER

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: text/jsonl
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"}},"Notifications":[{"NotificationId":0,"AgentId":0,"Description":"String","From":"String","CreatedDate":"0001-01-01T00:00:00.0000000","Type":"String","URL":"String","RefId":"String","IsDeleted":false}],"Deleted":false}