/// <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"); } }
public static string ToJson(this UserDataModel self) => JsonConvert.SerializeObject(self, Converterr.Settings);