Created
March 5, 2018 10:01
-
-
Save CharlesWinter/64cd6a15b4f90b3ffd010bcd9f822484 to your computer and use it in GitHub Desktop.
Golang API
This file contains hidden or 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
| const qxrecs = require('qxrecs'); | |
| /* | |
| Configure the module with your company name, unique token | |
| and communication protocol (currently either https or wss) | |
| */ | |
| qxrecs.Configure("my_company", "my_token", "https"); | |
| //Insert some products using callbacks. Can be used with multiple items | |
| qxrecs.PostProducts([{itemid: "A" }], (err, body) => { | |
| console.log(err); | |
| console.log(body); | |
| }); | |
| //Insert some products using Promises | |
| qxrecs.PostProducts([{itemid: "B" }]) | |
| .then(console.log, console.error); | |
| //Send a single consumption event with callbacks. Can be used with multiple events | |
| qxrecs.SendEvents([{userid: "1", itemid: "1"}], (err, body) => { | |
| console.log(err); | |
| console.log(body); | |
| }); | |
| //Send a single consumption event with Promises. Can be used with multiple events | |
| qxrecs.SendEvents([{userid: "2", itemid: "2"}]) | |
| .then(console.log, console.error); | |
| //Get recommendations for a user using callbacks | |
| qxrecs.GetRecs("1", (err, body) => { | |
| console.log(err); | |
| console.log(body); | |
| }); | |
| //Get recommendations for a user using Promises | |
| qxrecs.GetRecs("2") | |
| .then(console.log, console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment