Change return type of api request to get Connectors to get connector-list instead of dictionary

This commit is contained in:
Glax 2024-10-17 21:03:37 +02:00
parent d80fcd9039
commit 225db8beda
4 changed files with 22 additions and 12 deletions

View File

@ -14,7 +14,7 @@ public partial class Server
private ValueTuple<HttpStatusCode, object?> GetV2ConnectorConnectorNameGetManga(GroupCollection groups, Dictionary<string, string> requestParameters) private ValueTuple<HttpStatusCode, object?> GetV2ConnectorConnectorNameGetManga(GroupCollection groups, Dictionary<string, string> requestParameters)
{ {
if(groups.Count < 1 || if(groups.Count < 1 ||
!_parent.GetConnectors().Keys.Contains(groups[1].Value) || !_parent.GetConnectors().Any(mangaConnector => mangaConnector.name == groups[1].Value)||
!_parent.TryGetConnector(groups[1].Value, out MangaConnector? connector) || !_parent.TryGetConnector(groups[1].Value, out MangaConnector? connector) ||
connector is null) connector is null)
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.BadRequest, $"Connector '{groups[1].Value}' does not exist."); return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.BadRequest, $"Connector '{groups[1].Value}' does not exist.");

View File

@ -50,9 +50,9 @@ public partial class Tranga : GlobalBase
return connector is not null; return connector is not null;
} }
public Dictionary<string, string[]> GetConnectors() public List<MangaConnector> GetConnectors()
{ {
return _connectors.ToDictionary(c => c.name, c => c.SupportedLanguages); return _connectors.ToList();
} }
public Manga? GetPublicationById(string internalId) => GetCachedManga(internalId); public Manga? GetPublicationById(string internalId) => GetCachedManga(internalId);

View File

@ -34,7 +34,7 @@ Returns available Manga Connectors (Scanlation sites)
<details> <details>
<summary>Returns</summary> <summary>Returns</summary>
Dictionary with Connector-Names and supported languages. List of [Connectors](Types.md#Connector)
</details> </details>
### <sub>![GET](https://img.shields.io/badge/GET-0f0)</sub> `/v2/Connector/<ConnectorName>/GetManga` ### <sub>![GET](https://img.shields.io/badge/GET-0f0)</sub> `/v2/Connector/<ConnectorName>/GetManga`

View File

@ -1,41 +1,51 @@
## Manga ## Connector
```json
```
{ {
"name": string,
"SupportedLanguages": string[]
}
```
## Manga
```
{
} }
``` ```
## Chapter ## Chapter
```json ```
{ {
} }
``` ```
## Job ## Job
```json ```
{ {
} }
``` ```
## ProgressToken ## ProgressToken
```json ```
{ {
} }
``` ```
## Settings ## Settings
```json ```
{ {
} }
``` ```
## LibraryConnector ## LibraryConnector
```json ```
{ {
} }
``` ```
## NotificationConnector ## NotificationConnector
```json ```
{ {
} }
``` ```