Example #1
0
        public static IEnumerable <Game> GetOwnedGameList(String accessToken)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);

            return(SqualrApi.ExecuteRequest <Game[]>(Method.GET, SqualrApi.OwnedGamesEndpoint, parameters));
        }
Example #2
0
        public static IEnumerable <Game> SearchGameList(String searchTerm)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("search_term", searchTerm);

            return(SqualrApi.ExecuteRequest <Game[]>(Method.GET, SqualrApi.GameSearchEndpoint, parameters));
        }
Example #3
0
        public static String Connect(String accessToken)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);

            return(SqualrApi.ExecuteRequest <String>(Method.GET, SqualrApi.TwitchConnectionEndpoint + "/create", parameters));
        }
Example #4
0
        public static IEnumerable <CheatVotes> GetStreamActivationIds(String accessToken)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);

            return(SqualrApi.ExecuteRequest <IEnumerable <CheatVotes> >(Method.GET, SqualrApi.ActiveCheatIdsEndpoint, parameters));
        }
Example #5
0
        public static User GetTwitchUser(String accessToken)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);

            return(SqualrApi.ExecuteRequest <User>(Method.GET, SqualrApi.UserApi, parameters));
        }
Example #6
0
        public static IEnumerable <StreamIcon> GetStreamIcons()
        {
            if (cachedIcons == null)
            {
                cachedIcons = SqualrApi.ExecuteRequest <StreamIcon[]>(Method.GET, SqualrApi.StreamIconsEndpoint).Shuffle();
            }

            return(cachedIcons);
        }
Example #7
0
        public static IEnumerable <Library> GetLibraries(String accessToken, Int32 gameId)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);
            parameters.Add("game_id", gameId.ToString());

            return(SqualrApi.ExecuteRequest <Library[]>(Method.GET, SqualrApi.LibraryEndpoint, parameters));
        }
Example #8
0
        public static Library CreateLibrary(String accessToken, Int32 gameId)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);
            parameters.Add("game_id", gameId.ToString());

            return(SqualrApi.ExecuteRequest <Library>(Method.GET, SqualrApi.LibraryEndpoint + "/create", parameters));
        }
Example #9
0
        public static LibraryCheats GetCheats(String accessToken, Int32 libraryId)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);
            parameters.Add("library_id", libraryId.ToString());

            return(SqualrApi.ExecuteRequest <LibraryCheats>(Method.GET, SqualrApi.CheatsEndpoint, parameters));
        }
Example #10
0
        public static UnlockedCheat UnlockCheat(String accessToken, Int32 cheatId)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);
            parameters.Add("cheat_id", cheatId.ToString());

            return(SqualrApi.ExecuteRequest <UnlockedCheat>(Method.GET, SqualrApi.StoreEndpoint + "/create", parameters));
        }
Example #11
0
        public static StoreCheats GetStoreCheats(String accessToken, Int32 gameId)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);
            parameters.Add("game_id", gameId.ToString());

            return(SqualrApi.ExecuteRequest <StoreCheats>(Method.GET, SqualrApi.StoreEndpoint, parameters));
        }
Example #12
0
        public static void DeleteLibrary(String accessToken, Int32 libraryId)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);
            parameters.Add("library_id", libraryId.ToString());

            SqualrApi.ExecuteRequest(Method.DELETE, SqualrApi.LibraryEndpoint + "/" + libraryId.ToString(), parameters);
        }
Example #13
0
        public static Cheat RemoveCheatFromLibrary(String accessToken, Int32 libraryId, Int32 cheatId)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);
            parameters.Add("library_id", libraryId.ToString());
            parameters.Add("cheat_id", cheatId.ToString());

            return(SqualrApi.ExecuteRequest <Cheat>(Method.DELETE, SqualrApi.CheatsEndpoint + "/" + cheatId.ToString(), parameters));
        }
Example #14
0
        public static void UpdateCheatStreamMeta(String accessToken, Cheat cheat)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);
            parameters.Add("cheat_id", cheat?.CheatId.ToString());

            parameters.Add("is_stream_disabled", ((cheat?.IsStreamDisabled ?? false) ? 1 : 0).ToString());
            parameters.Add("cooldown", cheat?.CooldownMax.ToString());
            parameters.Add("duration", cheat?.DurationMax.ToString());
            parameters.Add("icon", cheat?.IconName?.ToString());

            SqualrApi.ExecuteRequest(Method.PUT, SqualrApi.UpdateCheatStreamMetaEndpoint + "/" + cheat?.CheatId.ToString(), parameters);
        }
Example #15
0
        public static void UpdateOverlayMeta(String accessToken, OverlayMeta[] activeCooldowns)
        {
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("access_token", accessToken);

            using (MemoryStream memoryStream = new MemoryStream())
            {
                DataContractJsonSerializer deserializer = new DataContractJsonSerializer(typeof(OverlayMeta[]));

                deserializer.WriteObject(memoryStream, activeCooldowns);

                parameters.Add("active_cooldowns", Encoding.ASCII.GetString(memoryStream.ToArray()));
            }

            SqualrApi.ExecuteRequest(Method.GET, SqualrApi.OverlayConfigEndpoint + "/create", parameters);
        }
Example #16
0
 /// <summary>
 /// Executes the given REST request.
 /// </summary>
 /// <param name="method">The HTTP method.</param>
 /// <param name="endpoint">The REST endpoint.</param>
 /// <param name="parameters">The request parameters.</param>
 /// <returns>The response content.</returns>
 private static void ExecuteRequest(Method method, String endpoint, Dictionary <String, String> parameters = null)
 {
     SqualrApi.ExecuteRequest <String>(method, endpoint, parameters);
 }
Example #17
0
 public static IEnumerable <Game> GetGameList()
 {
     return(SqualrApi.ExecuteRequest <Game[]>(Method.GET, SqualrApi.GameAvailableEndpoint));
 }