@audius/sdk 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,28 +1,65 @@
1
- # Audius Javascript SDK
1
+ # Audius JavaScript SDK
2
2
 
3
3
  ## Overview
4
4
 
5
- The Audius SDK allows you to easily build upon and interact with the Audius network. Currently, we only have a Typescript/Javascript SDK.
5
+ The Audius JavaScript (TypeScript) SDK allows you to easily build on and interact with the Audius protocol.
6
+ - ✍️ Log In with Audius
7
+ - 🎵 Fetch and stream tracks
8
+ - 🔍 Search and display users, tracks, and playlists
6
9
 
7
- We're actively working on building out more SDK features and functionality - stay tuned!
10
+ 👷‍♀️ We're actively working on building out more SDK features and functionality - stay tuned!
8
11
 
9
12
  ## Installation
10
13
 
11
- - [In the browser/Vanilla JS](#in-the-browservanilla-js)
12
- - [In Node.js](#in-nodejs)
14
+ - [Node.js](#nodejs)
15
+ - [HTML + JS](#html--js)
13
16
 
14
- ### In the browser/Vanilla JS
17
+ ### Node.js
15
18
 
16
- #### 0. Include Web3.js
19
+ #### 1. Install the SDK package using your preferred JS package manager
17
20
 
18
- ```html
19
- <script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
21
+ In your terminal, run:
22
+
23
+ ```bash"
24
+ npm install web3 @audius/sdk
25
+ ```
26
+
27
+ #### 2. Initialize the SDK
28
+
29
+ ```js
30
+ import { sdk } from '@audius/sdk'
31
+
32
+ const audiusSdk = sdk({ appName: 'Name of your app goes here' })
33
+ ```
34
+
35
+ #### 3. Make your first API call using the SDK!
36
+
37
+ ```js
38
+ const tracks = await audiusSdk.discoveryNode.getTracks()
39
+ console.log(tracks, 'Tracks fetched!')
20
40
  ```
21
41
 
42
+ #### Full example
43
+
44
+ ```js title="app.js" showLineNumbers
45
+ import Web3 from 'web3'
46
+ import { sdk } from '@audius/sdk'
47
+
48
+ // If running in a browser, set window.Web3
49
+ window.Web3 = Web3
50
+
51
+ const audiusSdk = sdk({ appName: 'My Example App' })
52
+
53
+ const tracks = await audiusSdk.discoveryNode.getTracks()
54
+ console.log(tracks, 'Tracks fetched!')
55
+ ```
56
+
57
+ ### HTML + JS
58
+
22
59
  #### 1. Include the SDK script tag
23
60
 
24
61
  ```html
25
- <!-- Put this AFTER web3.js -->
62
+ <script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
26
63
  <script src="https://cdn.jsdelivr.net/npm/@audius/sdk@latest/dist/sdk.min.js"></script>
27
64
  ```
28
65
 
@@ -42,7 +79,7 @@ const tracks = await audiusSdk.discoveryNode.getTracks()
42
79
 
43
80
  #### Full example
44
81
 
45
- ```html title="index.html"
82
+ ```html title="index.html" showLineNumbers
46
83
  <!DOCTYPE html>
47
84
  <html>
48
85
  <head>
@@ -61,55 +98,3 @@ const tracks = await audiusSdk.discoveryNode.getTracks()
61
98
  </body>
62
99
  </html>
63
100
  ```
64
-
65
- ### In Node.js
66
-
67
- #### 0. Install the SDK package using your preferred JS package manager
68
-
69
- In your terminal, run:
70
-
71
- ```bash"
72
- npm install @audius/sdk
73
- ```
74
-
75
- #### 1. [Skip if not in browser environment] Install web3.js
76
-
77
- In your terminal, run:
78
-
79
- ```bash"
80
- npm install web3
81
- ```
82
-
83
- #### 2. [Skip if not in browser environment] Assign web3.js to `window.Web3`
84
-
85
- ```js
86
- import Web3 from 'web3'
87
- window.Web3 = Web3
88
- ```
89
-
90
- #### 3. Initialize the SDK
91
-
92
- ```js
93
- import { sdk } from '@audius/sdk'
94
-
95
- const audiusSdk = sdk({ appName: 'Name of your app goes here' })
96
- ```
97
-
98
- #### 4. Make your first API call using the SDK!
99
-
100
- ```js
101
- const tracks = await audiusSdk.discoveryNode.getTracks()
102
- console.log(tracks, 'Tracks fetched!')
103
- ```
104
-
105
- #### Full example
106
-
107
- ```js title="app.js"
108
- import Web3 from 'web3'
109
- import { sdk } from '@audius/sdk'
110
-
111
- window.Web3 = Web3
112
- const audiusSdk = sdk({ appName: 'My Example App' })
113
- const tracks = await audiusSdk.discoveryNode.getTracks()
114
- console.log(tracks, 'Tracks fetched!')
115
- ```