Open haiqaldani opened 1 year ago
const { TransportApi, Configuration } = require("@mychaelgo/api-gojek");
const configuration = new Configuration({ accessToken: "***" });
const transportAPI = new TransportApi(configuration);
module.exports = async (req, res) => { const payload = req.body; try { const defaultHeaders = { xAppid: "com.gojek.app", xAppversion: "4.60", xDeviceos: "Android,10", xPhonemake: "Samsung", xPhonemodel: "GT-S7500", xPlatform: "Android", xPushtokentype: "FCM", xUniqueid: "95f99ddd6a5d34a9", xUserType: "customer", xSessionId: "d31cc210-a067-4d0d-a52f-199880ea8907", gojekCountryCode: "ID", };
const getTransportEstimateResponse = await transportAPI.getTransportEstimate({ ...defaultHeaders, sendPrioritisedOrder: true, userSelectedServiceType: 1, waypoints: "1.339299,103.981014|1.313135,103.952190" }); return res.status(200).json({ status: "success", getTransportEstimateResponse: getTransportEstimateResponse.data, });
} catch (error) { if (error.code === "ECONNREFUSED") { return res .status(500) .json({ status: "error", message: "service unavailable" }); }
return res.status(400).json({ status: "error", message: error.message, error: error, });
} };
loginnya masih bisa mas?
const { TransportApi, Configuration } = require("@mychaelgo/api-gojek");
const configuration = new Configuration({ accessToken: "***" });
const transportAPI = new TransportApi(configuration);
module.exports = async (req, res) => { const payload = req.body; try { const defaultHeaders = { xAppid: "com.gojek.app", xAppversion: "4.60", xDeviceos: "Android,10", xPhonemake: "Samsung", xPhonemodel: "GT-S7500", xPlatform: "Android", xPushtokentype: "FCM", xUniqueid: "95f99ddd6a5d34a9", xUserType: "customer", xSessionId: "d31cc210-a067-4d0d-a52f-199880ea8907", gojekCountryCode: "ID", };
} catch (error) { if (error.code === "ECONNREFUSED") { return res .status(500) .json({ status: "error", message: "service unavailable" }); }
} };