-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3b4309b
Showing
286 changed files
with
61,127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Compiled Object files, Static and Dynamic libs (Shared Objects) | ||
*.o | ||
*.a | ||
*.so | ||
|
||
# Folders | ||
_obj | ||
_test | ||
|
||
# Architecture specific extensions/prefixes | ||
*.[568vq] | ||
[568vq].out | ||
|
||
*.cgo1.go | ||
*.cgo2.c | ||
_cgo_defun.c | ||
_cgo_gotypes.go | ||
_cgo_export.* | ||
|
||
_testmain.go | ||
|
||
*.exe | ||
*.test | ||
*.prof | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Changelog | ||
|
||
## [1.0.0] - 2024-09-25 | ||
|
||
### Added | ||
- Initial release of the project. | ||
|
||
### Changed | ||
|
||
### Deprecated | ||
|
||
[1.0.0]: https://github.com/grab/grabfood-api-sdk-go/releases/tag/v1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Contributing to Our Project's SDK | ||
|
||
We value your input and contributions! We use the [OpenAPI Generator tool](https://openapi-generator.tech) to generate our SDK based on an OpenAPI YAML specification. | ||
|
||
If you find an issue with our SDK and want to contribute a fix, follow the guidelines mentioned below: | ||
|
||
## Reporting an Issue | ||
|
||
1. Notice an issue while using the SDK? Try to determine what's causing it. Was it a particular endpoint, operation, or datatype? | ||
|
||
2. Check the YAML specification: Once you've identified the issue, refer to the corresponding definition in the OpenAPI YAML specification file that is included in the SDK. This could be a specific path, operation, parameter, or schema. | ||
|
||
3. Describe the current behavior and desired correct behavior. | ||
|
||
4. Describe the steps to reproduce this issue. | ||
|
||
Please note that due to our open-source process, we don't have a direct way to accept code contributions for the SDK. The SDK is directly generated from our OpenAPI YAML specification file. Hence, you don't need to manually update the SDK. Instead, identify the modifications needed in the OpenAPI YAML specification. | ||
|
||
## Submitting a Suggestion | ||
|
||
If there's something in the SDK that isn't broken but could be better, you're welcome to share suggestions. Constructive feedback is always appreciated! | ||
|
||
When submitting a suggestion: | ||
|
||
1. Be clear and concise in your description of the suggestion. | ||
|
||
2. Explain why it would be beneficial. Real-life examples, if applicable, can help to illustrate your point. | ||
|
||
3. Be patient. Not all suggestions can be incorporated immediately, and it may be necessary for us to research your idea before we can implement it. | ||
|
||
Remember, contributions come in many forms, not just in code! Identifying areas for improvement or bringing up issues helps us make the SDK better for everyone. | ||
|
||
Thank you for your contributions! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright (c) 2024 Grabtaxi Holdings PTE LTE (GRAB) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,224 @@ | ||
# 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.GoClientCodegen | ||
|
||
For 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.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. | ||
|
||
## 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` |
Oops, something went wrong.