Add Endpoint POST /v2/Manga/internalId/ignoreChaptersBelow #167
This commit is contained in:
parent
061da1b4bf
commit
8887cea718
@ -29,6 +29,7 @@ public partial class Server : GlobalBase, IDisposable
|
|||||||
new ("GET", @"/v2/Manga/([-A-Za-z0-9]*={0,3})/Cover", GetV2MangaInternalIdCover),
|
new ("GET", @"/v2/Manga/([-A-Za-z0-9]*={0,3})/Cover", GetV2MangaInternalIdCover),
|
||||||
new ("GET", @"/v2/Manga/([-A-Za-z0-9]*={0,3})/Chapters", GetV2MangaInternalIdChapters),
|
new ("GET", @"/v2/Manga/([-A-Za-z0-9]*={0,3})/Chapters", GetV2MangaInternalIdChapters),
|
||||||
new ("GET", @"/v2/Manga/([-A-Za-z0-9]*={0,3})/Chapters/Latest", GetV2MangaInternalIdChaptersLatest),
|
new ("GET", @"/v2/Manga/([-A-Za-z0-9]*={0,3})/Chapters/Latest", GetV2MangaInternalIdChaptersLatest),
|
||||||
|
new ("POST", @"/v2/Manga/([-A-Za-z0-9]*={0,3})/ignoreChaptersBelow", PostV2MangaInternalIdIgnoreChaptersBelow),
|
||||||
new ("GET", @"/v2/Jobs", GetV2Jobs),
|
new ("GET", @"/v2/Jobs", GetV2Jobs),
|
||||||
new ("GET", @"/v2/Jobs/Running", GetV2JobsRunning),
|
new ("GET", @"/v2/Jobs/Running", GetV2JobsRunning),
|
||||||
new ("GET", @"/v2/Jobs/Waiting", GetV2JobsWaiting),
|
new ("GET", @"/v2/Jobs/Waiting", GetV2JobsWaiting),
|
||||||
|
@ -76,4 +76,20 @@ public partial class Server
|
|||||||
};
|
};
|
||||||
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.OK, latest);
|
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.OK, latest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ValueTuple<HttpStatusCode, object?> PostV2MangaInternalIdIgnoreChaptersBelow(GroupCollection groups, Dictionary<string, string> requestParameters)
|
||||||
|
{
|
||||||
|
if(groups.Count < 1 ||
|
||||||
|
!_parent.TryGetPublicationById(groups[1].Value, out Manga? manga) ||
|
||||||
|
manga is null)
|
||||||
|
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.NotFound, $"Manga with ID '{groups[1].Value} could not be found.'");
|
||||||
|
if (requestParameters.TryGetValue("startChapter", out string? startChapterStr) &&
|
||||||
|
float.TryParse(startChapterStr, out float startChapter))
|
||||||
|
{
|
||||||
|
Manga manga1 = manga.Value;
|
||||||
|
manga1.ignoreChaptersBelow = startChapter;
|
||||||
|
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.OK, null);
|
||||||
|
}else
|
||||||
|
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.InternalServerError, "Parameter 'startChapter' missing, or failed to parse.");
|
||||||
|
}
|
||||||
}
|
}
|
@ -195,6 +195,30 @@ Returns the latest Chapter of the specified Manga.
|
|||||||
| 404 | Manga with `internalId` could not be found |
|
| 404 | Manga with `internalId` could not be found |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### <sub>![POST](https://img.shields.io/badge/POST-00f)</sub> `/v2/Manga/<internalId>/ignoreChaptersBelow`
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Request</summary>
|
||||||
|
|
||||||
|
`internalId` is returned in the response of
|
||||||
|
* [GET /v2/Manga](#-v2manga)
|
||||||
|
* [GET /v2/Connector/*ConnectorName*/GetManga](#-v2connectorconnectornamegetmanga)
|
||||||
|
* [GET /v2/Job/*jobId*](#-v2jobjobid)
|
||||||
|
|
||||||
|
| Parameter | Value |
|
||||||
|
|--------------|----------------------------|
|
||||||
|
| startChapter | Chapter-number to start at |
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Returns</summary>
|
||||||
|
|
||||||
|
| StatusCode | Meaning |
|
||||||
|
|------------|--------------------------------------------|
|
||||||
|
| 404 | Manga with `internalId` could not be found |
|
||||||
|
| 500 | Parsing Error |
|
||||||
|
</details>
|
||||||
|
|
||||||
## Jobs <sup>[^top](#top)</sup>
|
## Jobs <sup>[^top](#top)</sup>
|
||||||
|
|
||||||
### <sub>![GET](https://img.shields.io/badge/GET-0f0)</sub> `/v2/Jobs`
|
### <sub>![GET](https://img.shields.io/badge/GET-0f0)</sub> `/v2/Jobs`
|
||||||
|
Loading…
Reference in New Issue
Block a user