| GET | /v1/import/history |
|---|
<?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 ImportBatchLog implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ImportBatchId=0,
/** @var string */
public string $BatchUID='',
/** @var string|null */
public ?string $ImportType=null,
/** @var string|null */
public ?string $FileName=null,
/** @var string|null */
public ?string $Status=null,
/** @var int */
public int $TotalRows=0,
/** @var int */
public int $InsertedRows=0,
/** @var int */
public int $UpdatedRows=0,
/** @var int */
public int $SkippedRows=0,
/** @var int */
public int $ErrorRows=0,
/** @var string|null */
public ?string $CreatedBy=null,
/** @var DateTime */
public DateTime $CreatedAt=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ImportBatchId'])) $this->ImportBatchId = $o['ImportBatchId'];
if (isset($o['BatchUID'])) $this->BatchUID = $o['BatchUID'];
if (isset($o['ImportType'])) $this->ImportType = $o['ImportType'];
if (isset($o['FileName'])) $this->FileName = $o['FileName'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['TotalRows'])) $this->TotalRows = $o['TotalRows'];
if (isset($o['InsertedRows'])) $this->InsertedRows = $o['InsertedRows'];
if (isset($o['UpdatedRows'])) $this->UpdatedRows = $o['UpdatedRows'];
if (isset($o['SkippedRows'])) $this->SkippedRows = $o['SkippedRows'];
if (isset($o['ErrorRows'])) $this->ErrorRows = $o['ErrorRows'];
if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
if (isset($o['CreatedAt'])) $this->CreatedAt = JsonConverters::from('DateTime', $o['CreatedAt']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ImportBatchId)) $o['ImportBatchId'] = $this->ImportBatchId;
if (isset($this->BatchUID)) $o['BatchUID'] = $this->BatchUID;
if (isset($this->ImportType)) $o['ImportType'] = $this->ImportType;
if (isset($this->FileName)) $o['FileName'] = $this->FileName;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->TotalRows)) $o['TotalRows'] = $this->TotalRows;
if (isset($this->InsertedRows)) $o['InsertedRows'] = $this->InsertedRows;
if (isset($this->UpdatedRows)) $o['UpdatedRows'] = $this->UpdatedRows;
if (isset($this->SkippedRows)) $o['SkippedRows'] = $this->SkippedRows;
if (isset($this->ErrorRows)) $o['ErrorRows'] = $this->ErrorRows;
if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
if (isset($this->CreatedAt)) $o['CreatedAt'] = JsonConverters::to('DateTime', $this->CreatedAt);
return empty($o) ? new class(){} : $o;
}
}
class ImportHistoryResponse implements JsonSerializable
{
public function __construct(
/** @var array<ImportBatchLog>|null */
public ?array $Batches=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Batches'])) $this->Batches = JsonConverters::fromArray('ImportBatchLog', $o['Batches']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Batches)) $o['Batches'] = JsonConverters::toArray('ImportBatchLog', $this->Batches);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class ImportHistoryRequest implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v1/import/history HTTP/1.1 Host: api.dev.dynamics.trendsic.com Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"Batches":[{"ImportBatchId":0,"BatchUID":"00000000000000000000000000000000","ImportType":"String","FileName":"String","Status":"String","TotalRows":0,"InsertedRows":0,"UpdatedRows":0,"SkippedRows":0,"ErrorRows":0,"CreatedBy":"String","CreatedAt":"0001-01-01T00:00:00.0000000"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}