Aller au contenu

omnifood/zenchef Référence de l’API

Étage
Fournisseur · Omnifood
Version
1.x
Suite de conformité
non branchée
Vérifié en réel
Non vérifié en réel
Licence
MIT
composer require omnifood/zenchef:1.x-dev

Lue dans les fichiers PHP du paquet au commit 8536fdc8200b : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.

Omnifood\Zenchef

  • Api class

    A client for Zenchef's partner API, configured from the documentation Zenchef sends on request - its base URL and the headers that carry the restaurant's credentials are not public, so nothing is assumed: they are options, "{token}" and "{restaurant_id}" in a header's value standing for the restaurant's token and id.

    3 methods · 1 constant

  • ZenchefPlatform class

    A restaurant's reservations at Zenchef - not yet: Zenchef's partner API is documented on request only (https://help.zenchef.com/hc/en-gb/articles/27690768125597-Zenchef-API).

    13 methods · 1 constant

  • ZenchefPlatformFactory class

    Zenchef: the restaurant's credentials, and a client ready for the partner API once Zenchef has sent its documentation:

    4 options

Omnifood\Zenchef

Api class

final class Api Api.php:24

A client for Zenchef's partner API, configured from the documentation Zenchef sends on request - its base URL and the headers that carry the restaurant's credentials are not public, so nothing is assumed: they are options, "{token}" and "{restaurant_id}" in a header's value standing for the restaurant's token and id.

Zenchef's published limits: 100 calls a minute for the calls answered in less than a second, the slower ones one after the other, pages of 250 to 500.

const PLATFORM = 'zenchef'

Api::__construct()

public function __construct(readonly ?string $token = null, readonly ?string $restaurantId = null, readonly ?string $baseUri = null, readonly array $headers = [], ?HttpClientInterface $http = null)

Api::request()

public function request(string $method, string $path, array $query = [], array|object|null $json = null): array

Api::restaurantId()

public function restaurantId(): ?string

ZenchefPlatform class

final class ZenchefPlatform implements ReservationsInterface, NotifiableInterface ZenchefPlatform.php:24

A restaurant's reservations at Zenchef - not yet: Zenchef's partner API is documented on request only (https://help.zenchef.com/hc/en-gb/articles/27690768125597-Zenchef-API).

Its help centre says what it offers - reservations read, created, updated, their status changed; availability and opening hours; guests; one webhook per restaurant, on a reservation made or updated - but not its paths, fields, statuses nor how a webhook is signed. Every call is refused (NotSupportedException) rather than guessed; api() is the client to write them with once the documentation is in hand.

const DOCUMENTATION = 'https://help.zenchef.com/hc/en-gb/articles/27690768125597-Zenchef-API'

ZenchefPlatform::__construct()

public function __construct(readonly Api $api)

ZenchefPlatform::getName()

public function getName(): string

ZenchefPlatform::getChannel()

public function getChannel(): Channel

ZenchefPlatform::capabilities()

public function capabilities(): Capabilities

ZenchefPlatform::api()

public function api(): Api

The client, configured with the restaurant's credentials, for the calls Zenchef's documentation describes.

ZenchefPlatform::reservations()

public function reservations(\DateTimeImmutable $from, \DateTimeImmutable $to): array

ZenchefPlatform::reservation()

public function reservation(string $ref): Reservation

ZenchefPlatform::createReservation()

public function createReservation(Reservation $reservation): Reservation

ZenchefPlatform::updateReservation()

public function updateReservation(Reservation $reservation): Reservation

ZenchefPlatform::cancelReservation()

public function cancelReservation(string $ref, ?string $reason = null): void

ZenchefPlatform::setStatus()

public function setStatus(string $ref, ReservationStatus $status): void

ZenchefPlatform::pushAvailability()

public function pushAvailability(array $slots): void

ZenchefPlatform::notify()

public function notify(string $body, array $headers): Notification

ZenchefPlatformFactory class

final class ZenchefPlatformFactory extends PlatformFactory ZenchefPlatformFactory.php:19

Zenchef: the restaurant's credentials, and a client ready for the partner API once Zenchef has sent its documentation:

options: token: '%env(default::ZENCHEF_TOKEN)%' # Settings > Partners in Zenchef: "Zenchef token" restaurant_id: '%env(default::ZENCHEF_RESTAURANT_ID)%' # Settings > Partners: the restaurant's id base_uri: ~ # from Zenchef's documentation (not public) headers: } # from it too: {"<header>": "{token}", "<header>": "{restaurant_id}"}

Options

OptionDefault
tokennull
restaurant_idnull
base_urinull
headers[]