BookStackApiClient 23.5.2
BookStackApiClient 23.5.0-lib.2
Additional DetailsVersioning rules were changed.
See the version list below for details.
dotnet add package BookStackApiClient --version 23.5.2
NuGet\Install-Package BookStackApiClient -Version 23.5.2
<PackageReference Include="BookStackApiClient" Version="23.5.2" />
paket add BookStackApiClient --version 23.5.2
#r "nuget: BookStackApiClient, 23.5.2"
// Install BookStackApiClient as a Cake Addin #addin nuget:?package=BookStackApiClient&version=23.5.2 // Install BookStackApiClient as a Cake Tool #tool nuget:?package=BookStackApiClient&version=23.5.2
BookStackApiClient
This is BookStack API client library for .NET.
BookStack is a platform for organizing and storing information.
Since this library is a relatively simple mapper for the BookStack API, it should be easy to tie the endpoints and methods described in the BookStack API documentation.
Sorry, IntelliSense messages (documentation comments) for types and members are provided in Japanese. This is because I currently think that the main users are me and the people around me.
Package and API version
Although the BookStack API specification may change from version to version, this library targets only a single version.
If the version targeted by the library does not match the server version, there is a large possibility that it will not work properly.
The package version represents the corresponding server version.
The first two parts of the version match the first two parts of the target BookStack version.
More detailed versions are considered to have no effect on the API specification.
The third and fourth numbers in the version are specific to this library.
The third number will be changed if the library specification has been changed (not binary compatible), even for the same target version.
The fourth number is changed for bug fixes and other cases where binary compatibility is maintained.
Examples
Some samples are shown below.
These use C#9 or later syntax.
Create books, chapters, and pages.
var apiEntry = new Uri(@"http://<your-hosting-server>/api/"),
var apiToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
var apiSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
using var client = new BookStackClient(apiEntry, apiToken, apiSecret);
var book = await client.CreateBookAsync(new("TestBook", tags: new Tag[] { new("test") }));
var chapter = await client.CreateChapterAsync(new(book.id, "TestChapter"));
var page1 = await client.CreateMarkdownPageInBookAsync(new(book.id, "TestPage", "# Test page in book"));
var page2 = await client.CreateMarkdownPageInChapterAsync(new(chapter.id, "TestPage", "# Test page in chapter"));
Display a list of books.
Note the limit on the number of API requests to issue many requests.
using var client = new BookStackClient(apiEntry, apiToken, apiSecret);
var offset = 0;
while (true)
{
var books = await client.ListBooksAsync(new(offset, sorts: new[] { "id", }));
foreach (var book in books.data)
{
var detail = await client.ReadBookAsync(book.id);
var chapters = detail.contents.OfType<BookContentChapter>().Count();
var pages = detail.contents.OfType<BookContentPage>().Count();
Console.WriteLine($"{book.id,4}: {book.name}, chapters={chapters}, pages={pages}");
}
offset += books.data.Length;
if (books.data.Length <= 0 || books.total <= offset) break;
}
Content Search
using var client = new BookStackClient(apiEntry, apiToken, apiSecret);
// search query (see https://www.bookstackapp.com/docs/user/searching/)
var found = await client.SearchAsync(new("search query"));
// list of pages (see https://demo.bookstackapp.com/api/docs#listing-endpoints)
var pages = await client.ListPagesAsync(new(filters: new[] { new Filter("filter", "expression") }));
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. 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. |
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
24.10.0-lib.0 | 36 | 10/10/2024 |
24.5.0-lib.1 | 66 | 5/12/2024 |
24.2.0-lib.2 | 63 | 5/5/2024 |
24.2.0-lib.1 | 58 | 2/29/2024 |
23.12.1-lib.1 | 102 | 1/16/2024 |
23.12.0-lib.1 | 88 | 12/30/2023 |
23.10.0-lib.1 | 103 | 12/1/2023 |
23.8.0-lib.1 | 96 | 8/30/2023 |
23.6.0-lib.1 | 86 | 8/11/2023 |
23.5.0-lib.2 | 75 | 8/11/2023 |