Skip to content

grab/grabfood-api-sdk-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grabfood

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

For more information, please visit https://developer.grab.com.

Installation & Usage

Requirements

PHP 7.4 and later. Should also work with PHP 8.0.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/grab/grabfood-api-sdk-php.git"
    }
  ],
  "require": {
    "grab/grabfood-api-sdk-php": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/grabfood/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');




$apiInstance = new Grab\GrabfoodApiSdk\Api\AcceptRejectOrderApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$authorization = Bearer <ACCESS_TOKEN_HERE>; // string | Specify the generated authorization token of the bearer type.
$content_type = application/json; // string | The content type of the request body. You must use `application/json` for this header as GrabFood API currently does not support other formats.
$accept_order_request = new \Grab\GrabfoodApiSdk\Model\AcceptOrderRequest(); // \Grab\GrabfoodApiSdk\Model\AcceptOrderRequest | 

try {
    $apiInstance->acceptRejectOrder($authorization, $content_type, $accept_order_request);
} catch (Exception $e) {
    echo 'Exception when calling AcceptRejectOrderApi->acceptRejectOrder: ', $e->getMessage(), PHP_EOL;
}

Environment Configuration

The SDK supports both staging and production environments. You can switch between environments by modifying the host settings parameter:

use OpenAPI\Client\Configuration;
$config = Configuration::getDefaultConfiguration()

// Staging Environment (default)
$config->setHost($config->getHostFromSettings(Configuration::StgEnv));

// Production Environment
$config->setHost($config->getHostFromSettings(Configuration::PrdEnv));

API Endpoints

All URIs are relative to https://partner-api.grab.com/grabfood-sandbox

Class Method HTTP request Description
AcceptRejectOrderApi acceptRejectOrder POST /partner/v1/order/prepare Manually accept/reject orders
CancelOrderApi cancelOrder PUT /partner/v1/order/cancel Cancel an order
CheckOrderCancelableApi checkOrderCancelable GET /partner/v1/order/cancelable Check order cancelable
CreateCampaignApi createCampaign POST /partner/v1/campaigns Create campaign
CreateSelfServeJourneyApi createSelfServeJourney POST /partner/v1/self-serve/activation Create self serve journey
DeleteCampaignApi deleteCampaign DELETE /partner/v1/campaigns/{campaign_id} Delete campaigns
EditOrderApi editOrder PUT /partner/v1/orders/{orderID} Edit Order
GetDineinVoucherApi getDineinVoucher GET /partner/v1/dinein/voucher Get Dine In Voucher
GetOauthGrabApi getOauthGrab POST /grabid/v1/oauth2/token Get Oauth access token
GetStoreHourApi getStoreHour GET /partner/v2/merchants/{merchantID}/store/hours Get Store Hours
GetStoreStatusApi getStoreStatus GET /partner/v1/merchants/{merchantID}/store/status Get Store Status
ListCampaignApi listCampaign GET /partner/v1/campaigns List campaigns
ListOrdersApi listOrders GET /partner/v1/orders List orders
MarkOrderReadyApi markOrderReady POST /partner/v1/orders/mark Mark order as ready
NotifyMembershipWebviewApi notifyMembershipWebview POST /partner/v1/membership/notify Notify Membership
PauseStoreApi pauseStore PUT /partner/v1/merchant/pause Pause store
RedeemDineinVoucherApi redeemDineinVoucher POST /partner/v1/dinein/voucher/redeem Redeem Dine In Voucher
TraceMenuSyncApi traceMenuSync GET /partner/v1/merchant/menu/trace Trace menu sync
UpdateCampaignApi updateCampaign PUT /partner/v1/campaigns/{campaign_id} Update campaign
UpdateDeliveryStateApi updateDeliveryState POST /partner/v1/order/delivery Update delivery state
UpdateMenuNotificationApi updateMenuNotification POST /partner/v1/merchant/menu/notification Notify Grab of updated menu
UpdateMenuRecordApi batchUpdateMenu PUT /partner/v1/batch/menu Batch Update Menu
UpdateMenuRecordApi updateMenu PUT /partner/v1/menu Update menu record
UpdateOrderReadyTimeApi updateOrderReadyTime PUT /partner/v1/order/readytime Update new order ready time
UpdateStoreDeliveryHourApi updateStoreDeliveryHour PUT /partner/v1/merchants/{merchantID}/store/opening-hours Update Store Delivery Hours
UpdateStoreDineInHourApi updateStoreDineInHour PUT /partner/v1/merchants/{merchantID}/store/dine-in-hours Update Store Dine-in Hours
UpdateStoreSpecialHourApi updateStoreSpecialHour PUT /partner/v2/merchants/{merchantID}/store/special-opening-hour Update Store Special Hours

Models

Authorization

Endpoints do not require authorization.

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 1.1.3
    • Package version: 1.0.1
    • Generator version: 7.8.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen