Skip to content

Commit 3b4309b

Browse files
Initial release
0 parents  commit 3b4309b

File tree

286 files changed

+61127
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+61127
-0
lines changed

.gitignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2+
*.o
3+
*.a
4+
*.so
5+
6+
# Folders
7+
_obj
8+
_test
9+
10+
# Architecture specific extensions/prefixes
11+
*.[568vq]
12+
[568vq].out
13+
14+
*.cgo1.go
15+
*.cgo2.c
16+
_cgo_defun.c
17+
_cgo_gotypes.go
18+
_cgo_export.*
19+
20+
_testmain.go
21+
22+
*.exe
23+
*.test
24+
*.prof
25+
26+
.DS_Store

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
## [1.0.0] - 2024-09-25
4+
5+
### Added
6+
- Initial release of the project.
7+
8+
### Changed
9+
10+
### Deprecated
11+
12+
[1.0.0]: https://github.com/grab/grabfood-api-sdk-go/releases/tag/v1.0.0

CONTRIBUTING.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Contributing to Our Project's SDK
2+
3+
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.
4+
5+
If you find an issue with our SDK and want to contribute a fix, follow the guidelines mentioned below:
6+
7+
## Reporting an Issue
8+
9+
1. Notice an issue while using the SDK? Try to determine what's causing it. Was it a particular endpoint, operation, or datatype?
10+
11+
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.
12+
13+
3. Describe the current behavior and desired correct behavior.
14+
15+
4. Describe the steps to reproduce this issue.
16+
17+
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.
18+
19+
## Submitting a Suggestion
20+
21+
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!
22+
23+
When submitting a suggestion:
24+
25+
1. Be clear and concise in your description of the suggestion.
26+
27+
2. Explain why it would be beneficial. Real-life examples, if applicable, can help to illustrate your point.
28+
29+
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.
30+
31+
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.
32+
33+
Thank you for your contributions!

LICENSE

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright (c) 2024 Grabtaxi Holdings PTE LTE (GRAB)
2+
3+
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:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
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.

README.md

+224
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# Go API client for GrabFood
2+
3+
## Overview
4+
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.
5+
6+
- API version: 1.1.3
7+
- Package version: 1.0.0
8+
- Generator version: 7.8.0
9+
- Build package: org.openapitools.codegen.languages.GoClientCodegen
10+
11+
For more information, please visit [https://developer.grab.com](https://developer.grab.com)
12+
13+
## Installation
14+
15+
```shell
16+
go get github.com/grab/grabfood-api-sdk-go
17+
```
18+
19+
Put the package under your project folder and add the following in import:
20+
21+
```go
22+
import grabfood "github.com/grab/grabfood-api-sdk-go"
23+
```
24+
25+
## Usage Example
26+
27+
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:
28+
- Store the received access token once it's obtained.
29+
- Use this stored access token for as long as it's valid.
30+
- Only request a new access token when the current one has expired.
31+
32+
By following these practices, you minimize the number of requests to the server, making your application more efficient and responsive.
33+
34+
You can usually determine the validity of a token by the `expires_in` attribute in the OAuth2 token response.
35+
36+
```go
37+
config := grabfood.NewConfiguration()
38+
apiClient := grabfood.NewAPIClient(config)
39+
ctx := context.WithValue(context.Background(), grabfood.ContextServerIndex, grabfood.StgEnv)
40+
41+
grabOauthRequest := *grabfood.NewGrabOauthRequest("client_id", "client_secret", "client_credentials", "food.partner_api")
42+
43+
authResp, _, _ := apiClient.GetOauthGrabAPI.GetOauthGrab(ctx).GrabOauthRequest(grabOauthRequest).Execute()
44+
45+
// Request a new token only when the previous one has expired.
46+
// Can utilize the `expires_in` from *authResp.ExpiresIn to determine the validity of the token.
47+
ACCESS_TOKEN := *authResp.AccessToken
48+
49+
authorization := "Bearer " + ACCESS_TOKEN
50+
merchantID := "1-CYNGRUNGSBCCC"
51+
resp, _, _ := apiClient.GetStoreHourAPI.GetStoreHour(ctx, merchantID).Authorization(authorization).Execute()
52+
53+
fmt.Printf("Response from `GetStoreHourAPI.GetStoreHour`: %+v\n", resp)
54+
```
55+
56+
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.
57+
58+
## Documentation for API Endpoints
59+
60+
The base URL for OAuth2 URIs is https://api.grab.com
61+
62+
For other GrabFood partner API endpoints, URIs are relative to https://partner-api.grab.com/grabfood
63+
64+
Class | Method | HTTP request | Description
65+
------------ | ------------- | ------------- | -------------
66+
*AcceptRejectOrderAPI* | [**AcceptRejectOrder**](docs/AcceptRejectOrderAPI.md#acceptrejectorder) | **Post** /partner/v1/order/prepare | Manually accept/reject orders
67+
*CancelOrderAPI* | [**CancelOrder**](docs/CancelOrderAPI.md#cancelorder) | **Put** /partner/v1/order/cancel | Cancel an order
68+
*CheckOrderCancelableAPI* | [**CheckOrderCancelable**](docs/CheckOrderCancelableAPI.md#checkordercancelable) | **Get** /partner/v1/order/cancelable | Check order cancelable
69+
*CreateCampaignAPI* | [**CreateCampaign**](docs/CreateCampaignAPI.md#createcampaign) | **Post** /partner/v1/campaigns | Create campaign
70+
*DeleteCampaignAPI* | [**DeleteCampaign**](docs/DeleteCampaignAPI.md#deletecampaign) | **Delete** /partner/v1/campaigns/{campaign_id} | Delete campaigns
71+
*EditOrderAPI* | [**EditOrder**](docs/EditOrderAPI.md#editorder) | **Put** /partner/v1/orders/{orderID} | Edit Order
72+
*GetDineinVoucherAPI* | [**GetDineinVoucher**](docs/GetDineinVoucherAPI.md#getdineinvoucher) | **Get** /partner/v1/dinein/voucher | Get Dine In Voucher
73+
*GetOauthGrabAPI* | [**GetOauthGrab**](docs/GetOauthGrabAPI.md#getoauthgrab) | **Post** /grabid/v1/oauth2/token | Get Oauth access token
74+
*GetStoreHourAPI* | [**GetStoreHour**](docs/GetStoreHourAPI.md#getstorehour) | **Get** /partner/v2/merchants/{merchantID}/store/hours | Get Store Hours
75+
*GetStoreStatusAPI* | [**GetStoreStatus**](docs/GetStoreStatusAPI.md#getstorestatus) | **Get** /partner/v1/merchants/{merchantID}/store/status | Get Store Status
76+
*ListCampaignAPI* | [**ListCampaign**](docs/ListCampaignAPI.md#listcampaign) | **Get** /partner/v1/campaigns | List campaigns
77+
*ListOrdersAPI* | [**ListOrders**](docs/ListOrdersAPI.md#listorders) | **Get** /partner/v1/orders | List orders
78+
*MarkOrderReadyAPI* | [**MarkOrderReady**](docs/MarkOrderReadyAPI.md#markorderready) | **Post** /partner/v1/orders/mark | Mark order as ready
79+
*NotifyMembershipWebviewAPI* | [**NotifyMembershipWebview**](docs/NotifyMembershipWebviewAPI.md#notifymembershipwebview) | **Post** /partner/v1/membership/notify | Notify Membership
80+
*PauseStoreAPI* | [**PauseStore**](docs/PauseStoreAPI.md#pausestore) | **Put** /partner/v1/merchant/pause | Pause store
81+
*RedeemDineinVoucherAPI* | [**RedeemDineinVoucher**](docs/RedeemDineinVoucherAPI.md#redeemdineinvoucher) | **Post** /partner/v1/dinein/voucher/redeem | Redeem Dine In Voucher
82+
*TraceMenuSyncAPI* | [**TraceMenuSync**](docs/TraceMenuSyncAPI.md#tracemenusync) | **Get** /partner/v1/merchant/menu/trace | Trace menu sync
83+
*UpdateCampaignAPI* | [**UpdateCampaign**](docs/UpdateCampaignAPI.md#updatecampaign) | **Put** /partner/v1/campaigns/{campaign_id} | Update campaign
84+
*UpdateDeliveryStateAPI* | [**UpdateDeliveryState**](docs/UpdateDeliveryStateAPI.md#updatedeliverystate) | **Post** /partner/v1/order/delivery | Update delivery state
85+
*UpdateMenuNotificationAPI* | [**UpdateMenuNotification**](docs/UpdateMenuNotificationAPI.md#updatemenunotification) | **Post** /partner/v1/merchant/menu/notification | Notify Grab of updated menu
86+
*UpdateMenuRecordAPI* | [**BatchUpdateMenu**](docs/UpdateMenuRecordAPI.md#batchupdatemenu) | **Put** /partner/v1/batch/menu | Batch Update Menu
87+
*UpdateMenuRecordAPI* | [**UpdateMenu**](docs/UpdateMenuRecordAPI.md#updatemenu) | **Put** /partner/v1/menu | Update menu record
88+
*UpdateOrderReadyTimeAPI* | [**UpdateOrderReadyTime**](docs/UpdateOrderReadyTimeAPI.md#updateorderreadytime) | **Put** /partner/v1/order/readytime | Update new order ready time
89+
*UpdateStoreDeliveryHourAPI* | [**UpdateStoreDeliveryHour**](docs/UpdateStoreDeliveryHourAPI.md#updatestoredeliveryhour) | **Put** /partner/v1/merchants/{merchantID}/store/opening-hours | Update Store Delivery Hours
90+
*UpdateStoreDineInHourAPI* | [**UpdateStoreDineInHour**](docs/UpdateStoreDineInHourAPI.md#updatestoredineinhour) | **Put** /partner/v1/merchants/{merchantID}/store/dine-in-hours | Update Store Dine-in Hours
91+
*UpdateStoreSpecialHourAPI* | [**UpdateStoreSpecialHour**](docs/UpdateStoreSpecialHourAPI.md#updatestorespecialhour) | **Put** /partner/v2/merchants/{merchantID}/store/special-opening-hour | Update Store Special Hours
92+
93+
94+
## Documentation For Models
95+
96+
- [AcceptOrderRequest](docs/AcceptOrderRequest.md)
97+
- [Address](docs/Address.md)
98+
- [AdvancedPricing](docs/AdvancedPricing.md)
99+
- [BatchUpdateMenuItem](docs/BatchUpdateMenuItem.md)
100+
- [BatchUpdateMenuResponse](docs/BatchUpdateMenuResponse.md)
101+
- [BindMembershipNativeRequest](docs/BindMembershipNativeRequest.md)
102+
- [BindMembershipNativeResponse](docs/BindMembershipNativeResponse.md)
103+
- [Campaign](docs/Campaign.md)
104+
- [CampaignConditions](docs/CampaignConditions.md)
105+
- [CampaignDiscount](docs/CampaignDiscount.md)
106+
- [CampaignQuotas](docs/CampaignQuotas.md)
107+
- [CampaignScope](docs/CampaignScope.md)
108+
- [CancelCode](docs/CancelCode.md)
109+
- [CancelOrderLimitType](docs/CancelOrderLimitType.md)
110+
- [CancelOrderRequest](docs/CancelOrderRequest.md)
111+
- [CancelOrderResponse](docs/CancelOrderResponse.md)
112+
- [CancelReason](docs/CancelReason.md)
113+
- [CheckOrderCancelableResponse](docs/CheckOrderCancelableResponse.md)
114+
- [Coordinates](docs/Coordinates.md)
115+
- [CreateCampaignRequest](docs/CreateCampaignRequest.md)
116+
- [CreateCampaignResponse](docs/CreateCampaignResponse.md)
117+
- [Currency](docs/Currency.md)
118+
- [DineIn](docs/DineIn.md)
119+
- [EditOrderItem](docs/EditOrderItem.md)
120+
- [EditOrderRequest](docs/EditOrderRequest.md)
121+
- [Error](docs/Error.md)
122+
- [GetDineInVoucherResponse](docs/GetDineInVoucherResponse.md)
123+
- [GetMembershipNativeResponse](docs/GetMembershipNativeResponse.md)
124+
- [GetMembershipNativeResponsePointInfo](docs/GetMembershipNativeResponsePointInfo.md)
125+
- [GetMembershipRequest](docs/GetMembershipRequest.md)
126+
- [GetMembershipWebviewResponse](docs/GetMembershipWebviewResponse.md)
127+
- [GetMenuNewResponse](docs/GetMenuNewResponse.md)
128+
- [GetMenuOldResponse](docs/GetMenuOldResponse.md)
129+
- [GetRewardNativeRequest](docs/GetRewardNativeRequest.md)
130+
- [GetRewardNativeResponse](docs/GetRewardNativeResponse.md)
131+
- [GrabOauthRequest](docs/GrabOauthRequest.md)
132+
- [GrabOauthResponse](docs/GrabOauthResponse.md)
133+
- [ListCampaignResponse](docs/ListCampaignResponse.md)
134+
- [ListOrdersResponse](docs/ListOrdersResponse.md)
135+
- [MarkOrderRequest](docs/MarkOrderRequest.md)
136+
- [MenuCategory](docs/MenuCategory.md)
137+
- [MenuEntity](docs/MenuEntity.md)
138+
- [MenuEntityError](docs/MenuEntityError.md)
139+
- [MenuItem](docs/MenuItem.md)
140+
- [MenuModifier](docs/MenuModifier.md)
141+
- [MenuSection](docs/MenuSection.md)
142+
- [MenuSectionCategory](docs/MenuSectionCategory.md)
143+
- [MenuSectionCategoryItem](docs/MenuSectionCategoryItem.md)
144+
- [MenuSyncFail](docs/MenuSyncFail.md)
145+
- [MenuSyncFailCategory](docs/MenuSyncFailCategory.md)
146+
- [MenuSyncFailItem](docs/MenuSyncFailItem.md)
147+
- [MenuSyncFailModifier](docs/MenuSyncFailModifier.md)
148+
- [MenuSyncFailModifierGroup](docs/MenuSyncFailModifierGroup.md)
149+
- [MenuSyncFailServiceHours](docs/MenuSyncFailServiceHours.md)
150+
- [MenuSyncResponse](docs/MenuSyncResponse.md)
151+
- [MenuSyncWebhookRequest](docs/MenuSyncWebhookRequest.md)
152+
- [ModifierGroup](docs/ModifierGroup.md)
153+
- [NewOrderTimeRequest](docs/NewOrderTimeRequest.md)
154+
- [NotifyMembershipWebviewRequest](docs/NotifyMembershipWebviewRequest.md)
155+
- [OpenPeriod](docs/OpenPeriod.md)
156+
- [Order](docs/Order.md)
157+
- [OrderCampaign](docs/OrderCampaign.md)
158+
- [OrderDeliveryRequest](docs/OrderDeliveryRequest.md)
159+
- [OrderFeatureFlags](docs/OrderFeatureFlags.md)
160+
- [OrderFreeItem](docs/OrderFreeItem.md)
161+
- [OrderItem](docs/OrderItem.md)
162+
- [OrderItemModifier](docs/OrderItemModifier.md)
163+
- [OrderPrice](docs/OrderPrice.md)
164+
- [OrderPromo](docs/OrderPromo.md)
165+
- [OrderReadyEstimation](docs/OrderReadyEstimation.md)
166+
- [OrderStateRequest](docs/OrderStateRequest.md)
167+
- [OutOfStockInstruction](docs/OutOfStockInstruction.md)
168+
- [PartnerOauthRequest](docs/PartnerOauthRequest.md)
169+
- [PartnerOauthResponse](docs/PartnerOauthResponse.md)
170+
- [PauseStoreRequest](docs/PauseStoreRequest.md)
171+
- [Purchasability](docs/Purchasability.md)
172+
- [Receiver](docs/Receiver.md)
173+
- [RedeemDineInVoucherRequest](docs/RedeemDineInVoucherRequest.md)
174+
- [RedeemDineInVoucherResponse](docs/RedeemDineInVoucherResponse.md)
175+
- [RedeemResult](docs/RedeemResult.md)
176+
- [RegisterMembershipNativeRequest](docs/RegisterMembershipNativeRequest.md)
177+
- [RegisterMembershipNativeResponse](docs/RegisterMembershipNativeResponse.md)
178+
- [RewardItem](docs/RewardItem.md)
179+
- [SellingTime](docs/SellingTime.md)
180+
- [ServiceHour](docs/ServiceHour.md)
181+
- [ServiceHours](docs/ServiceHours.md)
182+
- [SpecialOpeningHour](docs/SpecialOpeningHour.md)
183+
- [SpecialOpeningHourMetadata](docs/SpecialOpeningHourMetadata.md)
184+
- [SpecialOpeningHourOpeningHours](docs/SpecialOpeningHourOpeningHours.md)
185+
- [StoreHour](docs/StoreHour.md)
186+
- [StoreHourResponse](docs/StoreHourResponse.md)
187+
- [StoreStatusResponse](docs/StoreStatusResponse.md)
188+
- [SubmitOrderRequest](docs/SubmitOrderRequest.md)
189+
- [UnbindMembershipNativeRequest](docs/UnbindMembershipNativeRequest.md)
190+
- [UnlinkMembershipWebviewRequest](docs/UnlinkMembershipWebviewRequest.md)
191+
- [UpdateAdvancedPricing](docs/UpdateAdvancedPricing.md)
192+
- [UpdateCampaignRequest](docs/UpdateCampaignRequest.md)
193+
- [UpdateDeliveryHourRequest](docs/UpdateDeliveryHourRequest.md)
194+
- [UpdateDeliveryHourResponse](docs/UpdateDeliveryHourResponse.md)
195+
- [UpdateDineInHourRequest](docs/UpdateDineInHourRequest.md)
196+
- [UpdateDineInHourResponse](docs/UpdateDineInHourResponse.md)
197+
- [UpdateMenuItem](docs/UpdateMenuItem.md)
198+
- [UpdateMenuModifier](docs/UpdateMenuModifier.md)
199+
- [UpdateMenuNotifRequest](docs/UpdateMenuNotifRequest.md)
200+
- [UpdateMenuRequest](docs/UpdateMenuRequest.md)
201+
- [UpdatePurchasability](docs/UpdatePurchasability.md)
202+
- [UpdateSpecialHourRequest](docs/UpdateSpecialHourRequest.md)
203+
- [UpdateSpecialHourResponse](docs/UpdateSpecialHourResponse.md)
204+
- [Voucher](docs/Voucher.md)
205+
- [VoucherDescriptionInfo](docs/VoucherDescriptionInfo.md)
206+
- [WorkingHour](docs/WorkingHour.md)
207+
- [WorkingHourDay](docs/WorkingHourDay.md)
208+
209+
210+
## Documentation for Utility Methods
211+
212+
Due to the fact that model structure members are all pointers, this package contains
213+
a number of utility functions to easily obtain pointers to values of basic types.
214+
Each of these functions takes a value of the given basic type and returns a pointer to it:
215+
216+
* `PtrBool`
217+
* `PtrInt`
218+
* `PtrInt32`
219+
* `PtrInt64`
220+
* `PtrFloat`
221+
* `PtrFloat32`
222+
* `PtrFloat64`
223+
* `PtrString`
224+
* `PtrTime`

0 commit comments

Comments
 (0)