【问题标题】:Models.Link.getType in Spotify Apps API V1.0.0Spotify Apps API V1.0.0 中的 Models.Link.getType
【发布时间】:2013-07-15 20:24:25
【问题描述】:

在 V1.0 之前的 Spotify Apps API 中,您可以这样做...

var uri_type = models.Link.getType(playlist_uri); // returns 5 (number)

要确定 URI 是否为曲目、播放列表、专辑等... http://developer.spotify.com/docs/apps/api/0.1/506827d4e4.html

但我在应用程序 API 的 V1.0.0 中没有看到任何类似的东西。 https://developer.spotify.com/docs/apps/api/1.0/

有人知道新 API 中是否有类似的东西吗?

干杯

【问题讨论】:

  • 你用这个做什么?如果您需要它来确定类型以便知道在加载 URI 时使用什么类型(例如 Playlist.fromURI、Artist.fromURI),您可以使用models.fromURI(String uri)

标签: api model spotify


【解决方案1】:

如果您需要它来确定类型以便知道在加载 URI 时使用什么类型(例如 Playlist.fromURI、Artist.fromURI),您可以使用models.fromURI(String uri)

此外,如果您想确切知道加载了哪种类型,可以检查加载对象的 constructor.name 属性。例如,

require(['$api/models'], function(models) {
   var loadable = models.fromURI("spotify:artist:18iQQOuyGlHunPVzmoLY20");
   console.log(loadable.constructor.name);
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-08
    • 2012-01-13
    • 2012-01-11
    • 2012-08-07
    • 1970-01-01
    • 2012-03-30
    • 2019-07-18
    相关资源
    最近更新 更多