CoreService

<back to all web services

GetChangeLog

ChangeLog - CRUD

Returns a single changelog by its id

Requires Authentication
Required role:TenantAdmin
The following routes are available for this service:
GET/api/changelogs/{Id}Returns a changelog
GET/changelogs/{Id}Returns a changelog
<?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};


enum ObjectTypes : string
{
    case None = 'None';
    case ConfigItem = 'ConfigItem';
    case Tenant = 'Tenant';
    case Collection = 'Collection';
    case Resource = 'Resource';
    case ComputeNode = 'ComputeNode';
    case VirtualMachine = 'VirtualMachine';
    case PhysicalMachine = 'PhysicalMachine';
    case Disk = 'Disk';
    case Subnet = 'Subnet';
    case IPAddress = 'IPAddress';
    case Job = 'Job';
    case JobEvent = 'JobEvent';
    case FreezePeriod = 'FreezePeriod';
    case ResourceGroup = 'ResourceGroup';
    case Deployment = 'Deployment';
    case ResourceGroupTemplate = 'ResourceGroupTemplate';
    case DeploymentTemplate = 'DeploymentTemplate';
    case ResourceProvider = 'ResourceProvider';
    case GenericResource = 'GenericResource';
    case Role = 'Role';
    case Permission = 'Permission';
    case User = 'User';
    case PatchingWindow = 'PatchingWindow';
    case Update = 'Update';
    case ReportDefinition = 'ReportDefinition';
    case TimeSeries = 'TimeSeries';
    case DataPoint = 'DataPoint';
    case Action = 'Action';
    case ActionAssignment = 'ActionAssignment';
    case UserNote = 'UserNote';
}

enum ChangeTypes : string
{
    case Create = 'Create';
    case Update = 'Update';
    case Delete = 'Delete';
}

class ValueChangeDto implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $oldValue=null,
        /** @var string|null */
        public ?string $newValue=null
    ) {
    }

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

class ChangeLogDto implements IHasTenantId, JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $id='',
        /** @var string */
        public string $tenantId='',
        /** @var DateTime */
        public DateTime $timeStamp=new DateTime(),
        /** @var string */
        public string $objectId='',
        /** @var string */
        public string $objectName='',
        /** @var ObjectTypes|null */
        public ?ObjectTypes $objectType=null,
        /** @var ChangeTypes|null */
        public ?ChangeTypes $changeType=null,
        /** @var string */
        public string $description='',
        /** @var array<string,ValueChangeDto>|null */
        public ?array $changes=null,
        /** @var string */
        public string $modifyUserId='',
        /** @var string */
        public string $modifyUserEmail=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['tenantId'])) $this->tenantId = $o['tenantId'];
        if (isset($o['timeStamp'])) $this->timeStamp = JsonConverters::from('DateTime', $o['timeStamp']);
        if (isset($o['objectId'])) $this->objectId = $o['objectId'];
        if (isset($o['objectName'])) $this->objectName = $o['objectName'];
        if (isset($o['objectType'])) $this->objectType = JsonConverters::from('ObjectTypes', $o['objectType']);
        if (isset($o['changeType'])) $this->changeType = JsonConverters::from('ChangeTypes', $o['changeType']);
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['changes'])) $this->changes = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','ValueChangeDto']), $o['changes']);
        if (isset($o['modifyUserId'])) $this->modifyUserId = $o['modifyUserId'];
        if (isset($o['modifyUserEmail'])) $this->modifyUserEmail = $o['modifyUserEmail'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->tenantId)) $o['tenantId'] = $this->tenantId;
        if (isset($this->timeStamp)) $o['timeStamp'] = JsonConverters::to('DateTime', $this->timeStamp);
        if (isset($this->objectId)) $o['objectId'] = $this->objectId;
        if (isset($this->objectName)) $o['objectName'] = $this->objectName;
        if (isset($this->objectType)) $o['objectType'] = JsonConverters::to('ObjectTypes', $this->objectType);
        if (isset($this->changeType)) $o['changeType'] = JsonConverters::to('ChangeTypes', $this->changeType);
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->changes)) $o['changes'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','ValueChangeDto']), $this->changes);
        if (isset($this->modifyUserId)) $o['modifyUserId'] = $this->modifyUserId;
        if (isset($this->modifyUserEmail)) $o['modifyUserEmail'] = $this->modifyUserEmail;
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Returns a single changelog by its id */
// @Api(Description="Returns a single changelog by its id")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType="typeof(CoreService.ServiceModel.Dtos.Audit.Responses.ChangeLogDto)", StatusCode=200)
class GetChangeLog implements IBaseRequest, IHasId, IHasTenantName, IGet, JsonSerializable
{
    public function __construct(
        /** @description The unique id of the object */
        // @ApiMember(DataType="string", Description="The unique id of the object", Format="guid", IsRequired=true, ParameterType="path")
        /** @var string */
        public string $id='',

        // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $tenantName=''
    ) {
    }

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

PHP GetChangeLog DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /api/changelogs/{Id} HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"id":"00000000-0000-0000-0000-000000000000","tenantId":"00000000-0000-0000-0000-000000000000","timeStamp":"0001-01-01T00:00:00.0000000Z","objectId":"String","objectName":"String","objectType":"None","changeType":"Create","description":"String","changes":{"String":{"oldValue":"String","newValue":"String"}},"modifyUserId":"String","modifyUserEmail":"String"}