diff --git a/eslint.config.js b/eslint.config.js index 6b97abb..03dd426 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,36 +1,36 @@ module.exports = [ - { // Apply to `cjs`, `.mjs` and `.js` files. - files: ["**/*.?([cm])js"] - }, - { // Apply to `cts`, `.mts` and `.ts` files. - files: ["**/*.?([cm])ts"], - languageOptions: { - parser: require("@typescript-eslint/parser"), - parserOptions: { - sourceType: "module" - } + { // Apply to `cjs`, `.mjs` and `.js` files. + files: ["**/*.?([cm])js"] + }, + { // Apply to `cts`, `.mts` and `.ts` files. + files: ["**/*.?([cm])ts"], + languageOptions: { + parser: require("@typescript-eslint/parser"), + parserOptions: { + sourceType: "module" } + } + }, + { + ignores: ["dist/**", "docs/.astro/**", "docs/dist/**"], + plugins: { + stylistic: require("@stylistic/eslint-plugin") }, - { - ignores: ["dist/**", "docs/.astro/**", "docs/dist/**"], - plugins: { - stylistic: require("@stylistic/eslint-plugin") - }, - rules: { - "stylistic/indent": ["error", 2], - "stylistic/semi": ["error", "always"], - "stylistic/eol-last": ["error", "always"], - "stylistic/quotes": ["error", "double"], - "stylistic/dot-location": ["error", "property"], - "stylistic/array-bracket-spacing": ["error", "never"], - "stylistic/arrow-parens": ["error", "always"], - "stylistic/arrow-spacing": "error", - "stylistic/block-spacing": ["error", "always"], - "stylistic/brace-style": ["error", "stroustrup"], - "stylistic/comma-dangle": ["error", "never"], - "stylistic/comma-spacing": ["error", { before: false, after: true }], - "stylistic/function-call-spacing": ["error", "never"], - "stylistic/no-trailing-spaces": "error" - } + rules: { + "stylistic/indent": ["error", 2], + "stylistic/semi": ["error", "always"], + "stylistic/eol-last": ["error", "always"], + "stylistic/quotes": ["error", "double"], + "stylistic/dot-location": ["error", "property"], + "stylistic/array-bracket-spacing": ["error", "never"], + "stylistic/arrow-parens": ["error", "always"], + "stylistic/arrow-spacing": "error", + "stylistic/block-spacing": ["error", "always"], + "stylistic/brace-style": ["error", "stroustrup"], + "stylistic/comma-dangle": ["error", "never"], + "stylistic/comma-spacing": ["error", { before: false, after: true }], + "stylistic/function-call-spacing": ["error", "never"], + "stylistic/no-trailing-spaces": "error" } - ]; \ No newline at end of file + } +]; diff --git a/lib/index.ts b/lib/index.ts index 71e4962..ccbd92b 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,3 +1,5 @@ export * from "./auth/index"; export * from "./routes/User"; export * from "./structures/Client"; +export * from "./routes/User"; +export * from "./routes/School"; diff --git a/lib/routes/School.ts b/lib/routes/School.ts index 1cd3e6d..465b090 100644 --- a/lib/routes/School.ts +++ b/lib/routes/School.ts @@ -10,9 +10,10 @@ export class School { this.#manager = new RESTManager(); } - /** This method is used to get the user school informations. + /** This method is used to get the user school information. * @param hoteId The ID of the hote. - */ + * @param token The token of the user. + */ async getUserSchool(hoteId: number, token: string): Promise { return this.#manager.makeAuthRequest({ method: "GET", diff --git a/lib/routes/User.ts b/lib/routes/User.ts index 2620e43..0403ea0 100644 --- a/lib/routes/User.ts +++ b/lib/routes/User.ts @@ -85,7 +85,7 @@ export class User { * @param hoteId The ID of the hote to get. * @param token The token of the user. */ - async getSolds(hoteId: number, token: string): Promise { + async getBalances(hoteId: number, token: string): Promise { return this.#manager.makeAuthRequest({ method: "GET", url: endpoints.USER_BALANCES(hoteId), @@ -187,7 +187,7 @@ export class User { * @param hoteId The ID of the hote to get. * @param token The token of the user. * @param state The state of the booking (1==true, 0==false). - * @param weekId The week number to get. + * @param weekNumber The week number to get. * @param dayOfWeek The ID of the borne to get. * @param bookEvening If the evening should be booked. */ diff --git a/lib/structures/Client.ts b/lib/structures/Client.ts index 645fef5..242950d 100644 --- a/lib/structures/Client.ts +++ b/lib/structures/Client.ts @@ -82,7 +82,7 @@ export class Turboself { return this.#user.getLastPayment(this.hoteId, this.token); } - public async getSolds() { + public async getBalances() { if (await this.isExpire()) { if (this.mail && this.password) { await this.refreshToken(); @@ -92,7 +92,7 @@ export class Turboself { } } - return this.#user.getSolds(this.hoteId, this.token); + return this.#user.getBalances(this.hoteId, this.token); } public async getUserSchool() { diff --git a/package.json b/package.json index d9d8c1a..11aa0e8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { "name": "turboself-api", - "version": "0.1.0", + "version": "0.1.1", "description": "A wrapper around Turboself internal API.", + "repository": "github:raphckrman/turboself-api", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", @@ -43,14 +44,15 @@ "@types/set-cookie-parser": "^2.4.7", "@typescript-eslint/parser": "^6.18.0", "eslint": "^8.56.0", + "gen-esm-wrapper": "^1.1.3", "release-it": "^17.0.1", "terser": "^5.26.0", "tsup": "^8.0.1", "tsx": "^4.7.0", - "typescript": "^5.3.3", - "gen-esm-wrapper": "^1.1.3" + "typescript": "^5.3.3" }, "dependencies": { - "axios": "^1.6.7" + "axios": "^1.6.7", + "ts-node": "^10.9.2" } } diff --git a/scripts/build.js b/scripts/build.js index 6eb94dc..7b45e73 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,14 +1,15 @@ // build script for the project -const fs = require('fs'); -const path = require('path'); -const { execSync } = require('child_process'); +const fs = require("fs"); +const path = require("path"); +const { execSync } = require("child_process"); -const rootDir = path.resolve(__dirname, '..'); -const srcDir = path.resolve(rootDir, 'lib'); -const distDir = path.resolve(rootDir, 'dist'); +const rootDir = path.resolve(__dirname, ".."); +const distDir = path.resolve(rootDir, "dist"); -fs.rmdirSync(distDir, { recursive: true }); +if (fs.existsSync(distDir)) { + fs.rmdirSync(distDir, { recursive: true }); +} fs.mkdirSync(distDir); -execSync(`tsc --project ${rootDir}/tsconfig.json`); \ No newline at end of file +execSync(`tsc --project ${rootDir}/tsconfig.json`);