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)
{
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) ||
connector is null)
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;
}
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);

View File

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

View File

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