1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 06:01:17 -04:00

add page stats typings

This commit is contained in:
2022-06-30 09:17:12 -04:00
parent ae2cb50cbe
commit 7da0a713a4
9 changed files with 80 additions and 87 deletions

View File

@@ -4,6 +4,7 @@
import queryString from "query-string";
import { logServerError } from "../../lib/helpers/sentry";
import type { NextApiRequest, NextApiResponse } from "next";
import type { Track } from "../../types";
const { SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET, SPOTIFY_REFRESH_TOKEN } = process.env;
@@ -14,14 +15,6 @@ const NOW_PLAYING_ENDPOINT = "https://api.spotify.com/v1/me/player/currently-pla
// https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-users-top-artists-and-tracks
const TOP_TRACKS_ENDPOINT = "https://api.spotify.com/v1/me/top/tracks?time_range=long_term&limit=10";
type Track = {
artist: string;
title: string;
album: string;
url: URL | string;
image?: URL | string;
};
type SpotifyTrackSchema = {
name: string;
artists: Array<{