Bitzsoft.Integrations.Ticketing
1.0.0
See the version list below for details.
dotnet add package Bitzsoft.Integrations.Ticketing --version 1.0.0
NuGet\Install-Package Bitzsoft.Integrations.Ticketing -Version 1.0.0
<PackageReference Include="Bitzsoft.Integrations.Ticketing" Version="1.0.0" />
<PackageVersion Include="Bitzsoft.Integrations.Ticketing" Version="1.0.0" />
<PackageReference Include="Bitzsoft.Integrations.Ticketing" />
paket add Bitzsoft.Integrations.Ticketing --version 1.0.0
#r "nuget: Bitzsoft.Integrations.Ticketing, 1.0.0"
#:package Bitzsoft.Integrations.Ticketing@1.0.0
#addin nuget:?package=Bitzsoft.Integrations.Ticketing&version=1.0.0
#tool nuget:?package=Bitzsoft.Integrations.Ticketing&version=1.0.0
Bitzsoft.Integrations.Ticketing
工单系统(ITSM)抽象层 — 统一接口定义、基础模型与结果包装。
屏蔽 Zendesk、禅道 Zentao、Freshdesk、ServiceNow 等供应商差异,提供一致的工单创建、查询、更新、分配、状态变更、评论与列表查询 API。
功能特性
- 统一供应商接口
ITicketService:8 个异步方法覆盖工单全生命周期 - 统一结果包装:
TicketingResult携带成功标志与错误信息 - 统一异常
TicketingException:封装供应商标识、错误码与请求 ID - 不可变模型设计:集合返回
List<T>,属性使用init保证只读
安装
dotnet add package Bitzsoft.Integrations.Ticketing
<PackageReference Include="Bitzsoft.Integrations.Ticketing" Version="1.0.0" />
接口
ITicketService
统一的工单系统供应商接口。
| 方法 | 返回类型 | 说明 |
|---|---|---|
ProviderName |
string |
供应商标识(如 Zendesk、Zentao) |
CreateTicketAsync |
Task<TicketInfo> |
创建工单,返回工单信息 |
GetTicketAsync |
Task<TicketInfo> |
查询单个工单详情 |
UpdateTicketAsync |
Task<TicketingResult> |
更新工单信息 |
AssignTicketAsync |
Task<TicketingResult> |
分配工单给处理人 |
ChangeStatusAsync |
Task<TicketingResult> |
变更工单状态 |
AddCommentAsync |
Task<TicketingResult> |
添加工单评论/回复 |
ListTicketsAsync |
Task<List<TicketInfo>> |
分页查询工单列表 |
注意:ServiceNow 实现为只读,写操作(创建/更新/分配/变更状态/评论)将抛出
NotSupportedException。
核心模型
| 类 | 关键字段 | 说明 |
|---|---|---|
CreateTicketRequest |
Subject、Description、RequesterEmail、RequesterName、Priority、Tags |
创建工单请求 |
UpdateTicketRequest |
TicketId、Subject、Description、Priority |
更新工单请求 |
ListTicketsRequest |
Status、AssigneeId、PageIndex、PageSize |
工单列表查询参数 |
TicketInfo |
TicketId、Subject、Description、Status、Priority、Requester、Assignee、Tags、CreatedAt、UpdatedAt |
工单信息 |
TicketingResult |
Success、ErrorMessage |
操作结果 |
TicketingException |
— | 统一异常(继承 IntegrationException) |
枚举
| 枚举 | 说明 |
|---|---|
TicketStatus |
工单状态:New / Open / Pending / Resolved / Closed |
TicketPriority |
工单优先级:Low / Normal / High / Urgent |
使用示例
抽象层本身只定义接口与模型,具体实现由各供应商包提供。以下示例假设已注册某个供应商实现:
public class HelpDeskService(ITicketService ticketing)
{
public async Task<string> OpenTicketAsync(string subject, string email)
{
var ticket = await ticketing.CreateTicketAsync(new CreateTicketRequest
{
Subject = subject,
Description = "无法登录系统",
RequesterEmail = email,
Priority = TicketPriority.High
});
return ticket.TicketId;
}
public Task<List<TicketInfo>> GetOpenTicketsAsync()
=> ticketing.ListTicketsAsync(new ListTicketsRequest { Status = TicketStatus.Open });
}
多供应商解析
同一应用注册多个供应商时,通过 IIntegrationProviderResolver<ITicketService> 按供应商 ID 解析:
var resolver = serviceProvider.GetRequiredService<IIntegrationProviderResolver<ITicketService>>();
var zendesk = resolver.GetRequired("zendesk");
var ticket = await zendesk.CreateTicketAsync(request);
依赖
- Bitzsoft.Integrations.Core:公共基座(
IntegrationException、IIntegrationProviderResolver<T>)
相关包
| 供应商 | 包名 |
|---|---|
| 统一抽象 | Bitzsoft.Integrations.Ticketing |
| Zendesk | Bitzsoft.Integrations.Ticketing.Zendesk |
| 禅道 Zentao | Bitzsoft.Integrations.Ticketing.Zentao |
| Freshdesk | Bitzsoft.Integrations.Ticketing.Freshdesk |
| ServiceNow | Bitzsoft.Integrations.Ticketing.ServiceNow |
| 聚合包 | Bitzsoft.Integrations.Ticketing.All |
| 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. |
-
net10.0
- Bitzsoft.Integrations.Core (>= 1.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
-
net5.0
- Bitzsoft.Integrations.Core (>= 1.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Options (>= 5.0.0)
-
net8.0
- Bitzsoft.Integrations.Core (>= 1.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Bitzsoft.Integrations.Ticketing:
| Package | Downloads |
|---|---|
|
Bitzsoft.Integrations.Ticketing.Zendesk
Zendesk 工单系统实现 — Basic Auth(email/token:apiToken)鉴权 + HttpClient,实现 ITicketService 统一接口,支持工单创建/查询/更新/分配/状态变更/评论 |
|
|
Bitzsoft.Integrations.Ticketing.Freshdesk
Freshdesk 工单系统实现 — HTTP Basic Auth(api_key:x,密码为空)鉴权 + HttpClient,实现 ITicketService 统一接口,支持工单创建/查询/更新/分配/状态变更/评论/列表 |
|
|
Bitzsoft.Integrations.Ticketing.Zentao
禅道 Zentao 工单系统实现 — Session Token 鉴权(POST /tokens 换 token)+ HttpClient,实现 ITicketService 统一接口,支持工单(bug/task)创建/查询/更新/分配/状态变更/评论 |
|
|
Bitzsoft.Integrations.Ticketing.All
工单系统服务聚合包 — 包含全部供应商实现(Zendesk / 禅道 Zentao / Freshdesk) |
|
|
Bitzsoft.Integrations.Ticketing.ServiceNow
ServiceNow 工单系统适配器 — 委托 Bitzsoft.Integrations.ServiceNow 单体的只读 Incident client,实现 ITicketService 统一接口,支持工单查询/列表(写入操作抛 NotSupportedException) |
GitHub repositories
This package is not used by any popular GitHub repositories.