MarvinKlein1508.BookStackApi
1.0.0
See the version list below for details.
dotnet add package MarvinKlein1508.BookStackApi --version 1.0.0
NuGet\Install-Package MarvinKlein1508.BookStackApi -Version 1.0.0
<PackageReference Include="MarvinKlein1508.BookStackApi" Version="1.0.0" />
paket add MarvinKlein1508.BookStackApi --version 1.0.0
#r "nuget: MarvinKlein1508.BookStackApi, 1.0.0"
// Install MarvinKlein1508.BookStackApi as a Cake Addin #addin nuget:?package=MarvinKlein1508.BookStackApi&version=1.0.0 // Install MarvinKlein1508.BookStackApi as a Cake Tool #tool nuget:?package=MarvinKlein1508.BookStackApi&version=1.0.0
BookStackApi
A C# library for the BookStack API that supports async getting of books, pages & chapters. Designed to be used with Dependency Injection.
Installing
You can install from Nuget using the following command:
Install-Package MarvinKlein1508.BookStackApi
Or via the Visual Studio package manger.
Basic Usage
First you'll need to register a service. To do this we provide two extension methods. Those can be found within the namespace
using BookStackApi;
Once you have imported the namespace, you'll need to register the service with DI. You can either manually define the options
builder.Services.AddBookstack(options => {
options.BaseUrl = "https://yourdomain/api/";
options.Token = "YOUR TOKEN";
options.Secret = "YOUR SECRET";
})
Or use the appsettings.json
file to provide the configuration. Your appsettings.json
needs to this section:
"BookStack": {
"BaseUrl": "https://yourdomain/api/",
"Token": "YOUR TOKEN",
"Secret": "YOUR SECRET"
}
Please note to specify the base URL with an ending /api/
. Otherwise the API does not work.
Now you can use the extensionmethod to register the service:
builder.Services.AddBookstack(builder.Configuration));
Finally you can inject BookStackService
wherever you'll need it.
Get Data
You can get data from the API by using the GetAsync<T>
function. The Service will determine the correct endpoint by the specified class.
bookStackService.GetAsync<Book>(id_of_book);
bookStackService.GetAsync<Page>(id_of_page);
bookStackService.GetAsync<Chapter>(id_of_chapter);
There is also a function to get a list of those objects.
bookStackService.GetListAsync<Book>();
bookStackService.GetListAsync<Page>();
bookStackService.GetListAsync<Chapter>();
How do I create, update, delete, export with this API?
This features are currently not supported by this implemention. I've only implemented the features that I'll needed right now. I'll might add more features in the future once I'll need those. Otherwise feel free to create a pull request.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 7.0.0)
- Microsoft.Extensions.Options (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.