Exemple #1
0
        /// <summary>
        /// Get Deezer API Creds
        /// </summary>
        /// <returns></returns>
        private async Task GetDeezerAPILogin()
        {
            string webresult = await Requestasync("deezer.getUserData");

            var welcome = (dynamic)null;

            try
            {
                welcome = UserDataModel.FromJson(webresult);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            // Check for Valid User ID
            if (welcome.Results.User.UserId > 0)
            {
                // Check for Valid API Key
                if (!string.IsNullOrEmpty(welcome.Results.CheckForm) && welcome.Results.User.UserId != 0)
                {
                    // Write API Key to Var
                    apiKey = api_token + welcome.Results.CheckForm;
                    // Write UserID to Var
                    userid = welcome.Results.User.UserId.ToString();
                }
                else
                {
                    throw new Exception("Wrong User Information");
                }
            }
            else
            {
                throw new Exception("Cannot get Deezer API Key");
            }
        }
Exemple #2
0
 public static string ToJson(this UserDataModel self) => JsonConvert.SerializeObject(self, Converterr.Settings);