@auresjs/api
v1.1.0
Published
A JavaScript/TypeScript client for Aures API
Downloads
30
Maintainers
Readme
@auresjs/api
A TypeScript/JavaScript client library for accessing Aures account data.
Installation
npm install @auresjs/api
# or
yarn add @auresjs/apiQuick Start
// ES Modules / TypeScript
import Aures from "@auresjs/api";
// Initialize with username
const aures = new Aures({ username: "username" });
// Load all data
const data = await aures.load();
console.log(data);Basic Usage
Using the Client Class
import Aures from "@auresjs/api";
const aures = new Aures({
username: "username",
config: {
baseURL: "https://api.aures.io", // optional
timeout: 10000, // optional, default: 10000ms
cache: true, // optional, default: true
},
});
// Load all data
const allData = await aures.load();
// Load specific data types
const profile = await aures.getProfile();
const projects = await aures.getProjects();
const experience = await aures.getExperience();
const certificates = await aures.getCertificates();
const awards = await aures.getAwards();
const skills = await aures.getSkills();Using Individual Functions
import { loadProfile, loadCertificates } from "@auresjs/api";
const profile = await loadProfile("username");
const certificates = await loadCertificates("username");Individual Module Imports
import { loadProfile } from "@auresjs/api/profile";
import { loadCertificates } from "@auresjs/api/certificates";
import { loadProjects } from "@auresjs/api/projects";CommonJS Usage
const Aures = require("@auresjs/api").default;
const { loadProfile } = require("@auresjs/api");
// Or for individual modules
const { loadProfile } = require("@auresjs/api/profile");CDN Usage
<script src="https://unpkg.com/@auresjs/api"></script>
<script>
const aures = new Aures({ username: "username" });
// Global functions available
loadProfile("username").then((profile) => {
console.log(profile);
});
</script>React Example
import { useState, useEffect } from "react";
import { loadProfile, loadCertificates } from "@auresjs/api";
function Portfolio({ username }) {
const [profile, setProfile] = useState(null);
const [certificates, setCertificates] = useState([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
const fetchData = async () => {
try {
const [profileData, certificatesData] = await Promise.all([
loadProfile(username),
loadCertificates(username),
]);
setProfile(profileData);
setCertificates(certificatesData);
} finally {
setLoading(false);
}
};
fetchData();
}, [username]);
if (loading) return <div>Loading...</div>;
return (
<div>
<h1>{profile.username}</h1>
{/* Render your data */}
</div>
);
}API Reference
AuresClient
Constructor
new Aures({ username: string, config?: AuresConfig })Configuration
interface AuresConfig {
baseURL?: string; // default: 'https://api.aures.io'
timeout?: number; // default: 10000
cache?: boolean; // default: true
headers?: Record<string, string>;
}Methods
load(): Load all user datagetProfile(): Get profile information (username, avatar, email, skills)getProjects(): Get projects arraygetExperience(): Get work experience arraygetCertificates(): Get certificates arraygetAwards(): Get awards arraygetSkills(): Get skills arrayget(selectFields): Get specific fields
Available Data Fields
The API returns these data types:
interface ProfileData {
username: string;
avatar: string;
email?: string;
skills?: string[];
}
interface Project {
name: string;
desc: string;
url?: string;
tech?: string[];
}
interface Experience {
title: string;
company: string;
description: string;
startDate: string;
endDate?: string;
}
interface Certificate {
title: string;
platform: string;
description: string;
url?: string;
completedOn: string;
role?: string;
}
interface Award {
title: string;
issuer: string;
description: string;
date: string;
}Individual Functions
loadProfile(username, options?): Load profile dataloadProjects(username, options?): Load projectsloadExperience(username, options?): Load experienceloadCertificates(username, options?): Load certificatesloadAwards(username, options?): Load awardsloadSkills(username, options?): Load skills
Error Handling
import { AuresError } from "@auresjs/api";
try {
const data = await loadProfile("username");
} catch (error) {
if (error instanceof AuresError) {
console.error(`API Error ${error.status}: ${error.message}`);
} else {
console.error("Network error:", error.message);
}
}TypeScript Support
Full TypeScript definitions are included. All interfaces are exported:
import Aures, {
ProfileData,
Certificate,
AuresError,
type AuresConfig,
} from "@auresjs/api";License
MIT
