discogs-marketplace-api-nodejs 1.5.1 → 1.6.0
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 +193 -112
- package/dist/data/countries.data.d.ts +306 -0
- package/dist/data/countries.data.js +327 -0
- package/dist/data/currencies.data.d.ts +33 -0
- package/dist/data/currencies.data.js +35 -0
- package/dist/data/index.d.ts +3 -0
- package/dist/data/index.js +10 -0
- package/dist/index.d.ts +2 -6
- package/dist/index.js +0 -12
- package/dist/marketplace.d.ts +1 -2
- package/dist/marketplace.js +21 -24
- package/dist/types/commons/index.d.ts +4 -0
- package/dist/{interfaces → types/commons}/index.js +0 -0
- package/dist/types/commons/input.type.d.ts +95 -0
- package/dist/{interfaces/input.interface.js → types/commons/input.type.js} +0 -0
- package/dist/{interfaces/output-error.interface.d.ts → types/commons/output-error.type.d.ts} +3 -2
- package/dist/{interfaces/item.interface.js → types/commons/output-error.type.js} +0 -0
- package/dist/types/commons/output-sucess.type.d.ts +116 -0
- package/dist/{interfaces/output-error.interface.js → types/commons/output-sucess.type.js} +0 -0
- package/dist/types/unions/condition.type.d.ts +5 -0
- package/dist/{interfaces/output-sucess.interface.js → types/unions/condition.type.js} +0 -0
- package/dist/types/unions/currency.type.d.ts +5 -0
- package/dist/{interfaces/year.interface.js → types/unions/currency.type.js} +0 -0
- package/dist/types/unions/format-description.type.d.ts +5 -0
- package/dist/types/{index.js → unions/format-description.type.js} +0 -0
- package/dist/types/unions/format.type.d.ts +5 -0
- package/dist/types/{limit.type.js → unions/format.type.js} +0 -0
- package/dist/types/unions/from.type.d.ts +5 -0
- package/dist/types/unions/from.type.js +2 -0
- package/dist/types/unions/genre.type.d.ts +5 -0
- package/dist/types/unions/genre.type.js +2 -0
- package/dist/types/unions/index.d.ts +12 -0
- package/dist/types/unions/index.js +2 -0
- package/dist/types/unions/lang.type.d.ts +5 -0
- package/dist/types/unions/lang.type.js +2 -0
- package/dist/types/{limit.type.d.ts → unions/limit.type.d.ts} +1 -1
- package/dist/types/unions/limit.type.js +2 -0
- package/dist/types/unions/search-type.type.d.ts +5 -0
- package/dist/types/unions/search-type.type.js +2 -0
- package/dist/types/unions/sort.type.d.ts +5 -0
- package/dist/types/unions/sort.type.js +2 -0
- package/dist/types/unions/style.type.d.ts +5 -0
- package/dist/types/unions/style.type.js +2 -0
- package/package.json +16 -16
- package/dist/enums/currency.enum.d.ts +0 -19
- package/dist/enums/currency.enum.js +0 -22
- package/dist/enums/format-description.enum.d.ts +0 -144
- package/dist/enums/format-description.enum.js +0 -147
- package/dist/enums/format.enum.d.ts +0 -59
- package/dist/enums/format.enum.js +0 -62
- package/dist/enums/from.enum.d.ts +0 -251
- package/dist/enums/from.enum.js +0 -254
- package/dist/enums/genre.enum.d.ts +0 -21
- package/dist/enums/genre.enum.js +0 -24
- package/dist/enums/index.d.ts +0 -11
- package/dist/enums/index.js +0 -26
- package/dist/enums/iso/country-code.enum.d.ts +0 -255
- package/dist/enums/iso/country-code.enum.js +0 -258
- package/dist/enums/iso/country-name.enum.d.ts +0 -255
- package/dist/enums/iso/country-name.enum.js +0 -258
- package/dist/enums/iso/index.d.ts +0 -3
- package/dist/enums/iso/index.js +0 -10
- package/dist/enums/iso/translate/discogs-country-name-to-iso-code.enum.d.ts +0 -69
- package/dist/enums/iso/translate/discogs-country-name-to-iso-code.enum.js +0 -72
- package/dist/enums/iso/translate/discogs-currency-to-iso-code.enum.d.ts +0 -36
- package/dist/enums/iso/translate/discogs-currency-to-iso-code.enum.js +0 -39
- package/dist/enums/iso/translate/index.d.ts +0 -3
- package/dist/enums/iso/translate/index.js +0 -10
- package/dist/enums/lang.enum.d.ts +0 -15
- package/dist/enums/lang.enum.js +0 -18
- package/dist/enums/media-condition.enum.d.ts +0 -14
- package/dist/enums/media-condition.enum.js +0 -17
- package/dist/enums/stort.enum.d.ts +0 -62
- package/dist/enums/stort.enum.js +0 -65
- package/dist/enums/style.enum.d.ts +0 -255
- package/dist/enums/style.enum.js +0 -258
- package/dist/enums/type.enum.d.ts +0 -30
- package/dist/enums/type.enum.js +0 -33
- package/dist/interfaces/index.d.ts +0 -6
- package/dist/interfaces/input.interface.d.ts +0 -80
- package/dist/interfaces/item.interface.d.ts +0 -91
- package/dist/interfaces/output-sucess.interface.d.ts +0 -32
- package/dist/interfaces/year.interface.d.ts +0 -9
- package/dist/types/index.d.ts +0 -2
package/README.MD
CHANGED
|
@@ -1,132 +1,263 @@
|
|
|
1
1
|
# Discogs Marketplace API NodeJS · [](https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS/blob/master/LICENSE) [](https://www.npmjs.com/package/discogs-marketplace-api-nodejs)
|
|
2
2
|
|
|
3
|
-
Another (better ?) NodeJs library to fetch data from
|
|
3
|
+
Another (better ?) NodeJs library to fetch data from Discogs marketplace. 💿
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation (with npm)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run the following command in your project:
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
10
|
npm install discogs-marketplace-api-nodejs
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Quick Start
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Import `DiscogsMarketplace` into your project:
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
.catch(err => {
|
|
25
|
-
console.error(err)
|
|
26
|
-
})
|
|
18
|
+
// With ECMAScript 6 and +
|
|
19
|
+
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
20
|
+
|
|
21
|
+
// With CommonJS
|
|
22
|
+
const DiscogsMarketplace = require('discogs-marketplace-api-nodejs').default
|
|
27
23
|
```
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
- Get top 250 items, of the 2nd page, filtered by Rock, listed by newest, for a given artist
|
|
30
28
|
|
|
31
29
|
```js
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
DiscogsMarketplace.search({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
31
|
+
|
|
32
|
+
// https://www.discogs.com/sell/list?sort=listed,desc&limit=250&artist_id=244819&page=2&genre=Rock
|
|
33
|
+
const result = await DiscogsMarketplace.search({
|
|
34
|
+
limit: 250,
|
|
35
|
+
page: 2,
|
|
36
|
+
genre: 'Rock',
|
|
37
|
+
sort: 'Listed Newest',
|
|
38
|
+
searchType: 'artist_id',
|
|
39
|
+
searchValue: 244819,
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- Get top 50 items, of the 1st page, listed by price lowest, on a user wantlist
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
47
|
+
|
|
48
|
+
// https://www.discogs.com/sell/mywants?limit=50&user=Kirian_&sort=price,asc
|
|
49
|
+
const result = await DiscogsMarketplace.search({
|
|
50
|
+
limit: 50,
|
|
51
|
+
sort: 'Price Lowest',
|
|
52
|
+
searchType: 'user',
|
|
53
|
+
searchValue: 'Kirian_',
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- Get top 25 items, of the 1st page, listed by seller A-Z, on a release
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
61
|
+
|
|
62
|
+
// https://www.discogs.com/sell/release/767931?sort=seller,asc&limit=25&page=1
|
|
63
|
+
const result = await DiscogsMarketplace.search({
|
|
64
|
+
sort: 'Seller A-Z',
|
|
65
|
+
searchType: 'release_id',
|
|
66
|
+
searchValue: '767931',
|
|
67
|
+
})
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- Get top 100 items, of the 1st page, listed by newest, on a string search
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
74
|
+
|
|
75
|
+
// https://www.discogs.com/sell/list?sort=listed,desc&limit=100&q=in+flames&page=1
|
|
76
|
+
const result = await DiscogsMarketplace.search({
|
|
77
|
+
limit: 100,
|
|
78
|
+
sort: 'Listed Newest',
|
|
79
|
+
searchType: 'q',
|
|
80
|
+
searchValue: 'in flames',
|
|
81
|
+
})
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- Get top 25 items, of the 1st page, listed by newest, on a seller inventory
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
88
|
+
|
|
89
|
+
// https://www.discogs.com/seller/Kirian_/profile?sort=listed,desc&limit=25&page=1
|
|
90
|
+
const result = await DiscogsMarketplace.search({
|
|
91
|
+
sort: 'Listed Newest',
|
|
92
|
+
searchType: 'q',
|
|
93
|
+
searchValue: '',
|
|
94
|
+
seller: 'Kirian_',
|
|
95
|
+
})
|
|
42
96
|
```
|
|
43
97
|
|
|
44
|
-
|
|
98
|
+
- Get top 25 items, of the 1st page, listed by newest, on a user wantlist, on a seller inventory
|
|
45
99
|
|
|
46
|
-
|
|
100
|
+
```js
|
|
101
|
+
import DiscogsMarketplace from 'discogs-marketplace-api-nodejs'
|
|
102
|
+
|
|
103
|
+
// https://www.discogs.com/seller/Kirian_/mywants?sort=listed,desc&limit=25&user=Kirian_&page=1
|
|
104
|
+
const result = await DiscogsMarketplace.search({
|
|
105
|
+
sort: 'Listed Newest',
|
|
106
|
+
searchType: 'user',
|
|
107
|
+
searchValue: 'Kirian_',
|
|
108
|
+
seller: 'Kirian_',
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Data format
|
|
113
|
+
|
|
114
|
+
You can provide parameters to `DiscogsMarketplace.search` function according to this type:
|
|
47
115
|
|
|
48
116
|
```ts
|
|
49
|
-
|
|
117
|
+
type InputCommonType = {
|
|
50
118
|
/**
|
|
51
|
-
* Type of elements to search
|
|
119
|
+
* Type of elements to search.
|
|
120
|
+
* Default to `q`.
|
|
121
|
+
* | Name | Description |
|
|
122
|
+
* |:---------: |:--------------------------:|
|
|
123
|
+
* | q | Basic query search |
|
|
124
|
+
* | master_id | Search in a master release |
|
|
125
|
+
* | release_id | Search in a release |
|
|
126
|
+
* | label_id | Search in a label |
|
|
127
|
+
* | artist_id | Search in a artist |
|
|
128
|
+
* | user | Search in user wantlist |
|
|
52
129
|
*/
|
|
53
|
-
searchType:
|
|
130
|
+
searchType: SearchTypeType
|
|
54
131
|
/**
|
|
55
132
|
* Value to search corresponding to searchType
|
|
56
133
|
*/
|
|
57
|
-
searchValue: string | number | undefined
|
|
134
|
+
searchValue: string | number | undefined
|
|
58
135
|
/**
|
|
59
136
|
* Currency
|
|
60
137
|
*/
|
|
61
|
-
currency?:
|
|
138
|
+
currency?: CurrencyType
|
|
62
139
|
/**
|
|
63
140
|
* Genre
|
|
64
141
|
*/
|
|
65
|
-
genre?:
|
|
142
|
+
genre?: GenreType
|
|
66
143
|
/**
|
|
67
144
|
* Styles
|
|
68
145
|
*/
|
|
69
|
-
style?:
|
|
146
|
+
style?: StyleType[]
|
|
70
147
|
/**
|
|
71
148
|
* Formats
|
|
72
149
|
*/
|
|
73
|
-
format?:
|
|
150
|
+
format?: FormatType[]
|
|
74
151
|
/**
|
|
75
152
|
* Format descriptions
|
|
76
153
|
*/
|
|
77
|
-
formatDescription?:
|
|
154
|
+
formatDescription?: FormatDescriptionType[]
|
|
78
155
|
/**
|
|
79
156
|
* Media conditions
|
|
80
157
|
*/
|
|
81
|
-
|
|
158
|
+
condition?: ConditionType[]
|
|
82
159
|
/**
|
|
83
|
-
* Year (Do not use it with years)
|
|
160
|
+
* Year (Do not use it with `years`)
|
|
84
161
|
*/
|
|
85
|
-
year?: number
|
|
162
|
+
year?: number
|
|
86
163
|
/**
|
|
87
|
-
* Interval of years (Do not use it with year)
|
|
164
|
+
* Interval of years (Do not use it with `year`)
|
|
88
165
|
*/
|
|
89
|
-
years?:
|
|
166
|
+
years?: {
|
|
167
|
+
/** Min */
|
|
168
|
+
min: number
|
|
169
|
+
/** Max */
|
|
170
|
+
max: number
|
|
171
|
+
}
|
|
90
172
|
/**
|
|
91
173
|
* Is audio sample ?
|
|
92
174
|
*/
|
|
93
|
-
isAudioSample?: boolean
|
|
175
|
+
isAudioSample?: boolean
|
|
94
176
|
/**
|
|
95
177
|
* Is make an offer only ?
|
|
96
178
|
*/
|
|
97
|
-
isMakeAnOfferOnly?: boolean
|
|
179
|
+
isMakeAnOfferOnly?: boolean
|
|
98
180
|
/**
|
|
99
181
|
* Expedition country
|
|
100
182
|
*/
|
|
101
|
-
from?:
|
|
183
|
+
from?: FromType
|
|
102
184
|
/**
|
|
103
185
|
* Seller name
|
|
104
186
|
*/
|
|
105
|
-
seller?: string
|
|
187
|
+
seller?: string
|
|
106
188
|
/**
|
|
107
189
|
* Sort elements by
|
|
108
190
|
*/
|
|
109
|
-
sort?:
|
|
191
|
+
sort?: SortType
|
|
110
192
|
/**
|
|
111
193
|
* Limit of elements to search (25 | 50 | 100 | 250)
|
|
112
194
|
*/
|
|
113
|
-
limit?: LimitType
|
|
195
|
+
limit?: LimitType
|
|
114
196
|
/**
|
|
115
|
-
* Page (Must be < 401 or discogs will return an error 404)
|
|
197
|
+
* Page (Must be < 401 or discogs will return an error 404).
|
|
198
|
+
* Default to `25`.
|
|
116
199
|
*/
|
|
117
|
-
page?: number
|
|
200
|
+
page?: number
|
|
118
201
|
/**
|
|
119
|
-
* Lang to use for Discogs
|
|
202
|
+
* Lang to use for Discogs.
|
|
203
|
+
* Default to `en`.
|
|
120
204
|
*/
|
|
121
|
-
lang?:
|
|
205
|
+
lang?: LangType
|
|
122
206
|
}
|
|
123
207
|
```
|
|
124
208
|
|
|
125
|
-
If success, it will return
|
|
209
|
+
If success, it will return:
|
|
126
210
|
|
|
127
211
|
```ts
|
|
128
|
-
|
|
129
|
-
items:
|
|
212
|
+
type OutputSuccessType = {
|
|
213
|
+
items: {
|
|
214
|
+
id: number
|
|
215
|
+
title: {
|
|
216
|
+
original: string
|
|
217
|
+
artist: string
|
|
218
|
+
item: string
|
|
219
|
+
formats: string[]
|
|
220
|
+
}
|
|
221
|
+
url: string
|
|
222
|
+
labels: string[]
|
|
223
|
+
catnos: string[]
|
|
224
|
+
imageUrl: string
|
|
225
|
+
description: string
|
|
226
|
+
isAcceptingOffer: boolean
|
|
227
|
+
isAvailable: boolean
|
|
228
|
+
condition: {
|
|
229
|
+
media: {
|
|
230
|
+
full: string
|
|
231
|
+
short: string
|
|
232
|
+
}
|
|
233
|
+
sleeve: {
|
|
234
|
+
full: string
|
|
235
|
+
short: string
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
seller: {
|
|
239
|
+
name: string
|
|
240
|
+
url: string
|
|
241
|
+
score: string
|
|
242
|
+
notes: number
|
|
243
|
+
}
|
|
244
|
+
price: {
|
|
245
|
+
base: string
|
|
246
|
+
shipping: string
|
|
247
|
+
}
|
|
248
|
+
country: {
|
|
249
|
+
name: string
|
|
250
|
+
code: ECountryCode
|
|
251
|
+
}
|
|
252
|
+
community: {
|
|
253
|
+
have: number
|
|
254
|
+
want: number
|
|
255
|
+
}
|
|
256
|
+
release: {
|
|
257
|
+
id: number
|
|
258
|
+
url: string
|
|
259
|
+
}
|
|
260
|
+
}[]
|
|
130
261
|
page: {
|
|
131
262
|
current: number
|
|
132
263
|
total: number
|
|
@@ -137,84 +268,34 @@ interface IOutputSuccess {
|
|
|
137
268
|
}
|
|
138
269
|
search: {
|
|
139
270
|
value: string | number
|
|
140
|
-
type:
|
|
271
|
+
type: SearchTypeType
|
|
141
272
|
}
|
|
142
273
|
urlGenerated: string
|
|
143
274
|
}
|
|
144
|
-
|
|
145
|
-
interface IItem {
|
|
146
|
-
id: number
|
|
147
|
-
title: {
|
|
148
|
-
original: string
|
|
149
|
-
artist: string
|
|
150
|
-
item: string
|
|
151
|
-
formats: string[]
|
|
152
|
-
}
|
|
153
|
-
url: string
|
|
154
|
-
labels: string[]
|
|
155
|
-
catnos: string[]
|
|
156
|
-
imageUrl: string
|
|
157
|
-
description: string
|
|
158
|
-
isAcceptingOffer: boolean
|
|
159
|
-
isAvailable: boolean
|
|
160
|
-
condition: {
|
|
161
|
-
media: {
|
|
162
|
-
full: string
|
|
163
|
-
short: string
|
|
164
|
-
}
|
|
165
|
-
sleeve: {
|
|
166
|
-
full: string
|
|
167
|
-
short: string
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
seller: {
|
|
171
|
-
name: string
|
|
172
|
-
url: string
|
|
173
|
-
score: string
|
|
174
|
-
notes: number
|
|
175
|
-
}
|
|
176
|
-
price: {
|
|
177
|
-
base: string
|
|
178
|
-
shipping: string
|
|
179
|
-
}
|
|
180
|
-
from: {
|
|
181
|
-
countryName: string
|
|
182
|
-
isoCountryName: ECountryName
|
|
183
|
-
isoCountryCode: ECountryCode
|
|
184
|
-
}
|
|
185
|
-
community: {
|
|
186
|
-
have: number
|
|
187
|
-
want: number
|
|
188
|
-
}
|
|
189
|
-
release: {
|
|
190
|
-
id: number
|
|
191
|
-
url: string
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
275
|
```
|
|
195
276
|
|
|
196
|
-
If error, it will throw
|
|
277
|
+
If error, it will throw:
|
|
197
278
|
|
|
198
279
|
```ts
|
|
199
|
-
|
|
280
|
+
type OutputErrorType = {
|
|
200
281
|
message: string
|
|
201
282
|
code: number
|
|
202
283
|
}
|
|
203
284
|
```
|
|
204
285
|
|
|
286
|
+
Other interfaces can be found in `src/interfaces`.
|
|
287
|
+
|
|
205
288
|
## How to contribute
|
|
206
289
|
|
|
207
|
-
There is a devcontainer on that project already configured, feel free to use it.
|
|
290
|
+
There is a [devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) on that project already configured, feel free to use it.
|
|
208
291
|
|
|
209
292
|
You can install dependecies with:
|
|
210
293
|
|
|
211
294
|
```sh
|
|
212
|
-
npm
|
|
295
|
+
npm install
|
|
213
296
|
```
|
|
214
297
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
Finally, you can open a pull request with your new additions.
|
|
298
|
+
You can open a pull request with your new additions.
|
|
218
299
|
|
|
219
300
|
## Know issues
|
|
220
301
|
|