| All Verbs | /api/activityfeed/{ObjectId} |
|---|
<?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 ActivityFeedModel implements JsonSerializable
{
public function __construct(
/** @description Object linked to the event. */
// @ApiMember(DataType="Guid", Description="Object linked to the event.", IsRequired=true, Name="ObjectId")
/** @var string */
public string $ObjectId='',
/** @description Event Id */
// @ApiMember(DataType="Guid", Description="Event Id", IsRequired=true, Name="ActionEventId")
/** @var string */
public string $ActionEventId='',
/** @description Name of the object linked to the event. */
// @ApiMember(DataType="string", Description="Name of the object linked to the event.", Name="ObjectName")
/** @var string|null */
public ?string $ObjectName=null,
/** @description Event description */
// @ApiMember(DataType="string", Description="Event description", Name="ActionDescription")
/** @var string|null */
public ?string $ActionDescription=null,
/** @description Date of occurence of the event. */
// @ApiMember(DataType="DateTime", Description="Date of occurence of the event.", IsRequired=true, Name="OccurredDate")
/** @var DateTime */
public DateTime $OccurredDate=new DateTime(),
/** @description User, system or triggered */
// @ApiMember(DataType="Guid", Description="User, system or triggered", Name="AuditLevelId")
/** @var string */
public string $AuditLevelId='',
/** @description User, system or triggered */
// @ApiMember(DataType="string", Description="User, system or triggered", Name="AuditLevelName")
/** @var string|null */
public ?string $AuditLevelName=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ObjectId'])) $this->ObjectId = $o['ObjectId'];
if (isset($o['ActionEventId'])) $this->ActionEventId = $o['ActionEventId'];
if (isset($o['ObjectName'])) $this->ObjectName = $o['ObjectName'];
if (isset($o['ActionDescription'])) $this->ActionDescription = $o['ActionDescription'];
if (isset($o['OccurredDate'])) $this->OccurredDate = JsonConverters::from('DateTime', $o['OccurredDate']);
if (isset($o['AuditLevelId'])) $this->AuditLevelId = $o['AuditLevelId'];
if (isset($o['AuditLevelName'])) $this->AuditLevelName = $o['AuditLevelName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ObjectId)) $o['ObjectId'] = $this->ObjectId;
if (isset($this->ActionEventId)) $o['ActionEventId'] = $this->ActionEventId;
if (isset($this->ObjectName)) $o['ObjectName'] = $this->ObjectName;
if (isset($this->ActionDescription)) $o['ActionDescription'] = $this->ActionDescription;
if (isset($this->OccurredDate)) $o['OccurredDate'] = JsonConverters::to('DateTime', $this->OccurredDate);
if (isset($this->AuditLevelId)) $o['AuditLevelId'] = $this->AuditLevelId;
if (isset($this->AuditLevelName)) $o['AuditLevelName'] = $this->AuditLevelName;
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="Activity feed related to the object.")
class GetActivityFeedResponse implements JsonSerializable
{
public function __construct(
/** @var array<ActivityFeedModel>|null */
public ?array $ActivityFeed=null,
/** @var int */
public int $TotalRecords=0,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ActivityFeed'])) $this->ActivityFeed = JsonConverters::fromArray('ActivityFeedModel', $o['ActivityFeed']);
if (isset($o['TotalRecords'])) $this->TotalRecords = $o['TotalRecords'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ActivityFeed)) $o['ActivityFeed'] = JsonConverters::toArray('ActivityFeedModel', $this->ActivityFeed);
if (isset($this->TotalRecords)) $o['TotalRecords'] = $this->TotalRecords;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
/** @description Get activity feed related to the specified object. */
// @Api(Description="Get activity feed related to the specified object.")
class GetActivityFeed implements JsonSerializable
{
public function __construct(
/** @description Object to get activity feed for. */
// @ApiMember(Description="Object to get activity feed for.", IsRequired=true, Name="ObjectId")
/** @var string */
public string $ObjectId='',
/** @description User, system or triggered. */
// @ApiMember(Description="User, system or triggered.", Name="ActivityFeedType")
/** @var array<string>|null */
public ?array $ActivityFeedType=null,
/** @description Return all feeds matching criteria or paged results? */
// @ApiMember(Description="Return all feeds matching criteria or paged results?", Name="IsPagedMode")
/** @var bool|null */
public ?bool $IsPagedMode=null,
/** @description Return feeds matching criteria on the specified page number if paged mode. */
// @ApiMember(Description="Return feeds matching criteria on the specified page number if paged mode.", Name="PageNumber")
/** @var int */
public int $PageNumber=0,
/** @description Number of feeds on each page if paged mode */
// @ApiMember(Description="Number of feeds on each page if paged mode", Name="PageSize")
/** @var int */
public int $PageSize=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ObjectId'])) $this->ObjectId = $o['ObjectId'];
if (isset($o['ActivityFeedType'])) $this->ActivityFeedType = JsonConverters::fromArray('Guid', $o['ActivityFeedType']);
if (isset($o['IsPagedMode'])) $this->IsPagedMode = $o['IsPagedMode'];
if (isset($o['PageNumber'])) $this->PageNumber = $o['PageNumber'];
if (isset($o['PageSize'])) $this->PageSize = $o['PageSize'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ObjectId)) $o['ObjectId'] = $this->ObjectId;
if (isset($this->ActivityFeedType)) $o['ActivityFeedType'] = JsonConverters::toArray('Guid', $this->ActivityFeedType);
if (isset($this->IsPagedMode)) $o['IsPagedMode'] = $this->IsPagedMode;
if (isset($this->PageNumber)) $o['PageNumber'] = $this->PageNumber;
if (isset($this->PageSize)) $o['PageSize'] = $this->PageSize;
return empty($o) ? new class(){} : $o;
}
}
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.
POST /api/activityfeed/{ObjectId} HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ActivityFeedType:
[
00000000-0000-0000-0000-000000000000
],
IsPagedMode: False,
PageNumber: 0,
PageSize: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ActivityFeed:
[
{
ObjectName: String,
ActionDescription: String,
OccurredDate: 0001-01-01,
AuditLevelName: String
}
],
TotalRecords: 0,
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}