コード例 #1
0
        /// <summary>
        /// Send a password recovery request to Yify torrent. If the email is valid Yify torrent will email a
        /// password rest code which can be used on <code>ResetUserPassword</code> function.
        /// </summary>
        /// <param name="email">Email of a registered account</param>
        /// <returns>True if the request is successful</returns>
        /// <exception cref="YifyLib.YifyMissingAppKeyException">If application key is missing</exception>
        /// <exception cref="ArgumentException">If Email is empty or null</exception>
        /// <exception cref="YifyLib.YifyException">If any errors occurred YTS process</exception>
        public bool ForgotUserPassword(string email)
        {
            this.CheckAppKey();
            if (!email.HasValue())
            {
                throw new ArgumentException("Email cannot be empty.");
            }
            else
            {
                try
                {
                    var req = YifyAPI.GetForgotUserPasswordRequest(this.appKey, email);
                    var res = YifyAPI.SendPostRequest(req);

                    var xDoc = _parser.ToResponse(res);
                    return(true);
                }
                catch (Exception ex) { throw new YifyException("An error occurred. See inner exception for more details", ex); }
            }
        }