Code Monkey home page Code Monkey logo

spotify-types's People

Contributors

hawyar avatar scientific-dev avatar t1mofe1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

spotify-types's Issues

Add types for token

I would like to have types for the token object returned from the access token request.

interface Token {
  accessToken: string;
  tokenType: string;
  expiresIn: number;
}

I can open a PR for it. Thank you

Missing return type for '/me/following' endpoint

See docs here. Suggested type below:

interface FollowedArtistCursors {
  /** The cursor to use as key to find the next page of items. */
  after: string;
  /** The cursor to use as key to find the previous page of items. */
  before: string;
}

interface FollowedArtistCursorPaging<T> {
  /** A link to the Web API endpoint returning the full result of the request. */
  href: string;
  /** The maximum number of items in the response (as set in the query or by default). */
  limit: number;
  /** URL to the next page of items. (null if none) */
  next: string;
  /** The cursors used to find the next set of items. */
  cursors: FollowedArtistCursors;
  /** The total number of items available to return. */
  total: number;
  /** The requested data. */
  items: T[];
}

interface FollowedArtistsResults {
  artists: FollowedArtistCursorPaging<Artist>;
}

Allow users to narrow down type

Hi! Thank you for creating a great package. However, while using it, I noticed I couldn't narrow down the object types using standard TS type guards. For example, given an item: Track | Episode; I can't narrow it down to Track by simply checking item.type === "episode".

This happens because all interfaces share the same SpotifyType, which doesn't guarantee an Episode will always have a "episode" as a type.

Could we change them to simple literal types to benefit from type narrowing? I'd like to file a PR if you're interested.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.