Beispiel #1
0
func (s *SearchMethod) Games(q string, opt *ListOptions) (*SGamesS, error) {
	rel := fmt.Sprintf("search/games?q=%s&type=suggest", url.QueryEscape(q))
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "&" + v.Encode()
	}

	search := new(SGamesS)
	_, err := s.client.Get(rel, search)
	return search, err
}
Beispiel #2
0
func (t *TeamsMethod) List(opt *ListOptions) (*TeamsS, error) {
	rel := "teams"
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "?" + v.Encode()
	}

	teams := new(TeamsS)
	_, err := t.client.Get(rel, teams)
	return teams, err
}
Beispiel #3
0
func (v *VideosMethod) Top(opt *ListOptions) (*VideosS, error) {
	rel := "videos/top"
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "?" + v.Encode()
	}

	videos := new(VideosS)
	_, err := v.client.Get(rel, videos)
	return videos, err
}
Beispiel #4
0
func (s *SearchMethod) Streams(q string, opt *ListOptions) (*StreamsS, error) {
	rel := "search/streams?q=" + url.QueryEscape(q)
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "&" + v.Encode()
	}

	search := new(StreamsS)
	_, err := s.client.Get(rel, search)
	return search, err
}
Beispiel #5
0
// Returns a list of featured (promoted) stream objects.
func (s *StreamsMethod) Featured(opt *ListOptions) (*FeaturedS, error) {
	rel := "streams/featured"
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "?" + v.Encode()
	}

	featured := new(FeaturedS)
	_, err := s.client.Get(rel, featured)
	return featured, err
}
Beispiel #6
0
// Returns a summary of current streams.
func (s *StreamsMethod) Summary(opt *ListOptions) (*SummaryS, error) {
	rel := "streams/summary"
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "?" + v.Encode()
	}

	summary := new(SummaryS)
	_, err := s.client.Get(rel, summary)
	return summary, err
}
Beispiel #7
0
// Returns a list of users the channel `name` is following.
func (c *ChannelsMethod) Follows(name string, opt *ListOptions) (*FollowsS, error) {
	rel := "channels/" + name + "/follows"
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "?" + v.Encode()
	}

	follow := new(FollowsS)
	_, err := c.client.Get(rel, follow)
	return follow, err
}
Beispiel #8
0
// Returns a list of videos ordered by time of creation, starting with the most
// recent from channel `name`.
func (c *ChannelsMethod) Videos(name string, opt *ListOptions) (*VideosS, error) {
	rel := "channels/" + name + "/videos"
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "?" + v.Encode()
	}

	videos := new(VideosS)
	_, err := c.client.Get(rel, videos)
	return videos, err
}
Beispiel #9
0
func (c *ChannelsMethod) subscriptions(name string, opt *ListOptions) (*SubsS, error) {
	rel := "channels/" + name + "/subscriptions"
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "?" + v.Encode()
	}

	subs := new(SubsS)
	_, err := c.client.Get(rel, subs)
	return subs, err
}
Beispiel #10
0
// Get a user's list of followed channels
func (u *UsersMethod) Follows(user string, opt *ListOptions) (*UFollowsS, error) {
	rel := "users/" + user + "/follows/channels"
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "?" + v.Encode()
	}

	follows := new(UFollowsS)
	_, err := u.client.Get(rel, follows)
	return follows, err
}
Beispiel #11
0
func (u *UsersMethod) blocks(login string, opt *ListOptions) (*BlocksS, error) {
	rel := "users/" + login + "/blocks"
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "?" + v.Encode()
	}

	blocks := new(BlocksS)
	_, err := u.client.Get(rel, blocks)
	return blocks, err
}
Beispiel #12
0
// Returns a list of games objects sorted by number of current viewers, most
// popular first.
func (g *GamesMethod) Top(opt *ListOptions) (*TopsS, error) {
	rel := "games/top"
	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "?" + v.Encode()
	}

	games := new(TopsS)
	_, err := g.client.Get(rel, games)
	return games, err
}
Beispiel #13
0
// Returns a list of stream objects according to optional parameters.
func (s *StreamsMethod) List(opt *ListOptions) (*StreamsS, error) {
	rel := "streams"

	if opt != nil {
		v, err := query.Values(opt)
		if err != nil {
			return nil, err
		}
		rel += "?" + v.Encode()
	}

	streams := new(StreamsS)
	_, err := s.client.Get(rel, streams)
	return streams, err
}