1
0
mirror of https://github.com/Decicus/DecAPI-Docs.git synced 2024-11-25 22:02:32 +01:00

[Twitch] Begin documenting new followage/followed

This commit is contained in:
Alex Thomassen 2023-10-01 20:22:53 +02:00
parent 7b2cb04670
commit 9b52c058bb
Signed by: Alex
GPG Key ID: 10BD786B5F6FF5DE
3 changed files with 43 additions and 16 deletions

View File

@ -40,19 +40,22 @@ endpoints:
description: 'Specify the timezone that you want the date/time to be displayed as. <a href="https://decapi.me/misc/timezones">List of supported timezones.</a>'
required: false
type: "string"
- route: "followage/:channel/:user"
deprecated: true
- route: "followage/:channel/:user?token=YOUR_TOKEN_HERE"
cached: true
parameters:
- name: ":channel"
description: 'The channel name that will be used as reference for checking the "follow age".'
- name: ":user"
description: 'The name of the user that you wish to check the "follow age" for.'
qs:
- name: "token"
required: true
description: "The token provided by DecAPI when a moderator or the broadcaster authorizes for either followage or followed."
- name: "precision"
description: 'How precise the timestamp should be in terms of years, months, weeks, days, hours, minutes & seconds.- Default: <code>2</code>.'
type: "int"
notes:
- '<strong>Deprecated</strong>: You can read more here: <a href="https://gist.github.com/Decicus/daf7234366387636d5d2fe9f59ba0f11#file-2023-08-11_decapi-twitch-follows-endpoints-md">https://gist.github.com/Decicus/daf7234366387636d5d2fe9f59ba0f11#file-2023-08-11_decapi-twitch-follows-endpoints-md</a>'
- '<strong>As of September 2023, a token is required to use this endpoint.</strong> Either a moderator of the channel, or a channel owner themself, has to authorize using this: <a href="https://decapi.me/auth/twitch?redirect=followage&scopes=moderator:read:followers">Click here to authorize</a>.'
- 'Gets the time difference (also known as the "follow age") between when <code>:user</code> followed <code>:channel</code>'
- route: "followcount/:channel"
cached: true
@ -61,14 +64,17 @@ endpoints:
description: 'The channel name to retrieve the current follower count for.'
notes:
- 'Retrieves the current amount of followers a Twitch channel has.'
- route: "followed/:channel/:user"
deprecated: true
- route: "followed/:channel/:user?token=YOUR_TOKEN_HERE"
cached: true
parameters:
- name: ":channel"
description: 'The channel name.'
- name: ":user"
description: 'The name of the user.'
qs:
- name: "token"
required: true
description: "The token provided by DecAPI when a moderator or the broadcaster authorizes for either followage or followed."
- name: "tz"
description: 'Uses a different timezone for displaying date & time other than UTC. <a href="https://decapi.me/misc/timezones">List of supported timezones.</a>'
type: "string"
@ -76,7 +82,7 @@ endpoints:
description: 'Changes the formatting of the returned date & time. See the <a href="https://www.php.net/manual/en/datetime.format.php#refsect1-datetime.format-parameters"><code>PHP date()</code> documentation</a> for reference.<br>Default format string: <code>M j. Y - h:i:s A (e)</code>'
type: "string"
notes:
- '<strong>Deprecated</strong>: You can read more here: <a href="https://gist.github.com/Decicus/daf7234366387636d5d2fe9f59ba0f11#file-2023-08-11_decapi-twitch-follows-endpoints-md">https://gist.github.com/Decicus/daf7234366387636d5d2fe9f59ba0f11#file-2023-08-11_decapi-twitch-follows-endpoints-md</a>'
- 'As of September 2023, a token is required to use this endpoint. Either a moderator of the channel, or a channel owner themself, has to authorize using this: <a href="https://decapi.me/auth/twitch?redirect=followage&scopes=moderator:read:followers">Click here to authorize</a>.'
- 'Retrieves the date and time of when the user followed the channel.'
- 'Example format: <code>Mar 13. 2016 - 07:31:29 PM (UTC)</code>'
- route: "followers/:channel"

View File

@ -37,12 +37,14 @@
</tr>
<tr>
<td><code>game / title</code></td>
<td>3 minutes (180 seconds)</td>
<td><code>followage / followed</code></td>
<td>30 minutes*</td>
<td>
A channel's current game and stream title come from the same Twitch API, thus these are cached together.
The date and time someone followed a specific channel. This can be cached for up to 30 minutes.
<br>
If <code>game</code> is requested, the <code>title</code> will be cached too. Same goes for the other way around.
This will only affect users that follow a channel, try to check their follow date, and then unfollow/re-follow to mess with the values.
<br>
* If someone is currently <i>not following</i> and tries to check their follow date / followage, it will only be cached for 2 minutes.
</td>
</tr>
@ -52,6 +54,16 @@
<td></td>
</tr>
<tr>
<td><code>game / title</code></td>
<td>3 minutes (180 seconds)</td>
<td>
A channel's current game and stream title come from the same Twitch API, thus these are cached together.
<br>
If <code>game</code> is requested, the <code>title</code> will be cached too. Same goes for the other way around.
</td>
</tr>
<tr>
<td><code>subpoints / subcount</code></td>
<td>2 minutes (120 seconds)</td>

View File

@ -391,6 +391,10 @@ export default {
mounted() {
const path = this.$route.path.replace('/', '');
const endpoint = this.$route.query.endpoint || '';
const movedEndpoints = {
'followage/:channel/:user': 'followage/:channel/:user?token=YOUR_TOKEN_HERE',
'followed/:channel/:user': 'followed/:channel/:user?token=YOUR_TOKEN_HERE',
};
this.$http.get(`/static/yaml/endpoints/${path}.yaml`).then((response) => {
const { body } = response;
@ -402,13 +406,18 @@ export default {
this.basePath = basePath;
this.endpoints = endpoints;
endpoints.forEach((end) => {
const route = decodeURIComponent(endpoint);
if (route === '') {
return;
}
if (endpoint === '' || endpoint === '/') {
return;
}
if ((end.route === '' && route !== '/') || end.route !== route) {
const route = decodeURIComponent(endpoint);
if (movedEndpoints[route]) {
this.openModal(movedEndpoints[route]);
return;
}
endpoints.forEach((end) => {
if (end.route !== route) {
return;
}