BokaMera.API.Host

<back to all web services

CreateVossInvoice

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/voss/invoiceinit voss invoice
<?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};


// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class CreateVossInvoice implements JsonSerializable
{
    public function __construct(
        /** @description Company ids to create invoice. If none added invoice for all will be created */
        // @ApiMember(Description="Company ids to create invoice. If none added invoice for all will be created")
        /** @var array<string>|null */
        public ?array $CompanyIds=null,

        /** @description Controls up to which point of time transactions are included in invoice, can be set to any date, if not provided current UTC time will be used instead */
        // @ApiMember(Description="Controls up to which point of time transactions are included in invoice, can be set to any date, if not provided current UTC time will be used instead")
        /** @var DateTime|null */
        public ?DateTime $InvoiceDate=null,

        /** @description If present the operation will start only after this date */
        // @ApiMember(Description="If present the operation will start only after this date")
        /** @var DateTime|null */
        public ?DateTime $ScheduledStartTime=null,

        /** @description Optional CRON expression for recurring operations. */
        // @ApiMember(Description="Optional CRON expression for recurring operations.")
        /** @var string */
        public string $RecurringSchedule='',

        /** @description Only usage. */
        // @ApiMember(Description="Only usage.")
        /** @var bool|null */
        public ?bool $OnlyUsage=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyIds'])) $this->CompanyIds = JsonConverters::fromArray('Guid', $o['CompanyIds']);
        if (isset($o['InvoiceDate'])) $this->InvoiceDate = JsonConverters::from('DateTime', $o['InvoiceDate']);
        if (isset($o['ScheduledStartTime'])) $this->ScheduledStartTime = JsonConverters::from('DateTime', $o['ScheduledStartTime']);
        if (isset($o['RecurringSchedule'])) $this->RecurringSchedule = $o['RecurringSchedule'];
        if (isset($o['OnlyUsage'])) $this->OnlyUsage = $o['OnlyUsage'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyIds)) $o['CompanyIds'] = JsonConverters::toArray('Guid', $this->CompanyIds);
        if (isset($this->InvoiceDate)) $o['InvoiceDate'] = JsonConverters::to('DateTime', $this->InvoiceDate);
        if (isset($this->ScheduledStartTime)) $o['ScheduledStartTime'] = JsonConverters::to('DateTime', $this->ScheduledStartTime);
        if (isset($this->RecurringSchedule)) $o['RecurringSchedule'] = $this->RecurringSchedule;
        if (isset($this->OnlyUsage)) $o['OnlyUsage'] = $this->OnlyUsage;
        return empty($o) ? new class(){} : $o;
    }
}

PHP CreateVossInvoice DTOs

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

HTTP + OTHER

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

POST /voss/invoice HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"CompanyIds":["00000000-0000-0000-0000-000000000000"],"InvoiceDate":"0001-01-01T00:00:00","ScheduledStartTime":"0001-01-01T00:00:00","RecurringSchedule":"String","OnlyUsage":false}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{}