BangumiApiClient.NET
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package BangumiApiClient.NET --version 1.0.0
NuGet\Install-Package BangumiApiClient.NET -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BangumiApiClient.NET" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BangumiApiClient.NET" Version="1.0.0" />
<PackageReference Include="BangumiApiClient.NET" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BangumiApiClient.NET --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BangumiApiClient.NET, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BangumiApiClient.NET@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BangumiApiClient.NET&version=1.0.0
#tool nuget:?package=BangumiApiClient.NET&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bangumi API 客户端
这是一个基于 .NET 8.0 的 Bangumi API 客户端库,用于访问 Bangumi 番组计划 的 API 接口。
项目概述
该项目是使用 Microsoft Kiota 工具根据 Bangumi API 规范自动生成的客户端库。它提供了对 Bangumi 平台数据(如动画、书籍、游戏、音乐、三次元作品以及相关的人物、角色等信息)的访问能力。
项目结构
BangumiApi/
├── Calendar/ # 时间表相关接口
├── Models/ # 数据模型类(约90个)
├── V0/ # API v0 版本接口实现
│ ├── Characters/ # 角色相关接口
│ ├── Episodes/ # 剧集相关接口
│ ├── Indices/ # 索引相关接口
│ ├── Me/ # 当前用户相关接口
│ ├── Persons/ # 人物相关接口
│ ├── Revisions/ # 版本修订相关接口
│ ├── Search/ # 搜索相关接口
│ ├── Subjects/ # 条目相关接口
│ └── Users/ # 用户相关接口
├── ApiClient.cs # API 客户端主入口
├── ClientBuilder.cs # 客户端构建器
├── BangumiAuthenticationProvider.cs # 认证提供程序
└── BangumiAuthenticationTokenAccess.cs # Token 访问处理
主要功能模块
1. 数据模型 (Models)
包含约90个数据模型类,对应 Bangumi API 返回的各种数据结构:
- 条目相关:Subject、SlimSubject、Subjects 等
- 人物相关:Person、PersonDetail 等
- 角色相关:Character、CharacterPerson 等
- 剧集相关:Episode、EpisodeDetail 等
- 用户相关:User、UserSubjectCollection 等
2. API 接口 (V0)
按照 Bangumi API v0 版本组织的接口调用类:
- Characters - 角色相关操作
- Episodes - 剧集相关操作
- Indices - 索引相关操作
- Me - 当前用户相关操作
- Persons - 人物相关操作
- Revisions - 版本修订相关操作
- Search - 搜索相关操作
- Subjects - 条目相关操作
- Users - 用户相关操作
3. 核心组件
- ApiClient.cs - API 客户端主入口类
- ClientBuilder.cs - 提供创建客户端实例的便捷方法
- BangumiAuthenticationProvider.cs - 实现 Bangumi API 认证机制
使用示例
// 创建公共客户端(无需认证)
var client = ClientBuilder.CreatePublicClient();
// 获取条目信息
var subject = await client.V0.Subjects["123"].GetAsync();
// 创建认证客户端
var authProvider = new BangumiAuthenticationProvider("YourApp/1.0", "your-access-token");
var authenticatedClient = ClientBuilder.CreateAuthenticatedClient(authProvider, "your-access-token");
// 获取当前用户信息
var userInfo = await authenticatedClient.V0.Me.GetAsync();
依赖项
- .NET 8.0
- Microsoft.Kiota.Bundle 1.21.0
构建与打包
该项目配置为可打包的 NuGet 库,包名为 BangumiApi.Client。
dotnet pack
许可证
本项目采用 MIT 许可证。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Kiota.Bundle (>= 1.21.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.