public void Init() { // Configuration var configBuilder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); IConfiguration config = configBuilder.Build(); // Spotify Client Factory _client = SpotifySdkClientFactory.CreateSpotifySdkClient( config["client_id"], config["client_secret"], redirect_url, state ).Set(country); Assert.IsNotNull(_client); // Spotify Client Token var authenticationToken = new AuthenticationTokenResponse() { Token = config["token"], Refresh = config["refresh"], Expiration = DateTime.Parse(config["expires"]), AuthenticationTokenType = (AuthenticationTokenType)Enum.Parse(typeof(AuthenticationTokenType), config["type"]) }; _client.AuthenticationToken = authenticationToken; _client.Limit = limit; }
/// <summary> /// Init /// </summary> private async void Init() { _config = await Settings.GetAppSettings(); Client = SpotifySdkClientFactory.CreateSpotifySdkClient( clientId: _config["client_id"], authorisationRedirectUri: new Uri(_config["redirect_uri"]), authorisationState: _config["state"]); Client.Config.AttachAll(); }
public void Init() { // Configuration var configBuilder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); IConfiguration config = configBuilder.Build(); // Spotify Sdk Client Factory _client = SpotifySdkClientFactory.CreateSpotifySdkClient( config["client_id"], config["client_secret"] ).Set(country); Assert.IsNotNull(_client); // Set Limit _client.Limit = limit; }