import "reflect-metadata"; import { userSelfAll, } from "./scopes"; import { IOpenPlanetNode } from "./interfaces"; import { IPartnerActivity } from "./resources/partnerActivity"; process.env.AUTH_HOST = "http://connect.qa.lonelyplanet.com"; process.env.AUTH_CLIENT_ID = "m2q2o6tzvpxbu"; process.env.OPEN_PLANET_HOST = "http://stable.web.op-api-gateway.production.lonelyplanet.com"; const initialize = require("./").default; const client: IOpenPlanetNode = initialize(); const lodId = "bab0a3a2-7135-4c9f-8434-75c61a7b8113"; const fromDate = "2018-02-27"; const toDate = "2018-07-30"; const dates = { fromDate, toDate, }; // client.availability.checkDates(lodId, dates).then(response => console.log({response})); client.partnerActivity.findById("g-NUFY").then(response => { const coolString = JSON.stringify(response); console.log(JSON.parse(coolString)); }); // client.authorize({ // scope: userSelfAll, // headers: { // Cookie: `lp_session=${process.argv[2]}`, // } // }).then((...args) => { // console.log(args); // client.bookmarkList.createList("7b868102-e283-4867-be91-a2eaef94b42c", { // name: "My Awesome List", // visibility: "public", // source: "dotcom", // }) // .then((list) => { // console.log(list); // }); // Promise.all([ // client.user.findById("7b868102-e283-4867-be91-a2eaef94b42c"), // client.bookmarkList.findByUserId("7b868102-e283-4867-be91-a2eaef94b42c") // ]).then((...args) => { // const list = args[0][1][0].entries[0].target; // console.log(list); // }) // .catch(e => { console.log(e); }); // client.bookmark.addBookmarkToList("7b868102-e283-4867-be91-a2eaef94b42c", // { // checked: true, // order: 2, // target: { // type: "poi", // id: "1534928" // } // }, // { // id: "d8fa5183-b9a0-4bd7-b2db-448f3e755e76" // } // ); // }) // .catch((e) => { // console.log("an error has occurred"); // console.log(e.message); // console.log(e.stack); // });