Spotify.NET/web/getting_started.html

142 lines
31 KiB
HTML
Raw Normal View History

2019-08-16 23:41:36 +01:00
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Getting Started | SpotifyAPI-NET</title>
2019-08-16 23:45:09 +01:00
<meta name="description" content="🔉 An API for the Spotify-Client and the Spotify Web API, written in C#/.NET">
2020-03-27 10:47:13 +00:00
<meta name="generator" content="VuePress 1.4.0">
2019-08-16 23:41:36 +01:00
2020-04-19 12:03:39 +01:00
<link rel="preload" href="/SpotifyAPI-NET/assets/css/0.styles.82abfbf9.css" as="style"><link rel="preload" href="/SpotifyAPI-NET/assets/js/app.f0ac22cf.js" as="script"><link rel="preload" href="/SpotifyAPI-NET/assets/js/2.31113494.js" as="script"><link rel="preload" href="/SpotifyAPI-NET/assets/js/16.9c0ba2de.js" as="script"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/10.002ef499.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/11.7de40808.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/12.db52d3ac.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/13.8b5c9b44.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/14.c0f35def.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/15.cfa7a58a.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/17.5154e8d9.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/18.6bcd5883.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/19.a6196abf.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/20.540a6f36.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/21.956153ac.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/22.a4edf47c.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/23.e0985451.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/24.a9466c6a.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/25.33dd1a97.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/26.fd03eb58.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/3.7ef0fbfe.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/4.2f270ddd.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/5.14f2fea3.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/6.66d7c2fe.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/7.830f290b.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/8.9cb2269f.js"><link rel="prefetch" href="/SpotifyAPI-NET/assets/js/9.f14800d8.js">
2020-03-27 10:47:13 +00:00
<link rel="stylesheet" href="/SpotifyAPI-NET/assets/css/0.styles.82abfbf9.css">
2019-08-16 23:41:36 +01:00
</head>
<body>
2020-03-27 10:47:13 +00:00
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/SpotifyAPI-NET/" class="home-link router-link-active"><!----> <span class="site-name">SpotifyAPI-NET</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/SpotifyAPI-NET/" class="nav-link">
Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="SpotifyAPI.Web" class="dropdown-title"><span class="title">SpotifyAPI.Web</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/getting_started.html" class="nav-link router-link-exact-active router-link-active">
Getting Started
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/examples.html" class="nav-link">
Examples
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/proxy.html" class="nav-link">
Proxy
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/albums.html" class="nav-link">
- Albums
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/artists.html" class="nav-link">
- Artists
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/browse.html" class="nav-link">
- Browse
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/follow.html" class="nav-link">
- Follow
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/library.html" class="nav-link">
- Library
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/personalization.html" class="nav-link">
- Personalization
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/player.html" class="nav-link">
- Player
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/playlists.html" class="nav-link">
- Playlists
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/profiles.html" class="nav-link">
- Profiles
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/search.html" class="nav-link">
- Search
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/tracks.html" class="nav-link">
- Tracks
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/utils.html" class="nav-link">
Utilities
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="SpotifyAPI.Auth" class="dropdown-title"><span class="title">SpotifyAPI.Auth</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/auth/getting_started.html" class="nav-link">
Getting Started
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/auth/implicit_grant.html" class="nav-link">
- ImplicitGrantAuth
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/auth/token_swap.html" class="nav-link">
- TokenSwapAuth
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/auth/authorization_code.html" class="nav-link">
- AutorizationCodeAuth
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/auth/client_credentials.html" class="nav-link">
- ClientCredentialsAuth
</a></li></ul></div></div> <a href="https://github.com/JohnnyCrazy/SpotifyAPI-NET" target="_blank" rel="noopener noreferrer" class="repo-link">
2019-08-16 23:41:36 +01:00
🚀 GitHub
2020-03-27 10:47:13 +00:00
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/SpotifyAPI-NET/" class="nav-link">
Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="SpotifyAPI.Web" class="dropdown-title"><span class="title">SpotifyAPI.Web</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/getting_started.html" class="nav-link router-link-exact-active router-link-active">
Getting Started
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/examples.html" class="nav-link">
Examples
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/proxy.html" class="nav-link">
Proxy
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/albums.html" class="nav-link">
- Albums
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/artists.html" class="nav-link">
- Artists
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/browse.html" class="nav-link">
- Browse
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/follow.html" class="nav-link">
- Follow
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/library.html" class="nav-link">
- Library
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/personalization.html" class="nav-link">
- Personalization
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/player.html" class="nav-link">
- Player
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/playlists.html" class="nav-link">
- Playlists
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/profiles.html" class="nav-link">
- Profiles
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/search.html" class="nav-link">
- Search
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/tracks.html" class="nav-link">
- Tracks
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/web/utils.html" class="nav-link">
Utilities
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="SpotifyAPI.Auth" class="dropdown-title"><span class="title">SpotifyAPI.Auth</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/auth/getting_started.html" class="nav-link">
Getting Started
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/auth/implicit_grant.html" class="nav-link">
- ImplicitGrantAuth
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/auth/token_swap.html" class="nav-link">
- TokenSwapAuth
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/auth/authorization_code.html" class="nav-link">
- AutorizationCodeAuth
</a></li><li class="dropdown-item"><!----> <a href="/SpotifyAPI-NET/auth/client_credentials.html" class="nav-link">
- ClientCredentialsAuth
</a></li></ul></div></div> <a href="https://github.com/JohnnyCrazy/SpotifyAPI-NET" target="_blank" rel="noopener noreferrer" class="repo-link">
2019-08-16 23:41:36 +01:00
🚀 GitHub
2019-08-16 23:45:09 +01:00
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Getting Started</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/SpotifyAPI-NET/web/getting_started.html#first-steps" class="sidebar-link">First steps</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#imports" class="sidebar-link">Imports</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#basic-usage" class="sidebar-link">Basic-Usage</a></li></ul></li><li><a href="/SpotifyAPI-NET/web/getting_started.html#examples" class="sidebar-link">Examples</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/SpotifyAPI-NET/web/getting_started.html#error-handling" class="sidebar-link">Error-Handling</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/SpotifyAPI-NET/web/getting_started.html#sync-vs-asynchronous" class="sidebar-link">Sync vs Asynchronous</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/SpotifyAPI-NET/web/getting_started.html#api-reference" class="sidebar-link">API-Reference</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#albums" class="sidebar-link">Albums</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#artists" class="sidebar-link">Artists</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#browse" class="sidebar-link">Browse</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#follow" class="sidebar-link">Follow</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#library" class="sidebar-link">Library</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#personalization" class="sidebar-link">Personalization</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#player" class="sidebar-link">Player</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#playlists" class="sidebar-link">Playlists</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#profiles" class="sidebar-link">Profiles</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#search" class="sidebar-link">Search</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#tracks" class="sidebar-link">Tracks</a></li><li class="sidebar-sub-header"><a href="/SpotifyAPI-NET/web/getting_started.html#util" class="sidebar-link">Util</a></li></ul></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="getting-started"><a href="#getting-started" aria-hidden="true" class="header-anchor">#</a> Getting Started</h1> <p>This API provides full access to the new SpotifyWebAPI introduced <a href="https://developer.spotify.com/web-api/" target="_blank" rel="noopener noreferrer">here<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>.
2019-08-16 23:41:36 +01:00
With it, you can search for Tracks/Albums/Artists and also get User-based information.
It's also possible to create new playlists and add tracks to it.</p> <h2 id="first-steps"><a href="#first-steps" aria-hidden="true" class="header-anchor">#</a> First steps</h2> <h3 id="imports"><a href="#imports" aria-hidden="true" class="header-anchor">#</a> Imports</h3> <p>So after you added the API to your project, you may want to add following imports to your files:</p> <div class="language-csharp extra-class"><pre class="language-csharp"><code><span class="token keyword">using</span> SpotifyAPI<span class="token punctuation">.</span>Web<span class="token punctuation">;</span> <span class="token comment">//Base Namespace</span>
<span class="token keyword">using</span> SpotifyAPI<span class="token punctuation">.</span>Web<span class="token punctuation">.</span>Enums<span class="token punctuation">;</span> <span class="token comment">//Enums</span>
<span class="token keyword">using</span> SpotifyAPI<span class="token punctuation">.</span>Web<span class="token punctuation">.</span>Models<span class="token punctuation">;</span> <span class="token comment">//Models for the JSON-responses</span>
</code></pre></div><h3 id="basic-usage"><a href="#basic-usage" aria-hidden="true" class="header-anchor">#</a> Basic-Usage</h3> <p>Now you can actually start doing calls to the SpotifyAPI, just create a new Instance of SpotifyWebAPI:</p> <div class="language-csharp extra-class"><pre class="language-csharp"><code><span class="token keyword">private</span> <span class="token keyword">static</span> <span class="token class-name">SpotifyWebAPI</span> _spotify<span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">Main</span><span class="token punctuation">(</span>String<span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
_spotify <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">SpotifyWebAPI</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
AccessToken <span class="token operator">=</span> <span class="token string">&quot;XXXXXXXXXXXX&quot;</span><span class="token punctuation">,</span>
TokenType <span class="token operator">=</span> <span class="token string">&quot;Bearer&quot;</span>
<span class="token punctuation">}</span>
<span class="token class-name">FullTrack</span> track <span class="token operator">=</span> _spotify<span class="token punctuation">.</span><span class="token function">GetTrack</span><span class="token punctuation">(</span><span class="token string">&quot;3Hvu1pq89D4R0lyPBoujSv&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
Console<span class="token punctuation">.</span><span class="token function">WriteLine</span><span class="token punctuation">(</span>track<span class="token punctuation">.</span>Name<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//Yeay! We just printed a tracks name.</span>
<span class="token punctuation">}</span>
</code></pre></div><p>You may note that we used <code>AccessToken</code> and <code>TokenType</code>. Spotify does not allow un-authorized access to their API. You will need to implement one of the auth flows. Luckily, <code>SpotifyAPI.Web.Auth</code> exists for this reason. A simple way to receive a <code>AccessToken</code> is via <code>CredentialAuth</code>:</p> <div class="language-csharp extra-class"><pre class="language-csharp"><code><span class="token class-name">CredentialsAuth</span> auth <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">CredentialsAuth</span><span class="token punctuation">(</span><span class="token string">&quot;YourClientID&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;YourClientSecret&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token class-name">Token</span> token <span class="token operator">=</span> <span class="token keyword">await</span> auth<span class="token punctuation">.</span><span class="token function">GetToken</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
_spotify <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">SpotifyWebAPI</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
AccessToken <span class="token operator">=</span> token<span class="token punctuation">.</span>AccessToken<span class="token punctuation">,</span>
TokenType <span class="token operator">=</span> token<span class="token punctuation">.</span>TokenType
<span class="token punctuation">}</span>
2019-08-16 23:45:09 +01:00
</code></pre></div><p>For more info, visit the <a href="/SpotifyAPI-NET/auth/getting_started/">Getting Started of SpotifyAPI.Web.Auth</a></p> <hr> <h2 id="examples"><a href="#examples" aria-hidden="true" class="header-anchor">#</a> Examples</h2> <p>A list of small examples can be found <a href="/SpotifyAPI-NET/web/examples/">here</a>. Do you think a specific example is missing? Feel free to open a PR.mdIssue!</p> <hr> <h2 id="error-handling"><a href="#error-handling" aria-hidden="true" class="header-anchor">#</a> Error-Handling</h2> <p>Every API-Call returns a reponse-model which consists of base-error model. To check if a specific API-Call was successful, use the following approach:</p> <div class="language-csharp extra-class"><pre class="language-csharp"><code><span class="token class-name">PrivateProfile</span> profile <span class="token operator">=</span> _spotify<span class="token punctuation">.</span><span class="token function">GetPrivateProfile</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
2019-08-16 23:41:36 +01:00
<span class="token keyword">if</span> <span class="token punctuation">(</span>profile<span class="token punctuation">.</span><span class="token function">HasError</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
Console<span class="token punctuation">.</span><span class="token function">WriteLine</span><span class="token punctuation">(</span><span class="token string">&quot;Error Status: &quot;</span> <span class="token operator">+</span> profile<span class="token punctuation">.</span>Error<span class="token punctuation">.</span>Status<span class="token punctuation">)</span><span class="token punctuation">;</span>
Console<span class="token punctuation">.</span><span class="token function">WriteLine</span><span class="token punctuation">(</span><span class="token string">&quot;Error Msg: &quot;</span> <span class="token operator">+</span> profile<span class="token punctuation">.</span>Error<span class="token punctuation">.</span>Message<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre></div><p>In case some or all of the returned values are null, consult error status and message, they can lead to an explanation!</p> <h2 id="sync-vs-asynchronous"><a href="#sync-vs-asynchronous" aria-hidden="true" class="header-anchor">#</a> Sync vs Asynchronous</h2> <p>Every API-Call has an <code>asynchronous</code> and <code>synchronous</code> method.</p> <div class="language-csharp extra-class"><pre class="language-csharp"><code><span class="token keyword">public</span> <span class="token keyword">async</span> <span class="token keyword">void</span> <span class="token function">Test</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
<span class="token keyword">var</span> asyncProfile <span class="token operator">=</span> <span class="token keyword">await</span> _spotify<span class="token punctuation">.</span><span class="token function">GetPrivateProfileAsync</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">var</span> syncProfile <span class="token operator">=</span> _spotify<span class="token punctuation">.</span><span class="token function">GetPrivateProfile</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
2020-04-19 12:03:39 +01:00
</code></pre></div><p>Note that the <code>synchronous</code> call will block the current Thread!</p> <hr> <h2 id="api-reference"><a href="#api-reference" aria-hidden="true" class="header-anchor">#</a> API-Reference</h2> <h3 id="albums"><a href="#albums" aria-hidden="true" class="header-anchor">#</a> Albums</h3> <ul><li><a href="/SpotifyAPI-NET/web/albums.html#getalbumtracks">GetAlbumTracks</a></li> <li><a href="/SpotifyAPI-NET/web/albums.html#getalbum">GetAlbum</a></li> <li><a href="/SpotifyAPI-NET/web/albums.html#getseveralalbums">GetSeveralAlbums</a></li></ul> <h3 id="artists"><a href="#artists" aria-hidden="true" class="header-anchor">#</a> Artists</h3> <ul><li><a href="/SpotifyAPI-NET/web/artists.html#getartist">GetArtist</a></li> <li><a href="/SpotifyAPI-NET/web/artists.html#getrelatedartists">GetRelatedArtists</a></li> <li><a href="/SpotifyAPI-NET/web/artists.html#getartiststoptracks">GetArtistsTopTracks</a></li> <li><a href="/SpotifyAPI-NET/web/artists.html#getartistsalbums">GetArtistsAlbums</a></li> <li><a href="/SpotifyAPI-NET/web/artists.html#getseveralartists">GetSeveralArtists</a></li></ul> <h3 id="browse"><a href="#browse" aria-hidden="true" class="header-anchor">#</a> Browse</h3> <ul><li><a href="/SpotifyAPI-NET/web/browse.html#getfeaturedplaylists">GetFeaturedPlaylists</a></li> <li><a href="/SpotifyAPI-NET/web/browse.html#getnewalbumreleases">GetNewAlbumReleases</a></li> <li><a href="/SpotifyAPI-NET/web/browse.html#getcategories">GetCategories</a></li> <li><a href="/SpotifyAPI-NET/web/browse.html#getcategory">GetCategory</a></li> <li><a href="/SpotifyAPI-NET/web/browse.html#getcategoryplaylists">GetCategoryPlaylists</a></li></ul> <h3 id="follow"><a href="#follow" aria-hidden="true" class="header-anchor">#</a> Follow</h3> <ul><li><a href="/SpotifyAPI-NET/web/follow.html#follow">Follow</a></li> <li><a href="/SpotifyAPI-NET/web/follow.html#unfollow">Unfollow</a></li> <li><a href="/SpotifyAPI-NET/web/follow.html#isfollowing">IsFollowing</a></li> <li><a href="/SpotifyAPI-NET/web/follow.html#followplaylist">FollowPlaylist</a></li> <li><a href="/SpotifyAPI-NET/web/follow.html#unfollowplaylist">UnfollowPlaylist</a></li> <li><a href="/SpotifyAPI-NET/web/follow.html#isfollowingplaylist">IsFollowingPlaylist</a></li></ul> <h3 id="library"><a href="#library" aria-hidden="true" class="header-anchor">#</a> Library</h3> <ul><li><a href="/SpotifyAPI-NET/web/library.html#savetracks">SaveTracks</a></li> <li><a href="/SpotifyAPI-NET/web/library.html#savetrack">SaveTrack</a></li> <li><a href="/SpotifyAPI-NET/web/library.html#getsavedtracks">GetSavedTracks</a></li> <li><a href="/SpotifyAPI-NET/web/library.html#removesavedtracks">RemoveSavedTracks</a></li> <li><a href="/SpotifyAPI-NET/web/library.html#checksavedtracks">CheckSavedTracks</a></li> <li><a href="/SpotifyAPI-NET/web/library.html#savealbums">SaveAlbums</a></li> <li><a href="/SpotifyAPI-NET/web/library.html#savealbum">SaveAlbum</a></li> <li><a href="/SpotifyAPI-NET/web/library.html#getsavedalbums">GetSavedAlbums</a></li> <li><a href="/SpotifyAPI-NET/web/library.html#removesavedalbums">RemoveSavedAlbums</a></li> <li><a href="/SpotifyAPI-NET/web/library.html#checksavedalbums">CheckSavedAlbums</a></li></ul> <h3 id="personalization"><a href="#personalization" aria-hidden="true" class="header-anchor">#</a> Personalization</h3> <ul><li><a href="/SpotifyAPI-NET/web/personalization.html#getuserstoptracks">GetUsersTopTracks</a></li> <li><a href="/SpotifyAPI-NET/web/personalization.html#getuserstopartists">GetUsersTopArtists</a></li> <li><a href="/SpotifyAPI-NET/web/personalization.html#getusersrecentlyplayedtracks">GetUsersRecentlyPlayedTracks</a></li></ul> <h3 id="player"><a href="#player" aria-hidden="true" class="header-anchor">#</a> Player</h3> <ul><li><a href="/SpotifyAPI-NET/web/player.html#getdevices">GetDevices</a></li> <li><a href="/SpotifyAPI-NET/web/player.html#getplayback">GetPlayback</a></li> <li><a href="/SpotifyAPI-NET/web/player.html#getplayingtrack">GetPlayingTrack</a></li> <li><a href="/SpotifyAPI-NET/web/player.html#transferplayback">TransferPlayback</a></li>
<script src="/SpotifyAPI-NET/assets/js/app.f0ac22cf.js" defer></script><script src="/SpotifyAPI-NET/assets/js/2.31113494.js" defer></script><script src="/SpotifyAPI-NET/assets/js/16.9c0ba2de.js" defer></script>
2019-08-16 23:41:36 +01:00
</body>
</html>