BokaMera.API.Host

<back to all web services

QuerySummarizedInvoices

Requires Authentication
The following routes are available for this service:
GET/eaccounting/summarizedinvoicesList summarized invoices with optional filtersQuery summarized invoices by company, customer, date range, and status.
<?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 SummarizedInvoiceDetailResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id='',
        /** @var string */
        public string $CompanyId='',
        /** @var string */
        public string $CustomerId='',
        /** @var string */
        public string $CustomerName='',
        /** @var string|null */
        public ?string $EAccountingInvoiceId=null,
        /** @var bool|null */
        public ?bool $Draft=null,
        /** @var DateTime */
        public DateTime $DateFrom=new DateTime(),
        /** @var DateTime */
        public DateTime $DateTo=new DateTime(),
        /** @var int|null */
        public ?int $ServiceId=null,
        /** @var int */
        public int $Status=0,
        /** @var string */
        public string $StatusName='',
        /** @var string|null */
        public ?string $ErrorMessage=null,
        /** @var array<int>|null */
        public ?array $BookingIds=null,
        /** @var DateTime */
        public DateTime $CreatedDate=new DateTime(),
        /** @var DateTime */
        public DateTime $UpdatedDate=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
        if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
        if (isset($o['EAccountingInvoiceId'])) $this->EAccountingInvoiceId = $o['EAccountingInvoiceId'];
        if (isset($o['Draft'])) $this->Draft = $o['Draft'];
        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['ServiceId'])) $this->ServiceId = $o['ServiceId'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['StatusName'])) $this->StatusName = $o['StatusName'];
        if (isset($o['ErrorMessage'])) $this->ErrorMessage = $o['ErrorMessage'];
        if (isset($o['BookingIds'])) $this->BookingIds = JsonConverters::fromArray('int', $o['BookingIds']);
        if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
        if (isset($o['UpdatedDate'])) $this->UpdatedDate = JsonConverters::from('DateTime', $o['UpdatedDate']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
        if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
        if (isset($this->EAccountingInvoiceId)) $o['EAccountingInvoiceId'] = $this->EAccountingInvoiceId;
        if (isset($this->Draft)) $o['Draft'] = $this->Draft;
        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->ServiceId)) $o['ServiceId'] = $this->ServiceId;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->StatusName)) $o['StatusName'] = $this->StatusName;
        if (isset($this->ErrorMessage)) $o['ErrorMessage'] = $this->ErrorMessage;
        if (isset($this->BookingIds)) $o['BookingIds'] = JsonConverters::toArray('int', $this->BookingIds);
        if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
        if (isset($this->UpdatedDate)) $o['UpdatedDate'] = JsonConverters::to('DateTime', $this->UpdatedDate);
        return empty($o) ? new class(){} : $o;
    }
}

class QuerySummarizedInvoicesResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<SummarizedInvoiceDetailResponse>|null */
        public ?array $Results=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Results'])) $this->Results = JsonConverters::fromArray('SummarizedInvoiceDetailResponse', $o['Results']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Results)) $o['Results'] = JsonConverters::toArray('SummarizedInvoiceDetailResponse', $this->Results);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

enum SummarizedInvoiceStatus : string
{
    case Pending = 'Pending';
    case Processing = 'Processing';
    case Completed = 'Completed';
    case Failed = 'Failed';
}

// @ValidateRequest(Validator="IsAuthenticated")
class QuerySummarizedInvoices implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description The company id, if empty will use the company id for the user you are logged in with. */
        // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
        /** @var string|null */
        public ?string $CompanyId=null,

        /** @description Filter by customer id. */
        // @ApiMember(Description="Filter by customer id.")
        /** @var string|null */
        public ?string $CustomerId=null,

        /** @description Filter by date from. */
        // @ApiMember(Description="Filter by date from.")
        /** @var DateTime|null */
        public ?DateTime $DateFrom=null,

        /** @description Filter by date to. */
        // @ApiMember(Description="Filter by date to.")
        /** @var DateTime|null */
        public ?DateTime $DateTo=null,

        /** @description Filter by status (0=Pending, 1=Processing, 2=Completed, 3=Failed). */
        // @ApiMember(Description="Filter by status (0=Pending, 1=Processing, 2=Completed, 3=Failed).")
        /** @var SummarizedInvoiceStatus|null */
        public ?SummarizedInvoiceStatus $Status=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
        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['Status'])) $this->Status = JsonConverters::from('SummarizedInvoiceStatus', $o['Status']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
        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->Status)) $o['Status'] = JsonConverters::to('SummarizedInvoiceStatus', $this->Status);
        return empty($o) ? new class(){} : $o;
    }
}

PHP QuerySummarizedInvoices DTOs

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

HTTP + CSV

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

GET /eaccounting/summarizedinvoices HTTP/1.1 
Host: api.bokamera.se 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Results":[{"CustomerName":"String","EAccountingInvoiceId":"String","Draft":false,"ServiceId":0,"Status":0,"StatusName":"String","ErrorMessage":"String","BookingIds":[0]}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}