Ejemplo n.º 1
0
            public async static Task <Models.API.v3.Follows.FollowsResponse> GetFollowsAsync(string channel, int limit = 25, int offset = 0, Enums.Direction direction = Enums.Direction.Descending, Enums.SortBy sortBy = Enums.SortBy.CreatedAt)
            {
                string paramsStr = $"?limit={limit}&offset={offset}";

                switch (direction)
                {
                case Enums.Direction.Ascending:
                    paramsStr += $"&direction=asc";
                    break;

                case Enums.Direction.Descending:
                    paramsStr += $"&direction=desc";
                    break;
                }
                switch (sortBy)
                {
                case Enums.SortBy.CreatedAt:
                    paramsStr += $"&sortby=created_at";
                    break;

                case Enums.SortBy.LastBroadcast:
                    paramsStr += $"&sortby=last_broadcast";
                    break;

                case Enums.SortBy.Login:
                    paramsStr += $"&sortby=login";
                    break;
                }

                return(await Requests.GetGenericAsync <Models.API.v3.Follows.FollowsResponse>($"https://api.twitch.tv/kraken/users/{channel}/follows/channels{paramsStr}", null, Requests.API.v3));
            }
Ejemplo n.º 2
0
            public async Task <Models.API.v3.Follows.FollowsResponse> GetFollowsAsync(string channel, int limit = 25, int offset = 0, Enums.Direction direction = Enums.Direction.Descending, Enums.SortBy sortBy = Enums.SortBy.CreatedAt)
            {
                List <KeyValuePair <string, string> > getParams = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("limit", limit.ToString()), new KeyValuePair <string, string>("offset", offset.ToString())
                };

                switch (direction)
                {
                case Enums.Direction.Ascending:
                    getParams.Add(new KeyValuePair <string, string>("direction", "asc"));
                    break;

                case Enums.Direction.Descending:
                    getParams.Add(new KeyValuePair <string, string>("direction", "desc"));
                    break;
                }
                switch (sortBy)
                {
                case Enums.SortBy.CreatedAt:
                    getParams.Add(new KeyValuePair <string, string>("sortby", "created_at"));
                    break;

                case Enums.SortBy.LastBroadcast:
                    getParams.Add(new KeyValuePair <string, string>("sortby", "last_broadcast"));
                    break;

                case Enums.SortBy.Login:
                    getParams.Add(new KeyValuePair <string, string>("sortby", "login"));
                    break;
                }

                return(await Api.GetGenericAsync <Models.API.v3.Follows.FollowsResponse>($"https://api.twitch.tv/kraken/users/{channel}/follows/channels", getParams, null, ApiVersion.v3).ConfigureAwait(false));
            }