# Tankoubon API

## Get all Tankoubons

> Get list of Tankoubons paginated.

```json
{"openapi":"3.1.0","info":{"title":"LANraragi API","version":"0.9.6"},"tags":[{"name":"tankoubons","description":"Endpoints related to Tankoubons."}],"servers":[{"url":"https://lrr.tvc-16.science/api"}],"paths":{"/tankoubons":{"get":{"operationId":"getTankoubonList","summary":"Get all Tankoubons","description":"Get list of Tankoubons paginated.","tags":["tankoubons"],"parameters":[{"name":"page","in":"query","required":false,"description":"Page of the list of Tankoubons.  \nThe amount of tanks per page depends on the server `archives_per_page` setting.","schema":{"type":"integer"}}],"responses":{"200":{"description":"Tankoubons","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"array","items":{"$ref":"#/components/schemas/TankoubonMetadataJson"}},"total":{"type":"integer","description":"Total count of Tankoubons on the server"},"filtered":{"type":"integer","description":"Number of Tankoubons on the current page"}}}}}}}}}},"components":{"schemas":{"TankoubonMetadataJson":{"type":"object","description":"Tankoubon metadata","required":["tankid"],"properties":{"archives":{"type":"array","description":"Array of archive IDs","items":{"type":"string","minLength":40,"maxLength":40}},"tankid":{"type":"string","description":"ID of the tankoubon"},"name":{"type":"string","description":"Name of the tankoubon"}}}}}}
```

## 🔑 Create a Tankoubon

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

```json
{"openapi":"3.1.0","info":{"title":"LANraragi API","version":"0.9.6"},"tags":[{"name":"tankoubons","description":"Endpoints related to Tankoubons."}],"servers":[{"url":"https://lrr.tvc-16.science/api"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","name":"Authorization","in":"header","description":"Use Authorization: Bearer <base64(api_key)>"}},"schemas":{"OperationResponse":{"type":"object","required":["operation","success"],"properties":{"operation":{"type":"string","description":"Name of operation"},"error":{"type":"string","description":"Error message if any"},"successMessage":{"type":"string","description":"Success message if any"},"success":{"type":"integer","description":"Returns 1 if operation was successful, else 0","enum":[0,1]}}}}},"paths":{"/tankoubons":{"put":{"operationId":"createTankoubon","summary":"🔑 Create a Tankoubon","description":"Create a new Tankoubon or update the name of an existing one.","tags":["tankoubons"],"requestBody":{"required":false,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Name of the Tankoubon"},"tankid":{"type":"string","description":"ID of an existing Tankoubon, if you want to change its name."}}}},"multipart/form-data":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Name of the Tankoubon"},"tankid":{"type":"string","description":"ID of an existing Tankoubon, if you want to change its name."}}}}}},"responses":{"200":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"operation":{"type":"string","enum":["create_tankoubon"]},"tankoubon_id":{"type":"string","description":"ID of the created/modified Tankoubon"},"success":{"type":"integer","enum":[0,1]}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}}}}}}}
```

## Get a single Tankoubon

> Get the details of the specified tankoubon ID, with the archives list paginated.  \
> The amount of archives per page depends on the server \`archives\_per\_page\` setting.

```json
{"openapi":"3.1.0","info":{"title":"LANraragi API","version":"0.9.6"},"tags":[{"name":"tankoubons","description":"Endpoints related to Tankoubons."}],"servers":[{"url":"https://lrr.tvc-16.science/api"}],"paths":{"/tankoubons/{id}":{"get":{"operationId":"getTankoubon","summary":"Get a single Tankoubon","description":"Get the details of the specified tankoubon ID, with the archives list paginated.  \nThe amount of archives per page depends on the server `archives_per_page` setting.","tags":["tankoubons"],"parameters":[{"name":"id","in":"path","required":true,"description":"ID of the Tankoubon desired","schema":{"type":"string"}},{"name":"include_full_data","in":"query","required":false,"description":"If set to true, a `full_data` array will be added to the response with full Archive metadata.","schema":{"type":"boolean"}},{"name":"page","in":"query","required":false,"default":0,"description":"Page of the Archives list. You can use -1 to return all archives if needed.","schema":{"type":"integer"}}],"responses":{"200":{"description":"Tankoubon","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object","properties":{"archives":{"type":"array","description":"Paginated list of archive IDs or tankoubon IDs.","items":{"type":"string","oneOf":[{"minLength":40,"maxLength":40,"pattern":"^[0-9a-f]{40}$"},{"minLength":15,"maxLength":15,"pattern":"^TANK_[0-9]{10}$"}]},"uniqueItems":true},"full_data":{"type":"array","items":{"$ref":"#/components/schemas/ArchiveMetadataJson"}}}},"total":{"type":"integer","description":"The total amount of archives in this Tankoubon."},"filtered":{"type":"integer","description":"The amount of archives in the current page."}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}}}}}},"components":{"schemas":{"ArchiveMetadataJson":{"type":"object","description":"JSON object for archive metadata for most API responses","required":["arcid","title","filename","tags","isnew","extension","progress","pagecount","lastreadtime","size"],"properties":{"arcid":{"type":"string","description":"Unique identifier for the archive (40-char SHA1) or tankoubon (15-char TANK_* ID)","oneOf":[{"minLength":40,"maxLength":40,"pattern":"^[0-9a-f]{40}$"},{"minLength":15,"maxLength":15,"pattern":"^TANK_[0-9]{10}$"}]},"title":{"type":"string","description":"Title of the archive"},"filename":{"type":"string","description":"Filename of the archive"},"tags":{"type":"string","description":"Comma-separated list of tags associated with the archive"},"summary":{"type":"string","nullable":true,"description":"Summary description of the archive"},"isnew":{"oneOf":[{"type":"boolean"},{"type":"string"}],"nullable":true,"description":"Whether the archive is newly added."},"extension":{"type":"string","description":"File extension of the archive"},"progress":{"type":"integer","description":"Reading progress (page number)"},"pagecount":{"type":"integer","description":"Total number of pages in the archive"},"lastreadtime":{"type":"integer","description":"Unix timestamp of when the archive was last read"},"size":{"type":"integer","description":"Size of the archive in bytes"},"toc":{"type":"array","description":"Table of contents for the archive"}}},"OperationResponse":{"type":"object","required":["operation","success"],"properties":{"operation":{"type":"string","description":"Name of operation"},"error":{"type":"string","description":"Error message if any"},"successMessage":{"type":"string","description":"Success message if any"},"success":{"type":"integer","description":"Returns 1 if operation was successful, else 0","enum":[0,1]}}}}}}
```

## 🔑 Update Tankoubon metadata/contents

> Modify the full metadata (name, summary, additional tags) or the contents of a Tankoubon.  \
> If you only need to change the name of Tank, consider just using PUT \`/api/tankoubons\`.  \
> \
> Note: If there is no need to update something in one of the \`data\` keys, do not send the key -- This otherwise can result in unwanted results.

```json
{"openapi":"3.1.0","info":{"title":"LANraragi API","version":"0.9.6"},"tags":[{"name":"tankoubons","description":"Endpoints related to Tankoubons."}],"servers":[{"url":"https://lrr.tvc-16.science/api"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","name":"Authorization","in":"header","description":"Use Authorization: Bearer <base64(api_key)>"}},"schemas":{"OperationResponse":{"type":"object","required":["operation","success"],"properties":{"operation":{"type":"string","description":"Name of operation"},"error":{"type":"string","description":"Error message if any"},"successMessage":{"type":"string","description":"Success message if any"},"success":{"type":"integer","description":"Returns 1 if operation was successful, else 0","enum":[0,1]}}}}},"paths":{"/tankoubons/{id}":{"put":{"operationId":"updateTankoubon","summary":"🔑 Update Tankoubon metadata/contents","description":"Modify the full metadata (name, summary, additional tags) or the contents of a Tankoubon.  \nIf you only need to change the name of Tank, consider just using PUT `/api/tankoubons`.  \n\nNote: If there is no need to update something in one of the `data` keys, do not send the key -- This otherwise can result in unwanted results.","tags":["tankoubons"],"parameters":[{"name":"id","in":"path","required":true,"description":"ID of the Tankoubon to update.","schema":{"type":"string"}}],"requestBody":{"required":true,"description":"Json with 2 optional keys \"archives\" and \"metadata\"","content":{"application/json":{"schema":{"type":"object","properties":{"archives":{"description":"Ordered array with the IDs of the archives.","type":"array","items":{"type":"string","minLength":40,"maxLength":40}},"metadata":{"description":"Metadata parameters -- All are optional.","type":"object","properties":{"name":{"type":"string","description":"Name of the Tankoubon"},"summary":{"type":"string","description":"Summary of the Tankoubon"},"tags":{"type":"string","description":"Additional tags for the Tankoubon, in LRR comma-separated format."}}}}}}}},"responses":{"200":{"description":"Success response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}},"423":{"description":"The Tankoubon is currently locked for modification","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}}}}}}}
```

## 🔑 Delete Tankoubon

> Remove a Tankoubon from the server. This doesn't delete underlying Archives.

```json
{"openapi":"3.1.0","info":{"title":"LANraragi API","version":"0.9.6"},"tags":[{"name":"tankoubons","description":"Endpoints related to Tankoubons."}],"servers":[{"url":"https://lrr.tvc-16.science/api"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","name":"Authorization","in":"header","description":"Use Authorization: Bearer <base64(api_key)>"}},"schemas":{"OperationResponse":{"type":"object","required":["operation","success"],"properties":{"operation":{"type":"string","description":"Name of operation"},"error":{"type":"string","description":"Error message if any"},"successMessage":{"type":"string","description":"Success message if any"},"success":{"type":"integer","description":"Returns 1 if operation was successful, else 0","enum":[0,1]}}}}},"paths":{"/tankoubons/{id}":{"delete":{"operationId":"deleteTankoubon","summary":"🔑 Delete Tankoubon","description":"Remove a Tankoubon from the server. This doesn't delete underlying Archives.","tags":["tankoubons"],"responses":{"200":{"description":"Success response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}},"423":{"description":"The Tankoubon is currently locked for modification","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}}}}}}}
```

## 🔑 Add an Archive to a Tankoubon

> Append an archive at the final position of a Tankoubon.

```json
{"openapi":"3.1.0","info":{"title":"LANraragi API","version":"0.9.6"},"tags":[{"name":"tankoubons","description":"Endpoints related to Tankoubons."}],"servers":[{"url":"https://lrr.tvc-16.science/api"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","name":"Authorization","in":"header","description":"Use Authorization: Bearer <base64(api_key)>"}},"schemas":{"OperationResponse":{"type":"object","required":["operation","success"],"properties":{"operation":{"type":"string","description":"Name of operation"},"error":{"type":"string","description":"Error message if any"},"successMessage":{"type":"string","description":"Success message if any"},"success":{"type":"integer","description":"Returns 1 if operation was successful, else 0","enum":[0,1]}}}}},"paths":{"/tankoubons/{id}/{archive}":{"put":{"operationId":"addToTankoubon","summary":"🔑 Add an Archive to a Tankoubon","description":"Append an archive at the final position of a Tankoubon.","tags":["tankoubons"],"parameters":[{"name":"id","in":"path","required":true,"description":"ID of the Tankoubon to update.","schema":{"type":"string"}},{"name":"archive","in":"path","required":true,"description":"ID of the Archive to append.","schema":{"type":"string","minLength":40,"maxLength":40}}],"responses":{"200":{"description":"Success response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}},"423":{"description":"The Tankoubon is currently locked for modification","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}}}}}}}
```

## DELETE /tankoubons/{id}/{archive}

> 🔑 Remove an Archive from a Tankoubon

```json
{"openapi":"3.1.0","info":{"title":"LANraragi API","version":"0.9.6"},"tags":[{"name":"tankoubons","description":"Endpoints related to Tankoubons."}],"servers":[{"url":"https://lrr.tvc-16.science/api"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","name":"Authorization","in":"header","description":"Use Authorization: Bearer <base64(api_key)>"}},"schemas":{"OperationResponse":{"type":"object","required":["operation","success"],"properties":{"operation":{"type":"string","description":"Name of operation"},"error":{"type":"string","description":"Error message if any"},"successMessage":{"type":"string","description":"Success message if any"},"success":{"type":"integer","description":"Returns 1 if operation was successful, else 0","enum":[0,1]}}}}},"paths":{"/tankoubons/{id}/{archive}":{"delete":{"operationId":"removeFromTankoubon","summary":"🔑 Remove an Archive from a Tankoubon","tags":["tankoubons"],"parameters":[{"name":"id","in":"path","required":true,"description":"ID of the Tankoubon to update.","schema":{"type":"string"}},{"name":"archive","in":"path","required":true,"description":"ID of the Archive to remove.","schema":{"type":"string","minLength":40,"maxLength":40}}],"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}},"423":{"description":"The Tankoubon is currently locked for modification","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationResponse"}}}}}}}}}
```
