/// <summary>
 /// Gets a set of games by the specified name
 /// </summary>
 /// <param name="name">The name of the game</param>
 /// <returns>The games information</returns>
 public async Task <IEnumerable <GameModel> > GetGamesByName(string name)
 {
     Validator.ValidateString(name, "name");
     return(await this.GetDataResultAsync <GameModel>("games?name=" + AdvancedHttpClient.EncodeString(name)));
 }
Esempio n. 2
0
        /// <summary>
        /// Gets the team with the specified name.
        /// </summary>
        /// <param name="name">The id of the team</param>
        /// <returns>The team</returns>
        public async Task <TeamModel> GetTeam(string name)
        {
            Validator.ValidateVariable(name, "name");
            IEnumerable <TeamModel> results = await this.GetPagedNumberAsync <TeamModel>("teams?where=name:eq:" + AdvancedHttpClient.EncodeString(name));

            return(results.FirstOrDefault());
        }
Esempio n. 3
0
 /// <summary>
 /// Gets the list of streams that have the specified query string associated with them.
 /// </summary>
 /// <param name="query">The text to search for</param>
 /// <param name="maxResults">The maximum number of results. Will be either that amount or slightly more</param>
 /// <returns>The list of associated streams</returns>
 public async Task <IEnumerable <StreamModel> > SearchStreams(string query, int maxResults = 1)
 {
     Validator.ValidateVariable(query, "query");
     return(await this.GetOffsetPagedResultAsync <StreamModel>("search/streams?query=" + AdvancedHttpClient.EncodeString(query), "streams", maxResults));
 }
Esempio n. 4
0
        /// <summary>
        /// Updates the description of the current user.
        /// </summary>
        /// <param name="description">The description to set</param>
        /// <returns>The updated current user</returns>
        public async Task <UserModel> UpdateCurrentUserDescription(string description)
        {
            NewTwitchAPIDataRestResult <UserModel> result = await this.PutAsync <NewTwitchAPIDataRestResult <UserModel> >("users?description=" + AdvancedHttpClient.EncodeString(description));

            if (result != null && result.data != null)
            {
                return(result.data.FirstOrDefault());
            }
            return(null);
        }
Esempio n. 5
0
 /// <summary>
 /// Gets the list of games that have the specified query string associated with them.
 /// </summary>
 /// <param name="query">The text to search for</param>
 /// <param name="currentlyLive">Return only games that are live on at least one channel</param>
 /// <returns>The list of associated games</returns>
 public async Task <IEnumerable <GameModel> > SearchGames(string query, bool currentlyLive = false)
 {
     Validator.ValidateVariable(query, "query");
     return(await this.GetNamedArrayAsync <GameModel>("search/games?query=" + AdvancedHttpClient.EncodeString(query) + "&live=" + currentlyLive, "games"));
 }