| GET | /reports |
|---|
<?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};
interface IContentTypeWriter
{
}
/**
* @property Object|null $originalResponse
* @property IRequest|null $request
* @property int $statusCode
* @property string|null $statusDescription
* @property string|null $contentType
* @property ByteArray|null $outputStream
* @property Object|null $dto
* @property bool $useBufferedStream
* @property bool $isClosed
* @property bool $keepAlive
* @property bool $hasStarted
* @property array<string,Object>|null $items
*/
interface IResponse
{
}
// @Flags()
enum RequestAttributes : int
{
case None = 0;
case Localhost = 1;
case LocalSubnet = 2;
case External = 4;
case Secure = 8;
case InSecure = 16;
case AnySecurityMode = 24;
case HttpHead = 32;
case HttpGet = 64;
case HttpPost = 128;
case HttpPut = 256;
case HttpDelete = 512;
case HttpPatch = 1024;
case HttpOptions = 2048;
case HttpOther = 4096;
case AnyHttpMethod = 8160;
case OneWay = 8192;
case Reply = 16384;
case AnyCallStyle = 24576;
case Soap11 = 32768;
case Soap12 = 65536;
case Xml = 131072;
case Json = 262144;
case Jsv = 524288;
case ProtoBuf = 1048576;
case Csv = 2097152;
case Html = 4194304;
case Jsonl = 8388608;
case MsgPack = 16777216;
case FormatOther = 33554432;
case AnyFormat = 67076096;
case Http = 67108864;
case MessageQueue = 134217728;
case Tcp = 268435456;
case Grpc = 536870912;
case EndpointOther = 1073741824;
case AnyEndpoint = 2080374784;
case InProcess = -2147483648;
case InternalNetworkAccess = -2147483645;
case AnyNetworkAccessType = -2147483641;
case Any = -1;
}
/**
* @property bool $acceptsBrotli
* @property bool $acceptsDeflate
* @property bool $acceptsGzip
*/
interface IRequestPreferences
{
}
/**
* @property string|null $name
* @property string|null $fileName
* @property int $contentLength
* @property string|null $contentType
* @property ByteArray|null $inputStream
*/
interface IHttpFile
{
}
/**
* @property Object|null $originalRequest
* @property IResponse|null $response
* @property string|null $operationName
* @property string|null $verb
* @property RequestAttributes $requestAttributes
* @property IRequestPreferences|null $requestPreferences
* @property Object|null $dto
* @property string|null $contentType
* @property bool $isLocal
* @property string|null $userAgent
* @property array<string,Cookie>|null $cookies
* @property string|null $responseContentType
* @property bool $hasExplicitResponseContentType
* @property array<string,Object>|null $items
* @property NameValueCollection|null $headers
* @property NameValueCollection|null $queryString
* @property NameValueCollection|null $formData
* @property bool $useBufferedStream
* @property string|null $rawUrl
* @property string|null $absoluteUri
* @property string|null $userHostAddress
* @property string|null $remoteIp
* @property string|null $authorization
* @property bool $isSecureConnection
* @property string[]|null $acceptTypes
* @property string|null $pathInfo
* @property string|null $originalPathInfo
* @property ByteArray|null $inputStream
* @property int $contentLength
* @property IHttpFile[]|null $files
* @property string|null $urlReferrer
*/
interface IRequest
{
}
/**
* @property int $status
* @property HttpStatusCode $statusCode
* @property string|null $statusDescription
* @property string|null $contentType
* @property array<string,string>|null $headers
* @property array<Cookie>|null $cookies
* @property Object|null $response
* @property IContentTypeWriter|null $responseFilter
* @property IRequest|null $requestContext
* @property int $paddingLength
* @property Func<IDisposable>|null $resultScope
*/
interface IHttpResult
{
}
enum ReportType : int
{
case GeneralReport = 0;
case SportsReport = 1;
case RNGReport = 2;
}
enum ReportFormat : int
{
case PDF = 0;
case XLSX = 1;
case HTML = 2;
case XML = 3;
}
enum ReportOperation : int
{
case Prijava_od_strane_poreznog_obveznika = 0;
case Prijava_u_ime_poreznog_obveznika = 1;
case Izmjena = 2;
case Izmjena_prijava_poreske_uprave = 3;
}
class GetReport implements JsonSerializable
{
public function __construct(
/** @var ReportType|null */
public ?ReportType $type=null,
/** @var DateTime */
public DateTime $dateFrom=new DateTime(),
/** @var DateTime */
public DateTime $dateTo=new DateTime(),
/** @var ReportFormat|null */
public ?ReportFormat $format=null,
/** @var int */
public int $documentOrdinal=0,
/** @var string|null */
public ?string $official=null,
/** @var ReportOperation|null */
public ?ReportOperation $operation=null,
/** @var DateTime */
public DateTime $dateOfReceipt=new DateTime(),
/** @var string|null */
public ?string $authorizedPersonJMBG=null,
/** @var string|null */
public ?string $authorizedPersonFullName=null,
/** @var string|null */
public ?string $authorizedPersonLocation=null,
/** @var DateTime */
public DateTime $authorizedPersonStatementDate=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['type'])) $this->type = JsonConverters::from('ReportType', $o['type']);
if (isset($o['dateFrom'])) $this->dateFrom = JsonConverters::from('DateTime', $o['dateFrom']);
if (isset($o['dateTo'])) $this->dateTo = JsonConverters::from('DateTime', $o['dateTo']);
if (isset($o['format'])) $this->format = JsonConverters::from('ReportFormat', $o['format']);
if (isset($o['documentOrdinal'])) $this->documentOrdinal = $o['documentOrdinal'];
if (isset($o['official'])) $this->official = $o['official'];
if (isset($o['operation'])) $this->operation = JsonConverters::from('ReportOperation', $o['operation']);
if (isset($o['dateOfReceipt'])) $this->dateOfReceipt = JsonConverters::from('DateTime', $o['dateOfReceipt']);
if (isset($o['authorizedPersonJMBG'])) $this->authorizedPersonJMBG = $o['authorizedPersonJMBG'];
if (isset($o['authorizedPersonFullName'])) $this->authorizedPersonFullName = $o['authorizedPersonFullName'];
if (isset($o['authorizedPersonLocation'])) $this->authorizedPersonLocation = $o['authorizedPersonLocation'];
if (isset($o['authorizedPersonStatementDate'])) $this->authorizedPersonStatementDate = JsonConverters::from('DateTime', $o['authorizedPersonStatementDate']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->type)) $o['type'] = JsonConverters::to('ReportType', $this->type);
if (isset($this->dateFrom)) $o['dateFrom'] = JsonConverters::to('DateTime', $this->dateFrom);
if (isset($this->dateTo)) $o['dateTo'] = JsonConverters::to('DateTime', $this->dateTo);
if (isset($this->format)) $o['format'] = JsonConverters::to('ReportFormat', $this->format);
if (isset($this->documentOrdinal)) $o['documentOrdinal'] = $this->documentOrdinal;
if (isset($this->official)) $o['official'] = $this->official;
if (isset($this->operation)) $o['operation'] = JsonConverters::to('ReportOperation', $this->operation);
if (isset($this->dateOfReceipt)) $o['dateOfReceipt'] = JsonConverters::to('DateTime', $this->dateOfReceipt);
if (isset($this->authorizedPersonJMBG)) $o['authorizedPersonJMBG'] = $this->authorizedPersonJMBG;
if (isset($this->authorizedPersonFullName)) $o['authorizedPersonFullName'] = $this->authorizedPersonFullName;
if (isset($this->authorizedPersonLocation)) $o['authorizedPersonLocation'] = $this->authorizedPersonLocation;
if (isset($this->authorizedPersonStatementDate)) $o['authorizedPersonStatementDate'] = JsonConverters::to('DateTime', $this->authorizedPersonStatementDate);
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 /reports HTTP/1.1 Host: fbihtaapi.bettor.webhop.biz Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{Unable to show example output for type 'IHttpResult' using the custom 'csv' filter}Cannot dynamically create an instance of type 'ServiceStack.Web.IHttpResult'. Reason: Cannot create an instance of an interface.