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

This commit is contained in:
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);