<commit_before># REST API

This document describes the API endpoints of the Consus server.

## Table of Contents

* [rest-api](#rest-api)
    * [Table of contents](#table-of-contents)
    * [POST `/api/item`](#post-apiitem)
    * [GET `/api/item`](#get-apiitem)
    * [DELETE `api/item`](#delete-apiitem)
    * [POST `/api/model`](#post-apimodel)
    * [GET `/api/model`](#get-apimodel)
    * [GET `/api/model/all`](#get-apimodelall)
    * [GET `/api/student`](#get-apistudent)
    * [POST `/api/student`](#post-apistudent)
    * [POST `/api/checkout`](#post-apicheckout)
    * [POST `api/checkin`](#post-apicheckin)

## POST `/api/item`

Create an item.

### Parameters

* `modelAddress`: The identifier of the item's model

### Sample Response

```json
{
    "status": "success",
    "data": {
        "address": "iGwEZUvfA",
        "modelName": "Resistor"
    }
}
```

## GET `/api/item`

Retrieve an item.

### Parameters

* `id`: The item's identifier

### Sample Response

```json
{
    "status": "success",
    "data": {
        "item": {
            "address": "iGwEZUvfA",
            "modelAddress": "m8y7nEtAe",
            "status": "AVAILABLE"
        }
    }
}
```

## DELETE `/api/item`
Delete an item

### Parameters

* `itemAddress`: Address of the item to delete

### Sample Response
The entire list of items the server contains
```json
{
    "status": "success",
    "data": {
        "items": [{
            "address": "iGwEZUvfA",
            "modelAddress": "m8y7nEtAe",
            "status": "AVAILABLE"
        }],
        "modelName": "<NAME OF MODEL THE ITEM BELONGS TO>"
    }
}
```
## POST `/api/model`

Create a model.

### Parameters

* `name`: The name of the model
* `description`: The description of the model
* `manufacturer`: The manufacturer of the model
* `vendor`: The vendor who sold the model
* `location`: Location where the model is stored
* `isFaulty`: Whether the model is faulty of not
* `faultDescription`: Description of the fault
* `price`: Price of one model
* `count`: Amount of this model in stock

### Sample Response

```json
{
    "status": "success",
    "data": {
        "address": "m8y7nEtAe",
        "name": "Resistor",
        "description": "V = IR",
        "manufacturer": "Live",
        "vendor": "Mouzer",
        "location": "Shelf 14",
        "isFaulty": false,
        "faultDescription": "",
        "price": 10.50,
        "count": 20
    }
}
```

## GET `/api/model`

Retrieve a model.

### Parameters

* `id`: The model's identifier

### Sample Response

```json
{
    "status": "success",
    "data": {
        "model": {
            "address": "m8y7nEtAe",
            "name": "Resistor",
            "description": "V = IR",
            "manufacturer": "Pancakes R Us",
            "vendor": "Mouzer",
            "location": "Shelf 14",
            "isFaulty": false,
            "faultDescription": "",
            "price": 10.50,
            "count": 20
        }
    }
}
```

## GET `/api/model/all`

Retrieve all models.


### Sample Response
An array containing each model and its data.
```json
{
    "status": "success",
    "data": {
        "models": [{
            "address": "m8y7nEtAe",
            "name": "Resistor",
            "description": "V = IR",
            "manufacturer": "Pancakes R Us",
            "vendor": "Mouzer",
            "location": "Shelf 14",
            "isFaulty": false,
            "faultDescription": "",
            "price": 10.50,
            "count": 20
        }]
    }
}
```

## GET `/api/student`

Retrieve a student.
<commit_msg>Another `id` -> `address`<commit_after># REST API

This document describes the API endpoints of the Consus server.

## Table of Contents

* [rest-api](#rest-api)
    * [Table of contents](#table-of-contents)
    * [POST `/api/item`](#post-apiitem)
    * [GET `/api/item`](#get-apiitem)
    * [DELETE `api/item`](#delete-apiitem)
    * [POST `/api/model`](#post-apimodel)
    * [GET `/api/model`](#get-apimodel)
    * [GET `/api/model/all`](#get-apimodelall)
    * [GET `/api/student`](#get-apistudent)
    * [POST `/api/student`](#post-apistudent)
    * [POST `/api/checkout`](#post-apicheckout)
    * [POST `api/checkin`](#post-apicheckin)

## POST `/api/item`

Create an item.

### Parameters

* `modelAddress`: The identifier of the item's model

### Sample Response

```json
{
    "status": "success",
    "data": {
        "address": "iGwEZUvfA",
        "modelName": "Resistor"
    }
}
```

## GET `/api/item`

Retrieve an item.

### Parameters

* `id`: The item's identifier

### Sample Response

```json
{
    "status": "success",
    "data": {
        "item": {
            "address": "iGwEZUvfA",
            "modelAddress": "m8y7nEtAe",
            "status": "AVAILABLE"
        }
    }
}
```

## DELETE `/api/item`
Delete an item

### Parameters

* `itemAddress`: Address of the item to delete

### Sample Response
The entire list of items the server contains
```json
{
    "status": "success",
    "data": {
        "items": [{
            "address": "iGwEZUvfA",
            "modelAddress": "m8y7nEtAe",
            "status": "AVAILABLE"
        }],
        "modelName": "<NAME OF MODEL THE ITEM BELONGS TO>"
    }
}
```
## POST `/api/model`

Create a model.

### Parameters

* `name`: The name of the model
* `description`: The description of the model
* `manufacturer`: The manufacturer of the model
* `vendor`: The vendor who sold the model
* `location`: Location where the model is stored
* `isFaulty`: Whether the model is faulty of not
* `faultDescription`: Description of the fault
* `price`: Price of one model
* `count`: Amount of this model in stock

### Sample Response

```json
{
    "status": "success",
    "data": {
        "address": "m8y7nEtAe",
        "name": "Resistor",
        "description": "V = IR",
        "manufacturer": "Live",
        "vendor": "Mouzer",
        "location": "Shelf 14",
        "isFaulty": false,
        "faultDescription": "",
        "price": 10.50,
        "count": 20
    }
}
```

## GET `/api/model`

Retrieve a model.

### Parameters

* `address`: The model's identifier

### Sample Response

```json
{
    "status": "success",
    "data": {
        "model": {
            "address": "m8y7nEtAe",
            "name": "Resistor",
            "description": "V = IR",
            "manufacturer": "Pancakes R Us",
            "vendor": "Mouzer",
            "location": "Shelf 14",
            "isFaulty": false,
            "faultDescription": "",
            "price": 10.50,
            "count": 20
        }
    }
}
```

## GET `/api/model/all`

Retrieve all models.

### Sample Response
An array containing each model and its data.
```json
{
    "status": "success",
    "data": {
        "models": [{
            "address": "m8y7nEtAe",
            "name": "Resistor",
            "description": "V = IR",
            "manufacturer": "Pancakes R Us",
            "vendor": "Mouzer",
            "location": "Shelf 14",
            "isFaulty": false,
            "faultDescription": "",
            "price": 10.50,
            "count": 20
        }]
    }
}
```

## GET `/api/student`

Retrieve a student.

{'fraction_non_alphanumeric': 0.17638810992708917, 'fraction_numerical': 0.009534492428491307, 'mean_word_length': 2.281048758049678, 'pattern_counts': {'":': 110, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1141192', 'n_tokens_mistral': 2578, 'n_tokens_neox': 2387, 'n_words': 614}