From 7e5fa6ce41aa7d1404110d7895ee338476c17b17 Mon Sep 17 00:00:00 2001 From: Glax Date: Fri, 19 Apr 2024 21:23:15 +0200 Subject: [PATCH] API v2 --- Tranga/Server.cs | 8 +- Tranga/ServerV2.cs | 80 ++++ docs/API_Calls_v2.md | 895 +++++++++++++++++++++++++++++++++++++++++++ docs/Types.md | 41 ++ 4 files changed, 1023 insertions(+), 1 deletion(-) create mode 100644 Tranga/ServerV2.cs create mode 100644 docs/API_Calls_v2.md create mode 100644 docs/Types.md diff --git a/Tranga/Server.cs b/Tranga/Server.cs index 9b99c7a..8a085f9 100644 --- a/Tranga/Server.cs +++ b/Tranga/Server.cs @@ -10,7 +10,7 @@ using Tranga.NotificationConnectors; namespace Tranga; -public class Server : GlobalBase +public partial class Server : GlobalBase { private readonly HttpListener _listener = new (); private readonly Tranga _parent; @@ -68,6 +68,12 @@ public class Server : GlobalBase if(request.Url!.LocalPath.Contains("favicon")) SendResponse(HttpStatusCode.NoContent, response); + if (Regex.IsMatch(request.Url.LocalPath, "")) + { + HandleRequestV2(context); + return; + } + switch (request.HttpMethod) { case "GET": diff --git a/Tranga/ServerV2.cs b/Tranga/ServerV2.cs new file mode 100644 index 0000000..6c115d1 --- /dev/null +++ b/Tranga/ServerV2.cs @@ -0,0 +1,80 @@ +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; + +namespace Tranga; + +public partial class Server +{ + private void HandleRequestV2(HttpListenerContext context) + { + HttpListenerRequest request = context.Request; + HttpListenerResponse response = context.Response; + string path = Regex.Match(request.Url!.LocalPath, @"[A-z0-9]+(\/[A-z0-9]+)*").Value; + + Dictionary requestVariables = GetRequestVariables(request.Url!.Query); //Variables in the URI + Dictionary requestBody = GetRequestBody(request); //Variables in the JSON body + Dictionary requestParams = requestVariables.UnionBy(requestBody, v => v.Key) + .ToDictionary(kv => kv.Key, kv => kv.Value); //The actual variable used for the API + + + switch (request.HttpMethod) + { + case "GET": + HandleGetV2(path, response, requestParams); + break; + case "POST": + HandlePostV2(path, response, requestParams); + break; + case "DELETE": + HandleDeleteV2(path, response, requestParams); + break; + default: + SendResponse(HttpStatusCode.MethodNotAllowed, response); + break; + } + } + + private Dictionary GetRequestBody(HttpListenerRequest request) + { + if (!request.HasEntityBody) + { + Log("No request body"); + return new Dictionary(); + } + Stream body = request.InputStream; + Encoding encoding = request.ContentEncoding; + using StreamReader streamReader = new (body, encoding); + try + { + Dictionary requestBody = + JsonConvert.DeserializeObject>(streamReader.ReadToEnd()) + ?? new(); + return requestBody; + } + catch (JsonException e) + { + Log(e.Message); + } + return new Dictionary(); + } + + private void HandleGetV2(string path, HttpListenerResponse response, + Dictionary requestParameters) + { + throw new NotImplementedException("v2 not implemented yet"); + } + + private void HandlePostV2(string path, HttpListenerResponse response, + Dictionary requestParameters) + { + throw new NotImplementedException("v2 not implemented yet"); + } + + private void HandleDeleteV2(string path, HttpListenerResponse response, + Dictionary requestParameters) + { + throw new NotImplementedException("v2 not implemented yet"); + } +} \ No newline at end of file diff --git a/docs/API_Calls_v2.md b/docs/API_Calls_v2.md new file mode 100644 index 0000000..e81f287 --- /dev/null +++ b/docs/API_Calls_v2.md @@ -0,0 +1,895 @@ + +# Tranga API Calls v2 +This document outlines all different HTTP API calls that Tranga accepts. +Tranga expects specific HTTP methods for its calls and therefore careful attention must be paid when making them. + +`apiUri` refers to your `http(s)://TRANGA.FRONTEND.URI/api`. + +Parameters are included in the HTTP request URI and/or the request body. +The request Body is in JSON key-value-pair format, with all values as strings. +Tranga responses are always in the JSON format within the Response Body. + +Parameters in *italics* are optional + + + + + +### Quick Entry + +* [Connectors](#connectors-suptopsup) +* [Manga](#manga-suptopsup) +* [Jobs](#jobs-suptopsup) +* [Settings](#settings-suptopsup) +* [Library Connectors](#library-connectors-suptopsup) +* [Notification Connectors](#notification-connectors-suptopsup) +* [Miscellaneous](#miscellaneous-suptopsup) + +## Connectors [^top](#top) + +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Connector/Types` + +Returns available Manga Connectors (Scanlation sites) + +
+ Returns +List of strings with Names. +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Connector//GetManga` + +Returns the Manga from the specified Manga Connector. + +
+ Request + +`ConnectorName` is returned in the response of [GET /v2/Connector/Types](#/v2/Connector) + +Use either `title` or `url` Parameter. + +| Parameter | Value | +|-----------|-------------------------------------------------| +| title | Search Term | +| url | Direct link (URL) to the Manga on the used Site | +
+ +
+ Returns + +List of [Manga](Types.md/#Manga) + +| StatusCode | Meaning | +|------------|--------------------------| +| 400 | Connector does not exist | +| 404 | URL/Connector Mismatch | +
+ +## Manga [^top](#top) + +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Manga/` + +Returns the specified Manga. + +
+ Request + +`internalId` is returned in the response of +* [GET /v2/Connector/*ConnectorName*/GetManga](#subsub-v2connectorconnectornamegetmanga) +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +* [GET /v2/Jobs/*jobId*](#subsub-v2jobs) +
+ +
+ Returns + +[Manga](Types.md/#manga) + +| StatusCode | Meaning | +|------------|--------------------------------------------| +| 404 | Manga with `internalId` could not be found | +
+ +### ![DELETE](https://img.shields.io/badge/DELETE-f00) `/v2/Manga/` + +Deletes all associated Jobs for the specified Manga + +
+ Request + +`internalId` is returned in the response of +* [GET /v2/Connector/*ConnectorName*/GetManga](#subsub-v2connectorconnectornamegetmanga) +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +* [GET /v2/Jobs/*jobId*](#subsub-v2jobs) +
+ +
+ Returns + +| StatusCode | Meaning | +|------------|--------------------------------------------| +| 200 | Jobs were deleted | +| 404 | Manga with `internalId` could not be found | +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Manga//Cover` + +Returns the URL for the Cover of the specified Manga. + +
+ Request + +`internalId` is returned in the response of +* [GET /v2/Connector/*ConnectorName*/GetManga](#subsub-v2connectorconnectornamegetmanga) +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +* [GET /v2/Jobs/*jobId*](#subsub-v2jobs) +
+ +
+ Returns + +String with the url. + +| StatusCode | Meaning | +|------------|--------------------------------------------| +| 404 | Manga with `internalId` could not be found | +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Manga//Chapters` + +Returns the Chapter-list for the specified Manga. + +
+ Request + +`internalId` is returned in the response of +* [GET /v2/Connector/*ConnectorName*/GetManga](#subsub-v2connectorconnectornamegetmanga) +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +* [GET /v2/Jobs/*jobId*](#subsub-v2jobs) +
+ +
+ Returns + +List of [Chapters](Types.md/#chapter) + +| StatusCode | Meaning | +|------------|--------------------------------------------| +| 404 | Manga with `internalId` could not be found | +
+ +## Jobs [^top](#top) + +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Jobs` + +Returns all configured Jobs. + +
+ Returns + +List of [Jobs](Types.md#job) +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Jobs/Running` + +Returns all Running Jobs. + +
+ Returns + +List of [Jobs](Types.md#job) +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Jobs/Waiting` + +Returns all Waiting Jobs. + +
+ Returns + +List of [Jobs](Types.md#job) +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Jobs/Monitoring` + +Returns all Monitoring Jobs. + +
+ Returns + +List of [Jobs](Types.md#job) +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Jobs/Create/Monitor/` + +Creates a Monitoring-Job for the specified Manga at the specified Interval. + +
+ Request + +`internalId` is returned in the response of +* [GET /v2/Connector/*ConnectorName*/GetManga](#subsub-v2connectorconnectornamegetmanga) +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +* [GET /v2/Jobs/*jobId*](#subsub-v2jobs) + + | Parameter | Value | + |-----------|--------------------------------------------------------| + | interval | Interval at which the Job is re-run in HH:MM:SS format | +
+ +
+ Returns + +[Job](Types.md/#job) + +| StatusCode | Meaning | +|------------|--------------------------------------------| +| 404 | Manga with `internalId` could not be found | +| 500 | Error parsing interval | +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Jobs/Create/DownloadNewChapters/` + +Creates a Job to check for new Chapters and Download new ones of the specified Manga. + +
+ Request + +`internalId` is returned in the response of +* [GET /v2/Connector/*ConnectorName*/GetManga](#subsub-v2connectorconnectornamegetmanga) +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +* [GET /v2/Jobs/*jobId*](#subsub-v2jobs) +
+ +
+ Returns + +[Job](Types.md/#job) + +| StatusCode | Meaning | +|------------|--------------------------------------------| +| 404 | Manga with `internalId` could not be found | +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Jobs/Create/UpdateMetadata` + +Creates a Job to update the Metadata of all Manga. + +
+ Returns + +[Job](Types.md/#job) +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Jobs/Create/UpdateMetadata/` + +Updates the Metadata of the specified Manga. + +
+ Request + +`internalId` is returned in the response of +* [GET /v2/Connector/*ConnectorName*/GetManga](#subsub-v2connectorconnectornamegetmanga) +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +* [GET /v2/Jobs/*jobId*](#subsub-v2jobs) +
+ +
+ Returns + +[Job](Types.md/#job) + +| StatusCode | Meaning | +|------------|--------------------------------------------| +| 404 | Manga with `internalId` could not be found | +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Job/` + +Returns the specified Job. + +
+ Request + +`jobId` is returned in the response of + +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +
+ +
+ Returns + +[Job](Types.md/#job) + +| StatusCode | Meaning | +|------------|---------------------------------------| +| 404 | Manga with `jobId` could not be found | +
+ +### ![DELETE](https://img.shields.io/badge/DELETE-f00) `/v2/Job/` + +Deletes the specified Job and all descendants. + +
+ Request + +`jobId` is returned in the response of +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +
+ +
+ Returns + +| StatusCode | Meaning | +|------------|---------------------------------------| +| 200 | Job deleted | +| 404 | Manga with `jobId` could not be found | +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Job//Progress` + +Returns the progress the of the specified Job. + +
+ Request + +`jobId` is returned in the response of +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +
+ +
+ Returns + +[ProgressToken](Types.md#progresstoken) + +| StatusCode | Meaning | +|------------|---------------------------------------| +| 404 | Manga with `jobId` could not be found | +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Job//StartNow` + +Starts the specified Job. + +
+ Request + +`jobId` is returned in the response of +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +
+ +
+ Returns + +| StatusCode | Meaning | +|------------|---------------------------------------| +| 200 | Job started | +| 404 | Manga with `jobId` could not be found | +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Job//Cancel` + +Cancels the specified Job, or dequeues it. + +
+ Request + +`jobId` is returned in the response of +* [GET /v2/Jobs](#subsub-v2jobs) +* [GET /v2/Jobs/Running](#subsub-v2jobsrunning) +* [GET /v2/Jobs/Waiting](#subsub-v2jobswaiting) +* [GET /v2/Jobs/Monitoring](#subsub-v2jobsmonitoring) +
+ +
+ Returns + +| StatusCode | Meaning | +|------------|---------------------------------------| +| 200 | Job cancelled | +| 404 | Manga with `jobId` could not be found | +
+ +## Settings [^top](#top) + +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Settings` + +Returns the `settings.json` file. + +
+ Returns + +[Settings](Types.md/#settings) +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Settings/UserAgent` + +Returns the current User Agent used for Requests. + +
+ Returns + +[UserAgent](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Settings/UserAgent` + +Sets the User Agent. If left empty, User Agent is reset to default. + +
+ Request + +| Parameter | Value | +|-----------|----------------------------------------------------------------------------------------| +| value | New [UserAgent](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) | +
+ +
+ Returns +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Settings/RateLimit/Types` + +Returns the configurable Rate-Limits. + +
+ Returns + +List of Rate-Limit-Names. +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Settings/RateLimit` + +Returns the current configuration of Rate-Limits for Requests. + +
+ Returns + +Dictionary of `Rate-Limits` and `Requests per Minute` +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Settings/RateLimit` + +Sets the Rate-Limits for all Requests. If left empty, resets to default Rate-Limits. + +
+ Request + +For each Rate-Limit set as follows: + +| Parameter | Value | +|---------------------------------------|---------------------| +| [Type](#/v2/Settings/RateLimit/Types) | Requests per Minute | + +`Type` is returned by [GET /v2/Settings/RateLimit/Types](#/v2/Settings/RateLimit/Types) +
+ +
+ Returns + +| StatusCode | Meaning | +|------------|--------------------------------| +| 404 | Rate-Limit-Name does not exist | +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Settings/RateLimit/` + +Returns the current Rate-Limit for the Request-Type. + +
+ Request + +`Type` is returned by [GET /v2/Settings/RateLimit/Types](#/v2/Settings/RateLimit/Types) +
+ +
+ Returns + +Integer with Requests per Minute. +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Settings/RateLimit/` + +Sets the Rate-Limit for the Request-Type in Requests per Minute. + +
+ Request + +`Type` is returned by [GET /v2/Settings/RateLimit/Types](#/v2/Settings/RateLimit/Types) + +| Parameter | Value | +|-----------|---------------------| +| value | Requests per Minute | +
+
+ Returns + +| StatusCode | Meaning | +|------------|--------------------------------| +| 404 | Rate-Limit-Name does not exist | +| 500 | Parsing Error | +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Settings/AprilFoolsMode` + +Returns the current state of the April-Fools-Mode setting. + +
+ Returns + +Boolean +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Settings/ApriFoolsMode` + +Enables/Disables April-Fools-Mode. + +
+ Request + +| Parameter | Value | +|-----------|------------| +| value | true/false | +
+ +
+ Returns + +| StatusCode | Meaning | +|------------|--------------------------------| +| 404 | Rate-Limit-Name does not exist | +| 500 | Parsing Error | +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Settings/DownloadLocation` + +Updates the default Download-Location. + +
+ Request + +| Parameter | Value | +|-------------|------------------| +| location | New Folder-Path | +| *moveFiles* | __*true*__/false | +
+ +
+ Returns + + +| StatusCode | Meaning | +|------------|--------------------------| +| 200 | Successfully changed | +| 500 | Files could not be moved | +
+ +## Library Connectors [^top](#top) + +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/LibraryConnector` + +Returns the configured Library-Connectors. + +
+ Returns + +List of [LibraryConnectors](Types.md#libraryconnector) +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/LibraryConnector/Types` + +Returns the available Library-Connector types. + +
+ Returns + +List of String of Names. +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/LibraryConnector/` + +Returns the Library-Connector for the specified Type. + +
+ Request + +`Type` is returned by [GET /v2/LibraryConnector/Types](#/v2/LibraryConnector/Types) +
+ +
+ Returns + +[LibraryConnector](Types.md#libraryconnector) + +| StatusCode | Meaning | +|------------|---------------------------------------| +| 404 | Library Connector Type does not exist | +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/LibraryConnector/` + +Creates a Library-Connector of the specified Type. + +
+ Request + +`Type` is returned by [GET /v2/LibraryConnector/Types](#/v2/LibraryConnector/Types) + +| Parameter | Value | +|-------------|--------------------| +| URL | URL of the Library | + +#### Type specific Parameters (must be included for each) +* Komga + +| Parameter | Value | +|-----------|-------------------------------------------------------------------------------------------------------------------| +| auth | [Base64 encoded Basic-Authentication-String](https://datatracker.ietf.org/doc/html/rfc7617) (`username:password`) | + +* Kavita + +| Parameter | Value | +|-----------|-----------------| +| username | Kavita Username | +| password | Kavita Password | +
+ +
+ Returns + +[LibraryConnector](Types.md#libraryconnector) + +| StatusCode | Meaning | +|------------|----------------------------------| +| 404 | Library Connector does not exist | +| 500 | Parsing Error | +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/LibraryConnector//Test` + +Tests a Library-Connector of the specified Type. + +
+ Request + +`Type` is returned by [GET /v2/LibraryConnector/Types](#/v2/LibraryConnector/Types) + +| Parameter | Value | +|-------------|--------------------| +| URL | URL of the Library | + +#### Type specific Parameters (must be included for each) +* Komga + +| Parameter | Value | +|-----------|-------------------------------------------------------------------------------------------------------------------| +| auth | [Base64 encoded Basic-Authentication-String](https://datatracker.ietf.org/doc/html/rfc7617) (`username:password`) | + +* Kavita + +| Parameter | Value | +|-----------|-----------------| +| username | Kavita Username | +| password | Kavita Password | +
+ +
+ Returns + +| StatusCode | Meaning | +|------------|---------------------------------------| +| 200 | Test successful | +| 404 | Library Connector Type does not exist | +| 408 | Test failed | +| 500 | Parsing Error | +
+ +### ![DELETE](https://img.shields.io/badge/DELETE-f00) `/v2/LibraryConnector/` + +Deletes the Library-Connector of the specified Type. + +
+ Request + +`Type` is returned by [GET /v2/LibraryConnector/Types](#/v2/LibraryConnector/Types) +
+ +
+ Returns + +| StatusCode | Meaning | +|------------|---------------------------------------| +| 200 | Deleted | +| 404 | Library Connector Type does not exist | +
+ +## Notification Connectors [^top](#top) + +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/NotificationConnector` + +Returns the configured Notification-Connectors. + +
+ Returns + +List of [NotificationConnectors](Types.md#notificationconnector) +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/NotificationConnector/Types` + +Returns the available Notification-Connectors. + +
+ Returns + +List of String of Names. +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/NotificationConnector/` + +Returns the configured Notification-Connector of the specified Type. + +
+ Returns + +[Notification Connector](Types.md#notificationconnector) + +| StatusCode | Meaning | +|------------|---------------------------------------| +| 404 | Library Connector Type does not exist | +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/NotificationConnector/` + +Creates a Notification-Connector of the specified Type. + +
+ Request + +`Type` is returned by [GET /v2/NotificationConnector/Types](#/v2/NotificationConnector/Types) + +#### Type specific Parameters (must be included for each) +* Gotify + +| Parameter | Value | +|-----------|---------------------------------------| +| url | URL of the Gotify Instance | +| appToken | AppToken of the configured Gotify App | + +* LunaSea + +| Parameter | Value | +|-----------|-----------------| +| webhook | LunaSea Webhook | + +* Nty + +| Parameter | Value | +|-----------|--------------------------| +| url | URL of the Ntfy Instance | +| auth | Auth-String | +
+ +
+ Returns + +[NotificationConnector](Types.md#notificationconnector) + +| StatusCode | Meaning | +|------------|--------------------------------------------| +| 404 | Notification Connector Type does not exist | +| 500 | Parsing Error | +
+ +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/NotificationConnector//Test` + +Tests a Notification-Connector of the specified Type. + +
+ Request + +`Type` is returned by [GET /v2/NotificationConnector/Types](#/v2/NotificationConnector/Types) + +#### Type specific Parameters (must be included for each) +* Gotify + +| Parameter | Value | +|-----------|---------------------------------------| +| url | URL of the Gotify Instance | +| appToken | AppToken of the configured Gotify App | + +* LunaSea + +| Parameter | Value | +|-----------|-----------------| +| webhook | LunaSea Webhook | + +* Ntfy + +| Parameter | Value | +|-----------|--------------------------| +| url | URL of the Ntfy Instance | +| auth | Auth-String | +
+ +
+ Returns + +| StatusCode | Meaning | +|------------|--------------------------------------------| +| 200 | Test successful | +| 404 | Notification Connector Type does not exist | +| 408 | Test failed | +| 500 | Parsing Error | +
+ +### ![DELETE](https://img.shields.io/badge/DELETE-f00) `/v2/NotificationConnector/` + +Deletes the Notification-Connector of the specified Type. + +
+ Request + +`Type` is returned by [GET /v2/NotificationConnector/Types](#/v2/NotificationConnector/Types) +
+ +
+ Returns + +| StatusCode | Meaning | +|------------|--------------------------------------------| +| 200 | Deleted | +| 404 | Notification Connector Type does not exist | +
+ +## Miscellaneous [^top](#top) + +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/LogFile` + +Returns the current log-file. + +
+ Returns + +The Logfile as Stream. +
+ +### ![GET](https://img.shields.io/badge/GET-0f0) `/v2/Ping` + +Pong! + +### ![POST](https://img.shields.io/badge/POST-00f) `/v2/Ping` + +Pong! diff --git a/docs/Types.md b/docs/Types.md new file mode 100644 index 0000000..9a7ae3d --- /dev/null +++ b/docs/Types.md @@ -0,0 +1,41 @@ +## Manga +```json +{ +} +``` + +## Chapter +```json +{ +} +``` + +## Job +```json +{ +} +``` + +## ProgressToken +```json +{ +} +``` + +## Settings +```json +{ +} +``` + +## LibraryConnector +```json +{ +} +``` + +## NotificationConnector +```json +{ +} +``` \ No newline at end of file