BokaMera.API.Host

<back to all web services

EAccountingInvoiceDraftQuery

The following routes are available for this service:
GET/eaccounting/invoicedrafts
<?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 EAccountingPagination implements JsonSerializable
{
    public function __construct(
        /** @description Page number that will be fetched to e-accounting client; Default 1 */
        // @DataMember(Order=1)
        // @ApiMember(Description="Page number that will be fetched to e-accounting client; Default 1")
        /** @var int|null */
        public ?int $PageNumber=null,

        /** @description Page size that will be fetched to e-accounting client; Default 75~ */
        // @DataMember(Order=2)
        // @ApiMember(Description="Page size that will be fetched to e-accounting client; Default 75~")
        /** @var int|null */
        public ?int $PageSize=null
    ) {
    }

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

enum GreenTechnologyType : string
{
    case None = 'None';
    case SolarCellInstallation = 'SolarCellInstallation';
    case ElectricEnergyStorageInstallation = 'ElectricEnergyStorageInstallation';
    case ElectricVehicleChargingPointInstallation = 'ElectricVehicleChargingPointInstallation';
}

class ContributionMargin implements JsonSerializable
{
    public function __construct(
        /** @var int|null */
        public ?int $Amount=null,
        /** @var int|null */
        public ?int $Percentage=null
    ) {
    }

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

class InvoiceDraftLineQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $ArticleNumber=null,
        /** @var string|null */
        public ?string $ArticleId=null,
        /** @var bool|null */
        public ?bool $IsServiceArticle=null,
        /** @var float */
        public float $AmountNoVat=0.0,
        /** @var float */
        public float $PercentVat=0.0,
        /** @var int|null */
        public ?int $LineNumber=null,
        /** @var bool|null */
        public ?bool $IsTextRow=null,
        /** @var string|null */
        public ?string $Text=null,
        /** @var float|null */
        public ?float $UnitPrice=null,
        /** @var string|null */
        public ?string $UnitAbbreviation=null,
        /** @var string|null */
        public ?string $UnitAbbreviationEnglish=null,
        /** @var float|null */
        public ?float $DiscountPercentage=null,
        /** @var float|null */
        public ?float $Quantity=null,
        /** @var bool|null */
        public ?bool $IsWorkCost=null,
        /** @var bool|null */
        public ?bool $IsVatFree=null,
        /** @var string|null */
        public ?string $CostCenterItemId1=null,
        /** @var string|null */
        public ?string $CostCenterItemId2=null,
        /** @var string|null */
        public ?string $CostCenterItemId3=null,
        /** @var string|null */
        public ?string $UnitId=null,
        /** @var string|null */
        public ?string $ProjectId=null,
        /** @var int|null */
        public ?int $WorkCostType=null,
        /** @var float|null */
        public ?float $WorkHours=null,
        /** @var float|null */
        public ?float $MaterialCosts=null,
        /** @var GreenTechnologyType|null */
        public ?GreenTechnologyType $GreenTechnologyType=null,
        /** @var ContributionMargin|null */
        public ?ContributionMargin $ContributionMargin=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ArticleNumber'])) $this->ArticleNumber = $o['ArticleNumber'];
        if (isset($o['ArticleId'])) $this->ArticleId = $o['ArticleId'];
        if (isset($o['IsServiceArticle'])) $this->IsServiceArticle = $o['IsServiceArticle'];
        if (isset($o['AmountNoVat'])) $this->AmountNoVat = $o['AmountNoVat'];
        if (isset($o['PercentVat'])) $this->PercentVat = $o['PercentVat'];
        if (isset($o['LineNumber'])) $this->LineNumber = $o['LineNumber'];
        if (isset($o['IsTextRow'])) $this->IsTextRow = $o['IsTextRow'];
        if (isset($o['Text'])) $this->Text = $o['Text'];
        if (isset($o['UnitPrice'])) $this->UnitPrice = $o['UnitPrice'];
        if (isset($o['UnitAbbreviation'])) $this->UnitAbbreviation = $o['UnitAbbreviation'];
        if (isset($o['UnitAbbreviationEnglish'])) $this->UnitAbbreviationEnglish = $o['UnitAbbreviationEnglish'];
        if (isset($o['DiscountPercentage'])) $this->DiscountPercentage = $o['DiscountPercentage'];
        if (isset($o['Quantity'])) $this->Quantity = $o['Quantity'];
        if (isset($o['IsWorkCost'])) $this->IsWorkCost = $o['IsWorkCost'];
        if (isset($o['IsVatFree'])) $this->IsVatFree = $o['IsVatFree'];
        if (isset($o['CostCenterItemId1'])) $this->CostCenterItemId1 = $o['CostCenterItemId1'];
        if (isset($o['CostCenterItemId2'])) $this->CostCenterItemId2 = $o['CostCenterItemId2'];
        if (isset($o['CostCenterItemId3'])) $this->CostCenterItemId3 = $o['CostCenterItemId3'];
        if (isset($o['UnitId'])) $this->UnitId = $o['UnitId'];
        if (isset($o['ProjectId'])) $this->ProjectId = $o['ProjectId'];
        if (isset($o['WorkCostType'])) $this->WorkCostType = $o['WorkCostType'];
        if (isset($o['WorkHours'])) $this->WorkHours = $o['WorkHours'];
        if (isset($o['MaterialCosts'])) $this->MaterialCosts = $o['MaterialCosts'];
        if (isset($o['GreenTechnologyType'])) $this->GreenTechnologyType = JsonConverters::from('GreenTechnologyType', $o['GreenTechnologyType']);
        if (isset($o['ContributionMargin'])) $this->ContributionMargin = JsonConverters::from('ContributionMargin', $o['ContributionMargin']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ArticleNumber)) $o['ArticleNumber'] = $this->ArticleNumber;
        if (isset($this->ArticleId)) $o['ArticleId'] = $this->ArticleId;
        if (isset($this->IsServiceArticle)) $o['IsServiceArticle'] = $this->IsServiceArticle;
        if (isset($this->AmountNoVat)) $o['AmountNoVat'] = $this->AmountNoVat;
        if (isset($this->PercentVat)) $o['PercentVat'] = $this->PercentVat;
        if (isset($this->LineNumber)) $o['LineNumber'] = $this->LineNumber;
        if (isset($this->IsTextRow)) $o['IsTextRow'] = $this->IsTextRow;
        if (isset($this->Text)) $o['Text'] = $this->Text;
        if (isset($this->UnitPrice)) $o['UnitPrice'] = $this->UnitPrice;
        if (isset($this->UnitAbbreviation)) $o['UnitAbbreviation'] = $this->UnitAbbreviation;
        if (isset($this->UnitAbbreviationEnglish)) $o['UnitAbbreviationEnglish'] = $this->UnitAbbreviationEnglish;
        if (isset($this->DiscountPercentage)) $o['DiscountPercentage'] = $this->DiscountPercentage;
        if (isset($this->Quantity)) $o['Quantity'] = $this->Quantity;
        if (isset($this->IsWorkCost)) $o['IsWorkCost'] = $this->IsWorkCost;
        if (isset($this->IsVatFree)) $o['IsVatFree'] = $this->IsVatFree;
        if (isset($this->CostCenterItemId1)) $o['CostCenterItemId1'] = $this->CostCenterItemId1;
        if (isset($this->CostCenterItemId2)) $o['CostCenterItemId2'] = $this->CostCenterItemId2;
        if (isset($this->CostCenterItemId3)) $o['CostCenterItemId3'] = $this->CostCenterItemId3;
        if (isset($this->UnitId)) $o['UnitId'] = $this->UnitId;
        if (isset($this->ProjectId)) $o['ProjectId'] = $this->ProjectId;
        if (isset($this->WorkCostType)) $o['WorkCostType'] = $this->WorkCostType;
        if (isset($this->WorkHours)) $o['WorkHours'] = $this->WorkHours;
        if (isset($this->MaterialCosts)) $o['MaterialCosts'] = $this->MaterialCosts;
        if (isset($this->GreenTechnologyType)) $o['GreenTechnologyType'] = JsonConverters::to('GreenTechnologyType', $this->GreenTechnologyType);
        if (isset($this->ContributionMargin)) $o['ContributionMargin'] = JsonConverters::to('ContributionMargin', $this->ContributionMargin);
        return empty($o) ? new class(){} : $o;
    }
}

class Person implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Ssn=null,
        /** @var int */
        public int $Amount=0
    ) {
    }

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

class InvoiceAddress implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $CorporateIdentityNumber=null,
        /** @var string|null */
        public ?string $InvoiceAddress1=null,
        /** @var string|null */
        public ?string $InvoiceAddress2=null,
        /** @var string|null */
        public ?string $InvoiceCity=null,
        /** @var string|null */
        public ?string $InvoicePostalCode=null,
        /** @var string|null */
        public ?string $InvoiceCountryCode=null
    ) {
    }

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

class NoteQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Id=null,
        /** @var string|null */
        public ?string $Text=null,
        /** @var DateTime */
        public DateTime $CreatedUtc=new DateTime(),
        /** @var DateTime */
        public DateTime $ModifiedUtc=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Text'])) $this->Text = $o['Text'];
        if (isset($o['CreatedUtc'])) $this->CreatedUtc = JsonConverters::from('DateTime', $o['CreatedUtc']);
        if (isset($o['ModifiedUtc'])) $this->ModifiedUtc = JsonConverters::from('DateTime', $o['ModifiedUtc']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Text)) $o['Text'] = $this->Text;
        if (isset($this->CreatedUtc)) $o['CreatedUtc'] = JsonConverters::to('DateTime', $this->CreatedUtc);
        if (isset($this->ModifiedUtc)) $o['ModifiedUtc'] = JsonConverters::to('DateTime', $this->ModifiedUtc);
        return empty($o) ? new class(){} : $o;
    }
}

class InvoiceDraftQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $InvoiceId='',
        /** @var DateTime|null */
        public ?DateTime $CreatedDate=null,
        /** @var float|null */
        public ?float $TotalAmount=null,
        /** @var float|null */
        public ?float $TotalVatAmount=null,
        /** @var string|null */
        public ?string $CustomerId=null,
        /** @var array<InvoiceDraftLineQueryResponse>|null */
        public ?array $Rows=null,
        /** @var string|null */
        public ?string $InvoiceDate=null,
        /** @var string|null */
        public ?string $DueDate=null,
        /** @var DateTime|null */
        public ?DateTime $DeliveryDate=null,
        /** @var array<Person>|null */
        public ?array $Persons=null,
        /** @var string|null */
        public ?string $InvoiceCustomerName=null,
        /** @var InvoiceAddress|null */
        public ?InvoiceAddress $InvoiceAddress=null,
        /** @var bool|null */
        public ?bool $CustomerIsPrivatePerson=null,
        /** @var string|null */
        public ?string $CustomerNumber=null,
        /** @var array<NoteQueryResponse>|null */
        public ?array $Notes=null,
        /** @var array<string>|null */
        public ?array $NoteIds=null,
        /** @var DateTime */
        public DateTime $CreatedUtc=new DateTime(),
        /** @var bool|null */
        public ?bool $IncludesVat=null,
        /** @var string|null */
        public ?string $PriceSign=null,
        /** @var string|null */
        public ?string $BookingId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['InvoiceId'])) $this->InvoiceId = $o['InvoiceId'];
        if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
        if (isset($o['TotalAmount'])) $this->TotalAmount = $o['TotalAmount'];
        if (isset($o['TotalVatAmount'])) $this->TotalVatAmount = $o['TotalVatAmount'];
        if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
        if (isset($o['Rows'])) $this->Rows = JsonConverters::fromArray('InvoiceDraftLineQueryResponse', $o['Rows']);
        if (isset($o['InvoiceDate'])) $this->InvoiceDate = $o['InvoiceDate'];
        if (isset($o['DueDate'])) $this->DueDate = $o['DueDate'];
        if (isset($o['DeliveryDate'])) $this->DeliveryDate = JsonConverters::from('DateTime', $o['DeliveryDate']);
        if (isset($o['Persons'])) $this->Persons = JsonConverters::fromArray('Person', $o['Persons']);
        if (isset($o['InvoiceCustomerName'])) $this->InvoiceCustomerName = $o['InvoiceCustomerName'];
        if (isset($o['InvoiceAddress'])) $this->InvoiceAddress = JsonConverters::from('InvoiceAddress', $o['InvoiceAddress']);
        if (isset($o['CustomerIsPrivatePerson'])) $this->CustomerIsPrivatePerson = $o['CustomerIsPrivatePerson'];
        if (isset($o['CustomerNumber'])) $this->CustomerNumber = $o['CustomerNumber'];
        if (isset($o['Notes'])) $this->Notes = JsonConverters::fromArray('NoteQueryResponse', $o['Notes']);
        if (isset($o['NoteIds'])) $this->NoteIds = JsonConverters::fromArray('string', $o['NoteIds']);
        if (isset($o['CreatedUtc'])) $this->CreatedUtc = JsonConverters::from('DateTime', $o['CreatedUtc']);
        if (isset($o['IncludesVat'])) $this->IncludesVat = $o['IncludesVat'];
        if (isset($o['PriceSign'])) $this->PriceSign = $o['PriceSign'];
        if (isset($o['BookingId'])) $this->BookingId = $o['BookingId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->InvoiceId)) $o['InvoiceId'] = $this->InvoiceId;
        if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
        if (isset($this->TotalAmount)) $o['TotalAmount'] = $this->TotalAmount;
        if (isset($this->TotalVatAmount)) $o['TotalVatAmount'] = $this->TotalVatAmount;
        if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
        if (isset($this->Rows)) $o['Rows'] = JsonConverters::toArray('InvoiceDraftLineQueryResponse', $this->Rows);
        if (isset($this->InvoiceDate)) $o['InvoiceDate'] = $this->InvoiceDate;
        if (isset($this->DueDate)) $o['DueDate'] = $this->DueDate;
        if (isset($this->DeliveryDate)) $o['DeliveryDate'] = JsonConverters::to('DateTime', $this->DeliveryDate);
        if (isset($this->Persons)) $o['Persons'] = JsonConverters::toArray('Person', $this->Persons);
        if (isset($this->InvoiceCustomerName)) $o['InvoiceCustomerName'] = $this->InvoiceCustomerName;
        if (isset($this->InvoiceAddress)) $o['InvoiceAddress'] = JsonConverters::to('InvoiceAddress', $this->InvoiceAddress);
        if (isset($this->CustomerIsPrivatePerson)) $o['CustomerIsPrivatePerson'] = $this->CustomerIsPrivatePerson;
        if (isset($this->CustomerNumber)) $o['CustomerNumber'] = $this->CustomerNumber;
        if (isset($this->Notes)) $o['Notes'] = JsonConverters::toArray('NoteQueryResponse', $this->Notes);
        if (isset($this->NoteIds)) $o['NoteIds'] = JsonConverters::toArray('string', $this->NoteIds);
        if (isset($this->CreatedUtc)) $o['CreatedUtc'] = JsonConverters::to('DateTime', $this->CreatedUtc);
        if (isset($this->IncludesVat)) $o['IncludesVat'] = $this->IncludesVat;
        if (isset($this->PriceSign)) $o['PriceSign'] = $this->PriceSign;
        if (isset($this->BookingId)) $o['BookingId'] = $this->BookingId;
        return empty($o) ? new class(){} : $o;
    }
}

class EAccountingInvoiceDraftQuery extends EAccountingPagination implements ICompany, JsonSerializable
{
    /**
     * @param int|null $PageNumber
     * @param int|null $PageSize
     */
    public function __construct(
        ?int $PageNumber=null,
        ?int $PageSize=null,
        /** @var int|null */
        public ?int $BookingId=null,
        /** @var bool|null */
        public ?bool $IncludeInvoiceLines=null,
        /** @var bool|null */
        public ?bool $IncludeInvoiceNotes=null,
        /** @var string|null */
        public ?string $CompanyId=null
    ) {
        parent::__construct($PageNumber,$PageSize);
    }

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

PHP EAccountingInvoiceDraftQuery 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/invoicedrafts HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"CreatedDate":"0001-01-01T00:00:00","TotalAmount":0,"TotalVatAmount":0,"CustomerId":"String","Rows":[{"ArticleNumber":"String","ArticleId":"String","IsServiceArticle":false,"AmountNoVat":0,"PercentVat":0,"LineNumber":0,"IsTextRow":false,"Text":"String","UnitPrice":0,"UnitAbbreviation":"String","UnitAbbreviationEnglish":"String","DiscountPercentage":0,"Quantity":0,"IsWorkCost":false,"IsVatFree":false,"CostCenterItemId1":"String","CostCenterItemId2":"String","CostCenterItemId3":"String","UnitId":"String","ProjectId":"String","WorkCostType":0,"WorkHours":0,"MaterialCosts":0,"GreenTechnologyType":"None","ContributionMargin":{"Amount":0,"Percentage":0}}],"InvoiceDate":"String","DueDate":"String","DeliveryDate":"0001-01-01T00:00:00","Persons":[{"Ssn":"String","Amount":0}],"InvoiceCustomerName":"String","InvoiceAddress":{"CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"},"CustomerIsPrivatePerson":false,"CustomerNumber":"String","Notes":[{"Id":"String","Text":"String"}],"NoteIds":["String"],"IncludesVat":false,"PriceSign":"String","BookingId":"String"}