Add LibraryConnector.Test to see if requests can be made to endpoint.
This commit is contained in:
parent
51a26a3cba
commit
783f229a6a
@ -68,6 +68,14 @@ public class Kavita : LibraryConnector
|
||||
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>
|
||||
/// Fetches all libraries available to the user
|
||||
/// </summary>
|
||||
|
@ -32,6 +32,14 @@ public class Komga : LibraryConnector
|
||||
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>
|
||||
/// Fetches all libraries available to the user
|
||||
/// </summary>
|
||||
|
@ -30,6 +30,7 @@ public abstract class LibraryConnector : GlobalBase
|
||||
this.libraryType = libraryType;
|
||||
}
|
||||
public abstract void UpdateLibrary();
|
||||
internal abstract bool Test();
|
||||
|
||||
protected static class NetClient
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user