UNPKG

codingame-api-node-ts

Version:

A CodinGame API node, that permits you to access all of the endpoints of this website. Wrote in TypeScript, so you can previsualize how the response will look like by checking the code.

41 lines (40 loc) 1.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCookies = exports.urls = void 0; var fs = require("fs"); /** @internal */ exports.urls = { achievement: "https://www.codingame.com/services/Achievement/", career: "https://www.codingame.com/services/Career/", challenge: "https://www.codingame.com/services/Challenge/", coc: "https://www.codingame.com/services/ClashOfCode/", codingamer: "https://www.codingame.com/services/CodinGamer/", comment: "https://www.codingame.com/services/Comment/", company: "https://www.codingame.com/services/Company/", contribution: "https://www.codingame.com/services/Contribution/", course: "https://www.codingame.com/services/course/", help: "https://www.codingame.com/services/Help/", leaderboards: "https://www.codingame.com/services/Leaderboards/", notification: "https://www.codingame.com/services/Notification/", puzzle: "https://www.codingame.com/services/Puzzle/", quest: "https://www.codingame.com/services/Quest/", school: "https://www.codingame.com/services/School/", testsession: "https://www.codingame.com/services/TestSession/", vote: "https://www.codingame.com/services/Vote/", xp: "https://www.codingame.com/services/Xp/" }; /** @internal */ var getCookies = function (response) { var cookies = response.headers["set-cookie"]; var cookiesStr = cookies.map(function (el, i) { var elSplit = el.split(";"); if (i !== cookies.length - 1) { return elSplit[0] + "; "; } else { return elSplit[0]; } }).join(""); return cookiesStr; }; exports.getCookies = getCookies;