feat(work): 新增微盘版本和容量管理相关接口

This commit is contained in:
fudiwei
2022-12-03 18:14:53 +08:00
parent 67e1f7947c
commit 1e4659c0ad
8 changed files with 158 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
@@ -476,5 +476,47 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
return await client.SendRequestWithJsonAsync<Models.CgibinWebDriveFileACLDeleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region Manage
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedrive/mng_pro_info 接口。</para>
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95861 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWebDriveManageProfessionalInfoResponse> ExecuteCgibinWebDriveManageProfessionalInfoAsync(this WechatWorkClient client, Models.CgibinWebDriveManageProfessionalInfoRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "wedrive", "mng_pro_info")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.CgibinWebDriveManageProfessionalInfoResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedrive/mng_capacity 接口。</para>
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95861 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWebDriveManageCapacityResponse> ExecuteCgibinWebDriveManageCapacityAsync(this WechatWorkClient client, Models.CgibinWebDriveManageCapacityRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "wedrive", "mng_capacity")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.CgibinWebDriveManageCapacityResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
}
}

View File

@@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/mng_capacity 接口的请求。</para>
/// </summary>
public class CgibinWebDriveManageCapacityRequest : WechatWorkRequest
{
}
}

View File

@@ -0,0 +1,36 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/mng_capacity 接口的响应。</para>
/// </summary>
public class CgibinWebDriveManageCapacityResponse : WechatWorkResponse
{
/// <summary>
/// 获取或设置全员容量(单位:字节)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_capacity_for_all")]
[System.Text.Json.Serialization.JsonPropertyName("total_capacity_for_all")]
public long TotalCapacityForAll { get; set; }
/// <summary>
/// 获取或设置专业容量(单位:字节)。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_capacity_for_vip")]
[System.Text.Json.Serialization.JsonPropertyName("total_capacity_for_vip")]
public long TotalCapacityForVip { get; set; }
/// <summary>
/// 获取或设置全员可用容量(单位:字节)。
/// </summary>
[Newtonsoft.Json.JsonProperty("rest_capacity_for_all")]
[System.Text.Json.Serialization.JsonPropertyName("rest_capacity_for_all")]
public long RestCapacityForAll { get; set; }
/// <summary>
/// 获取或设置专业可用容量(单位:字节)。
/// </summary>
[Newtonsoft.Json.JsonProperty("rest_capacity_for_vip")]
[System.Text.Json.Serialization.JsonPropertyName("rest_capacity_for_vip")]
public long RestCapacityForVip { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/mng_pro_info 接口的请求。</para>
/// </summary>
public class CgibinWebDriveManageProfessionalInfoRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置操作者成员账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("userid")]
[System.Text.Json.Serialization.JsonPropertyName("userid")]
public string? UserId { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/mng_pro_info 接口的响应。</para>
/// </summary>
public class CgibinWebDriveManageProfessionalInfoResponse : WechatWorkResponse
{
/// <summary>
/// 获取或设置是否是专业版。
/// </summary>
[Newtonsoft.Json.JsonProperty("is_pro")]
[System.Text.Json.Serialization.JsonPropertyName("is_pro")]
public bool IsProfessional { get; set; }
/// <summary>
/// 获取或设置 VIP 账号总数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("total_vip_acct_num")]
[System.Text.Json.Serialization.JsonPropertyName("total_vip_acct_num")]
public int TotalVipAccountCount { get; set; }
/// <summary>
/// 获取或设置 VIP 账号已使用数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("use_vip_acct_num")]
[System.Text.Json.Serialization.JsonPropertyName("use_vip_acct_num")]
public int UsedVipAccountCount { get; set; }
/// <summary>
/// 获取或设置专业版到期时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("pro_expire_time")]
[System.Text.Json.Serialization.JsonPropertyName("pro_expire_time")]
public long? ProfessionalExpireTimestamp { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
{
"errcode": 0,
"errmsg": "ok",
"total_capacity_for_all": 22666689904640,
"total_capacity_for_vip": 22300038149020,
"rest_capacity_for_all": 0,
"rest_capacity_for_vip": 0
}

View File

@@ -0,0 +1,8 @@
{
"errcode": 0,
"errmsg": "ok",
"is_pro": true,
"total_vip_acct_num": 10,
"use_vip_acct_num": 5,
"pro_expire_time": 1754827419
}