mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-04-05 17:37:54 +08:00
feat(work): 新增获取微盘文件权限信息接口
This commit is contained in:
parent
aedd92ad39
commit
d024f45c00
@ -393,6 +393,26 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinWebDriveFileShareResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/wedrive/get_file_permission 接口。</para>
|
||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/97962 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinWebDriveGetFilePermissionResponse> ExecuteCgibinWebDriveGetFilePermissionAsync(this WechatWorkClient client, Models.CgibinWebDriveGetFilePermissionRequest 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", "get_file_permission")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinWebDriveGetFilePermissionResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region FileACL
|
||||
|
@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/wedrive/get_file_permission 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinWebDriveGetFilePermissionRequest : WechatWorkRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置文件 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("fileid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("fileid")]
|
||||
public string FileId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,195 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/wedrive/get_file_permission 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinWebDriveGetFilePermissionResponse : WechatWorkResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class ShareRange
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置是否为企业内可访问。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("enable_corp_internal")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("enable_corp_internal")]
|
||||
public bool EnableCorpInternal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置企业内权限类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("corp_internal_auth")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("corp_internal_auth")]
|
||||
public int CorpInternalAuthType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否开启企业内管理员审批。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("corp_internal_approve_only_by_admin")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("corp_internal_approve_only_by_admin")]
|
||||
public bool? IsCorpInternalApproveOnlyByAdmin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否为企业外可访问。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("enable_corp_external")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("enable_corp_external")]
|
||||
public bool EnableCorpExternal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置企业外权限类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("corp_external_auth")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("corp_external_auth")]
|
||||
public int CorpExternalAuthType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否开启企业外管理员审批。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("corp_external_approve_only_by_admin")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("corp_external_approve_only_by_admin")]
|
||||
public bool? IsCorpExternalApproveOnlyByAdmin { get; set; }
|
||||
}
|
||||
|
||||
public class SecureSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置是否开启只读备份。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("enable_readonly_copy")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("enable_readonly_copy")]
|
||||
public bool EnableReadonlyCopy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否只允许管理员进行修改。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("modify_only_by_admin")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("modify_only_by_admin")]
|
||||
public bool IsModifyOnlyByAdmin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否开启只读评论。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("enable_readonly_comment")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("enable_readonly_comment")]
|
||||
public bool EnableReadonlyComment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否禁止分享到企业外部。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("ban_share_external")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("ban_share_external")]
|
||||
public bool IsBanShareExternal { get; set; }
|
||||
}
|
||||
|
||||
public class ACL
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置文件授权信息列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("auth_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("auth_list")]
|
||||
public Types.Authority[] AuthorityList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否开启父路径权限继承。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("inherit")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("inherit")]
|
||||
public bool IsInherit { get; set; }
|
||||
}
|
||||
|
||||
public class Authority : CgibinWebDriveSpaceInfoResponse.Types.Space.Types.Authority
|
||||
{
|
||||
}
|
||||
|
||||
public class Watermark
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置水印文字。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("text")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("text")]
|
||||
public string Text { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置水印类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("margin_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("margin_type")]
|
||||
public int MarginType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否开启水印文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("show_text")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("show_text")]
|
||||
public bool EnableShowText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否开启水印访问人名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("show_visitor_name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("show_visitor_name")]
|
||||
public bool EnableShowVisitorName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置管理员是否强制要求使用水印。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("force_by_admin")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("force_by_admin")]
|
||||
public bool IsForceByAdmin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置空间管理员是否强制要求使用水印。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("force_by_space_admin")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("force_by_space_admin")]
|
||||
public bool IsForceBySpaceAdmin { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置文件分享设置。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("share_range")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("share_range")]
|
||||
public Types.ShareRange ShareRange { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置安全配置信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("secure_setting")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("secure_setting")]
|
||||
public Types.SecureSettings SecureSettings { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置从文件父路径继承的权限信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("inherit_father_auth")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("inherit_father_auth")]
|
||||
public Types.ACL FatherACL { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置文件成员授权信息列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("file_member_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("file_member_list")]
|
||||
public Types.Authority[]? FileMemberAuthorityList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置文件协作者授权信息列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("co_auth_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("co_auth_list")]
|
||||
public Types.Authority[]? FileCollaboratorAuthorityList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置水印信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("watermark")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("watermark")]
|
||||
public Types.Watermark? Watermark { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"fileid": "FILEID"
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"share_range": {
|
||||
"enable_corp_internal": true,
|
||||
"corp_internal_auth": 1,
|
||||
"enable_corp_external": false,
|
||||
"corp_external_auth": 2
|
||||
},
|
||||
"secure_setting": {
|
||||
"enable_readonly_copy": true,
|
||||
"modify_only_by_admin": true,
|
||||
"enable_readonly_comment": false,
|
||||
"ban_share_external": true
|
||||
},
|
||||
"inherit_father_auth": {
|
||||
"auth_list": [
|
||||
{
|
||||
"type": 1,
|
||||
"userid": "USERID",
|
||||
"auth": 1
|
||||
}
|
||||
],
|
||||
"inherit": true
|
||||
},
|
||||
"file_member_list": [
|
||||
{
|
||||
"type": 1,
|
||||
"userid": "USERID",
|
||||
"auth": 1
|
||||
}
|
||||
],
|
||||
"watermark": {
|
||||
"text": "WATERMARK_TEXT",
|
||||
"margin_type": 1,
|
||||
"show_visitor_name": false,
|
||||
"force_by_admin": false,
|
||||
"show_text": false,
|
||||
"force_by_space_admin": false
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user