Bitzsoft.Integrations.ProjectManagement.Ones
1.0.4
dotnet add package Bitzsoft.Integrations.ProjectManagement.Ones --version 1.0.4
NuGet\Install-Package Bitzsoft.Integrations.ProjectManagement.Ones -Version 1.0.4
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="Bitzsoft.Integrations.ProjectManagement.Ones" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.ProjectManagement.Ones" Version="1.0.4" />
<PackageReference Include="Bitzsoft.Integrations.ProjectManagement.Ones" />
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 Bitzsoft.Integrations.ProjectManagement.Ones --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bitzsoft.Integrations.ProjectManagement.Ones, 1.0.4"
#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 Bitzsoft.Integrations.ProjectManagement.Ones@1.0.4
#: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=Bitzsoft.Integrations.ProjectManagement.Ones&version=1.0.4
#tool nuget:?package=Bitzsoft.Integrations.ProjectManagement.Ones&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bitzsoft.Integrations.ProjectManagement.Ones
ONES(万事)企业级研发管理平台 REST API v2 连接器实现。遵循项目管理通用抽象规范,实现通用 IProjectManagementService 接口。
功能特性
- 通用契约对齐:完整实现
IProjectManagementService抽象规范,支持项目空间创建与列表查询、任务创建、详情获取、属性更新、任务完成与状态过滤检索。 - 双模安全鉴权:支持预设用户访问令牌(
UserToken),或基于租户邮箱与密码(Email+Password)自动向 ONES 鉴权中心换取 Token,内置线程安全的 Token 缓存。 - 租户空间隔离:支持私有化部署或多租户 SaaS 架构,基地址自由配置(
https://{tenant}.ones.ai)。 - 任务生命周期流转:支持任务(Task)、需求与缺陷的字段维护,并通过内置状态机推进至 Done 完成态。
- 工业级弹性韧性:内置 Polly 标准韧性管道(429 Too Many Requests / 503 Service Unavailable 指数退避重试与熔断保护)及出站审计日志(
RequestLogging)。
安装
dotnet add package Bitzsoft.Integrations.ProjectManagement.Ones
<PackageReference Include="Bitzsoft.Integrations.ProjectManagement.Ones" Version="1.0.0" />
配置
在 appsettings.json 中配置 ONES 连接器参数:
{
"ProjectManagement": {
"Ones": {
"BaseUrl": "https://your-tenant.ones.ai",
"Email": "developer@example.com",
"Password": "your-strong-password",
"UserToken": ""
}
}
}
配置项说明
| 配置键 | 类型 | 默认值 | 说明 |
|---|---|---|---|
BaseUrl |
string |
"https://your-tenant.ones.ai" |
ONES 服务端基地址或租户域名。 |
Email |
string |
"" |
ONES 登录账号邮箱(用于自动换取 Token)。 |
Password |
string |
"" |
ONES 登录账号密码。 |
UserToken |
string? |
null |
预持有的用户 Token(若已填写,将跳过邮箱密码换取流程)。 |
HttpClientName |
string |
"ProjectManagementOnes" |
底层业务 HttpClient 命名。 |
注册服务
支持通过配置源绑定或委托方式进行依赖注入注册:
using Microsoft.Extensions.DependencyInjection;
// 方式 1:通过 IConfiguration 绑定注册(推荐,默认读取 ProjectManagement:Ones)
services.AddOnesProjectManagement(configuration);
// 自定义配置节路径:
// services.AddOnesProjectManagement(configuration, "Integrations:Ones");
// 方式 2:通过委托手动配置注册
services.AddOnesProjectManagement(options =>
{
options.BaseUrl = "https://your-tenant.ones.ai";
options.Email = "developer@example.com";
options.Password = "your-strong-password";
});
使用示例(通用 IProjectManagementService)
以下代码演示如何在业务类中通过依赖注入使用通用的 IProjectManagementService 契约操作 ONES 项目空间与研发任务:
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Bitzsoft.Integrations.ProjectManagement;
using Bitzsoft.Integrations.ProjectManagement.Dtos;
using TaskStatus = Bitzsoft.Integrations.ProjectManagement.Dtos.TaskStatus;
namespace YourNamespace;
public class OnesTaskAppService
{
private readonly IProjectManagementService _pmService;
public OnesTaskAppService(IProjectManagementService pmService)
{
_pmService = pmService;
}
public async Task<List<PmProject>> GetProjectsAsync(
CancellationToken cancellationToken = default)
{
return await _pmService.ListProjectsAsync(cancellationToken);
}
public async Task<PmTask> CreateTaskAsync(
string projectId,
string taskName,
string description,
string? assigneeId = null,
DateTimeOffset? dueDate = null,
CancellationToken cancellationToken = default)
{
var request = new CreateTaskRequest
{
ProjectId = projectId,
Name = taskName,
Description = description,
AssigneeId = assigneeId,
DueDate = dueDate,
Priority = TaskPriority.Normal
};
return await _pmService.CreateTaskAsync(request, cancellationToken);
}
public async Task<PmTask> GetTaskDetailAsync(
string taskId,
CancellationToken cancellationToken = default)
{
return await _pmService.GetTaskAsync(taskId, cancellationToken);
}
public async Task<PmTask> UpdateTaskAsync(
string taskId,
string newName,
string? newDescription = null,
CancellationToken cancellationToken = default)
{
var request = new UpdateTaskRequest
{
Name = newName,
Description = newDescription
};
return await _pmService.UpdateTaskAsync(taskId, request, cancellationToken);
}
public async Task<PmResult> CompleteTaskAsync(
string taskId,
CancellationToken cancellationToken = default)
{
return await _pmService.CompleteTaskAsync(taskId, cancellationToken);
}
public async Task<List<PmTask>> ListTasksAsync(
string projectId,
TaskStatus? status = null,
CancellationToken cancellationToken = default)
{
var query = new TaskQuery
{
ProjectId = projectId,
Status = status
};
return await _pmService.ListTasksAsync(query, cancellationToken);
}
}
架构与鉴权原理
ONES 连接器内部采用状态自愈认证设计:
- Token 换取与刷新:当未配置
UserToken时,首次请求前会自动调用 ONES/auth/login接口通过邮箱和密码交换 Token,并在内存中进行缓存复用。 - 401 自动重试:当缓存的 Token 因服务端过期或吊销引发 HTTP 401 Unauthorized 时,底层客户端自动使 Token 失效并触发重新登录换取,保障业务连续性。
异常处理与弹性策略
连接器集成了基于 Polly 的指数退避重试与熔断机制:
- 限流防护:当触发 ONES 服务端限流或瞬时故障(HTTP 429 / 503)时,系统自动按照指数递增等待时间进行重试。
- 参数验证:所有接口入参均经过前置验证,避免发送无效网络请求。
依赖
| 包 | 说明 |
|---|---|
| Bitzsoft.Integrations.ProjectManagement | 项目管理服务统一抽象层 |
| Bitzsoft.Integrations.Core | 公共基座与供应商解析机制 |
| Bitzsoft.Integrations.Compatibility | 多目标框架兼容性工具集 |
| Bitzsoft.Integrations.RequestLogging | 出站请求审计与耗时追踪日志 |
相关包
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 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 is compatible. 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.
-
net10.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.4)
- Bitzsoft.Integrations.Core (>= 1.0.4)
- Bitzsoft.Integrations.ProjectManagement (>= 1.0.4)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.4)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Http.Resilience (>= 10.7.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.10)
-
net5.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.4)
- Bitzsoft.Integrations.Core (>= 1.0.4)
- Bitzsoft.Integrations.ProjectManagement (>= 1.0.4)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.4)
- Microsoft.Extensions.Configuration.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 5.0.0)
-
net8.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.4)
- Bitzsoft.Integrations.Core (>= 1.0.4)
- Bitzsoft.Integrations.ProjectManagement (>= 1.0.4)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.4)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Http.Resilience (>= 10.7.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.10)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.ProjectManagement.Ones:
| Package | Downloads |
|---|---|
|
Bitzsoft.Integrations.ProjectManagement.All
项目管理服务聚合包 — 包含全部供应商实现(Asana / Teambition / Monday / Trello / ONES / PingCode / Yunxiao / GitHub / GitLab / Gitee / JiraCloud / JiraDataCenter / AzureDevOps / Tapd) |
GitHub repositories
This package is not used by any popular GitHub repositories.