Modify API call:
`/v2/Connector/Types`
Returns: Dictionary with Connector-Names and supported languages.
This commit is contained in:
Glax 2024-09-16 21:25:08 +02:00
parent 73ad881600
commit 18edcef1c3
3 changed files with 4 additions and 4 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().Contains(groups[1].Value) || !_parent.GetConnectors().Keys.Contains(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

@ -49,9 +49,9 @@ public partial class Tranga : GlobalBase
return connector is not null; return connector is not null;
} }
public IEnumerable<string> GetConnectors() public Dictionary<string, string[]> GetConnectors()
{ {
return _connectors.Select(c => c.name); return _connectors.ToDictionary(c => c.name, c => c.SupportedLanguages);
} }
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>
List of strings with Names. Dictionary with Connector-Names and supported languages.
</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`