HitGeneralServices 0.4.4
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package HitGeneralServices --version 0.4.4
NuGet\Install-Package HitGeneralServices -Version 0.4.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="HitGeneralServices" Version="0.4.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HitGeneralServices --version 0.4.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HitGeneralServices, 0.4.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.
// Install HitGeneralServices as a Cake Addin #addin nuget:?package=HitGeneralServices&version=0.4.4 // Install HitGeneralServices as a Cake Tool #tool nuget:?package=HitGeneralServices&version=0.4.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
<div align=center> <img src="https://github.com/HIT-ReFreSH/HitGeneralServices/raw/master/images/Full_2048.png" width = 30% height = 30% /> </div>
HitGeneralServices-HIT通用服务集
HIT通用服务集包含了以下常用的组件:
- HitInfoProviderFactory: 用于获取乐学网认证登录后,用户信息的工厂类
- CasLogin.LoginHttpClient:用于使用统一身份认证登录的HttpClient
- Jwts.JwtsService:用于Jwts的各种服务
HitInfoProviderFactory 使用方法
将需要使用的服务,加入依赖注入的服务集合即可
CasLogin.LoginHttpClient 使用方法
既可以使用依赖注入初始化,也可以直接使用new
来创建LoginHttpClient的实例。LoginHttpClient直接继承自HttpClient,可以像HttpClient一样使用。除此外,还提供了以下成员:
名称 | 类型 | 说明 | 参数 | 返回值 | 异常 |
---|---|---|---|---|---|
LoginAsync | 异步方法 | 进行统一认证登录 | string username 用户名<br> string password 密码<br> Func<Stream, Task<string>>? captchaGenerator 可选。 验证码填写适配器,用于在必须时填写验证码。 |
- | CaptchaRequiredException : 需要填写二维码,但是未提供对应的适配器<br>LoginFailedException : 登陆认证失败,原因见Message 。 |
TryLoginFor | 异步方法 | 持续尝试进行统一认证登录,直至满足最大尝试次数,或者抛出不能处理的异常 | string username 用户名<br> string password 密码<br> uint maxTrail 最大尝试次数<br> Func<Stream, Task<string>>? captchaGenerator 可选。 验证码填写适配器,用于在必须时填写验证码。 |
- | CaptchaRequiredException : 需要填写二维码,但是未提供对应的适配器<br>LoginFailedException : 登陆认证失败,原因见Message 。 |
IsAuthorized | 异步方法 | 检查是否已经完成统一认证登录 | - | bool ,是/否 |
- |
Win32CaptchaInput | 静态函数(验证码填写适配器) | 适用于控制台程序。 使用Windows默认图片查看器查看验证码图片 | - | - | - |
CaptchaInputFactory | 静态函数(验证码填写适配器工厂) | 适用于控制台程序。 使用指定查看器生成验证码填写适配器 | string pathToJpegViewer Jpeg查看器的路径 |
验证码填写适配器 | - |
GetTwoPhaseLoginInfoAsync | 异步方法 | 获取进行两段CAS登录的登录信息(第一阶段) | string username 用户名 |
Dictionary<string, string?> 用于两段异步登录的登录信息字典;其中键password 对应值是加密的salt(Aes.Key);键captcha 如果存在,则对应值是用于获取验证码的url |
- |
ApplyTwoPhaseLoginInfoAsync | 异步方法 | 应用两段CAS登录的登录信息进行登录(第二阶段) | Dictionary<string, string?> loginInfo 登录信息,原始产生自GetTwoPhaseLoginInfoAsync(string) ;但是此处的键password 对应值已经加密(Aes);键captcha 如果存在,则对应值已经完成人工填写。 |
- | LoginFailedException : 登陆认证失败,原因见Message 。 |
Jwts.JwtsService 使用方法
既可以使用依赖注入初始化,也可以直接使用new
来创建JwtsService的实例。JwtsService提供了以下成员:
名称 | 类型 | 说明 | 参数 | 返回值 | 异常 |
---|---|---|---|---|---|
LoginAsync | 异步方法 | 进行统一认证登录 | string username 用户名<br> string password 密码<br> Func<Stream, Task<string>>? captchaGenerator 可选。 验证码填写适配器,用于在必须时填写验证码。 |
- | CaptchaRequiredException : 需要填写二维码,但是未提供对应的适配器<br>LoginFailedException : 登陆认证失败,原因见Message 。 |
LoginAsync | 异步方法 | 使用已经登录完毕LoginHttpClient登录Jwts | LoginHttpClient,已经完成登录 | - | - |
GetSemesterStartAsync | 异步方法 | 获取学期开始日期 | uint year 学年<br> JwtsSemester semester 学期 |
学期开始日期 | - |
GetScheduleAsync | 异步方法 | 获取课表信息 | uint year 学年<br> JwtsSemester semester 学期 |
大小为[7,6]的字符串列表矩阵,7为周一至周日,6为节次;数组的每个元素是该位置的课程(课程可能会占用1-3行) | - |
GetExamDetailsAsync | 异步方法 | 获取考试详细(默认学期全部类别) | - | 一组考试详细记录 | - |
GetExamDetailsAsync | 异步方法 | 获取考试详细(指定学期类别) | uint year 学年<br> JwtsSemester semester 学期<br> JwtsExamType type 类别 |
一组考试详细记录 | - |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- HtmlAgilityPack (>= 1.11.37)
- Microsoft.Extensions.Configuration (>= 5.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on HitGeneralServices:
Package | Downloads |
---|---|
HitRefresh.Schedule
Helps to convert schedule of HIT. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.5.3 | 640 | 8/23/2022 |
0.5.2 | 577 | 4/14/2022 |
0.5.1 | 1,181 | 2/16/2022 |
0.5.0 | 428 | 2/16/2022 |
0.4.4 | 436 | 1/15/2022 |
0.4.3.2 | 450 | 1/14/2022 |
0.4.3.1 | 459 | 1/13/2022 |
0.4.3 | 282 | 1/9/2022 |
0.4.2 | 281 | 12/20/2021 |
0.4.1.2 | 327 | 10/15/2021 |
0.4.1.1 | 334 | 10/15/2021 |
0.4.1 | 372 | 10/15/2021 |
0.4.0 | 330 | 10/14/2021 |
0.3.0 | 337 | 3/29/2021 |
0.2.0 | 335 | 3/29/2021 |
0.1.0 | 347 | 3/28/2021 |
版本0.4.4:增加了学期开始查询和考试信息查询功能.