This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 1.1.3
- Package version: 1.0.0
- Generator version: 7.8.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
For more information, please visit https://developer.grab.com
go get github.com/grab/grabfood-api-sdk-go
Put the package under your project folder and add the following in import:
import grabfood "github.com/grab/grabfood-api-sdk-go"
In the example below, we start by acquiring an OAuth2 access token. In your applications, it's important to handle OAuth2 tokens efficiently. This means:
- Store the received access token once it's obtained.
- Use this stored access token for as long as it's valid.
- Only request a new access token when the current one has expired.
By following these practices, you minimize the number of requests to the server, making your application more efficient and responsive.
You can usually determine the validity of a token by the expires_in
attribute in the OAuth2 token response.
config := grabfood.NewConfiguration()
apiClient := grabfood.NewAPIClient(config)
ctx := context.WithValue(context.Background(), grabfood.ContextServerIndex, grabfood.StgEnv)
grabOauthRequest := *grabfood.NewGrabOauthRequest("client_id", "client_secret", "client_credentials", "food.partner_api")
authResp, _, _ := apiClient.GetOauthGrabAPI.GetOauthGrab(ctx).GrabOauthRequest(grabOauthRequest).Execute()
// Request a new token only when the previous one has expired.
// Can utilize the `expires_in` from *authResp.ExpiresIn to determine the validity of the token.
ACCESS_TOKEN := *authResp.AccessToken
authorization := "Bearer " + ACCESS_TOKEN
merchantID := "1-CYNGRUNGSBCCC"
resp, _, _ := apiClient.GetStoreHourAPI.GetStoreHour(ctx, merchantID).Authorization(authorization).Execute()
fmt.Printf("Response from `GetStoreHourAPI.GetStoreHour`: %+v\n", resp)
For handling webhook requests, we provide dedicated models for both requests and responses. Please refer to the list of available models provided below for more details.
The base URL for OAuth2 URIs is https://api.grab.com
For other GrabFood partner API endpoints, URIs are relative to https://partner-api.grab.com/grabfood
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 |
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 |
- AcceptOrderRequest
- Address
- AdvancedPricing
- BatchUpdateMenuItem
- BatchUpdateMenuResponse
- BindMembershipNativeRequest
- BindMembershipNativeResponse
- Campaign
- CampaignConditions
- CampaignDiscount
- CampaignQuotas
- CampaignScope
- CancelCode
- CancelOrderLimitType
- CancelOrderRequest
- CancelOrderResponse
- CancelReason
- CheckOrderCancelableResponse
- Coordinates
- CreateCampaignRequest
- CreateCampaignResponse
- Currency
- DineIn
- EditOrderItem
- EditOrderRequest
- Error
- GetDineInVoucherResponse
- GetMembershipNativeResponse
- GetMembershipNativeResponsePointInfo
- GetMembershipRequest
- GetMembershipWebviewResponse
- GetMenuNewResponse
- GetMenuOldResponse
- GetRewardNativeRequest
- GetRewardNativeResponse
- GrabOauthRequest
- GrabOauthResponse
- ListCampaignResponse
- ListOrdersResponse
- MarkOrderRequest
- MenuCategory
- MenuEntity
- MenuEntityError
- MenuItem
- MenuModifier
- MenuSection
- MenuSectionCategory
- MenuSectionCategoryItem
- MenuSyncFail
- MenuSyncFailCategory
- MenuSyncFailItem
- MenuSyncFailModifier
- MenuSyncFailModifierGroup
- MenuSyncFailServiceHours
- MenuSyncResponse
- MenuSyncWebhookRequest
- ModifierGroup
- NewOrderTimeRequest
- NotifyMembershipWebviewRequest
- OpenPeriod
- Order
- OrderCampaign
- OrderDeliveryRequest
- OrderFeatureFlags
- OrderFreeItem
- OrderItem
- OrderItemModifier
- OrderPrice
- OrderPromo
- OrderReadyEstimation
- OrderStateRequest
- OutOfStockInstruction
- PartnerOauthRequest
- PartnerOauthResponse
- PauseStoreRequest
- Purchasability
- Receiver
- RedeemDineInVoucherRequest
- RedeemDineInVoucherResponse
- RedeemResult
- RegisterMembershipNativeRequest
- RegisterMembershipNativeResponse
- RewardItem
- SellingTime
- ServiceHour
- ServiceHours
- SpecialOpeningHour
- SpecialOpeningHourMetadata
- SpecialOpeningHourOpeningHours
- StoreHour
- StoreHourResponse
- StoreStatusResponse
- SubmitOrderRequest
- UnbindMembershipNativeRequest
- UnlinkMembershipWebviewRequest
- UpdateAdvancedPricing
- UpdateCampaignRequest
- UpdateDeliveryHourRequest
- UpdateDeliveryHourResponse
- UpdateDineInHourRequest
- UpdateDineInHourResponse
- UpdateMenuItem
- UpdateMenuModifier
- UpdateMenuNotifRequest
- UpdateMenuRequest
- UpdatePurchasability
- UpdateSpecialHourRequest
- UpdateSpecialHourResponse
- Voucher
- VoucherDescriptionInfo
- WorkingHour
- WorkingHourDay
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime