Add LibraryConnector.Test to see if requests can be made to endpoint.
This commit is contained in:
parent
51a26a3cba
commit
783f229a6a
@ -67,7 +67,15 @@ public class Kavita : LibraryConnector
|
|||||||
foreach (KavitaLibrary lib in GetLibraries())
|
foreach (KavitaLibrary lib in GetLibraries())
|
||||||
NetClient.MakePost($"{baseUrl}/api/Library/scan?libraryId={lib.id}", "Bearer", auth, logger);
|
NetClient.MakePost($"{baseUrl}/api/Library/scan?libraryId={lib.id}", "Bearer", auth, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal override bool Test()
|
||||||
|
{
|
||||||
|
foreach (KavitaLibrary lib in GetLibraries())
|
||||||
|
if (NetClient.MakePost($"{baseUrl}/api/Library/scan?libraryId={lib.id}", "Bearer", auth, logger))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches all libraries available to the user
|
/// Fetches all libraries available to the user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -32,6 +32,14 @@ public class Komga : LibraryConnector
|
|||||||
NetClient.MakePost($"{baseUrl}/api/v1/libraries/{lib.id}/scan", "Basic", auth, logger);
|
NetClient.MakePost($"{baseUrl}/api/v1/libraries/{lib.id}/scan", "Basic", auth, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal override bool Test()
|
||||||
|
{
|
||||||
|
foreach (KomgaLibrary lib in GetLibraries())
|
||||||
|
if (NetClient.MakePost($"{baseUrl}/api/v1/libraries/{lib.id}/scan", "Basic", auth, logger))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches all libraries available to the user
|
/// Fetches all libraries available to the user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -30,6 +30,7 @@ public abstract class LibraryConnector : GlobalBase
|
|||||||
this.libraryType = libraryType;
|
this.libraryType = libraryType;
|
||||||
}
|
}
|
||||||
public abstract void UpdateLibrary();
|
public abstract void UpdateLibrary();
|
||||||
|
internal abstract bool Test();
|
||||||
|
|
||||||
protected static class NetClient
|
protected static class NetClient
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user