JMPerez / spotify-web-api-js

A client-side JS wrapper for the Spotify Web API
https://jmperezperez.com/spotify-web-api-js/
MIT License
1.86k stars 260 forks source link

Update type of ListOfUsersShowsResponse #204

Closed manan2501 closed 2 years ago

manan2501 commented 2 years ago

Describe the bug Current type of ListOfUsersShowsResponse is extended from PagingObject but we have two things inside the item, added_at, and show. The show is of type ShowObjectSimplifies. So I am unable to extract the value of "name".

To Reproduce Try to extract the name(or any other value) of the show from the response.

Expected behavior Type of item should be an array of object, and the type of that object will be: { added_at: sting; show: ShowObjectSimplied }

Screenshots If applicable, add screenshots to help explain your problem. This is the response of request: image

This is the current type of ListOfUsersShowsResponse:

  interface ListOfUsersShowsResponse extends PagingObject<ShowObjectSimplified> {}

  interface PagingObject<T> {
    href: string;
    items: T[];
    limit: number;
    next: string;
    offset: number;
    previous: string;
    total: number;
  }

  interface ShowObjectSimplified {
    available_markets?: string[];
    copyrights: CopyrightObject[];
    description: string;
    explicit: boolean;
    external_urls: ExternalUrlObject;
    href: string;
    id: string;
    images: ImageObject[];
    is_externally_hosted: boolean;
    languages: string[];
    media_type: string;
    name: string;
    publisher: string;
    type: 'show';
    uri: string;
  }

Desktop (please complete the following information):

manan2501 commented 2 years ago

I am working towards the solution, but feeling sleepy🥱 so I will probably continue tomorrow. ShowObjectSimplified is also used in the type of showSearchRespomse. So, I will see if we can directly change the type of ShowObjectSimplified or not.

And I will make a PR if I am able to solve this issue.

Anyways Good Night🌃.