Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs Can';t更改SpotifyAPI(顶级艺术家)的默认限制-React Native_Reactjs_Api_Native_Spotify - Fatal编程技术网

Reactjs Can';t更改SpotifyAPI(顶级艺术家)的默认限制-React Native

Reactjs Can';t更改SpotifyAPI(顶级艺术家)的默认限制-React Native,reactjs,api,native,spotify,Reactjs,Api,Native,Spotify,我尝试了一切来改变这个。。。不知道出了什么问题,不管怎么说,它还是把20位艺术家拉了回来 const sp = await this.getValidSPObj(); const { id: userId } = await sp.getMe(); const { items: topArtists } = await sp.getMyTopArtists(userId, {limit: 10, offset: 20}); this.props.setData("TopArtists&

我尝试了一切来改变这个。。。不知道出了什么问题,不管怎么说,它还是把20位艺术家拉了回来

const sp = await this.getValidSPObj();
const { id: userId } = await sp.getMe();
const { items: topArtists } = await sp.getMyTopArtists(userId, {limit: 10, offset: 20});
this.props.setData("TopArtists", topArtists);
API中的注释

/**
 * Get the current user’s top artists based on calculated affinity.
 * See [Get a User’s Top Artists](https://developer.spotify.com/web-api/get-users-top-artists-and-tracks/) on
 * the Spotify Developer site for more information about the endpoint.
 *
 * @param {Object} options A JSON object with options that can be passed
 * @param {function(Object,Object)} callback An optional callback that receives 2 parameters. The first
 * one is the error object (null if no error), and the second is the value if the request succeeded.
 * @return {Object} Null if a callback is provided, a `Promise` object otherwise
 */
getMyTopArtists(
  options?: Object,
  callback?: ResultsCallback<SpotifyApi.UsersTopArtistsResponse>
): Promise<SpotifyApi.UsersTopArtistsResponse>;
/**
*根据计算的亲和力获取当前用户的顶级艺术家。
*请参见[获取用户的顶级艺术家](https://developer.spotify.com/web-api/get-users-top-artists-and-tracks/)在
*有关端点的详细信息,请访问Spotify开发者网站。
*
*@param{Object}options带有可传递选项的JSON对象
*@param{function(Object,Object)}回调接收2个参数的可选回调。第一
*一个是错误对象(如果没有错误,则为null),第二个是请求成功时的值。
*@return{Object}Null如果提供回调,则为'Promise'对象
*/
getMyTopArtists(
选项?:对象,
回调?:结果回调
):承诺;

根据函数
签名
用户ID没有
独立的
参数,您将
用户ID
作为
第一个
参数传递,实际上
第一个
参数是
选项
对象

文档还提到一些
函数不需要
用户ID

有些函数不需要接收用户id作为参数,而是使用访问令牌中的用户信息:

p、 s:我相信根据你的
access\u令牌
scope
它可以找出用户