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 .xml suffix or ?format=xml

HTTP + XML

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: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<QuerySummarizedInvoicesResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
  <Results>
    <SummarizedInvoiceDetailResponse>
      <BookingIds xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:int>0</d4p1:int>
      </BookingIds>
      <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
      <CreatedDate>0001-01-01T00:00:00</CreatedDate>
      <CustomerId>00000000-0000-0000-0000-000000000000</CustomerId>
      <CustomerName>String</CustomerName>
      <DateFrom>0001-01-01T00:00:00</DateFrom>
      <DateTo>0001-01-01T00:00:00</DateTo>
      <Draft>false</Draft>
      <EAccountingInvoiceId>String</EAccountingInvoiceId>
      <ErrorMessage>String</ErrorMessage>
      <Id>00000000-0000-0000-0000-000000000000</Id>
      <ServiceId>0</ServiceId>
      <Status>0</Status>
      <StatusName>String</StatusName>
      <UpdatedDate>0001-01-01T00:00:00</UpdatedDate>
    </SummarizedInvoiceDetailResponse>
  </Results>
</QuerySummarizedInvoicesResponse>