Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grab/grabfood-api-sdk-go
Go API client for GrabFood
https://github.com/grab/grabfood-api-sdk-go
go-client grab grabfood openapi
Last synced: 21 days ago
JSON representation
Go API client for GrabFood
- Host: GitHub
- URL: https://github.com/grab/grabfood-api-sdk-go
- Owner: grab
- License: mit
- Created: 2024-09-11T05:47:01.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-10-04T10:23:53.000Z (3 months ago)
- Last Synced: 2024-11-01T18:25:26.874Z (2 months ago)
- Topics: go-client, grab, grabfood, openapi
- Homepage: https://developer.grab.com
- Size: 284 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Go API client for GrabFood
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) 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.GoClientCodegenFor more information, please visit [https://developer.grab.com](https://developer.grab.com)
## Installation
```shell
go get github.com/grab/grabfood-api-sdk-go
```Put the package under your project folder and add the following in import:
```go
import grabfood "github.com/grab/grabfood-api-sdk-go"
```## Usage Example
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.
```go
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.AccessTokenauthorization := "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.
## Documentation for API Endpoints
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**](docs/AcceptRejectOrderAPI.md#acceptrejectorder) | **Post** /partner/v1/order/prepare | Manually accept/reject orders
*CancelOrderAPI* | [**CancelOrder**](docs/CancelOrderAPI.md#cancelorder) | **Put** /partner/v1/order/cancel | Cancel an order
*CheckOrderCancelableAPI* | [**CheckOrderCancelable**](docs/CheckOrderCancelableAPI.md#checkordercancelable) | **Get** /partner/v1/order/cancelable | Check order cancelable
*CreateCampaignAPI* | [**CreateCampaign**](docs/CreateCampaignAPI.md#createcampaign) | **Post** /partner/v1/campaigns | Create campaign
*DeleteCampaignAPI* | [**DeleteCampaign**](docs/DeleteCampaignAPI.md#deletecampaign) | **Delete** /partner/v1/campaigns/{campaign_id} | Delete campaigns
*EditOrderAPI* | [**EditOrder**](docs/EditOrderAPI.md#editorder) | **Put** /partner/v1/orders/{orderID} | Edit Order
*GetDineinVoucherAPI* | [**GetDineinVoucher**](docs/GetDineinVoucherAPI.md#getdineinvoucher) | **Get** /partner/v1/dinein/voucher | Get Dine In Voucher
*GetOauthGrabAPI* | [**GetOauthGrab**](docs/GetOauthGrabAPI.md#getoauthgrab) | **Post** /grabid/v1/oauth2/token | Get Oauth access token
*GetStoreHourAPI* | [**GetStoreHour**](docs/GetStoreHourAPI.md#getstorehour) | **Get** /partner/v2/merchants/{merchantID}/store/hours | Get Store Hours
*GetStoreStatusAPI* | [**GetStoreStatus**](docs/GetStoreStatusAPI.md#getstorestatus) | **Get** /partner/v1/merchants/{merchantID}/store/status | Get Store Status
*ListCampaignAPI* | [**ListCampaign**](docs/ListCampaignAPI.md#listcampaign) | **Get** /partner/v1/campaigns | List campaigns
*ListOrdersAPI* | [**ListOrders**](docs/ListOrdersAPI.md#listorders) | **Get** /partner/v1/orders | List orders
*MarkOrderReadyAPI* | [**MarkOrderReady**](docs/MarkOrderReadyAPI.md#markorderready) | **Post** /partner/v1/orders/mark | Mark order as ready
*NotifyMembershipWebviewAPI* | [**NotifyMembershipWebview**](docs/NotifyMembershipWebviewAPI.md#notifymembershipwebview) | **Post** /partner/v1/membership/notify | Notify Membership
*PauseStoreAPI* | [**PauseStore**](docs/PauseStoreAPI.md#pausestore) | **Put** /partner/v1/merchant/pause | Pause store
*RedeemDineinVoucherAPI* | [**RedeemDineinVoucher**](docs/RedeemDineinVoucherAPI.md#redeemdineinvoucher) | **Post** /partner/v1/dinein/voucher/redeem | Redeem Dine In Voucher
*TraceMenuSyncAPI* | [**TraceMenuSync**](docs/TraceMenuSyncAPI.md#tracemenusync) | **Get** /partner/v1/merchant/menu/trace | Trace menu sync
*UpdateCampaignAPI* | [**UpdateCampaign**](docs/UpdateCampaignAPI.md#updatecampaign) | **Put** /partner/v1/campaigns/{campaign_id} | Update campaign
*UpdateDeliveryStateAPI* | [**UpdateDeliveryState**](docs/UpdateDeliveryStateAPI.md#updatedeliverystate) | **Post** /partner/v1/order/delivery | Update delivery state
*UpdateMenuNotificationAPI* | [**UpdateMenuNotification**](docs/UpdateMenuNotificationAPI.md#updatemenunotification) | **Post** /partner/v1/merchant/menu/notification | Notify Grab of updated menu
*UpdateMenuRecordAPI* | [**BatchUpdateMenu**](docs/UpdateMenuRecordAPI.md#batchupdatemenu) | **Put** /partner/v1/batch/menu | Batch Update Menu
*UpdateMenuRecordAPI* | [**UpdateMenu**](docs/UpdateMenuRecordAPI.md#updatemenu) | **Put** /partner/v1/menu | Update menu record
*UpdateOrderReadyTimeAPI* | [**UpdateOrderReadyTime**](docs/UpdateOrderReadyTimeAPI.md#updateorderreadytime) | **Put** /partner/v1/order/readytime | Update new order ready time
*UpdateStoreDeliveryHourAPI* | [**UpdateStoreDeliveryHour**](docs/UpdateStoreDeliveryHourAPI.md#updatestoredeliveryhour) | **Put** /partner/v1/merchants/{merchantID}/store/opening-hours | Update Store Delivery Hours
*UpdateStoreDineInHourAPI* | [**UpdateStoreDineInHour**](docs/UpdateStoreDineInHourAPI.md#updatestoredineinhour) | **Put** /partner/v1/merchants/{merchantID}/store/dine-in-hours | Update Store Dine-in Hours
*UpdateStoreSpecialHourAPI* | [**UpdateStoreSpecialHour**](docs/UpdateStoreSpecialHourAPI.md#updatestorespecialhour) | **Put** /partner/v2/merchants/{merchantID}/store/special-opening-hour | Update Store Special Hours## Documentation For Models
- [AcceptOrderRequest](docs/AcceptOrderRequest.md)
- [Address](docs/Address.md)
- [AdvancedPricing](docs/AdvancedPricing.md)
- [BatchUpdateMenuItem](docs/BatchUpdateMenuItem.md)
- [BatchUpdateMenuResponse](docs/BatchUpdateMenuResponse.md)
- [BindMembershipNativeRequest](docs/BindMembershipNativeRequest.md)
- [BindMembershipNativeResponse](docs/BindMembershipNativeResponse.md)
- [Campaign](docs/Campaign.md)
- [CampaignConditions](docs/CampaignConditions.md)
- [CampaignDiscount](docs/CampaignDiscount.md)
- [CampaignQuotas](docs/CampaignQuotas.md)
- [CampaignScope](docs/CampaignScope.md)
- [CancelCode](docs/CancelCode.md)
- [CancelOrderLimitType](docs/CancelOrderLimitType.md)
- [CancelOrderRequest](docs/CancelOrderRequest.md)
- [CancelOrderResponse](docs/CancelOrderResponse.md)
- [CancelReason](docs/CancelReason.md)
- [CheckOrderCancelableResponse](docs/CheckOrderCancelableResponse.md)
- [Coordinates](docs/Coordinates.md)
- [CreateCampaignRequest](docs/CreateCampaignRequest.md)
- [CreateCampaignResponse](docs/CreateCampaignResponse.md)
- [Currency](docs/Currency.md)
- [DineIn](docs/DineIn.md)
- [EditOrderItem](docs/EditOrderItem.md)
- [EditOrderRequest](docs/EditOrderRequest.md)
- [Error](docs/Error.md)
- [GetDineInVoucherResponse](docs/GetDineInVoucherResponse.md)
- [GetMembershipNativeResponse](docs/GetMembershipNativeResponse.md)
- [GetMembershipNativeResponsePointInfo](docs/GetMembershipNativeResponsePointInfo.md)
- [GetMembershipRequest](docs/GetMembershipRequest.md)
- [GetMembershipWebviewResponse](docs/GetMembershipWebviewResponse.md)
- [GetMenuNewResponse](docs/GetMenuNewResponse.md)
- [GetMenuOldResponse](docs/GetMenuOldResponse.md)
- [GetRewardNativeRequest](docs/GetRewardNativeRequest.md)
- [GetRewardNativeResponse](docs/GetRewardNativeResponse.md)
- [GrabOauthRequest](docs/GrabOauthRequest.md)
- [GrabOauthResponse](docs/GrabOauthResponse.md)
- [ListCampaignResponse](docs/ListCampaignResponse.md)
- [ListOrdersResponse](docs/ListOrdersResponse.md)
- [MarkOrderRequest](docs/MarkOrderRequest.md)
- [MenuCategory](docs/MenuCategory.md)
- [MenuEntity](docs/MenuEntity.md)
- [MenuEntityError](docs/MenuEntityError.md)
- [MenuItem](docs/MenuItem.md)
- [MenuModifier](docs/MenuModifier.md)
- [MenuSection](docs/MenuSection.md)
- [MenuSectionCategory](docs/MenuSectionCategory.md)
- [MenuSectionCategoryItem](docs/MenuSectionCategoryItem.md)
- [MenuSyncFail](docs/MenuSyncFail.md)
- [MenuSyncFailCategory](docs/MenuSyncFailCategory.md)
- [MenuSyncFailItem](docs/MenuSyncFailItem.md)
- [MenuSyncFailModifier](docs/MenuSyncFailModifier.md)
- [MenuSyncFailModifierGroup](docs/MenuSyncFailModifierGroup.md)
- [MenuSyncFailServiceHours](docs/MenuSyncFailServiceHours.md)
- [MenuSyncResponse](docs/MenuSyncResponse.md)
- [MenuSyncWebhookRequest](docs/MenuSyncWebhookRequest.md)
- [ModifierGroup](docs/ModifierGroup.md)
- [NewOrderTimeRequest](docs/NewOrderTimeRequest.md)
- [NotifyMembershipWebviewRequest](docs/NotifyMembershipWebviewRequest.md)
- [OpenPeriod](docs/OpenPeriod.md)
- [Order](docs/Order.md)
- [OrderCampaign](docs/OrderCampaign.md)
- [OrderDeliveryRequest](docs/OrderDeliveryRequest.md)
- [OrderFeatureFlags](docs/OrderFeatureFlags.md)
- [OrderFreeItem](docs/OrderFreeItem.md)
- [OrderItem](docs/OrderItem.md)
- [OrderItemModifier](docs/OrderItemModifier.md)
- [OrderPrice](docs/OrderPrice.md)
- [OrderPromo](docs/OrderPromo.md)
- [OrderReadyEstimation](docs/OrderReadyEstimation.md)
- [OrderStateRequest](docs/OrderStateRequest.md)
- [OutOfStockInstruction](docs/OutOfStockInstruction.md)
- [PartnerOauthRequest](docs/PartnerOauthRequest.md)
- [PartnerOauthResponse](docs/PartnerOauthResponse.md)
- [PauseStoreRequest](docs/PauseStoreRequest.md)
- [Purchasability](docs/Purchasability.md)
- [Receiver](docs/Receiver.md)
- [RedeemDineInVoucherRequest](docs/RedeemDineInVoucherRequest.md)
- [RedeemDineInVoucherResponse](docs/RedeemDineInVoucherResponse.md)
- [RedeemResult](docs/RedeemResult.md)
- [RegisterMembershipNativeRequest](docs/RegisterMembershipNativeRequest.md)
- [RegisterMembershipNativeResponse](docs/RegisterMembershipNativeResponse.md)
- [RewardItem](docs/RewardItem.md)
- [SellingTime](docs/SellingTime.md)
- [ServiceHour](docs/ServiceHour.md)
- [ServiceHours](docs/ServiceHours.md)
- [SpecialOpeningHour](docs/SpecialOpeningHour.md)
- [SpecialOpeningHourMetadata](docs/SpecialOpeningHourMetadata.md)
- [SpecialOpeningHourOpeningHours](docs/SpecialOpeningHourOpeningHours.md)
- [StoreHour](docs/StoreHour.md)
- [StoreHourResponse](docs/StoreHourResponse.md)
- [StoreStatusResponse](docs/StoreStatusResponse.md)
- [SubmitOrderRequest](docs/SubmitOrderRequest.md)
- [UnbindMembershipNativeRequest](docs/UnbindMembershipNativeRequest.md)
- [UnlinkMembershipWebviewRequest](docs/UnlinkMembershipWebviewRequest.md)
- [UpdateAdvancedPricing](docs/UpdateAdvancedPricing.md)
- [UpdateCampaignRequest](docs/UpdateCampaignRequest.md)
- [UpdateDeliveryHourRequest](docs/UpdateDeliveryHourRequest.md)
- [UpdateDeliveryHourResponse](docs/UpdateDeliveryHourResponse.md)
- [UpdateDineInHourRequest](docs/UpdateDineInHourRequest.md)
- [UpdateDineInHourResponse](docs/UpdateDineInHourResponse.md)
- [UpdateMenuItem](docs/UpdateMenuItem.md)
- [UpdateMenuModifier](docs/UpdateMenuModifier.md)
- [UpdateMenuNotifRequest](docs/UpdateMenuNotifRequest.md)
- [UpdateMenuRequest](docs/UpdateMenuRequest.md)
- [UpdatePurchasability](docs/UpdatePurchasability.md)
- [UpdateSpecialHourRequest](docs/UpdateSpecialHourRequest.md)
- [UpdateSpecialHourResponse](docs/UpdateSpecialHourResponse.md)
- [Voucher](docs/Voucher.md)
- [VoucherDescriptionInfo](docs/VoucherDescriptionInfo.md)
- [WorkingHour](docs/WorkingHour.md)
- [WorkingHourDay](docs/WorkingHourDay.md)## Documentation for Utility Methods
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`