Skip to content

Commit

Permalink
Docs for Twitch Clips API (#23)
Browse files Browse the repository at this point in the history
* Added Clip as an API resource

* Add day as valid PERIODS value

* Twitch Clips API implementation

* Add Clips to TwitchClient

* Import clips

* Tests on Twitch Clips API

* Added test_get_top

* Renamed test name to follow standard

* E261: at least two spaces before inline comment

* Expected 2 blank lines

* Re-ordered imports

* Sorted imports

* Documentation for Clips API
  • Loading branch information
garciabruno authored and tsifrer committed Nov 7, 2017
1 parent bd79f97 commit fbf45a2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
35 changes: 35 additions & 0 deletions docs/api/clips.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Clips
====

.. currentmodule:: twitch.api.clips

.. class:: Clips()

This class provides methods for easy access to `Twitch Clips API`_.

.. classmethod:: get_by_slug(slug)

Gets a clip object based on the slug provided

:param string slug: Twitch Slug.


.. classmethod:: get_top(channel, cursor, game, language, limit, period, trending)

Gets all clips emoticons in one or more specified sets.

:param string channel: Channel name. If this is specified, top clips for only this channel are returned; otherwise, top clips for all channels are returned. If both channel and game are specified, game is ignored.
:param string cursor: Tells the server where to start fetching the next set of results, in a multi-page response.
:param string game: Game name. (Game names can be retrieved with the Search Games endpoint.) If this is specified, top clips for only this game are returned; otherwise, top clips for all games are returned. If both channel and game are specified, game is ignored.
:param string language: Comma-separated list of languages, which constrains the languages of videos returned. Examples: es, en,es,th. If no language is specified, all languages are returned.
:param int limit: Maximum number of most-recent objects to return. Default: 10. Maximum: 100.
:param string period: The window of time to search for clips. Valid values: day, week, month, all. Default: week.
:param boolean trending: If True, the clips returned are ordered by popularity; otherwise, by viewcount. Default: False.


.. classmethod:: get_followed()

Gets top clips for games followed by the user identified by OAuth token. Results are ordered by popularity.


.. _`Twitch Clips API`: https://dev.twitch.tv/docs/v5/reference/clips
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ An easy to use Python library for accessing the Twitch API
This documentation is a work in progress

.. note::
``python-twitch-client`` currently supports Twitch API v5.
``python-twitch-client`` currently supports Twitch API v5.

If you find a missing endpoint or a bug please raise an issue_ or contribute and open a
`pull request`_.
Expand Down Expand Up @@ -65,6 +65,7 @@ Contents:
:maxdepth: 2

basic_usage
api/clips
api/chat
api/channel_feed
api/channels
Expand Down

0 comments on commit fbf45a2

Please sign in to comment.