diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml new file mode 100644 index 0000000..07fd396 --- /dev/null +++ b/.github/workflows/deploy_docs.yml @@ -0,0 +1,32 @@ +name: Deploy docs to GitHub Pages + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [19.x] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: yarn install + working-directory: ./docs + - name: Build + run: yarn build + working-directory: ./docs + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + branch: gh-pages + folder: ./docs/build \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 93234dd..8cf65da 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,7 +1,7 @@ name: Publish to NPM on: release: - types: [created] + types: [published] jobs: build: runs-on: ubuntu-latest @@ -16,8 +16,18 @@ jobs: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' - name: Install dependencies and build - run: npm run prepublish - - name: Publish package - run: npm publish + run: yarn && yarn prepublish + - name: Extract tag version + id: extract_tag + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} + - name: Update version in package.json + run: | + npm --no-git-tag-version version ${{ steps.extract_tag.outputs.VERSION }} + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git commit -am "chore: bump version to ${{ steps.extract_tag.outputs.VERSION }}" + git push origin HEAD:main + - name: Publish to npm + run: npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index 881a9ee..518b67d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This project is loosely based on [Vulcan API](https://github.com/kapi2289/vulcan ## Docs -[Gitbook docs](https://capure.gitbook.io/vulcan-api-js/) +You can find the docs [here](https://avorty.github.io/vulcan-api-js) ## License diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..7dd4037 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,23 @@ +# Dependencies +/node_modules + +# Production +/build + +# Generated files +.docusaurus +.cache-loader + +# Misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Other package managers +pnpm-lock.yaml diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..0c6c2c2 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,41 @@ +# Website + +This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. + +### Installation + +``` +$ yarn +``` + +### Local Development + +``` +$ yarn start +``` + +This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. + +### Build + +``` +$ yarn build +``` + +This command generates static content into the `build` directory and can be served using any static contents hosting service. + +### Deployment + +Using SSH: + +``` +$ USE_SSH=true yarn deploy +``` + +Not using SSH: + +``` +$ GIT_USER= yarn deploy +``` + +If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. diff --git a/docs/babel.config.js b/docs/babel.config.js new file mode 100644 index 0000000..e00595d --- /dev/null +++ b/docs/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + presets: [require.resolve('@docusaurus/core/lib/babel/preset')], +}; diff --git a/docs/docs/contributing/_category_.json b/docs/docs/contributing/_category_.json new file mode 100644 index 0000000..957fd41 --- /dev/null +++ b/docs/docs/contributing/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Contributing", + "position": 5, + "link": { + "type": "generated-index", + "description": "Some details on how to contribute to the project." + } +} diff --git a/docs/docs/contributing/docs.md b/docs/docs/contributing/docs.md new file mode 100644 index 0000000..d11bf4b --- /dev/null +++ b/docs/docs/contributing/docs.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 3 +--- + +# Contributing to the docs + +On every page you can find a link to the source file of the page. You can edit the file and create a pull request. + +## Docusaurus + +Our documentation uses Docusaurus. If you want to learn about Markdown or special features of Docusaurus you can look at the [Docusaurus documentation](https://docusaurus.io/docs). \ No newline at end of file diff --git a/docs/docs/contributing/general.md b/docs/docs/contributing/general.md new file mode 100644 index 0000000..926ec3f --- /dev/null +++ b/docs/docs/contributing/general.md @@ -0,0 +1,17 @@ +--- +sidebar_position: 1 +--- + +# General information + +Contributions are welcome! We are happy to accept contributions in the form of pull requests, issues, or just general feedback and discussion. + +## Contributing to the SDK + +See [Contributing to the SDK](./sdk). + +## Contributing to the documentation + +See [Contributing to the documentation](./docs). + +If you have any questions feel free to contact us. \ No newline at end of file diff --git a/docs/docs/contributing/sdk.md b/docs/docs/contributing/sdk.md new file mode 100644 index 0000000..0bd7445 --- /dev/null +++ b/docs/docs/contributing/sdk.md @@ -0,0 +1,23 @@ +--- +sidebar_position: 2 +--- + +# Contributing to the SDK + +You can look on the [list of issues](https://github.com/avorty/vulcan-api-js/issues) and pick one to work on. If you have an idea for a new feature, you can create an issue and discuss it with us. + +## Running SDK in the development mode + +We use yarn as a package manager. + +1. First install the dependencies + +```bash +yarn install +``` + +2. Then run the SDK in development mode + +```bash +yarn dev +``` \ No newline at end of file diff --git a/docs/docs/example_projects.md b/docs/docs/example_projects.md new file mode 100644 index 0000000..ab0dc5d --- /dev/null +++ b/docs/docs/example_projects.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 4 +--- + +# Example projects + +Here is a list of example projects that use our SDK. + +## BasedBook + +BasedBook is a web application created by [Avorty](https://github.com/avorty) and it's a great example of how to use our SDK with Nest.js. See [backend repository](https://github.com/avorty/basedbook-backend). \ No newline at end of file diff --git a/docs/docs/getting-started/_category_.json b/docs/docs/getting-started/_category_.json new file mode 100644 index 0000000..3ee0780 --- /dev/null +++ b/docs/docs/getting-started/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Getting started", + "position": 1, + "link": { + "type": "generated-index", + "description": "How to get started with the SDK" + } +} diff --git a/docs/docs/getting-started/installation.md b/docs/docs/getting-started/installation.md new file mode 100644 index 0000000..1db007b --- /dev/null +++ b/docs/docs/getting-started/installation.md @@ -0,0 +1,28 @@ +--- +sidebar_position: 1 +--- + +# Installation + +NPM +```bash +npm install vulcan-api-js +``` + +YARN +```bash +yarn add vulcan-api-js +``` + +PNPM +```bash +pnpm add vulcan-api-js +``` + +:::info +TypeScript typings are included. +::: + +:::info +React Native is now supported, but you must install the react-native-get-random-values npm module and import it before the vulcan-api-js module. +::: diff --git a/docs/docs/getting-started/usage.md b/docs/docs/getting-started/usage.md new file mode 100644 index 0000000..746a1bb --- /dev/null +++ b/docs/docs/getting-started/usage.md @@ -0,0 +1,64 @@ +--- +sidebar_position: 5 +--- + +# Usage + +First, you need to create a keystore, this is where your certificate is stored. + +You will have to save it somewhere as that's what gets registered in Vulcan. + +```js +const {Keystore} = require('vulcan-api-js'); +const fs = require('fs'); + +const main = async () => { + const keystore = new Keystore(); + await keystore.init(); + + fs.writeFileSync("keystore.json", keystore.dumpToJsonString(), { encoding: 'utf-8' }); +}; + +main(); +``` + +Then you will have to register the account. + +```js +const {Keystore, AccountTools, registerAccount} = require('vulcan-api-js'); +const fs = require('fs'); + +const main = async () => { + const keystore = new Keystore(); + keystore.loadFromJsonString(fs.readFileSync("keystore.json", { encoding: 'utf-8' })); + + const account = await registerAccount(keystore, {TOKEN}, {SYMBOL}, {PIN}); + fs.writeFileSync("account.json", AccountTools.dumpToJsonString(account), { encoding: 'utf-8' }); +}; + +main(); +``` + +When you have your keystore and account generated, you can load them and use the SDK. + +```js +const {Keystore, AccountTools, VulcanHebe} = require('vulcan-api-js'); + +const main = async () => { + const keystore = new Keystore(); + keystore.loadFromJsonString(fs.readFileSync("keystore.json", { encoding: 'utf-8' })); + + const client = new VulcanHebe(keystore, AccountTools.loadFromJsonString(fs.readFileSync("account.json", { encoding: 'utf-8' }))); + + // Pick your student (defaults to the first one) + await client.selectStudent(); + + // You can use the SDK here +}; + +main(); +``` + +:::info +All the methods in the Vulcan API JS are async. +::: \ No newline at end of file diff --git a/docs/docs/methods/_category_.json b/docs/docs/methods/_category_.json new file mode 100644 index 0000000..01efbc3 --- /dev/null +++ b/docs/docs/methods/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Methods", + "position": 2, + "link": { + "type": "generated-index", + "description": "All methods" + } +} diff --git a/docs/docs/methods/get_attendance.md b/docs/docs/methods/get_attendance.md new file mode 100644 index 0000000..08c5e2c --- /dev/null +++ b/docs/docs/methods/get_attendance.md @@ -0,0 +1,26 @@ +--- +sidebar_position: 9 +--- + +# getAttendance + +Gets attendace from a date range. + +## Arguments + +- (from) - [DateTime](../models/date_time) +- (to) - [DateTime](../models/date_time) + +## Returns + +This method will return an array of [Attendance](../models/attendance) objects with all attendance from the date range. + +## Example + +```js +client.getAttendance({from, to}).then(attendance => { + attendance.forEach(attendance => { + // attendance + }) +}) +``` \ No newline at end of file diff --git a/docs/docs/methods/get_exams.md b/docs/docs/methods/get_exams.md new file mode 100644 index 0000000..3345504 --- /dev/null +++ b/docs/docs/methods/get_exams.md @@ -0,0 +1,25 @@ +--- +sidebar_position: 10 +--- + +# getExams + +Gets all exams since the last sync. + +## Arguments + +- (lastSync?) - Date + +## Returns + +This method will return an array of [Exam](../models/exam) objects with all exams since the last sync. + +## Example + +```js +client.getExams({lastSync}).then(exams => { + exams.forEach(exam => { + // exams + }) +}) +``` \ No newline at end of file diff --git a/docs/docs/methods/get_grades.md b/docs/docs/methods/get_grades.md new file mode 100644 index 0000000..00e6004 --- /dev/null +++ b/docs/docs/methods/get_grades.md @@ -0,0 +1,24 @@ +--- +sidebar_position: 5 +--- + +# getGrades + +Gets all grades since the last sync. + +## Arguments +- (lastSync?) - Date + +## Returns + +This method will return an array of [Grade](../models/grade) objects with all grades since the last sync. + +## Example + +```js +client.getGrades({lastSync}).then(grades => { + grades.forEach(grade => { + // grades + }) +}) +``` \ No newline at end of file diff --git a/docs/docs/methods/get_homework.md b/docs/docs/methods/get_homework.md new file mode 100644 index 0000000..272af56 --- /dev/null +++ b/docs/docs/methods/get_homework.md @@ -0,0 +1,21 @@ +--- +sidebar_position: 8 +--- + +# getHomework + +Gets all homework. + +## Returns + +This method will return an array of [Homework](../models/homework) objects with all homework. + +## Example + +```js +client.getHomework().then(homework => { + homework.forEach(homework => { + // homework + }) +}) +``` \ No newline at end of file diff --git a/docs/docs/methods/get_lessons.md b/docs/docs/methods/get_lessons.md new file mode 100644 index 0000000..5cc945d --- /dev/null +++ b/docs/docs/methods/get_lessons.md @@ -0,0 +1,27 @@ +--- +sidebar_position: 3 +--- + +# getLessons + +Gets a list of lessons. + +## Arguments +- (dateFrom?) - Date +- (dateTo?) - Date + +If the dates aren't provided defaults to today. + +## Returns + +An array of [Lesson](../models/Lesson) objects + +## Example + +```js +client.getLessons({dateFrom?}, {dateTo?}).then(lessons => { + lessons.forEach(lesson => { + // lessons + }) +}) +``` \ No newline at end of file diff --git a/docs/docs/methods/get_lucky_number.md b/docs/docs/methods/get_lucky_number.md new file mode 100644 index 0000000..0239b32 --- /dev/null +++ b/docs/docs/methods/get_lucky_number.md @@ -0,0 +1,19 @@ +--- +sidebar_position: 4 +--- + +# getLuckyNumber + +Gets the lucky number for today. + +## Returns + +An [LuckyNumber](../models/lucky_number) object. + +## Example + +```js +client.getLuckyNumber().then(luckyNumber => { + // luckyNumber +}) +``` \ No newline at end of file diff --git a/docs/docs/methods/get_message_boxes.md b/docs/docs/methods/get_message_boxes.md new file mode 100644 index 0000000..515b598 --- /dev/null +++ b/docs/docs/methods/get_message_boxes.md @@ -0,0 +1,21 @@ +--- +sidebar_position: 6 +--- + +# getMessageBoxes + +Gets all message boxes. + +## Returns + +This method will return an array of [MessageBox](../models/message_box) objects with all message boxes. + +## Example + +```js +client.getMessageBoxes().then(messageBoxes => { + messageBoxes.forEach(messageBox => { + // messageBoxes + }) +}) +``` \ No newline at end of file diff --git a/docs/docs/methods/get_messages.md b/docs/docs/methods/get_messages.md new file mode 100644 index 0000000..1ca6084 --- /dev/null +++ b/docs/docs/methods/get_messages.md @@ -0,0 +1,24 @@ +--- +sidebar_position: 7 +--- + +# getMessages + +Gets all messages. + +## Arguments +- (messageBox) - [MessageBox](../models/message_box) + +## Returns + +This method will return an array of [Message](../models/message) objects with all messages in the message box. + +## Example + +```js +client.getMessages({messageBox}).then(messages => { + messages.forEach(message => { + // messages + }) +}) +``` \ No newline at end of file diff --git a/docs/docs/methods/get_students.md b/docs/docs/methods/get_students.md new file mode 100644 index 0000000..c404ce4 --- /dev/null +++ b/docs/docs/methods/get_students.md @@ -0,0 +1,20 @@ +--- +sidebar_position: 1 +--- + +# getStudents + +Gets a list of students registered in the account. + +## Returns +A list of [Student](../models/student) objects + +## Example + +```js +client.getStudents().then(students => { + students.forEach(student => { + // students + }) +}) +``` \ No newline at end of file diff --git a/docs/docs/methods/select_student.md b/docs/docs/methods/select_student.md new file mode 100644 index 0000000..8fdf1d7 --- /dev/null +++ b/docs/docs/methods/select_student.md @@ -0,0 +1,20 @@ +--- +sidebar_position: 2 +--- + +# selectStudent + +Sets the student that you want to use to access the API. + +## Arguments +- (student?) - [Student](../models/student) + +If a student is not provided the first one gets selected. + +## Example + +```js +client.selectStudent({student?}).then(() => { + // Do something +}) +``` \ No newline at end of file diff --git a/docs/docs/models/_category_.json b/docs/docs/models/_category_.json new file mode 100644 index 0000000..57f0334 --- /dev/null +++ b/docs/docs/models/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Models", + "position": 3, + "link": { + "type": "generated-index", + "description": "How to get started with the SDK" + } +} diff --git a/docs/docs/models/address.md b/docs/docs/models/address.md new file mode 100644 index 0000000..9e1b4e4 --- /dev/null +++ b/docs/docs/models/address.md @@ -0,0 +1,12 @@ +--- +sidebar_position: 18 +--- + +# Address + +An object represents receiver of message. + +## Properties +- (globalKey) - string +- (name) - string +- (hasRead) - boolean \ No newline at end of file diff --git a/docs/docs/models/attendance.md b/docs/docs/models/attendance.md new file mode 100644 index 0000000..8c5d008 --- /dev/null +++ b/docs/docs/models/attendance.md @@ -0,0 +1,35 @@ +--- +sidebar_position: 19 +--- + +# Attendance + +An object representing attendance details. + +## Properties +- (lessonId) - number +- (id) - number +- (lessonNumber) - number +- (globalKey) - string +- (lessonClassId) - number +- (lessonClassGlobalKey) - string +- (calculcatePresence) - boolean +- (replacement) - boolean +- (subject) - [Subject](./subject) +- (topic) - string +- (teacher) - [Teacher](./teacher) +- (secondTeacher?) - [Teacher](./teacher) +- (mainTeacher?) - [Teacher](./teacher) +- (teamClass?) - [TeamClass](./team_class) +- (classAlias?) - string +- (date) - [DateTime](./date_time) +- (time?) - [TimeSlot](./time_slot) +- (dateModified?) - [DateTime](./date_time) +- (auxPresenceId?) - number +- (justificationStatus?) - string +- (presenceType?) - [PresenceType](./presence_type) +- (note?) - string +- (publicResources?) - string +- (remoteResources?) - string +- (group?) - [TeamVirtual](./team_virtual) +- (visible?) - boolean diff --git a/docs/docs/models/date_time.md b/docs/docs/models/date_time.md new file mode 100644 index 0000000..096182e --- /dev/null +++ b/docs/docs/models/date_time.md @@ -0,0 +1,13 @@ +--- +sidebar_position: 6 +--- + +# DateTime + +An object representing date and time. + +## Properties +- (timestamp) - number +- (date) - string +- (time) - string +- (dateDisplay?) - string \ No newline at end of file diff --git a/docs/docs/models/exam.md b/docs/docs/models/exam.md new file mode 100644 index 0000000..e72c5cd --- /dev/null +++ b/docs/docs/models/exam.md @@ -0,0 +1,19 @@ +--- +sidebar_position: 20 +--- + +# Exam + +An object representing exam. + +## Properties +- (id) - number +- (key) - string +- (type) - string +- (topic) - string +- (dateCreated) - [DateTime](./date_time) +- (dateModified) - [DateTime](./date_time) +- (deadline) - [DateTime](./date_time) +- (creator) - [Teacher](./teacher) +- (subject) - [Subject](./subject) +- (pupilId) - number diff --git a/docs/docs/models/grade.md b/docs/docs/models/grade.md new file mode 100644 index 0000000..c0522d8 --- /dev/null +++ b/docs/docs/models/grade.md @@ -0,0 +1,23 @@ +--- +sidebar_position: 14 +--- + +# Grade + +An object representing a grade. + +## Properties +- (id) - number +- (key) - string +- (pupilId) - number +- (contentRaw) - string +- (content) - string +- (dateCreated) - [DateTime](./date_time) +- (dateModify) - [DateTime](./date_time) +- (creator) - [Teacher](./teacher) +- (modifier) - [Teacher](./teacher) +- (column) - [GradeColumn](./grade_column) +- (value?) - number +- (comment?) - string +- (numerator?) - string +- (denominator?) - number \ No newline at end of file diff --git a/docs/docs/models/grade_category.md b/docs/docs/models/grade_category.md new file mode 100644 index 0000000..ab06dc4 --- /dev/null +++ b/docs/docs/models/grade_category.md @@ -0,0 +1,12 @@ +--- +sidebar_position: 16 +--- + +# GradeCategory + +An object representing a grade category. + +## Properties +- (id) - number +- (name) - string +- (code) - string diff --git a/docs/docs/models/grade_column.md b/docs/docs/models/grade_column.md new file mode 100644 index 0000000..d6fe015 --- /dev/null +++ b/docs/docs/models/grade_column.md @@ -0,0 +1,20 @@ +--- +sidebar_position: 15 +--- + +# GradeColumn + +An object representing a type of grade. + +## Properties +- (id) - number +- (key) - string +- (periodId) - number +- (name) - string +- (code) - string +- (group) - string +- (number) - number +- (weight) - number +- (subject) - [Subject](./subject) +- (category?) - [GradeCategory](./grade_category) +- (period?) - [Period](./period) \ No newline at end of file diff --git a/docs/docs/models/homework.md b/docs/docs/models/homework.md new file mode 100644 index 0000000..b230f00 --- /dev/null +++ b/docs/docs/models/homework.md @@ -0,0 +1,21 @@ +--- +sidebar_position: 21 +--- + +# Homework + +An object representing homework. + +## Properties +- (id) - number +- (key) - string +- (homeworkId) - number +- (content) - string +- (dateCreated) - Date +- (creator) - [Teacher](./teacher) +- (subject) - [Subject](./subject) +- (attachments) - Attachment[] +- (isAnswerRequired) - boolean +- (deadline) - Date +- (answerDeadline) - Date +- (answerDate) - Date diff --git a/docs/docs/models/lesson.md b/docs/docs/models/lesson.md new file mode 100644 index 0000000..8dc9ffd --- /dev/null +++ b/docs/docs/models/lesson.md @@ -0,0 +1,22 @@ +--- +sidebar_position: 17 +--- + +# Lesson + +An object representing a lesson. + +## Properties +- (id?) - number +- (date?) - [DateTime](./date_time) +- (timeSlot?) - [TimeSlot](./time_slot) +- (room?) - [Room](./room) +- (teacherPrimary?) - [Teacher](./teacher) +- (teacherSecondary?) - [Teacher](./teacher) +- (subject?) - [Subject](./subject) +- (event?) - string +- (change?) - string +- (class?) - [TeamClass](./team_class) +- (pupilAlias?) - string +- (distribution?) - [TeamVirtual](./team_virtual.md) +- (visible?) - boolean \ No newline at end of file diff --git a/docs/docs/models/lesson_room.md b/docs/docs/models/lesson_room.md new file mode 100644 index 0000000..21a54bd --- /dev/null +++ b/docs/docs/models/lesson_room.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 8 +--- + +# LessonRoom + +An object representing a classroom. + +## Properties +- (id) - number +- (code) - string \ No newline at end of file diff --git a/docs/docs/models/lucky_number.md b/docs/docs/models/lucky_number.md new file mode 100644 index 0000000..bdb7f2c --- /dev/null +++ b/docs/docs/models/lucky_number.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 13 +--- + +# LuckyNumber + +An object representing a lucky number. + +## Properties +- (day) - number +- (number) - number \ No newline at end of file diff --git a/docs/docs/models/message.md b/docs/docs/models/message.md new file mode 100644 index 0000000..db5667f --- /dev/null +++ b/docs/docs/models/message.md @@ -0,0 +1,20 @@ +--- +sidebar_position: 22 +--- + +# Message + +An object representing message. + +## Properties +- (id) - string +- (globalKey) - string +- (threadKey) - string +- (subject) - string +- (content) - string +- (sentDate) - Date +- (status) - number +- (sender) - string +- (receivers) - [Address](./address)[] +- (attachments) - Attachment[] +- (readDate?) - Date diff --git a/docs/docs/models/message_box.md b/docs/docs/models/message_box.md new file mode 100644 index 0000000..8e0c578 --- /dev/null +++ b/docs/docs/models/message_box.md @@ -0,0 +1,12 @@ +--- +sidebar_position: 23 +--- + +# MessageBox + +An object representing message box. + +## Properties +- (id) - string +- (globalKey) - string +- (name) - string \ No newline at end of file diff --git a/docs/docs/models/period.md b/docs/docs/models/period.md new file mode 100644 index 0000000..8c03c35 --- /dev/null +++ b/docs/docs/models/period.md @@ -0,0 +1,16 @@ +--- +sidebar_position: 5 +--- + +# Period + +An object representing a school year period. + +## Properties +- (id) - number +- (level) - number +- (number) - number +- (current) - boolean +- (last) - boolean +- (start) - any +- (end) - any \ No newline at end of file diff --git a/docs/docs/models/presence_type.md b/docs/docs/models/presence_type.md new file mode 100644 index 0000000..7eecda8 --- /dev/null +++ b/docs/docs/models/presence_type.md @@ -0,0 +1,21 @@ +--- +sidebar_position: 24 +--- + +# Presence type + +An object representing presence type. + +## Properties +- (id) - string +- (name) - string +- (symbol) - string +- (category_id) - number +- (category_name) - string +- (position) - number +- (presence) - boolean +- (absence) - boolean +- (exemption) - boolean +- (late) - boolean +- (justified) - boolean +- (deleted) - boolean \ No newline at end of file diff --git a/docs/docs/models/pupil.md b/docs/docs/models/pupil.md new file mode 100644 index 0000000..95544bb --- /dev/null +++ b/docs/docs/models/pupil.md @@ -0,0 +1,21 @@ +--- +sidebar_position: 2 +--- + +# Pupil + +An object representing a person. + +## Properties +- (id) - number +- (loginId) - number +- (loginValue) - string +- (firstName) - string +- (secondName) - string +- (surname) - string +- (sex) - boolean: + +### Sex + +- Male - true +- Female - false diff --git a/docs/docs/models/room.md b/docs/docs/models/room.md new file mode 100644 index 0000000..17aced0 --- /dev/null +++ b/docs/docs/models/room.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 25 +--- + +# Room + +An object representing room. + +## Properties +- (id) - number +- (code) - string \ No newline at end of file diff --git a/docs/docs/models/school.md b/docs/docs/models/school.md new file mode 100644 index 0000000..790f82a --- /dev/null +++ b/docs/docs/models/school.md @@ -0,0 +1,13 @@ +--- +sidebar_position: 4 +--- + +# School + +An object representing a single school. + +## Properties +- (id) - number +- (name) - string +- (short) - string +- (address) - string \ No newline at end of file diff --git a/docs/docs/models/student.md b/docs/docs/models/student.md new file mode 100644 index 0000000..8a498ec --- /dev/null +++ b/docs/docs/models/student.md @@ -0,0 +1,15 @@ +--- +sidebar_position: 1 +--- + +# Student + +A student object returned by the SDK. + +## Properties +- (symbol) - string +- (symbol_code) - string +- (pupil) - [Pupil](./pupil) +- (unit) - [Unit](./unit) +- (school) - [School](./school) +- (periods) - [Period](./period)[] diff --git a/docs/docs/models/subject.md b/docs/docs/models/subject.md new file mode 100644 index 0000000..4e86b33 --- /dev/null +++ b/docs/docs/models/subject.md @@ -0,0 +1,14 @@ +--- +sidebar_position: 10 +--- + +# Subject + +An object representing a school subject. + +## Properties +- (id) - number +- (key) - string +- (name) - string +- (code) - string +- (position) - number \ No newline at end of file diff --git a/docs/docs/models/teacher.md b/docs/docs/models/teacher.md new file mode 100644 index 0000000..0ff84d7 --- /dev/null +++ b/docs/docs/models/teacher.md @@ -0,0 +1,13 @@ +--- +sidebar_position: 9 +--- + +# Teacher + +An object representing a teacher. + +## Properties +- (id) - number +- (name) - string +- (surname) - string +- (displayName) - string \ No newline at end of file diff --git a/docs/docs/models/team_class.md b/docs/docs/models/team_class.md new file mode 100644 index 0000000..be37103 --- /dev/null +++ b/docs/docs/models/team_class.md @@ -0,0 +1,13 @@ +--- +sidebar_position: 11 +--- + +# Subject + +An object representing a school class. + +## Properties +- (id) - number +- (key) - string +- (displayName) - string +- (symbol) - string \ No newline at end of file diff --git a/docs/docs/models/team_virtual.md b/docs/docs/models/team_virtual.md new file mode 100644 index 0000000..2f1fc89 --- /dev/null +++ b/docs/docs/models/team_virtual.md @@ -0,0 +1,14 @@ +--- +sidebar_position: 12 +--- + +# TeamVirtual + +An object representing a part of school class. + +## Properties +- (id) - number +- (key) - string +- (shortcut) - string +- (name) - string +- (partType) - string \ No newline at end of file diff --git a/docs/docs/models/time_slot.md b/docs/docs/models/time_slot.md new file mode 100644 index 0000000..166ad43 --- /dev/null +++ b/docs/docs/models/time_slot.md @@ -0,0 +1,14 @@ +--- +sidebar_position: 7 +--- + +# Period + +An object representing a lesson time. + +## Properties +- (id) - number +- (start) - any +- (end) - any +- (display) - string +- (position) - number \ No newline at end of file diff --git a/docs/docs/models/unit.md b/docs/docs/models/unit.md new file mode 100644 index 0000000..04adf90 --- /dev/null +++ b/docs/docs/models/unit.md @@ -0,0 +1,16 @@ +--- +sidebar_position: 3 +--- + +# Unit + +An object representing a school or a group of schools. + +## Properties +- (id) - number +- (symbol) - string +- (name) - string +- (short) - string +- (displayName) - string +- (address) - string +- (restUrl) - string \ No newline at end of file diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts new file mode 100644 index 0000000..94f9301 --- /dev/null +++ b/docs/docusaurus.config.ts @@ -0,0 +1,79 @@ +import {themes as prismThemes} from 'prism-react-renderer'; +import type {Config} from '@docusaurus/types'; +import type * as Preset from '@docusaurus/preset-classic'; + +const config: Config = { + title: 'vulcan-api-js', + tagline: 'Unoffical Vulcan UONET+ SDK for JavaScript / TypeScript', + favicon: 'img/favicon.ico', + url: 'https://avorty.github.io', + baseUrl: '/vulcan-api-js/', + + // GitHub pages deployment config. + // If you aren't using GitHub pages, you don't need these. + organizationName: 'avorty', // Usually your GitHub org/user name. + projectName: 'vulcan-api-js', // Usually your repo name. + + onBrokenLinks: 'throw', + onBrokenMarkdownLinks: 'warn', + + // Even if you don't use internationalization, you can use this field to set + // useful metadata like html lang. For example, if your site is Chinese, you + // may want to replace "en" with "zh-Hans". + i18n: { + defaultLocale: 'en', + locales: ['en'], + }, + plugins: [require.resolve('docusaurus-lunr-search')], + presets: [ + [ + 'classic', + { + docs: { + sidebarPath: './sidebars.ts', + // Please change this to your repo. + // Remove this to remove the "edit this page" links. + editUrl: + 'https://github.com/avorty/vulcan-api-js/tree/main/docs/', + }, + theme: { + customCss: './src/css/custom.css', + }, + } satisfies Preset.Options, + ], + ], + + themeConfig: { + image: 'img/docusaurus-social-card.jpg', + navbar: { + title: 'vulcan-api-js', + logo: { + alt: 'Logo', + src: 'img/logo.svg', + }, + items: [ + { + type: 'docSidebar', + sidebarId: 'tutorialSidebar', + position: 'left', + label: 'Documentation', + }, + { + href: 'https://github.com/avorty/vulcan-api-js', + label: 'GitHub', + position: 'right', + }, + ], + }, + footer: { + style: 'dark', + copyright: `Copyright © ${new Date().getFullYear()} Avorty
Built with Docusaurus.`, + }, + prism: { + theme: prismThemes.github, + darkTheme: prismThemes.dracula, + }, + } satisfies Preset.ThemeConfig, +}; + +export default config; diff --git a/docs/package.json b/docs/package.json new file mode 100644 index 0000000..3ccd6ec --- /dev/null +++ b/docs/package.json @@ -0,0 +1,49 @@ +{ + "name": "docs", + "version": "0.0.0", + "private": true, + "scripts": { + "docusaurus": "docusaurus", + "start": "docusaurus start", + "build": "docusaurus build", + "swizzle": "docusaurus swizzle", + "deploy": "docusaurus deploy", + "clear": "docusaurus clear", + "serve": "docusaurus serve", + "write-translations": "docusaurus write-translations", + "write-heading-ids": "docusaurus write-heading-ids", + "typecheck": "tsc" + }, + "dependencies": { + "@docusaurus/core": "3.0.1", + "@docusaurus/preset-classic": "3.0.1", + "@mdx-js/react": "^3.0.0", + "clsx": "^2.0.0", + "docusaurus-lunr-search": "^3.3.1", + "lunr": "^2.3.9", + "prism-react-renderer": "^2.3.0", + "react": "^18.0.0", + "react-dom": "^18.0.0" + }, + "devDependencies": { + "@docusaurus/module-type-aliases": "3.0.1", + "@docusaurus/tsconfig": "3.0.1", + "@docusaurus/types": "3.0.1", + "typescript": "~5.2.2" + }, + "browserslist": { + "production": [ + ">0.5%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 3 chrome version", + "last 3 firefox version", + "last 5 safari version" + ] + }, + "engines": { + "node": ">=18.0" + } +} diff --git a/docs/sidebars.ts b/docs/sidebars.ts new file mode 100644 index 0000000..acc7685 --- /dev/null +++ b/docs/sidebars.ts @@ -0,0 +1,31 @@ +import type {SidebarsConfig} from '@docusaurus/plugin-content-docs'; + +/** + * Creating a sidebar enables you to: + - create an ordered group of docs + - render a sidebar for each doc of that group + - provide next/previous navigation + + The sidebars can be generated from the filesystem, or explicitly defined here. + + Create as many sidebars as you want. + */ +const sidebars: SidebarsConfig = { + // By default, Docusaurus generates a sidebar from the docs folder structure + tutorialSidebar: [{type: 'autogenerated', dirName: '.'}], + + // But you can create a sidebar manually + /* + tutorialSidebar: [ + 'intro', + 'hello', + { + type: 'category', + label: 'Tutorial', + items: ['tutorial-basics/create-a-document'], + }, + ], + */ +}; + +export default sidebars; diff --git a/docs/src/components/HomepageFeatures/index.tsx b/docs/src/components/HomepageFeatures/index.tsx new file mode 100644 index 0000000..8a97cc0 --- /dev/null +++ b/docs/src/components/HomepageFeatures/index.tsx @@ -0,0 +1,67 @@ +import clsx from 'clsx'; +import Heading from '@theme/Heading'; +import styles from './styles.module.css'; + +type FeatureItem = { + title: string; + Svg: React.ComponentType>; + description: JSX.Element; +}; + +const FeatureList: FeatureItem[] = [ + { + title: 'Easy to Use', + Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, + description: ( + <> + Our API is simple and easy to use. You can get started in minutes. + + ), + }, + { + title: 'Clean and simple documentation', + Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default, + description: ( + <> + Our documentation is clean and simple. We describe every methods and properties available in our SDK in detail. + + ), + }, + { + title: 'TypeScript support', + Svg: require('@site/static/img/undraw_docusaurus_react.svg').default, + description: ( + <> + We support TypeScript out of the box. No need to install any additional packages. + + ), + }, +]; + +function Feature({ title, Svg, description }: FeatureItem) { + return ( +
+
+ +
+
+ {title} +

{description}

+
+
+ ); +} + +export default function HomepageFeatures(): JSX.Element { + return ( +
+
+
+ {FeatureList.map((props, idx) => ( + + ))} +
+
+
+ ); +} diff --git a/docs/src/components/HomepageFeatures/styles.module.css b/docs/src/components/HomepageFeatures/styles.module.css new file mode 100644 index 0000000..b248eb2 --- /dev/null +++ b/docs/src/components/HomepageFeatures/styles.module.css @@ -0,0 +1,11 @@ +.features { + display: flex; + align-items: center; + padding: 2rem 0; + width: 100%; +} + +.featureSvg { + height: 200px; + width: 200px; +} diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css new file mode 100644 index 0000000..2bc6a4c --- /dev/null +++ b/docs/src/css/custom.css @@ -0,0 +1,30 @@ +/** + * Any CSS included here will be global. The classic template + * bundles Infima by default. Infima is a CSS framework designed to + * work well for content-centric websites. + */ + +/* You can override the default Infima variables here. */ +:root { + --ifm-color-primary: #2e8555; + --ifm-color-primary-dark: #29784c; + --ifm-color-primary-darker: #277148; + --ifm-color-primary-darkest: #205d3b; + --ifm-color-primary-light: #33925d; + --ifm-color-primary-lighter: #359962; + --ifm-color-primary-lightest: #3cad6e; + --ifm-code-font-size: 95%; + --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); +} + +/* For readability concerns, you should choose a lighter palette in dark mode. */ +[data-theme='dark'] { + --ifm-color-primary: #25c2a0; + --ifm-color-primary-dark: #21af90; + --ifm-color-primary-darker: #1fa588; + --ifm-color-primary-darkest: #1a8870; + --ifm-color-primary-light: #29d5b0; + --ifm-color-primary-lighter: #32d8b4; + --ifm-color-primary-lightest: #4fddbf; + --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); +} diff --git a/docs/src/pages/index.module.css b/docs/src/pages/index.module.css new file mode 100644 index 0000000..9f71a5d --- /dev/null +++ b/docs/src/pages/index.module.css @@ -0,0 +1,23 @@ +/** + * CSS files with the .module.css suffix will be treated as CSS modules + * and scoped locally. + */ + +.heroBanner { + padding: 4rem 0; + text-align: center; + position: relative; + overflow: hidden; +} + +@media screen and (max-width: 996px) { + .heroBanner { + padding: 2rem; + } +} + +.buttons { + display: flex; + align-items: center; + justify-content: center; +} diff --git a/docs/src/pages/index.tsx b/docs/src/pages/index.tsx new file mode 100644 index 0000000..845391c --- /dev/null +++ b/docs/src/pages/index.tsx @@ -0,0 +1,43 @@ +import clsx from 'clsx'; +import Link from '@docusaurus/Link'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import Layout from '@theme/Layout'; +import HomepageFeatures from '@site/src/components/HomepageFeatures'; +import Heading from '@theme/Heading'; + +import styles from './index.module.css'; + +function HomepageHeader() { + const { siteConfig } = useDocusaurusContext(); + return ( +
+
+ + {siteConfig.title} + +

{siteConfig.tagline}

+
+ + Get started + +
+
+
+ ); +} + +export default function Home(): JSX.Element { + const { siteConfig } = useDocusaurusContext(); + return ( + + +
+ +
+
+ ); +} diff --git a/docs/src/pages/markdown-page.md b/docs/src/pages/markdown-page.md new file mode 100644 index 0000000..9756c5b --- /dev/null +++ b/docs/src/pages/markdown-page.md @@ -0,0 +1,7 @@ +--- +title: Markdown page example +--- + +# Markdown page example + +You don't need React to write simple standalone pages. diff --git a/docs/static/.nojekyll b/docs/static/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/docs/static/img/docusaurus-social-card.jpg b/docs/static/img/docusaurus-social-card.jpg new file mode 100644 index 0000000..ffcb448 Binary files /dev/null and b/docs/static/img/docusaurus-social-card.jpg differ diff --git a/docs/static/img/docusaurus.png b/docs/static/img/docusaurus.png new file mode 100644 index 0000000..f458149 Binary files /dev/null and b/docs/static/img/docusaurus.png differ diff --git a/docs/static/img/favicon.ico b/docs/static/img/favicon.ico new file mode 100644 index 0000000..c01d54b Binary files /dev/null and b/docs/static/img/favicon.ico differ diff --git a/docs/static/img/logo.svg b/docs/static/img/logo.svg new file mode 100644 index 0000000..9db6d0d --- /dev/null +++ b/docs/static/img/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/img/undraw_docusaurus_mountain.svg b/docs/static/img/undraw_docusaurus_mountain.svg new file mode 100644 index 0000000..af961c4 --- /dev/null +++ b/docs/static/img/undraw_docusaurus_mountain.svg @@ -0,0 +1,171 @@ + + Easy to Use + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/static/img/undraw_docusaurus_react.svg b/docs/static/img/undraw_docusaurus_react.svg new file mode 100644 index 0000000..94b5cf0 --- /dev/null +++ b/docs/static/img/undraw_docusaurus_react.svg @@ -0,0 +1,170 @@ + + Powered by React + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/static/img/undraw_docusaurus_tree.svg b/docs/static/img/undraw_docusaurus_tree.svg new file mode 100644 index 0000000..d9161d3 --- /dev/null +++ b/docs/static/img/undraw_docusaurus_tree.svg @@ -0,0 +1,40 @@ + + Focus on What Matters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/tsconfig.json b/docs/tsconfig.json new file mode 100644 index 0000000..314eab8 --- /dev/null +++ b/docs/tsconfig.json @@ -0,0 +1,7 @@ +{ + // This file is not used in compilation. It is here just for a nice editor experience. + "extends": "@docusaurus/tsconfig", + "compilerOptions": { + "baseUrl": "." + } +} diff --git a/package.json b/package.json index 03cadf4..93b3305 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "dev-ts": "yarn run prepublish && npx ts-node ./dev.ts" }, "repository": "https://github.com/avorty/vulcan-api-js.git", - "author": "Capure", + "homepage": "https://avorty.github.io/vulcan-api-js", + "author": "Avorty", "license": "MIT", "dependencies": { "@babel/runtime": "^7.12.5",