codingame_profile_fetcher
TypeScript icon, indicating that this package has built-in type declarations

0.3.7 • Public • Published

Codingame Profile Fetcher

npm version

A TypeScript library for retrieving Codingame user profile information. Easily fetch details such as user level, XP, achievements, programming languages, and more.

Features

  • Fetches basic user data including pseudo, level, XP, rank, and more.
  • Retrieves certifications, followers, followings, skills, and programming languages.
  • Provides URLs for user avatar and cover images.

Installation

npm install codingame_profile_fetcher

Usage

Using get_codingamer_by_url

// Example 1: Valid profile URL
const validProfileUrl = "https://www.codingame.com/profile/<your_codingame_handle>";
try {
  const codingamer = await get_codingamer_by_url(validProfileUrl);
  console.log("User Details:", codingamer.pseudo, codingamer.level, codingamer.xp);
} catch (error) {
  console.error("Error:", error.message);
}

Create instance manually

import { Codingamer } from 'codingame_profile_fetcher';

// Create a new Codingamer instance with a Codingame handle
const codingamer = new Codingamer('<your_codingame_handle>');

// Update basic data
try {
  await codingamer.update_basic_data();
  console.log("Basic Data:", codingamer.pseudo, codingamer.level, codingamer.xp);
} catch (error) {
  console.error("Error updating basic data:", error.message);
}

// Update quest certifications
try {
  await codingamer.update_quest_certifications();
  console.log("Quest Certifications:", codingamer.quest_certifications);
} catch (error) {
  console.error("Error updating quest certifications:", error.message);
}

// Update follower IDs
try {
  await codingamer.update_follower_ids();
  console.log("Follower IDs:", codingamer.follower_ids);
} catch (error) {
  console.error("Error updating follower IDs:", error.message);
}

// Update following IDs
try {
  await codingamer.update_following_ids();
  console.log("Following IDs:", codingamer.following_ids);
} catch (error) {
  console.error("Error updating following IDs:", error.message);
}

// Update topic skills
try {
  await codingamer.update_topic_skills();
  console.log("Topic Skills:", codingamer.topic_skills);
} catch (error) {
  console.error("Error updating topic skills:", error.message);
}

// Update programming languages
try {
  await codingamer.update_programming_languages();
  console.log("Programming Languages:", codingamer.programming_languages);
} catch (error) {
  console.error("Error updating programming languages:", error.message);
}

// Update achievements
try {
  await codingamer.update_achievements();
  console.log("Achievements:", codingamer.achievements);
} catch (error) {
  console.error("Error updating achievements:", error.message);
}

Get started with Codingame profile data retrieval effortlessly!

Package Sidebar

Install

npm i codingame_profile_fetcher

Weekly Downloads

8

Version

0.3.7

License

ISC

Unpacked Size

57.5 kB

Total Files

50

Last publish

Collaborators

  • elnop