Exemplo n.º 1
0
        public static RawMercuryRequest Sub(string uri)
        {
            var r = new RawMercuryRequest(uri, "SUB");

            r.AddUserField("Accept-Language", "1202656e");
            return(r);
        }
        public T Request <T>(
            [NotNull] SearchRequest <T> req,
            bool outputString) where T : SearchBase
        {
            if (req.Username.IsEmpty())
            {
                req.Username = _session.Username;
            }
            if (req.Country.IsEmpty())
            {
                req.Country = _session.CountryCode;
            }
            if (req.Locale.IsEmpty())
            {
                req.Locale = _session.Locale;
            }

            if (!outputString)
            {
                return(_session.Mercury().SendSync(new JsonMercuryRequest <T>(RawMercuryRequest.Get(req.BuildUrl()))));
            }
            else
            {
                var test = _session.Mercury().SendSync(new JsonMercuryRequest <string>(RawMercuryRequest.Get(req.BuildUrl())));
                Debug.WriteLine(test);
                return(default(T));
            }
        }
Exemplo n.º 3
0
        public static ProtobuffedMercuryRequest <MercuryMultiGetReply> MultiGet(string uri, IEnumerable <MercuryRequest> requests)
        {
            var request = new RawMercuryRequest(
                uri,
                "GET",
                requests)
                          .ContentType("vnd.spotify/mercury-mget-request");

            return(new ProtobuffedMercuryRequest <MercuryMultiGetReply>(request, MercuryMultiGetReply.Parser));
        }
Exemplo n.º 4
0
 public JsonMercuryRequest([NotNull] RawMercuryRequest request)
 {
     this.Request = request;
 }
 public ProtobuffedMercuryRequest([NotNull] RawMercuryRequest request, MessageParser <T> parser)
 {
     this.Request = request;
     _parser      = parser;
 }
Exemplo n.º 6
0
 public static JsonMercuryRequest <string> GetStationFor([NotNull] string context)
 {
     return(new JsonMercuryRequest <string>(RawMercuryRequest.Get("hm://radio-apollo/v3/stations/" + context)));
 }
Exemplo n.º 7
0
 public static RawMercuryRequest AutoplayQuery([NotNull] string context)
 {
     return(RawMercuryRequest.Get("hm://autoplay-enabled/query?uri=" + context));
 }
Exemplo n.º 8
0
 public static JsonMercuryRequest <MercuryArtist> GetArtist([NotNull] ArtistId id)
 {
     return(new JsonMercuryRequest <MercuryArtist>(RawMercuryRequest.Get(id.ToMercuryUri())));
 }
Exemplo n.º 9
0
 public static JsonMercuryRequest <string> GetGenericJson([NotNull] string uri)
 {
     return(new JsonMercuryRequest <string>(RawMercuryRequest.Get(uri)));
 }
Exemplo n.º 10
0
 public static JsonMercuryRequest <StoredToken> RequestToken([NotNull] string deviceId, [NotNull] string[] scope)
 {
     return(new JsonMercuryRequest <StoredToken>(RawMercuryRequest.Get(
                                                     $"hm://keymaster/token/authenticated?scope={string.Join(",", scope)}&client_id={KEYMASTER_CLIENT_ID}&device_id={deviceId}")));
 }
Exemplo n.º 11
0
 public static JsonMercuryRequest <string> ResolveContext([NotNull] string uri)
 {
     return(new JsonMercuryRequest <string>(RawMercuryRequest.Get(
                                                $"hm://context-resolve/v1/{uri}")));
 }