This is an unofficial API wrapper for the GoBiz Resto App written in Golang.
You can install the package using the go get
command:
go get -u github.com/hugo6866/gobiz
Here's an example code snippet that demonstrates how to use the wrapper :
The following example demonstrates how to use the GojekAuth
struct to get an authentication token for the GoBiz REST API.
import (
"fmt"
"github.com/hugo6866/gobiz"
)
func main() {
// Create an instance of the GojekAPI class with a unique ID
api := gobizApi.NewGojekAuth("Android 11", "Samsung", "Galaxy S22", "1453455d71e619")
var phoneNumber int
fmt.Print("Enter your phone number: +62")
fmt.Scan(&phoneNumber)
// Get an OTP token
otpToken, err := api.GetOtpToken(phoneNumber)
if err != nil {
fmt.Printf("Error getting OTP token: %v\n", err)
return
} else {
fmt.Println(otpToken)
}
// Input the OTP code
var otpCode int
fmt.Print("Enter your OTP code: ")
fmt.Scan(&otpCode)
// Use the OTP token to get the final authentication token
authToken, err := api.ProcessOtpToken(otpCode, otpToken)
if err != nil {
fmt.Printf("Error getting authentication token: %v\n", err)
return
} else {
fmt.Println(authToken)
}
}
More examples on how to use the GoBiz Resto App Unofficial API Wrapper, please check out the examples folder in the GitHub repository.
The following API endpoints are currently supported by the wrapper :
- getOtpToken(number)
number
: Phone number to request an OTP token- Returns:
otp_token
(string) and an error (if any)
- processOtpToken(otp, otpToken)
otp
: The OTP received on the phone numberotpToken
: The OTP token obtained from thegetOtpToken
method- Returns:
access_token
(string) and an error (if any)
- fetchCompletedOrders(restaurantID, authorization)
restaurantID
: Restaurant ID to get completed ordersauthorization
: API key for the restaurant
- fetchNewOrders(restaurantID, authorization)
restaurantID
: Restaurant ID to get new ordersauthorization
: API key for the restaurant
- fetchCanceledOrders(restaurantID, authorization)
restaurantID
: Restaurant ID to get canceled ordersauthorization
: API key for the restaurant
- setRestoClose(restaurantID, authorization, isClose)
restaurantID
: Restaurant ID to set close statusauthorization
: API key for the restaurantisClose
:true
for closed,false
for open
- getRestoStatus(restaurantID, authorization)
restaurantID
: Restaurant ID to get statusauthorization
: API key for the restaurant
- getRestoTransactions(restaurantID, authorization, start, end)
restaurantID
: Restaurant ID to get transactionsauthorization
: API key for the restaurantstart
: Start date in "yyyy-mm-dd" formatend
: End date in "yyyy-mm-dd" format
- getTodayTransactions(restaurantID, authorization)
restaurantID
: Restaurant ID to get today's transactionsauthorization
: API key for the restaurant
- getMerchants(authorization)
authorization
: API key for the merchant
- getMerchantInfo(authorization, merchantID)
authorization
: API key for the merchantmerchantID
: Merchant ID to get information
- getRestoMenu(authorization, restaurantID)
authorization
: API key for the restaurantrestaurantID
: Restaurant ID to get menu
- setStockAvailable(authorization, itemID, isAvailable)
authorization
: API key for the restaurantitemID
: Item ID to set availabilityisAvailable
:true
for available,false
for not available
- acceptNewOrders(authorization, orderID)
authorization
: API key for the restaurantorderID
: Order ID to accept
- setOrderPrepared(authorization, orderID)
authorization
: API key for the restaurantorderID
: Order ID to set as prepared
- cancelOrder(authorization, orderID, reason, itemID, uuid)
authorization
: API key for the restaurantorderID
: Order ID to cancelreason
: Cancellation reasonitemID
: Item ID for "ITEMS_OUT_OF_STOCK" reasonuuid
: UUID for "ITEMS_OUT_OF_STOCK" reason
- cancelOrderStockEmpty(authorization, orderID, itemID, uuid)
authorization
: API key for the restaurantorderID
: Order ID to cancel due to out of stockitemID
: Out of stock item IDuuid
: Out of stock item UUID
- cancelOrderRestoClosed(authorization, orderID)
authorization
: API key for the restaurantorderID
: Order ID to cancel due to closed restaurant
- cancelOrderHighDemand(authorization, orderID)
authorization
: API key for the restaurantorderID
: Order ID to cancel due to high demand
- IsDebug: A global boolean variable to enable or disable debug mode.
true
: Debug mode enabledfalse
: Debug mode disabled (default)
Please note that this is an unofficial API wrapper for the GoBiz Resto App and is not affiliated with or endorsed by GoBiz or its parent company, Gojek