Skip to content

Commit

Permalink
Resolve #247
Browse files Browse the repository at this point in the history
Modify API call:
`/v2/Connector/Types`
Returns: Dictionary with Connector-Names and supported languages.
  • Loading branch information
C9Glax committed Sep 16, 2024
1 parent 73ad881 commit 18edcef
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Tranga/Server/v2Connector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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().Contains(groups[1].Value) ||
!_parent.GetConnectors().Keys.Contains(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.");
Expand Down
4 changes: 2 additions & 2 deletions Tranga/Tranga.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public bool TryGetConnector(string name, out MangaConnector? connector)
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);
Expand Down
2 changes: 1 addition & 1 deletion docs/API_Calls_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Returns available Manga Connectors (Scanlation sites)
<details>
<summary>Returns</summary>

List of strings with Names.
Dictionary with Connector-Names and supported languages.
</details>

### <sub>![GET](https://img.shields.io/badge/GET-0f0)</sub> `/v2/Connector/<ConnectorName>/GetManga`
Expand Down

0 comments on commit 18edcef

Please sign in to comment.