chefu-academy-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # CheFu Academy SDK
2
+
3
+ A TypeScript SDK for interacting with the CheFu Academy platform. This SDK provides authentication, client management, and course-related functionalities for developers integrating with CheFu Academy services.
4
+
5
+ ## Features
6
+ - Authentication utilities
7
+ - Client management
8
+ - Course management
9
+ - TypeScript support
10
+
11
+ ## Installation
12
+
13
+ ```
14
+ npm install chefu-academy-sdk
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Import the SDK modules as needed:
20
+
21
+ ```typescript
22
+ import { authenticate } from './src/auth';
23
+ import { Client } from './src/client';
24
+ import { getCourses } from './src/courses';
25
+ ```
26
+
27
+ ### Example
28
+
29
+ ```typescript
30
+ import { authenticate } from './src/auth';
31
+ import { Client } from './src/client';
32
+ import { getCourses } from './src/courses';
33
+
34
+ const client = new Client({ apiKey: 'YOUR_API_KEY' });
35
+ authenticate(client)
36
+ .then(() => getCourses(client))
37
+ .then(courses => console.log(courses));
38
+ ```
39
+
40
+ ## Development
41
+
42
+ - Build: `npm run build`
43
+ - Lint: `npm run lint`
44
+ - Test: `npm test`
45
+
46
+ ## Project Structure
47
+
48
+ - `src/auth.ts` - Authentication logic
49
+ - `src/client.ts` - API client
50
+ - `src/courses.ts` - Course management
51
+ - `src/index.ts` - SDK entry point
52
+
53
+ ## License
54
+
55
+ MIT
@@ -0,0 +1,35 @@
1
+ import * as axios from 'axios';
2
+ import axios__default from 'axios';
3
+
4
+ interface CheFuConfig {
5
+ apiKey: string;
6
+ baseURL?: string;
7
+ }
8
+ declare class CheFuClient {
9
+ apiKey: string;
10
+ baseURL: string;
11
+ constructor(config: CheFuConfig);
12
+ request(path: string, data?: any): Promise<axios__default.AxiosResponse<any, any, {}>>;
13
+ }
14
+
15
+ declare class Auth {
16
+ client: CheFuClient;
17
+ constructor(client: CheFuClient);
18
+ login(email: string, password: string): Promise<axios.AxiosResponse<any, any, {}>>;
19
+ register(email: string, password: string): Promise<axios.AxiosResponse<any, any, {}>>;
20
+ }
21
+
22
+ declare class Courses {
23
+ client: CheFuClient;
24
+ constructor(client: CheFuClient);
25
+ getAll(): Promise<axios.AxiosResponse<any, any, {}>>;
26
+ getById(courseId: string): Promise<axios.AxiosResponse<any, any, {}>>;
27
+ }
28
+
29
+ declare class CheFuAcademy {
30
+ auth: Auth;
31
+ courses: Courses;
32
+ constructor(config: CheFuConfig);
33
+ }
34
+
35
+ export { CheFuAcademy as default };
@@ -0,0 +1,35 @@
1
+ import * as axios from 'axios';
2
+ import axios__default from 'axios';
3
+
4
+ interface CheFuConfig {
5
+ apiKey: string;
6
+ baseURL?: string;
7
+ }
8
+ declare class CheFuClient {
9
+ apiKey: string;
10
+ baseURL: string;
11
+ constructor(config: CheFuConfig);
12
+ request(path: string, data?: any): Promise<axios__default.AxiosResponse<any, any, {}>>;
13
+ }
14
+
15
+ declare class Auth {
16
+ client: CheFuClient;
17
+ constructor(client: CheFuClient);
18
+ login(email: string, password: string): Promise<axios.AxiosResponse<any, any, {}>>;
19
+ register(email: string, password: string): Promise<axios.AxiosResponse<any, any, {}>>;
20
+ }
21
+
22
+ declare class Courses {
23
+ client: CheFuClient;
24
+ constructor(client: CheFuClient);
25
+ getAll(): Promise<axios.AxiosResponse<any, any, {}>>;
26
+ getById(courseId: string): Promise<axios.AxiosResponse<any, any, {}>>;
27
+ }
28
+
29
+ declare class CheFuAcademy {
30
+ auth: Auth;
31
+ courses: Courses;
32
+ constructor(config: CheFuConfig);
33
+ }
34
+
35
+ export { CheFuAcademy as default };
package/dist/index.js ADDED
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => CheFuAcademy
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/auth.ts
38
+ var Auth = class {
39
+ constructor(client) {
40
+ this.client = client;
41
+ }
42
+ login(email, password) {
43
+ return this.client.request("/auth/login", { email, password });
44
+ }
45
+ register(email, password) {
46
+ return this.client.request("/auth/register", { email, password });
47
+ }
48
+ };
49
+
50
+ // src/client.ts
51
+ var import_axios = __toESM(require("axios"));
52
+ var CheFuClient = class {
53
+ constructor(config) {
54
+ this.apiKey = config.apiKey;
55
+ this.baseURL = config.baseURL || "https://api.chefuacademy.com";
56
+ if (!this.apiKey) {
57
+ throw new Error("[CheFuAcademy]: API key is required");
58
+ }
59
+ }
60
+ request(path, data) {
61
+ return import_axios.default.post(`${this.baseURL}${path}`, data, {
62
+ headers: {
63
+ Authorization: `Bearer ${this.apiKey}`
64
+ }
65
+ });
66
+ }
67
+ };
68
+
69
+ // src/courses.ts
70
+ var Courses = class {
71
+ constructor(client) {
72
+ this.client = client;
73
+ }
74
+ getAll() {
75
+ return this.client.request("/courses");
76
+ }
77
+ getById(courseId) {
78
+ return this.client.request("/courses/view", { courseId });
79
+ }
80
+ };
81
+
82
+ // src/index.ts
83
+ var CheFuAcademy = class {
84
+ constructor(config) {
85
+ const client = new CheFuClient(config);
86
+ this.auth = new Auth(client);
87
+ this.courses = new Courses(client);
88
+ }
89
+ };
package/dist/index.mjs ADDED
@@ -0,0 +1,56 @@
1
+ // src/auth.ts
2
+ var Auth = class {
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ login(email, password) {
7
+ return this.client.request("/auth/login", { email, password });
8
+ }
9
+ register(email, password) {
10
+ return this.client.request("/auth/register", { email, password });
11
+ }
12
+ };
13
+
14
+ // src/client.ts
15
+ import axios from "axios";
16
+ var CheFuClient = class {
17
+ constructor(config) {
18
+ this.apiKey = config.apiKey;
19
+ this.baseURL = config.baseURL || "https://api.chefuacademy.com";
20
+ if (!this.apiKey) {
21
+ throw new Error("[CheFuAcademy]: API key is required");
22
+ }
23
+ }
24
+ request(path, data) {
25
+ return axios.post(`${this.baseURL}${path}`, data, {
26
+ headers: {
27
+ Authorization: `Bearer ${this.apiKey}`
28
+ }
29
+ });
30
+ }
31
+ };
32
+
33
+ // src/courses.ts
34
+ var Courses = class {
35
+ constructor(client) {
36
+ this.client = client;
37
+ }
38
+ getAll() {
39
+ return this.client.request("/courses");
40
+ }
41
+ getById(courseId) {
42
+ return this.client.request("/courses/view", { courseId });
43
+ }
44
+ };
45
+
46
+ // src/index.ts
47
+ var CheFuAcademy = class {
48
+ constructor(config) {
49
+ const client = new CheFuClient(config);
50
+ this.auth = new Auth(client);
51
+ this.courses = new Courses(client);
52
+ }
53
+ };
54
+ export {
55
+ CheFuAcademy as default
56
+ };
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "chefu-academy-sdk",
3
+ "version": "1.0.0",
4
+ "main": "./dist/index.js",
5
+ "types": "./dist/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./dist/index.mjs",
9
+ "require": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsup src/index.ts --dts --format esm,cjs"
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "description": "",
23
+ "devDependencies": {
24
+ "tsup": "^8.5.1",
25
+ "typescript": "^5.9.3"
26
+ },
27
+ "dependencies": {
28
+ "axios": "^1.13.2"
29
+ }
30
+ }