Bitzsoft.Integrations.HumanResources.Moka
1.0.2
dotnet add package Bitzsoft.Integrations.HumanResources.Moka --version 1.0.2
NuGet\Install-Package Bitzsoft.Integrations.HumanResources.Moka -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.HumanResources.Moka" 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.HumanResources.Moka" Version="1.0.2" />
<PackageReference Include="Bitzsoft.Integrations.HumanResources.Moka" />
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.HumanResources.Moka --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bitzsoft.Integrations.HumanResources.Moka, 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.HumanResources.Moka@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.HumanResources.Moka&version=1.0.2
#tool nuget:?package=Bitzsoft.Integrations.HumanResources.Moka&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bitzsoft.Integrations.HumanResources.Moka
Moka 人力资源服务实现,实现 IHumanResourcesService 统一接口。
功能特性
- 员工全生命周期:创建、查询、更新、停用(离职)、分页列表查询
- 部门管理:创建部门、查询部门列表
- 考勤管理:提交考勤、按日期范围查询考勤记录
- HTTP Basic Auth 鉴权:API Key 作为用户名、API Secret 作为密码
- 统一接口:实现
IHumanResourcesService,ProviderName返回 Moka 供应商标识 - 配置校验:注册时通过
MokaOptionsValidator校验必填项 - 请求审计:内置 RequestLogging 管道,记录出站请求
安装
dotnet add package Bitzsoft.Integrations.HumanResources.Moka
<PackageReference Include="Bitzsoft.Integrations.HumanResources.Moka" Version="1.0.0" />
配置
appsettings.json
{
"HumanResources": {
"Moka": {
"ApiBaseUrl": "https://api.mokahr.com/api",
"ApiKey": "your-api-key",
"ApiSecret": "your-api-secret"
}
}
}
| 配置项 | 说明 | 必填 | 默认值 |
|---|---|---|---|
ApiBaseUrl |
Moka 开放平台基地址 | 否 | https://api.mokahr.com/api |
ApiKey |
API Key(Basic Auth 用户名,须脱敏) | 是 | - |
ApiSecret |
API Secret(Basic Auth 密码,须脱敏) | 是 | - |
HttpClientName |
命名 HttpClient 标识 | 否 | HumanResourcesMoka |
注册服务
从 IConfiguration 绑定(推荐)
using Microsoft.Extensions.DependencyInjection;
builder.Services.AddMokaHumanResources(
builder.Configuration.GetSection("HumanResources:Moka"));
委托配置
builder.Services.AddMokaHumanResources(options =>
{
options.ApiBaseUrl = "https://api.mokahr.com/api";
options.ApiKey = "your-api-key";
options.ApiSecret = "your-api-secret";
});
注册后
IHumanResourcesService(ProviderName = Moka)可用,可通过IIntegrationProviderResolver<IHumanResourcesService>按供应商 ID(moka)解析。
使用示例
using Bitzsoft.Integrations.Core;
using Bitzsoft.Integrations.HumanResources;
public class EmployeeSyncService(IIntegrationProviderResolver<IHumanResourcesService> resolver)
{
public async Task<HrEmployee> CreateEmployeeAsync(string name, string email, CancellationToken ct)
{
var service = resolver.GetRequired("moka");
return await service.CreateEmployeeAsync(new CreateEmployeeRequest
{
Name = name,
Email = email
}, ct);
}
public async Task<List<HrEmployee>> ListByDepartmentAsync(string departmentId, CancellationToken ct)
{
var service = resolver.GetRequired("moka");
return await service.ListEmployeesAsync(new ListEmployeesRequest
{
DepartmentId = departmentId,
PageSize = 100
}, ct);
}
public async Task<List<HrAttendanceRecord>> GetAttendanceAsync(
string employeeId, DateTimeOffset start, DateTimeOffset end, CancellationToken ct)
{
var service = resolver.GetRequired("moka");
return await service.ListAttendanceRecordsAsync(employeeId, start, end, ct);
}
}
IHumanResourcesService 方法 |
说明 |
|---|---|
CreateEmployeeAsync |
创建员工 |
GetEmployeeAsync |
按 ID 查询员工 |
UpdateEmployeeAsync |
更新员工信息 |
DeactivateEmployeeAsync |
停用(离职)员工 |
ListEmployeesAsync |
分页查询员工列表(支持按部门 / 关键字 / 状态过滤) |
CreateDepartmentAsync |
创建部门 |
ListDepartmentsAsync |
查询部门列表 |
SubmitAttendanceAsync |
提交考勤记录 |
ListAttendanceRecordsAsync |
按日期范围查询考勤记录 |
依赖
| 包 | 说明 |
|---|---|
Bitzsoft.Integrations.HumanResources |
抽象层(IHumanResourcesService / 模型) |
Bitzsoft.Integrations.Core |
核心基础库 |
Bitzsoft.Integrations.Compatibility |
基础工具库 |
Bitzsoft.Integrations.RequestLogging |
出站请求审计 |
Microsoft.Extensions.Http |
IHttpClientFactory |
Microsoft.Extensions.Options.ConfigurationExtensions |
Options 配置绑定 |
相关包
| 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.2)
- Bitzsoft.Integrations.Core (>= 1.0.2)
- Bitzsoft.Integrations.HumanResources (>= 1.0.2)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.2)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.10)
-
net5.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.2)
- Bitzsoft.Integrations.Core (>= 1.0.2)
- Bitzsoft.Integrations.HumanResources (>= 1.0.2)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.2)
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 5.0.0)
-
net8.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.2)
- Bitzsoft.Integrations.Core (>= 1.0.2)
- Bitzsoft.Integrations.HumanResources (>= 1.0.2)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.2)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.10)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.HumanResources.Moka:
| Package | Downloads |
|---|---|
|
Bitzsoft.Integrations.HumanResources.All
人力资源服务聚合包 — 包含全部供应商实现(Moka / 薪人薪事) |
GitHub repositories
This package is not used by any popular GitHub repositories.