BusinessApi

<back to all web services

GetAllEatingSuitabilityRequest

Business
Requires Authentication
Required role:Business
The following routes are available for this service:
GET/eating_suitability/get_all
<?php namespace BusinessApi;

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 EatingSuitability implements IAudit, JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var string|null */
        public ?string $label=null,
        /** @var string|null */
        public ?string $slug=null,
        /** @var int */
        public int $position=0,
        /** @var DateTime */
        public DateTime $createdAt=new DateTime(),
        /** @var DateTime */
        public DateTime $updatedAt=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['label'])) $this->label = $o['label'];
        if (isset($o['slug'])) $this->slug = $o['slug'];
        if (isset($o['position'])) $this->position = $o['position'];
        if (isset($o['createdAt'])) $this->createdAt = JsonConverters::from('DateTime', $o['createdAt']);
        if (isset($o['updatedAt'])) $this->updatedAt = JsonConverters::from('DateTime', $o['updatedAt']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->label)) $o['label'] = $this->label;
        if (isset($this->slug)) $o['slug'] = $this->slug;
        if (isset($this->position)) $o['position'] = $this->position;
        if (isset($this->createdAt)) $o['createdAt'] = JsonConverters::to('DateTime', $this->createdAt);
        if (isset($this->updatedAt)) $o['updatedAt'] = JsonConverters::to('DateTime', $this->updatedAt);
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetAllEatingSuitabilityRequest 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 /eating_suitability/get_all HTTP/1.1 
Host: business-api.brovs.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<GetAllEatingSuitabilityResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BusinessApi.Dto">
  <EatingSuitabilities>
    <EatingSuitabilityDto>
      <Label>String</Label>
      <Slug xmlns:d4p1="http://schemas.datacontract.org/2004/07/Entities.Database">
        <d4p1:CreatedAt xmlns:d5p1="http://schemas.datacontract.org/2004/07/System">
          <d5p1:DateTime>0001-01-01T00:00:00Z</d5p1:DateTime>
          <d5p1:OffsetMinutes>0</d5p1:OffsetMinutes>
        </d4p1:CreatedAt>
        <d4p1:Id>0</d4p1:Id>
        <d4p1:Label>String</d4p1:Label>
        <d4p1:Position>0</d4p1:Position>
        <d4p1:Slug>String</d4p1:Slug>
        <d4p1:UpdatedAt xmlns:d5p1="http://schemas.datacontract.org/2004/07/System">
          <d5p1:DateTime>0001-01-01T00:00:00Z</d5p1:DateTime>
          <d5p1:OffsetMinutes>0</d5p1:OffsetMinutes>
        </d4p1:UpdatedAt>
      </Slug>
    </EatingSuitabilityDto>
  </EatingSuitabilities>
</GetAllEatingSuitabilityResponse>