Bitzsoft.Integrations.Calendar 1.0.2

dotnet add package Bitzsoft.Integrations.Calendar --version 1.0.2
                    
NuGet\Install-Package Bitzsoft.Integrations.Calendar -Version 1.0.2
                    
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.Calendar" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.Calendar" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.Calendar" />
                    
Project file
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.Calendar --version 1.0.2
                    
#r "nuget: Bitzsoft.Integrations.Calendar, 1.0.2"
                    
#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.Calendar@1.0.2
                    
#: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.Calendar&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.Calendar&version=1.0.2
                    
Install as a Cake Tool

Bitzsoft.Integrations.Calendar

日历抽象层 — 统一接口定义、基础模型与结果包装。

屏蔽 Google Calendar、Microsoft 365 等供应商差异,提供一致的日历事件创建、查询、更新、删除、列表与邀请响应 API。

功能特性

  • 统一供应商接口 ICalendarService:8 个异步方法覆盖日历事件全生命周期,含邀请接受/拒绝
  • 统一结果包装 CalendarResult:携带成功标志与错误信息
  • 统一异常 CalendarException:封装供应商标识、错误码与请求 ID
  • 统一模型设计:集合返回 List<T>,覆盖全天事件、时区、参会人、在线会议与重复规则

安装

dotnet add package Bitzsoft.Integrations.Calendar
<PackageReference Include="Bitzsoft.Integrations.Calendar" Version="1.0.0" />

接口

ICalendarService

统一的日历服务供应商接口。

方法 返回类型 说明
ProviderName string 供应商标识(如 GoogleMicrosoft365
CreateEventAsync Task<CalendarEvent> 创建日历事件,返回事件信息
GetEventAsync Task<CalendarEvent> 查询单个事件详情
UpdateEventAsync Task<CalendarResult> 更新事件信息
DeleteEventAsync Task<CalendarResult> 删除事件
ListEventsAsync Task<List<CalendarEvent>> 分页查询事件列表
AcceptInvitationAsync Task<CalendarResult> 接受事件邀请
DeclineInvitationAsync Task<CalendarResult> 拒绝事件邀请(可附原因)

核心模型

关键字段 说明
CreateEventRequest TitleDescriptionLocationStartDateTimeEndDateTimeIsAllDayTimeZoneAttendeesOnlineMeetingUrlRecurrenceRule 创建事件请求
UpdateEventRequest EventIdTitleDescriptionLocationStartDateTimeEndDateTime 更新事件请求
ListEventsRequest CalendarIdStartDateEndDatePageIndexPageSizePageToken 事件列表查询参数(PageToken 为分页游标,Google 等供应商使用)
CalendarEvent EventIdTitleDescriptionLocationStartDateTimeEndDateTimeIsAllDayTimeZoneOrganizerAttendeesStatusOnlineMeetingUrl 日历事件信息
CalendarAttendee EmailNameResponseStatusOptional 参会人信息
CalendarResult SuccessErrorMessage 操作结果
CalendarException 统一异常(继承 IntegrationException

枚举

枚举 说明
CalendarEventStatus 事件状态:Confirmed / Tentative / Cancelled
CalendarResponseStatus 参会人响应状态:NeedsAction / Accepted / Declined / Tentative

使用示例

抽象层本身只定义接口与模型,具体实现由各供应商包提供。以下示例假设已注册某个供应商实现:

public class EventService(ICalendarService calendar)
{
    public async Task<string> CreateAsync(string title, DateTimeOffset start, DateTimeOffset end)
    {
        var evt = await calendar.CreateEventAsync(new CreateEventRequest
        {
            Title = title,
            StartDateTime = start,
            EndDateTime = end,
            Attendees =
            [
                new() { Email = "zhangsan@example.com", Name = "张三" }
            ]
        });
        return evt.EventId;
    }

    public Task<CalendarResult> DeclineAsync(string eventId, string reason)
        => calendar.DeclineInvitationAsync(eventId, reason);
}

多供应商解析

同一应用注册多个供应商时,通过 IIntegrationProviderResolver<ICalendarService> 按供应商 ID 解析:

var resolver = serviceProvider.GetRequiredService<IIntegrationProviderResolver<ICalendarService>>();
var google = resolver.GetRequired("Google");
var evt = await google.CreateEventAsync(request);

依赖

相关包

供应商 包名
统一抽象 Bitzsoft.Integrations.Calendar
Google Calendar Bitzsoft.Integrations.Calendar.Google
Microsoft 365 Bitzsoft.Integrations.Calendar.Microsoft365
聚合包 Bitzsoft.Integrations.Calendar.All
Product 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.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Bitzsoft.Integrations.Calendar:

Package Downloads
Bitzsoft.Integrations.Calendar.Google

Google Calendar 实现 — Bearer / API Key 鉴权 + HttpClient,实现 ICalendarService 统一接口,支持事件创建/查询/更新/删除/列表/接受邀请/拒绝邀请

Bitzsoft.Integrations.Calendar.Microsoft365

Microsoft 365 Calendar 实现 — Azure AD Client Credentials Bearer 鉴权 + HttpClient,实现 ICalendarService 统一接口,支持事件创建/查询/更新/删除/列表/接受邀请/拒绝邀请

Bitzsoft.Integrations.Calendar.All

日历服务聚合包 — 包含全部供应商实现(Google / Microsoft 365)

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 172 8/29/2026
1.0.1 208 8/3/2026
1.0.0 202 8/2/2026