# Tankoubon API

## Get all tankoubons

<mark style="color:blue;">`GET`</mark> `http://lrr.tvc-16.science/api/tankoubons`

Get list of Tankoubons paginated.

#### Query Parameters

| Name | Type   | Description                     |
| ---- | ------ | ------------------------------- |
| page | string | Page of the list of Tankoubons. |

{% tabs %}
{% tab title="200 " %}
```javascript
{
    "filtered": 2,
    "result": [
        {
            "archives": [
                "28697b96f0ac5858be2614ed10ca47742c9522fd",
                "4857fd2e7c00db8b0af0337b94055d8445118630",
                "fa74bc15e7dd2b6ec0dc2e10cc7cd4942867318a"
            ],
            "id": "TANK_1688616437",
            "name": "Test 1",
            "summary": "",
            "tags": ""
        },
        {
            "archives": [
                "fa74bc15e7dd2b6ec0dc2e10cc7cd4942867318a"
            ],
            "id": "TANK_1688693913",
            "name": "Test 2",
            "summary": "",
            "tags": ""
        }
    ],
    "total": 2
}
```
{% endtab %}
{% endtabs %}

## Get a single tankoubon

<mark style="color:blue;">`GET`</mark> `http://lrr.tvc-16.science/api/tankoubons/:id`

Get the details of the specified tankoubon ID, with the archives list paginated.

#### Path Parameters

| Name                                 | Type   | Description                  |
| ------------------------------------ | ------ | ---------------------------- |
| id<mark style="color:red;">\*</mark> | string | ID of the Tankoubon desired. |

#### Query Parameters

| Name                | Type   | Description                                                      |
| ------------------- | ------ | ---------------------------------------------------------------- |
| include\_full\_data | string | If set in 1, it appends a full\_data array with Archive objects. |
| page                | string | Page of the Archives list.                                       |

{% tabs %}
{% tab title="200 include_full_data = 0" %}
```javascript
{
    "filtered": 3,
    "result": {
        "archives": [
            "fa74bc15e7dd2b6ec0dc2e10cc7cd4942867318a",
            "28697b96f0ac5858be2614ed10ca47742c9522fd",
            "4857fd2e7c00db8b0af0337b94055d8445118630"
        ],
        "id": "TANK_1688616437",
        "name": "Test 1",
        "summary": "",
        "tags": ""
    },
    "total": 3
}
```
{% endtab %}

{% tab title="200 include_full_data = 1" %}
```javascript
{
    "filtered": 3,
    "result": {
        "archives": [
            "fa74bc15e7dd2b6ec0dc2e10cc7cd4942867318a",
            "28697b96f0ac5858be2614ed10ca47742c9522fd",
            "4857fd2e7c00db8b0af0337b94055d8445118630"
        ],
        "full_data": [
            {
                "arcid": "fa74bc15e7dd2b6ec0dc2e10cc7cd4942867318a",
                "extension": "zip",
                "isnew": "true",
                "lastreadtime": 0,
                "pagecount": 30,
                "progress": 0,
                "tags": "date_added:1688608157",
                "lastreadtime": 0,
                "title": "(C95) [wadamemo (WADA Rco)] Fate GO MEMO 3 (Fate Grand Order)"
            },
            {
                "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",
                "extension": "zip",
                "isnew": "true",
                "lastreadtime": 0,
                "pagecount": 30,
                "progress": 0,
                "tags": "date_added:1688608157",
                "lastreadtime": 0,
                "title": "FateGOMEMO"
            },
            {
                "arcid": "4857fd2e7c00db8b0af0337b94055d8445118630",
                "extension": "zip",
                "isnew": "true",
                "lastreadtime": 0,
                "pagecount": 26,
                "progress": 0,
                "tags": "date_added:1688608157",
                "lastreadtime": 0,
                "title": "gits (2)"
            }
        ],
        "id": "TANK_1688616437",
        "name": "Test 1",
        "summary": "",
        "tags": ""
    },
    "total": 3
}
```
{% endtab %}

{% tab title="400 " %}
```javascript
{
  "error": "The given tankoubon does not exist.",
  "operation": "get_tankoubon",
  "success": 0
}
```
{% endtab %}
{% endtabs %}

## 🔑Create a Tankoubon

<mark style="color:orange;">`PUT`</mark> `http://lrr.tvc-16.science/api/tankoubons`

Create a new Tankoubon or updated the name of an existing one.

#### Query Parameters

| Name                                   | Type   | Description           |
| -------------------------------------- | ------ | --------------------- |
| name<mark style="color:red;">\*</mark> | string | Name of the Category. |

{% tabs %}
{% tab title="200 " %}
```javascript
{
    "operation": "create_tankoubon",
    "success": 1,
    "tankoubon_id": "TANK_1690056313"
}
```
{% endtab %}

{% tab title="400 " %}
```javascript
{
  "error": "Tankoubon name not specified.",
  "operation": "create_tankoubon",
  "success": 0
}
```
{% endtab %}
{% endtabs %}

## 🔑Update a Tankoubon

<mark style="color:orange;">`PUT`</mark> `http://lrr.tvc-16.science/api/tankoubons/:id`

Update a Tankoubon.

#### Path Parameters

| Name                                 | Type   | Description                    |
| ------------------------------------ | ------ | ------------------------------ |
| id<mark style="color:red;">\*</mark> | string | ID of the Tankoubon to update. |

#### Request Body

| Name                                       | Type | Description                                                                                                                                                                                                                                                                                                                                                  |
| ------------------------------------------ | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| archives<mark style="color:red;">\*</mark> | json | <p>Json with 2 optional keys "archives" and "metadata" defining:</p><ul><li>archives: Ordered array with the IDs of the archives.</li><li>metadata: Json with the metadata parameters: name, summary, tags.</li></ul><p>Note: If there is no need to update something in one of the keys, do not send the key, otherwise can result on unwanted results.</p> |

{% tabs %}
{% tab title="200 " %}
```javascript
{
    "error": "",
    "operation": "update_tankoubon",
    "success": 1,
    "successMessage": "Updated tankoubon \"Test 1\"!"
}
```
{% endtab %}

{% tab title="400 " %}
```javascript
{
  "error": "rr doesn't exist in the database!",
  "operation": "update_tankoubon",
  "success": 0
}
```
{% endtab %}

{% tab title="423 locked resource" %}
```javascript
{
  "operation": "upload",
  "error": "Locked resource: TANK_1750145148",
  "success": 0
}
```
{% endtab %}
{% endtabs %}

## 🔑Add an archive to a Tankoubon

<mark style="color:orange;">`PUT`</mark> `http://lrr.tvc-16.science/api/tankoubons/:id/:archive`

Append an archive at the final position of a Tankoubon.

#### Path Parameters

| Name                                      | Type   | Description                    |
| ----------------------------------------- | ------ | ------------------------------ |
| id<mark style="color:red;">\*</mark>      | string | ID of the Tankoubon to update. |
| archive<mark style="color:red;">\*</mark> | string | ID of the Archive to append.   |

{% tabs %}
{% tab title="200 " %}
```javascript
{
    "error": "",
    "operation": "add_to_tankoubon",
    "success": 1,
    "successMessage": "Added \"(C95) [wadamemo (WADA Rco)] Fate GO MEMO 3 (Fate Grand Order)\" to tankoubon \"Test 1\"!"
}
```
{% endtab %}

{% tab title="400 " %}
```javascript
{
  "error": "rr doesn't exist in the database!",
  "operation": "add_to_tankoubon",
  "success": 0
}
```
{% endtab %}

{% tab title="423 locked resource" %}
```javascript
{
  "operation": "upload",
  "error": "Locked resource: TANK_1750145178",
  "success": 0
}
```
{% endtab %}
{% endtabs %}

## 🔑Remove an archive from a Tankoubon

<mark style="color:red;">`DELETE`</mark> `http://lrr.tvc-16.science/api/tankoubons/:id/:archive`

Remove an archive from a Tankoubon.

#### Path Parameters

| Name                                      | Type   | Description                    |
| ----------------------------------------- | ------ | ------------------------------ |
| id<mark style="color:red;">\*</mark>      | string | ID of the Tankoubon to update. |
| archive<mark style="color:red;">\*</mark> | string | ID of the archive to remove.   |

{% tabs %}
{% tab title="200 " %}
```javascript
{
    "error": "",
    "operation": "remove_from_tankoubon",
    "success": 1,
    "successMessage": "Removed \"(C95) [wadamemo (WADA Rco)] Fate GO MEMO 3 (Fate Grand Order)\" from tankoubon \"Test 1\"!"
}
```
{% endtab %}

{% tab title="400 " %}
```javascript
{
  "error": "rr doesn't exist in the database!",
  "operation": "remove_from_tankoubon",
  "success": 0
}
```
{% endtab %}

{% tab title="423 locked resource" %}
```javascript
{
  "operation": "upload",
  "error": "Locked resource: TANK_1750145189",
  "success": 0
}
```
{% endtab %}
{% endtabs %}

## 🔑Delete a Tankoubon

<mark style="color:red;">`DELETE`</mark> `http://lrr.tvc-16.science/api/tankoubons/:id`

Remove a Tankoubon.

#### Path Parameters

| Name                                 | Type   | Description                    |
| ------------------------------------ | ------ | ------------------------------ |
| id<mark style="color:red;">\*</mark> | string | ID of the Tankoubon to delete. |

{% tabs %}
{% tab title="200 " %}
```javascript
{
    "error": "",
    "operation": "delete_tankoubon",
    "success": 1,
    "successMessage": null
}
```
{% endtab %}

{% tab title="423 locked resource" %}
```javascript
{
  "operation": "upload",
  "error": "Locked resource: TANK_1750145097",
  "success": 0
}
```
{% endtab %}
{% endtabs %}
