示例#1
0
 public UpdateShareLinkArg(ShareLinkAccess access, DateTime dueTime, bool disableDownload = false, bool passwordProtected = false, string password = null)
 {
     this.Access            = access;
     this.DueTime           = dueTime;
     this.DisableDownload   = disableDownload;
     this.PasswordProtected = passwordProtected;
     this.Password          = password;
 }
        public CreateShareLinkArg(long id, ItemType type, ShareLinkAccess access, DateTime dueTime, bool disableDownload = false, bool passwordProtected = false, string password = null)
        {
            if (type == ItemType.file)
            {
                this.FileId = id;
            }
            else if (type == ItemType.folder)
            {
                this.FolderId = id;
            }
            else
            {
                throw new ArgumentException("type can not be all, should be file or folder", nameof(type));
            }

            this.Access            = access;
            this.DueTime           = dueTime;
            this.DisableDownload   = disableDownload;
            this.PasswordProtected = passwordProtected;
            this.Password          = password;
        }
示例#3
0
        /// <summary>
        /// 更新分享链接
        /// </summary>
        /// <param name="uniqueName">分享标识符</param>
        /// <param name="access">权限范围</param>
        /// <param name="dueTime">到期时间(格式如:yyyy-MM-dd)</param>
        /// <param name="disableDownload">是否不允许下载(默认false)</param>
        /// <param name="passwordProtected">是否有密码(默认false)</param>
        /// <param name="password">密码</param>
        /// <returns>通用分享链接对象</returns>
        public YfyShareLink Update(string uniqueName, ShareLinkAccess access, DateTime dueTime, bool disableDownload = false, bool passwordProtected = false, string password = null)
        {
            var requestArg = new UpdateShareLinkArg(access, dueTime, disableDownload, passwordProtected, password);

            return(this._transport.SendRpcRequest <UpdateShareLinkArg, YfyShareLink>(requestArg, UriHelper.UpdateShareLinkUri(uniqueName)));
        }
示例#4
0
        /// <summary>
        /// 创建分享链接
        /// </summary>
        /// <param name="id">文件(文件夹)id</param>
        /// <param name="type">文件(文件夹)类型</param>
        /// <param name="access">权限范围</param>
        /// <param name="dueTime">到期时间(格式如:yyyy-MM-dd)</param>
        /// <param name="disableDownload">是否不允许下载(默认false)</param>
        /// <param name="passwordProtected">是否有密码(默认false)</param>
        /// <param name="password">密码</param>
        /// <returns>通用分享链接对象</returns>
        public YfyShareLink Create(long id, ItemType type, ShareLinkAccess access, DateTime dueTime, bool disableDownload = false, bool passwordProtected = false, string password = null)
        {
            var requestArg = new CreateShareLinkArg(id, type, access, dueTime, disableDownload, passwordProtected, password);

            return(this._transport.SendRpcRequest <CreateShareLinkArg, YfyShareLink>(requestArg, UriHelper.CreateShareLinkUri()));
        }