public SpotifyHandle(IHttpHandle httpHandle, IJsonHandle jsonHandle, IOptions <SpotifySettings> spotifySettings, IDiscoRepository discoRepository)
 {
     _httpHandle      = httpHandle;
     _jsonHandle      = jsonHandle;
     _spotifySettings = spotifySettings.Value;
     _discoRepository = discoRepository;
 }
 public PlaylistsController(IMapper mapper, ISpotifyRepository repository, IUnitOfWork unitOfWork,
                            IOptionsSnapshot <SpotifySettings> spotifySettings)
 {
     Mapper           = mapper;
     _repository      = repository;
     _unitOfWork      = unitOfWork;
     _spotifySettings = spotifySettings.Value;
 }
 public SpotifyService(IHttpService httpService,
                       IJsonService jsonService,
                       IOptions <SpotifySettings> spotifySettings,
                       IDiscoRepository discoRepository)
 {
     _httpService     = httpService;
     _jsonService     = jsonService;
     _spotifySettings = spotifySettings.Value;
     _discoRepository = discoRepository;
 }
        static async Task <SpotifyToken> GetTokenAsync(SpotifySettings settings)
        {
            var auth = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{settings.ClientId}:{settings.ClientSecret}"));

            var args = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("grant_type", "client_credentials")
            };

            var request = new HttpRequestMessage(HttpMethod.Post, TokenUrl);

            request.Headers.Add("Authorization", $"Basic {auth}");
            request.Content = new FormUrlEncodedContent(args);

            var resp = await Client.SendAsync(request);

            var msg = await resp.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <SpotifyToken>(msg));
        }
 public SpotifyService(CBVinilContext context, IOptions <SpotifySettings> options)
 {
     _context         = context;
     _spotifySettings = options.Value;
 }
Exemple #6
0
 public SmartThings()
 {
     Sensor          = new Sensor();
     SpotifySettings = new SpotifySettings();
 }
Exemple #7
0
 public SpotifyService(HttpClient apiClient, IConfiguration configuration)
 {
     _apiClient       = apiClient;
     _spotifySettings = configuration.GetSection(nameof(SpotifySettings)).Get <SpotifySettings>();
 }
 public SpotifyController(ILogger <SpotifyController> logger, IConfiguration configuration, SongOfTheDayContext context, IOptions <SpotifySettings> settings)
 {
     _settings = settings.Value;
     _context  = context;
 }