-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
70 changed files
with
1,670 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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=<Your GitHub username> 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"label": "Contributing", | ||
"position": 5, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "Some details on how to contribute to the project." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"label": "Getting started", | ||
"position": 1, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "How to get started with the SDK" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"label": "Methods", | ||
"position": 2, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "All methods" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}) | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}) | ||
}) | ||
``` |
Oops, something went wrong.