mirror of
https://github.com/C9Glax/tranga.git
synced 2025-02-23 07:40:13 +01:00
Resolve #247
Modify API call: `/v2/Connector/Types` Returns: Dictionary with Connector-Names and supported languages.
This commit is contained in:
parent
73ad881600
commit
18edcef1c3
@ -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.");
|
||||||
|
@ -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);
|
||||||
|
@ -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></sub> `/v2/Connector/<ConnectorName>/GetManga`
|
### <sub></sub> `/v2/Connector/<ConnectorName>/GetManga`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user