Bitzsoft.Integrations.Ticketing.ServiceNow
1.0.1
dotnet add package Bitzsoft.Integrations.Ticketing.ServiceNow --version 1.0.1
NuGet\Install-Package Bitzsoft.Integrations.Ticketing.ServiceNow -Version 1.0.1
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.Ticketing.ServiceNow" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.Ticketing.ServiceNow" Version="1.0.1" />
<PackageReference Include="Bitzsoft.Integrations.Ticketing.ServiceNow" />
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.Ticketing.ServiceNow --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bitzsoft.Integrations.Ticketing.ServiceNow, 1.0.1"
#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.Ticketing.ServiceNow@1.0.1
#: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.Ticketing.ServiceNow&version=1.0.1
#tool nuget:?package=Bitzsoft.Integrations.Ticketing.ServiceNow&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bitzsoft.Integrations.Ticketing.ServiceNow
ServiceNow 工单系统适配器,将 ITicketService 统一抽象适配到 Bitzsoft.Integrations.ServiceNow 单体。
设计说明
该适配器委托 IServiceNowClient(ServiceNow 单体的只读 Incident client)执行实际调用。
ServiceNow 单体的 client 仅暴露 Incident 读取与受控键集扫描能力,不提供 Incident 写入方法。
能力矩阵
| ITicketService 方法 | 支持 | 实现方式 |
|---|---|---|
CreateTicketAsync |
否 | 抛出 NotSupportedException(只读 client 不支持创建) |
GetTicketAsync |
是 | IServiceNowClient.GetIncidentAsync(按 sys_id 查询) |
UpdateTicketAsync |
否 | 抛出 NotSupportedException(只读 client 不支持更新) |
AssignTicketAsync |
否 | 抛出 NotSupportedException(只读 client 不支持分配) |
ChangeStatusAsync |
否 | 抛出 NotSupportedException(只读 client 不支持状态变更) |
AddCommentAsync |
否 | 抛出 NotSupportedException(只读 client 不支持评论) |
ListTicketsAsync |
是 | IServiceNowClient.QueryIncidentsAsync(受控过滤,按 state + assignee) |
写入类操作请直接使用 ServiceNow Table API 写入端点。
字段映射
- ServiceNow Incident
sys_id↔ 工单TicketId - ServiceNow Incident
state(1 New / 2 In Progress / 3 On Hold / 6 Resolved / 7 Closed)↔ 统一TicketStatus - ServiceNow Incident
priority(1 Critical / 2 High / 3 Moderate / 4 Low)↔ 统一TicketPriority ListTicketsRequest.AssigneeId映射为 ServiceNowassignment_groupsys_id 过滤
安装
dotnet add package Bitzsoft.Integrations.Ticketing.ServiceNow
注册服务
宿主需先通过 ServiceNow 单体注册 IServiceNowClient,再注册适配器:
// 1. 注册 ServiceNow 单体(提供 IServiceNowClient)
services.AddBitzsoftServiceNow(endpointProfile);
// 2. 注册工单适配器(固定上下文)
var context = new ServiceNowRequestContext(tenantId: "tenant-1");
services.AddServiceNowTicket(context);
// 或使用自定义上下文工厂(多租户推荐)
services.AddServiceNowTicket<TenantServiceNowContextFactory>();
IServiceNowTicketContextFactory
IServiceNowClient 的所有方法都需要 ServiceNowRequestContext(绑定租户、profile、凭据)。
适配器通过 IServiceNowTicketContextFactory 获取该上下文。多租户宿主应实现该接口,
从 IIntegrationContextAccessor 与凭据解析器动态构造;单租户或测试可使用固定上下文。
使用示例
public class TicketQueryService
{
private readonly ITicketService _ticket;
public TicketQueryService(ITicketService ticket)
=> _ticket = ticket;
public Task<TicketInfo> GetTicketAsync(string sysId)
=> _ticket.GetTicketAsync(sysId); // 32 位十六进制 sys_id
public Task<List<TicketInfo>> ListOpenTicketsAsync()
=> _ticket.ListTicketsAsync(new ListTicketsRequest { Status = TicketStatus.Open });
}
依赖
| 包 | 说明 |
|---|---|
| Bitzsoft.Integrations.Ticketing | 工单系统服务抽象层 |
| Bitzsoft.Integrations.ServiceNow | ServiceNow 单体(提供 IServiceNowClient) |
| Bitzsoft.Integrations.Core | 公共基座 |
| Bitzsoft.Integrations.Compatibility | 多 TFM 兼容工具 |
| 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.1)
- Bitzsoft.Integrations.Core (>= 1.0.1)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.1)
- Bitzsoft.Integrations.ServiceNow (>= 1.0.1)
- Bitzsoft.Integrations.Ticketing (>= 1.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
-
net5.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.1)
- Bitzsoft.Integrations.Core (>= 1.0.1)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.1)
- Bitzsoft.Integrations.ServiceNow (>= 1.0.1)
- Bitzsoft.Integrations.Ticketing (>= 1.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Options (>= 5.0.0)
-
net8.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.1)
- Bitzsoft.Integrations.Core (>= 1.0.1)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.1)
- Bitzsoft.Integrations.ServiceNow (>= 1.0.1)
- Bitzsoft.Integrations.Ticketing (>= 1.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.