BokaMera.API.Host

<back to all web services

UpdateQuantity

Requires Authentication
The following routes are available for this service:
PUT/bookings/{BookingId}/quantity/{Id}Update an existing booking quantityUpdates an existing booking quantity if you are authorized to do so. Note: Updating quantity wont updated the number of booked resources.
<?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 BookedQuantity implements JsonSerializable
{
    public function __construct(
        /** @description The quantity Id */
        // @ApiMember(Description="The quantity Id")
        /** @var int */
        public int $Id=0,

        /** @description The quantity for booked on this price category */
        // @ApiMember(Description="The quantity for booked on this price category")
        /** @var int */
        public int $Quantity=0,

        /** @description The price */
        // @ApiMember(Description="The price")
        /** @var float|null */
        public ?float $Price=null,

        /** @description The price bofore rebate codes */
        // @ApiMember(Description="The price bofore rebate codes")
        /** @var float|null */
        public ?float $PriceBeforeRebate=null,

        /** @description The price currency */
        // @ApiMember(Description="The price currency")
        /** @var string|null */
        public ?string $CurrencyId=null,

        /** @description The price sign */
        // @ApiMember(Description="The price sign")
        /** @var string|null */
        public ?string $PriceSign=null,

        /** @description The price category */
        // @ApiMember(Description="The price category")
        /** @var string|null */
        public ?string $Category=null,

        /** @description The price VAT in percent */
        // @ApiMember(Description="The price VAT in percent")
        /** @var float|null */
        public ?float $VAT=null,

        /** @description The price text to display */
        // @ApiMember(Description="The price text to display")
        /** @var string|null */
        public ?string $PriceText=null,

        /** @description If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information. */
        // @ApiMember(Description="If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information.")
        /** @var bool|null */
        public ?bool $OccupiesSpot=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Quantity'])) $this->Quantity = $o['Quantity'];
        if (isset($o['Price'])) $this->Price = $o['Price'];
        if (isset($o['PriceBeforeRebate'])) $this->PriceBeforeRebate = $o['PriceBeforeRebate'];
        if (isset($o['CurrencyId'])) $this->CurrencyId = $o['CurrencyId'];
        if (isset($o['PriceSign'])) $this->PriceSign = $o['PriceSign'];
        if (isset($o['Category'])) $this->Category = $o['Category'];
        if (isset($o['VAT'])) $this->VAT = $o['VAT'];
        if (isset($o['PriceText'])) $this->PriceText = $o['PriceText'];
        if (isset($o['OccupiesSpot'])) $this->OccupiesSpot = $o['OccupiesSpot'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Quantity)) $o['Quantity'] = $this->Quantity;
        if (isset($this->Price)) $o['Price'] = $this->Price;
        if (isset($this->PriceBeforeRebate)) $o['PriceBeforeRebate'] = $this->PriceBeforeRebate;
        if (isset($this->CurrencyId)) $o['CurrencyId'] = $this->CurrencyId;
        if (isset($this->PriceSign)) $o['PriceSign'] = $this->PriceSign;
        if (isset($this->Category)) $o['Category'] = $this->Category;
        if (isset($this->VAT)) $o['VAT'] = $this->VAT;
        if (isset($this->PriceText)) $o['PriceText'] = $this->PriceText;
        if (isset($this->OccupiesSpot)) $o['OccupiesSpot'] = $this->OccupiesSpot;
        return empty($o) ? new class(){} : $o;
    }
}

// @ValidateRequest(Validator="IsAuthenticated")
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ApiResponse(Description="You have too low privilegies to call this service", StatusCode=403)
class UpdateQuantity 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 Id of the booking */
        // @ApiMember(Description="Id of the booking", IsRequired=true, ParameterType="path")
        /** @var int */
        public int $BookingId=0,

        /** @description Id of the quantity */
        // @ApiMember(Description="Id of the quantity", IsRequired=true, ParameterType="path")
        /** @var int */
        public int $Id=0,

        /** @description If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information. */
        // @ApiMember(Description="If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information.")
        /** @var bool|null */
        public ?bool $OccupiesSpot=null,

        /** @description The quantity for booked on this price category */
        // @ApiMember(Description="The quantity for booked on this price category")
        /** @var int */
        public int $Quantity=0,

        /** @description The price */
        // @ApiMember(Description="The price")
        /** @var float|null */
        public ?float $Price=null,

        /** @description The price currency */
        // @ApiMember(Description="The price currency")
        /** @var string|null */
        public ?string $CurrencyId=null,

        /** @description The price category */
        // @ApiMember(Description="The price category")
        /** @var string|null */
        public ?string $Category=null,

        /** @description The price VAT in percent */
        // @ApiMember(Description="The price VAT in percent")
        /** @var float|null */
        public ?float $VAT=null,

        /** @description Any comments to be stored in the event log. */
        // @ApiMember(Description="Any comments to be stored in the event log.")
        /** @var string|null */
        public ?string $Comments=null,

        /** @description If you want the amount to be refunded automatically if amount is lower than paid */
        // @ApiMember(Description="If you want the amount to be refunded automatically if amount is lower than paid")
        /** @var bool|null */
        public ?bool $Refund=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['BookingId'])) $this->BookingId = $o['BookingId'];
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['OccupiesSpot'])) $this->OccupiesSpot = $o['OccupiesSpot'];
        if (isset($o['Quantity'])) $this->Quantity = $o['Quantity'];
        if (isset($o['Price'])) $this->Price = $o['Price'];
        if (isset($o['CurrencyId'])) $this->CurrencyId = $o['CurrencyId'];
        if (isset($o['Category'])) $this->Category = $o['Category'];
        if (isset($o['VAT'])) $this->VAT = $o['VAT'];
        if (isset($o['Comments'])) $this->Comments = $o['Comments'];
        if (isset($o['Refund'])) $this->Refund = $o['Refund'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->BookingId)) $o['BookingId'] = $this->BookingId;
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->OccupiesSpot)) $o['OccupiesSpot'] = $this->OccupiesSpot;
        if (isset($this->Quantity)) $o['Quantity'] = $this->Quantity;
        if (isset($this->Price)) $o['Price'] = $this->Price;
        if (isset($this->CurrencyId)) $o['CurrencyId'] = $this->CurrencyId;
        if (isset($this->Category)) $o['Category'] = $this->Category;
        if (isset($this->VAT)) $o['VAT'] = $this->VAT;
        if (isset($this->Comments)) $o['Comments'] = $this->Comments;
        if (isset($this->Refund)) $o['Refund'] = $this->Refund;
        return empty($o) ? new class(){} : $o;
    }
}

PHP UpdateQuantity 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.

PUT /bookings/{BookingId}/quantity/{Id} HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<UpdateQuantity xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <BookingId>0</BookingId>
  <Category>String</Category>
  <Comments>String</Comments>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <CurrencyId>String</CurrencyId>
  <Id>0</Id>
  <OccupiesSpot>false</OccupiesSpot>
  <Price>0</Price>
  <Quantity>0</Quantity>
  <Refund>false</Refund>
  <VAT>0</VAT>
</UpdateQuantity>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<BookedQuantity xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <Category>String</Category>
  <CurrencyId>String</CurrencyId>
  <Id>0</Id>
  <OccupiesSpot>false</OccupiesSpot>
  <Price>0</Price>
  <PriceBeforeRebate>0</PriceBeforeRebate>
  <PriceSign>String</PriceSign>
  <PriceText>String</PriceText>
  <Quantity>0</Quantity>
  <VAT>0</VAT>
</BookedQuantity>