# academical-api-client

> Official Academical API library client for node.js

Latest version **0.1.0** (published 2015-11-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install academical-api-client
pnpm add academical-api-client
yarn add academical-api-client
bun add academical-api-client
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2015-11-16 |
| First published | 2015-11-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Academical |
| Maintainers | academical |
| Keywords | academical, api |

## Links

- npm: https://www.npmjs.com/package/academical-api-client
- Repository: https://github.com/academical-inc/api-client-node
- Homepage: https://api.academical.co
- Issues: https://github.com/academical-inc/api-client-node/issues
- npm.io page: https://npm.io/package/academical-api-client

## Dependencies (1)

- [request](https://npm.io/package/request.md) 2.x.x

## Recent versions

- 0.1.0 (latest) — 2015-11-16

## README

# api-client-node

Official Academical API library client for node.js

__This library is generated by [alpaca](https://github.com/pksunkara/alpaca)__

## Installation

Make sure you have [npm](https://npmjs.org) installed.

```bash
$ npm install academical-api-client
```

#### Versions

Works with [ 0.8 / 0.9 / 0.10 / 0.11 ]

## Usage

```js
var academical = require('academical-api-client');

// Then we instantiate a client (as shown below)
```

### Build a client

__Using this api without authentication gives an error__

##### Authorization header token

```js
var client = academical.client('1a2b3', clientOptions);
```

### Client Options

The following options are available while instantiating a client:

 * __base__: Base url for the api
 * __api_version__: Default version of the api (to be used in url)
 * __user_agent__: Default user-agent for all requests
 * __headers__: Default headers for all requests
 * __request_type__: Default format of the request body

### Response information

__All the callbacks provided to an api call will recieve the response as shown below__

```js
// You can also omit the 'methodOptions' param below
client.klass('args').method('args', methodOptions, function (err, response) {
    if (err) console.log(err);

    response.code;
    // >>> 200

    response.headers;
    // >>> {'x-server': 'apache'}
}
```

##### JSON response

When the response sent by server is __json__, it is decoded into a hash

```js
response.body;
// >>> {'user': 'pksunkara'}
```

### Method Options

The following options are available while calling a method of an api:

 * __api_version__: Version of the api (to be used in url)
 * __headers__: Headers for the request
 * __query__: Query parameters for the url
 * __body__: Body of the request
 * __request_type__: Format of the request body

### Request body information

Set __request_type__ in options to modify the body accordingly

### Schools api

All schools that are using Academical

```js
var schools = client.schools();
```

##### Get a school (GET /schools/:id)

Returns a school object given its ID

The following arguments are required:

 * __id__: ID of the school

```js
schools.get("5593455069702d5d40000095", options, callback);
```

##### Delete a school (DELETE /schools/:id)

Delete a school from the API given its ID

The following arguments are required:

 * __id__: ID of the school

```js
schools.delete("5593455069702d5d40000095", options, callback);
```

##### Get all schedules on a school (GET /schools/:id/schedules)

Returns a list of schedules that have been created in a given school

The following arguments are required:

 * __id__: ID of the school

```js
schools.schedules("5593455069702d5d40000095", options, callback);
```

##### Get all students on a school (GET /schools/:id/students)

Returns a list of students for a given school

The following arguments are required:

 * __id__: ID of the school

```js
schools.students("5593455069702d5d40000095", options, callback);
```

##### Get all sections on a school (GET /schools/:id/sections)

Returns a list of sections for a given school

The following arguments are required:

 * __id__: ID of the school

```js
schools.sections("5593455069702d5d40000095", options, callback);
```

##### Get all teachers registered to a school (GET /schools/:id/teachers)

Return a list of teachers for a given school

The following arguments are required:

 * __id__: ID of the school

```js
schools.teachers("5593455069702d5d40000095", options, callback);
```

##### Create a new school (POST /schools/)

Creates a new school object in Academical. All required parameters must be provided

The following arguments are required:

 * __name__: Name of the school
 * __nickname__: Nickname of the school
 * __locale__: Locale of the school
 * __timezone__: Timezone of the school
 * __departments__: A list of Department objects. Each department should specify a name and faculty_name
 * __identity_providers__: A list of Identify Providers to use with this school
 * __app_ui__: Object describing UI specific parameters for our planner app
 * __terms__: A list containing Term objects. Each term should define a name, a start date and end date.

```js
schools.create(
 "Example University",
 "example-university",
  "en",
 "America/Bogota",
 [{'name': 'Medicine', 'faculty_name' : '' }],
 ["example.edu.co", "facebook"],
 { "info_fields:" [], "search_filters":[], "search_result_fields": [], "summary_fields:"[] },
 [{"end_date":"2015-11-14", "name":"2015-2", "start_date":"2015-07-27"}],
 options
);
```

##### Update a new School (PUT /schools/:id/)

Update a new school in Academical. You must provide all of the required parameters

The following arguments are required:

 * __id__: Generated ID for the school
 * __name__: Name of the school
 * __nickname__: Nickname of the school
 * __locale__: Locale of the school
 * __timezone__: Timezone of the school
 * __departments__: A list of Department objects. Each department should specify a name and faculty_name
 * __identity_providers__: A list of Identify Providers to use with this school
 * __app_ui__: Object describing UI specific parameters for our planner app
 * __terms__: A list containing Term objects. Each term should define a name, a start date and end date.

```js
schools.update(
"5593455069702d5d40000095",
 "Example University",
 "example-university",
  "en",
 "America/Bogota",
 [{'name': 'Medicine', 'faculty_name' : '' }],
 ["example.edu.co", "facebook"],
 { "info_fields:" [], "search_filters":[], "search_result_fields": [], "summary_fields:"[] },
 [{"end_date":"2015-11-14", "name":"2015-2", "start_date":"2015-07-27"}],
 options
);
```

### Section api

Represents the section of a course in a school

```js
var sections = client.sections();
```

##### Get section (GET /sections/:id)

Returns a section object given its ID

The following arguments are required:

 * __id__: ID of the section

```js
sections.get("55a5385969702d1b41020d39", options, callback);
```

##### Delete section (DELETE /sections/:id)

Delete a section given its ID

The following arguments are required:

 * __id__: ID of the section

```js
sections.delete("55a5385969702d1b41020d39", options, callback);
```

##### Create a new section (POST /sections/)

Creates a new section object in Academical. All required parameters must be provided.

The following arguments are required:

 * __course_name__: Name of the course
 * __course_code__: The code of the course which this section belongs to
 * __section_number__: Section number of the course. This is X of Y sections for course K
 * __section_id__: Unique identifier for the section
 * __term__: The term object this section will be taking place in
 * __seats__: Object describing the number of available, taken and total seats for the section
 * __school_id__: ID of the school this section belongs to
 * __events__: A list of events this section takes place on
 * __departments__: List of departments this section belongs to.
 * __credits__: Number of credits this course is worth

```js
sections.create(
  "Medicine 101",
 "MEDI1000",
 "3",
 "16934",
 "See https://academical.readme.io/docs/resources#term-embedded",
 {"available":"", "taken":"", "total":""},
 "5593455069702d5d40000000",
 "See https://academical.readme.io/docs/resources#event-embedded",
 [{ name: "Medicine" faculty_name: "" }],
 "3",
 options
);
```

##### Update a section (PUT /sections/:id)

Update the attributes of a section given its ID as a part of the body of the request

The following arguments are required:

 * __id__: ID of the section
 * __course_name__: Name of the course
 * __course_code__: The code of the course which this section belongs to
 * __section_number__: Section number of the course. This is X of Y sections for course K
 * __section_id__: Unique identifier for the section
 * __term__: The term object this section will be taking place in
 * __seats__: Object describing the number of available, taken and total seats for the section
 * __school_id__: ID of the school this section belongs to
 * __events__: A list of events this section takes place on
 * __departments__: List of departments this section belongs to.
 * __credits__: Number of credits this course is worth

```js
sections.update(
 "5634f74c66c2b7163200a6dc",
  "Medicine 101",
 "MEDI1000",
 "3",
 "16934",
 "See https://academical.readme.io/docs/resources#term-embedded",
 {"available":"", "taken":"", "total":""},
 "5593455069702d5d40000000",
 "See https://academical.readme.io/docs/resources#event-embedded",
 [{ name: "Medicine" faculty_name: "" }],
 "3",
 options
);
```

##### Get the teachers of a section (GET /sections/:id/teachers)

Returns the list of teachers given a section ID

The following arguments are required:

 * __id__: ID of the section

```js
sections.teachers("5634f74c66c2b7163200a6dc", options, callback);
```

##### Get the schedules of a section (GET /sections/:id/schedules)

List of all the schedules with a given section

The following arguments are required:

 * __id__: ID of the section

```js
sections.schedules("5634f74c66c2b7163200a6dc", options, callback);
```

### Teachers api

A teacher in a school.

```js
var teachers = client.teachers();
```

##### Get teacher (GET /teachers/:id)

Get a teacher given its ID

The following arguments are required:

 * __id__: ID of the teacher

```js
teachers.get("5593465369702d5d420059fe", options, callback);
```

##### Delete teacher (DELETE /teachers/:id)

Delete a teacher given its ID

The following arguments are required:

 * __id__: ID of the teacher

```js
teachers.delete("5593465369702d5d420059fe", options, callback);
```

##### Create a new teacher (POST /teachers/)

Create a new teacher in Academical. You must provide all of the required values

The following arguments are required:

 * __name__: Object with the name of the teacher
 * __school_id__: ID of the school which this teacher belongs to

```js
teachers.create({"first":"FELIPE","last":"PENAGOS","middle":"JUAN","other":"SERNA"}, "5593455069702d5d40000000", options, callback);
```

##### Updates a teacher (PUT /teachers/:id)

Update a teacher in Academical. You must provide all of the required parameters

The following arguments are required:

 * __id__: ID of the teacher
 * __name__: Object with the name of the teacher
 * __school_id__: ID of the school which this teacher belongs to

```js
teachers.update("5593465369702d5d420059fe", {"first":"FELIPE","last":"PENAGOS","middle":"JUAN","other":"SERNA"}, "5593455069702d5d40000000", options, callback);
```

## Contributors
Here is a list of [Contributors](https://github.com/academical-inc/api-client-node/contributors)

### TODO

## License
MIT

## Bug Reports
Report [here](https://github.com/academical-inc/api-client-node/issues).

## Contact
Academical (support+developers@academical.co)

---
_Source: https://npm.io/package/academical-api-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
