BokaMera.API.Host

<back to all web services

GetSummarizedInvoice

Requires Authentication
The following routes are available for this service:
GET/eaccounting/summarizedinvoice/{Id}Get a single summarized invoice by idReturns the summarized invoice details including associated booking ids.
<?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;
    }
}

// @ValidateRequest(Validator="IsAuthenticated")
class GetSummarizedInvoice implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description The summarized invoice id. */
        // @ApiMember(Description="The summarized invoice id.", IsRequired=true)
        /** @var string */
        public string $Id='',

        /** @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
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetSummarizedInvoice 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/summarizedinvoice/{Id} HTTP/1.1 
Host: api.bokamera.se 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"CustomerName":"String","EAccountingInvoiceId":"String","Draft":false,"ServiceId":0,"Status":0,"StatusName":"String","ErrorMessage":"String","BookingIds":[0]}