| POST | /api/statistics |
|---|
<?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 ProgramName : string
{
case DO4Outlook = 'DO4Outlook';
case DO4Word = 'DO4Word';
case DO4Excel = 'DO4Excel';
case DO4PowerPoint = 'DO4PowerPoint';
case ITS = 'ITS';
case Other = 'Other';
case DigiOfficeMobile = 'DigiOfficeMobile';
}
enum Action : string
{
case Start = 'Start';
case Command = 'Command';
case NewDoc = 'NewDoc';
case ChangeDoc = 'ChangeDoc';
case NewVersion = 'NewVersion';
case Send = 'Send';
case Other = 'Other';
}
/** @description Add a statistic entity. */
// @Api(Description="Add a statistic entity.")
class AddStatistic implements JsonSerializable
{
public function __construct(
/** @description Computername */
// @ApiMember(Description="Computername", IsRequired=true)
/** @var string */
public string $Computer='',
/** @description Program for the statistic entry */
// @ApiMember(Description="Program for the statistic entry", IsRequired=true)
/** @var ProgramName|null */
public ?ProgramName $ProgramName=null,
/** @description Version of the program */
// @ApiMember(Description="Version of the program")
/** @var string|null */
public ?string $ProgramVersion=null,
/** @description Action of statistic */
// @ApiMember(Description="Action of statistic", IsRequired=true)
/** @var Action|null */
public ?Action $Action=null,
/** @description First parameter */
// @ApiMember(Description="First parameter", IsRequired=true)
/** @var string */
public string $Param1='',
/** @description Second parameter */
// @ApiMember(Description="Second parameter")
/** @var string|null */
public ?string $Param2=null,
/** @description Duration of action */
// @ApiMember(Description="Duration of action")
/** @var int|null */
public ?int $Duration=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Computer'])) $this->Computer = $o['Computer'];
if (isset($o['ProgramName'])) $this->ProgramName = JsonConverters::from('ProgramName', $o['ProgramName']);
if (isset($o['ProgramVersion'])) $this->ProgramVersion = $o['ProgramVersion'];
if (isset($o['Action'])) $this->Action = JsonConverters::from('Action', $o['Action']);
if (isset($o['Param1'])) $this->Param1 = $o['Param1'];
if (isset($o['Param2'])) $this->Param2 = $o['Param2'];
if (isset($o['Duration'])) $this->Duration = $o['Duration'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Computer)) $o['Computer'] = $this->Computer;
if (isset($this->ProgramName)) $o['ProgramName'] = JsonConverters::to('ProgramName', $this->ProgramName);
if (isset($this->ProgramVersion)) $o['ProgramVersion'] = $this->ProgramVersion;
if (isset($this->Action)) $o['Action'] = JsonConverters::to('Action', $this->Action);
if (isset($this->Param1)) $o['Param1'] = $this->Param1;
if (isset($this->Param2)) $o['Param2'] = $this->Param2;
if (isset($this->Duration)) $o['Duration'] = $this->Duration;
return empty($o) ? new class(){} : $o;
}
}
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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/statistics HTTP/1.1
Host: test-do-services.klokgroep.nl
Accept: application/json
Content-Type: application/json
Content-Length: length
{"Computer":"String","ProgramName":"DO4Outlook","ProgramVersion":"String","Action":"Start","Param1":"String","Param2":"String","Duration":0}