Commit d9ce04cb authored by Simon Kirsten's avatar Simon Kirsten
Browse files

Updated reference to new parameter passing and added many new examples

parent 577bdd4b
......@@ -6,29 +6,48 @@
> Updates and returns the new state of the TV.
Optional Query String Parameters:
Optional Parameters:
| Name | Type | Description |
| --------------- | ------ | --- |
| `large_channel` | string | Sets the channel name of the large screen.<br>This screen is always visible. Set to `#!java null` to disable.<br>Example: `large_channel=monstercat` |
| `small_channel` | string | Sets the channel name of the small screen.<br>This screen is only visible if it is not `#!java null`. Set to `#!java null` to disable.<br>Example: `small_channel=null` |
| `volume` | float | Sets the volume of the large screen.<br>The small screen is always muted. Set to `#!java 0` or `#!java 0.0` to mute.<br>Values are in the range of `#!java 0.0 - 1.0`.<br>Example: `volume=0.75` |
| `small_scale` | float | Sets the scale (size) of the small screen.<br>The value is relative to the width of the large screen.<br>Reasonable values are in the range of `#!java 0.2 - 0.5`.<br>It is best to just experiment with this setting.<br>Example: `small_scale=0.4` |
| `show_chat` | bool | Sets whether the chat should be shown or not.<br>Example: `show_chat=true` |
| `large_channel` | string | Sets the channel name of the large screen.<br>This screen is the always visible main screen.<br>Set to *empty* to disable (see examples). |
| `small_channel` | string | Sets the channel name of the small screen.<br>This screen is a small Picture-in-Picture like screen in the top right corner.<br>Set to *empty* to disable (see examples). |
| `volume` | float | Sets the volume of the large screen.<br>Set to `#!java 0` or `#!java 0.0` to mute.<br>Values are in the range of `#!java 0.0 - 1.0`.<br> Note: The small screen is always muted.|
| `small_scale` | float | Sets the scale (size) of the small screen.<br>The value is relative to the width of the large screen.<br>Reasonable values are in the range of `#!java 0.2 - 0.5`.<br>It is best to just experiment with this setting. |
| `show_chat` | bool | Sets whether the chat should be shown or not.<br>Accepts `#!java true` and `#!java false`. |
!!! note
All parameters are optional and can be combined. If none are supplied no updates are done and the current state gets returned. Also empty parameters like `?large_channel=&volume=` are simply ignored. This makes the Android integration a lot simpler.
All parameters are optional and can be combined. If none are supplied no updates are done and the current state gets returned.
Returns: [`TVState`](#tvstate_1).
Examples:
``` tab="Browser"
http://127.0.0.1:8080/tv/state?large_channel=riotgames&small_channel=&volume=0.75&show_chat=true
``` md tab="Browser"
Only set the large_channel to riotgames
> http://127.0.0.1:8080/tv/state?large_channel=riotgames
Set the large_channel to monstercat
Disable the small_channel
Set the volume to 0.8
The small_scale is not changed (because of its absense)
Hide the chat
> http://127.0.0.1:8080/tv/state?large_channel=monstercat&small_channel=&volume=0.8&show_chat=false
```
``` java tab="Remote (Android)"
TODO
``` java tab="StreamTV.java"
StreamTV streamTV = new StreamTV("10.0.2.2:8080");
// Only set the large_channel to riotgames
JSONObject newState = streamTV.tvState("riotgames", null, null, null, null);
// Set the large_channel to monstercat
// Disable the small_channel
// Set the volume to 0.8
// The small_scale is not changed (because of null)
// Hide the chat
JSONObject newState = streamTV.tvState("monstercat", "", 0.8f, null, false);
```
---
......@@ -45,12 +64,14 @@ Returns: [`Game`](#game) array.
Examples:
``` tab="Browser"
http://127.0.0.1:8080/twitch/games/top
``` md tab="Browser"
> http://127.0.0.1:8080/twitch/games/top
```
``` java tab="Remote (Android)"
TODO
``` java tab="StreamTV.java"
StreamTV streamTV = new StreamTV("10.0.2.2:8080");
List<JSONObject> topGames = streamTV.twitchGamesTop();
```
---
......@@ -58,22 +79,31 @@ TODO
### `/twitch/games/search`
> Searches games by query.
Query String Parameters:
Parameters:
| Name | Type | Description |
| --------------- | ------ | --- |
| `query` | string | What should be searched e.g. `query=Talk%20Shows`<br>**Required** |
| `query` | string | What should be searched.<br>**Required** |
Returns: [`Game`](#game) array.
Examples:
``` tab="Browser"
http://127.0.0.1:8080/twitch/games/search?query=Talk%20Shows
``` md tab="Browser"
Search for the game Talk Shows
> http://127.0.0.1:8080/twitch/games/search?query=Talk%20Shows
Search for ove (will show games starting with "ove" like Overwatch)
> http://127.0.0.1:8080/twitch/games/search?query=ove
```
``` java tab="Remote (Android)"
TODO
``` java tab="StreamTV.java"
StreamTV streamTV = new StreamTV("10.0.2.2:8080");
// Search for the game Talk Shows & Podcasts
List<JSONObject> topGames = streamTV.twitchGamesSearch("talk show");
// Search for ove (will show games starting with "ove" like Overwatch)
List<JSONObject> topGames = streamTV.twitchGamesSearch("ove");
```
---
......@@ -82,36 +112,60 @@ TODO
> Gets the most popular streams on Twitch right now. Optionally filter by channels, game and language.
Optional Query String Parameters:
Optional Parameters:
| Name | Type | Description |
| --------------- | ------ | --- |
| `channels` | string | Specify up to 100 channels seperated by `,` that the search should be limited to. See the note why that would be useful.<br>Example: `channels=xqcow,dafran,kitboga` |
| `game` | string | Specify a game that the search should be limited to.<br>Example: `game=overwatch` |
| `language` | string | Specify a language that the search should be limited to.<br>Example: `language=de` |
| `channels` | string | Specify up to 100 channels separated by `,` that the search should be limited to.<br>See the examples why that would be useful. |
| `game` | string | Specify a game that the search should be limited to. |
| `language` | string | Specify a language that the search should be limited to. |
!!! note
All parameters are optional and can be combined. Empty parameters like `?channels=&language=` are simply ignored. This makes the Android integration a lot simpler.
The `channels` option can be very usefull: If for example your app implements a favorite list you can very easily query these channels `http://127.0.0.1:8080/twitch/streams/top?channels={comma seperated list of favorite channels here}` and see who is streaming and other metadata.
All parameters are optional and can be combined. If none are supplied the top streams for all channels, games and languages are returned.
Returns: [`Stream`](#stream) array.
Examples:
``` tab="Browser"
http://127.0.0.1:8080/twitch/streams/top?game=Talk%20Shows%20%26%20Podcasts&language=en
``` md tab="Browser"
Get the unfiltered top streams
> http://127.0.0.1:8080/twitch/streams/top
German top streams
> http://127.0.0.1:8080/twitch/streams/top?language=de
English top streams in Talk Shows and Podcasts
> http://127.0.0.1:8080/twitch/streams/top?language=en&game=Talk%20Shows%20%26%20Podcasts
Tip: If your app implements a favorite list you can very easily query these channels and see who is streaming and other information:
> http://127.0.0.1:8080/twitch/streams/top?channels={comma separated favorite channels}
> http://127.0.0.1:8080/twitch/streams/top?channels=xqcow,dafran,kitboga
```
``` java tab="Remote (Android)"
TODO
``` java tab="StreamTV.java"
StreamTV streamTV = new StreamTV("10.0.2.2:8080");
// Get the unfiltered top streams
List<JSONObject> topStreams = streamTV.twitchStreamsTop(null, null, null);
// German top streams
List<JSONObject> topStreams = streamTV.twitchStreamsTop(null, null, "de");
// English top streams in Talk Shows and Podcasts
List<JSONObject> topStreams = streamTV.twitchStreamsTop(null, "Talk Shows and Podcasts", "en");
// Tip: If your app implements a favorite list you can very easily query these channels and see who is streaming and other information:
String[] favoriteChannels = {"xqcow", "dafran", "kitboga"};
List<JSONObject> topStreams = streamTV.twitchStreamsTop(favoriteChannels, null, null);
```
---
### `/twitch/streams/featured`
> Gets the featured games on Twitch's homepage.
> Gets the featured streams on Twitch's homepage.
*No Parameters*
......@@ -123,8 +177,10 @@ Examples:
http://127.0.0.1:8080/twitch/streams/featured
```
``` java tab="Remote (Android)"
TODO
``` java tab="StreamTV.java"
StreamTV streamTV = new StreamTV("10.0.2.2:8080");
List<JSONObject> featuredStreams = streamTV.twitchStreamsFeatured();
```
---
......@@ -135,7 +191,7 @@ TODO
``` json
{
"large_channel": "xqcow",
"small_channel": "jackdire",
"small_channel": "",
"volume": 0.75,
"small_scale": 0.25,
"show_chat": true
......@@ -170,6 +226,8 @@ TODO
}
```
Note that the image at the `preview_img_url` url updates itself every couple of seconds <small>TODO research how many seconds</small>. This could be used to display a *"live"* preview in the app.
Also note that `started_at` is an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
\ No newline at end of file
!!! note
* The image at the `preview_img_url` url updates itself every couple of seconds <small>TODO research how many seconds</small>. This could be used to display a *"live"* preview in the app.
* `started_at` is an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
* `video_height`: `#!json 1080` = `HD`, `#!json < 1080` = `SD`, `#!json > 1080` = `UHD`.
* `mature`: If the stream is meant for mature audiences (set by the streamer himself as a guideline).
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment