discogs-marketplace-api-nodejs 1.11.0 → 1.13.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 CHANGED
@@ -1,227 +1,235 @@
1
- # Discogs Marketplace API NodeJS
1
+ # 🎧 Discogs Marketplace API NodeJS
2
2
 
3
3
  [![NPM Version](https://img.shields.io/npm/v/discogs-marketplace-api-nodejs?logo=npm&color=CB3837)](https://www.npmjs.com/package/discogs-marketplace-api-nodejs) ![GitHub Repo stars](https://img.shields.io/github/stars/KirianCaumes/Discogs-Marketplace-API-NodeJS?style=flat&logo=github&label=Stars&color=%23181717) [![GitHub License](https://img.shields.io/github/license/KirianCaumes/Discogs-Marketplace-API-NodeJS?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI%2FPg0KPHN2ZyBmaWxsPSIjZmZmIiBhcmlhLWhpZGRlbj0idHJ1ZSIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiB2ZXJzaW9uPSIxLjEiIHdpZHRoPSIxNiIgZGF0YS12aWV3LWNvbXBvbmVudD0idHJ1ZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgPg0KICAgIDxwYXRoIGQ9Ik04Ljc1Ljc1VjJoLjk4NWMuMzA0IDAgLjYwMy4wOC44NjcuMjMxbDEuMjkuNzM2Yy4wMzguMDIyLjA4LjAzMy4xMjQuMDMzaDIuMjM0YS43NS43NSAwIDAgMSAwIDEuNWgtLjQyN2wyLjExMSA0LjY5MmEuNzUuNzUgMCAwIDEtLjE1NC44MzhsLS41My0uNTMuNTI5LjUzMS0uMDAxLjAwMi0uMDAyLjAwMi0uMDA2LjAwNi0uMDA2LjAwNS0uMDEuMDEtLjA0NS4wNGMtLjIxLjE3Ni0uNDQxLjMyNy0uNjg2LjQ1QzE0LjU1NiAxMC43OCAxMy44OCAxMSAxMyAxMWE0LjQ5OCA0LjQ5OCAwIDAgMS0yLjAyMy0uNDU0IDMuNTQ0IDMuNTQ0IDAgMCAxLS42ODYtLjQ1bC0uMDQ1LS4wNC0uMDE2LS4wMTUtLjAwNi0uMDA2LS4wMDQtLjAwNHYtLjAwMWEuNzUuNzUgMCAwIDEtLjE1NC0uODM4TDEyLjE3OCA0LjVoLS4xNjJjLS4zMDUgMC0uNjA0LS4wNzktLjg2OC0uMjMxbC0xLjI5LS43MzZhLjI0NS4yNDUgMCAwIDAtLjEyNC0uMDMzSDguNzVWMTNoMi41YS43NS43NSAwIDAgMSAwIDEuNWgtNi41YS43NS43NSAwIDAgMSAwLTEuNWgyLjVWMy41aC0uOTg0YS4yNDUuMjQ1IDAgMCAwLS4xMjQuMDMzbC0xLjI4OS43MzdjLS4yNjUuMTUtLjU2NC4yMy0uODY5LjIzaC0uMTYybDIuMTEyIDQuNjkyYS43NS43NSAwIDAgMS0uMTU0LjgzOGwtLjUzLS41My41MjkuNTMxLS4wMDEuMDAyLS4wMDIuMDAyLS4wMDYuMDA2LS4wMTYuMDE1LS4wNDUuMDRjLS4yMS4xNzYtLjQ0MS4zMjctLjY4Ni40NUM0LjU1NiAxMC43OCAzLjg4IDExIDMgMTFhNC40OTggNC40OTggMCAwIDEtMi4wMjMtLjQ1NCAzLjU0NCAzLjU0NCAwIDAgMS0uNjg2LS40NWwtLjA0NS0uMDQtLjAxNi0uMDE1LS4wMDYtLjAwNi0uMDA0LS4wMDR2LS4wMDFhLjc1Ljc1IDAgMCAxLS4xNTQtLjgzOEwyLjE3OCA0LjVIMS43NWEuNzUuNzUgMCAwIDEgMC0xLjVoMi4yMzRhLjI0OS4yNDkgMCAwIDAgLjEyNS0uMDMzbDEuMjg4LS43MzdjLjI2NS0uMTUuNTY0LS4yMy44NjktLjIzaC45ODRWLjc1YS43NS43NSAwIDAgMSAxLjUgMFptMi45NDUgOC40NzdjLjI4NS4xMzUuNzE4LjI3MyAxLjMwNS4yNzNzMS4wMi0uMTM4IDEuMzA1LS4yNzNMMTMgNi4zMjdabS0xMCAwYy4yODUuMTM1LjcxOC4yNzMgMS4zMDUuMjczczEuMDItLjEzOCAxLjMwNS0uMjczTDMgNi4zMjdaIj48L3BhdGg%2BDQo8L3N2Zz4%3D&logoColor=fff&label=License)](https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS/blob/master/LICENSE) [![Support this project](https://img.shields.io/badge/Support%20this%20project-003087?logo=PayPal&logoColor=fff)](https://www.paypal.me/KirianCaumes)
4
4
 
5
- Another (better ?) NodeJs library to fetch data from Discogs marketplace. 💿
5
+ A modern TypeScript/Node.js client for scraping and retrieving Discogs Marketplace listings — flexible, type safe, and easy to use. 💿
6
+ > 💪 No Discogs API token required — this client scrapes public Marketplace data.
6
7
 
7
- ## 📂 Installation (with npm)
8
-
9
- Run the following command in your project:
8
+ ## 🚀 Installation
10
9
 
11
10
  ```sh
12
- npm i discogs-marketplace-api-nodejs
11
+ npm install discogs-marketplace-api-nodejs
13
12
  ```
14
13
 
15
- ## ▶️ Quick Start
16
-
17
- Import `DiscogsMarketplace` into your project:
14
+ ## ⚡ Quick Start
18
15
 
19
- ```js
16
+ ```ts
20
17
  import { DiscogsMarketplace } from 'discogs-marketplace-api-nodejs'
18
+
19
+ const result = await DiscogsMarketplace.search({
20
+ searchType: 'artist_id',
21
+ searchValue: 244819,
22
+ genre: 'Rock',
23
+ sort: 'price,asc',
24
+ limit: 50,
25
+ page: 1,
26
+ })
27
+
28
+ console.log(result.items)
21
29
  ```
22
30
 
23
- ## 🤔 Examples
31
+ ## 📚 Usage Examples
24
32
 
25
- - Get top 250 items, of the 2nd page, filtered by Rock, listed by newest, for a given artist
33
+ ### 1. Get 250 latest listings by a specific artist in the Rock genre, page 2
26
34
 
27
- ```js
35
+ ```ts
28
36
  // https://www.discogs.com/sell/list?sort=listed,desc&limit=250&artist_id=244819&page=2&genre=Rock
29
37
  const result = await DiscogsMarketplace.search({
30
- limit: 250,
31
- page: 2,
32
- genre: 'Rock',
33
- sort: 'Listed Newest',
34
38
  searchType: 'artist_id',
35
39
  searchValue: 244819,
40
+ genre: 'Rock',
41
+ sort: 'listed,desc',
42
+ limit: 250,
43
+ page: 2,
36
44
  })
37
45
  ```
38
46
 
39
- - Get top 50 items, of the 1st page, listed by price lowest, on a user wantlist
47
+ ### 2. Get listings of a user's wantlist, sorted by price, limit 50
40
48
 
41
- ```js
49
+ ```ts
42
50
  // https://www.discogs.com/sell/mywants?limit=50&user=Kirian_&sort=price,asc
43
51
  const result = await DiscogsMarketplace.search({
44
52
  limit: 50,
45
- page: 1,
46
- sort: 'Price Lowest',
53
+ sort: 'price,asc',
47
54
  searchType: 'user',
48
55
  searchValue: 'Kirian_',
49
56
  })
50
57
  ```
51
58
 
52
- - Get top 25 items, of the 1st page, listed by seller A-Z, on a release
59
+ ### 3. Get listings on a release, sorted by seller name
53
60
 
54
- ```js
55
- // https://www.discogs.com/sell/release/767931?sort=seller,asc&limit=25&page=1
61
+ ```ts
62
+ // https://www.discogs.com/sell/list?release_id=767931&sort=seller,asc&limit=25
63
+ // https://www.discogs.com/sell/release/767931?sort=seller,asc&limit=25
56
64
  const result = await DiscogsMarketplace.search({
57
- sort: 'Seller A-Z',
58
- page: 1,
59
65
  searchType: 'release_id',
60
66
  searchValue: '767931',
67
+ sort: 'seller,asc',
61
68
  })
62
69
  ```
63
70
 
64
- - Get top 100 items, of the 1st page, listed by newest, on a string search
71
+ ### 4. Get listings by a general search query (e.g., "in flames"), sorted by newest listings, limit 100
65
72
 
66
- ```js
73
+ ```ts
67
74
  // https://www.discogs.com/sell/list?sort=listed,desc&limit=100&q=in+flames&page=1
68
75
  const result = await DiscogsMarketplace.search({
69
- limit: 100,
70
- page: 1,
71
- sort: 'Listed Newest',
72
76
  searchType: 'q',
73
77
  searchValue: 'in flames',
78
+ sort: 'listed,desc',
79
+ limit: 100,
74
80
  })
75
81
  ```
76
82
 
77
- - Get top 25 items, of the 1st page, listed by newest, on a seller inventory
83
+ ### 5. Get newest listings on a seller inventory
78
84
 
79
- ```js
80
- // https://www.discogs.com/seller/Kirian_/profile?sort=listed,desc&limit=25&page=1
85
+ ```ts
86
+ // https://www.discogs.com/sell/list?sort=listed,desc&seller=Kirian_
87
+ // https://www.discogs.com/seller/Kirian_/profile?sort=listed,desc
81
88
  const result = await DiscogsMarketplace.search({
82
- sort: 'Listed Newest',
83
- page: 1,
89
+ sort: 'listed,desc',
84
90
  searchType: 'q',
85
- searchValue: '',
86
91
  seller: 'Kirian_',
87
92
  })
88
93
  ```
89
94
 
90
- - Get top 25 items, of the 1st page, listed by newest, on a user wantlist, on a seller inventory
95
+ ### 6. Get newest listings of a user's wantlist, on a seller inventory
91
96
 
92
- ```js
93
- // https://www.discogs.com/seller/Kirian_/mywants?sort=listed,desc&limit=25&user=Kirian_&page=1
97
+ ```ts
98
+ // https://www.discogs.com/sell/mywants?sort=listed,desc&seller=Kirian_&user=Kirian_
99
+ // https://www.discogs.com/seller/Kirian_/mywants?sort=listed,desc&user=Kirian_
94
100
  const result = await DiscogsMarketplace.search({
95
- sort: 'Listed Newest',
96
- page: 1,
101
+ sort: 'listed,desc',
97
102
  searchType: 'user',
98
103
  searchValue: 'Kirian_',
99
104
  seller: 'Kirian_',
100
105
  })
101
106
  ```
102
107
 
103
- - If you are making a lot of requests, you can pass a playwright page instance to reuse it:
108
+ ## 💁 Additional Features
104
109
 
105
- ```js
106
- const browser = await playwright.launch()
107
- const browserContext = await browser.newContext()
108
- const browserPage = await browserContext.newPage()
110
+ ### 1. Extract correct parameters from URL
109
111
 
110
- const result = await DiscogsMarketplace.search({ searchType: 'q'}, browserPage)
111
-
112
- await browserContext.close()
113
- await browser.close()
112
+ ```ts
113
+ const searchParams = DiscogsMarketplace.getSearchParamsFromUrl('https://www.discogs.com/fr/sell/list?sort=listed,desc&limit=250&artist_id=244819&page=2&genre=Rock')
114
+ // {
115
+ // searchType: 'artist_id',
116
+ // searchValue: '244819',
117
+ // genre: 'Rock',
118
+ // sort: 'listed,desc',
119
+ // limit: 250,
120
+ // page: 2,
121
+ // lang: 'fr',
122
+ // }
114
123
  ```
115
124
 
116
- ## 📃 Data format
125
+ ## 🧩 API Reference
117
126
 
118
- You can provide parameters to `DiscogsMarketplace.search` function according to this interface:
127
+ The `DiscogsMarketplace.search` function accepts parameters defined by the following interface:
119
128
 
120
129
  ```ts
121
130
  interface SearchParams {
122
131
  /**
123
- * Type of elements to search.
124
- * | Name | Description |
125
- * |:---------: |:--------------------------:|
126
- * | q | Basic query search |
127
- * | master_id | Search in a master release |
128
- * | release_id | Search in a release |
129
- * | label_id | Search in a label |
130
- * | artist_id | Search in a artist |
131
- * | user | Search in user wantlist |
132
+ * The type of element to search.
133
+ * | Value | Description |
134
+ * |-------------|--------------------------------|
135
+ * | `q` | Basic query search |
136
+ * | `master_id` | Search within a master release |
137
+ * | `release_id`| Search within a release |
138
+ * | `label_id` | Search within a label |
139
+ * | `artist_id` | Search by artist |
140
+ * | `user` | Search a user's wantlist |
132
141
  * @default 'q'
133
142
  */
134
143
  searchType: Search
135
144
  /**
136
- * Value to search corresponding to the search type
145
+ * The search value corresponding to the selected `searchType`.
137
146
  */
138
147
  searchValue?: string | number
139
148
  /**
140
- * Currency
149
+ * Currency code for price filtering.
141
150
  * @example 'USD'
142
151
  */
143
152
  currency?: Currency
144
153
  /**
145
- * Genre
154
+ * Genre filter.
146
155
  * @example 'Rock'
147
156
  */
148
157
  genre?: Genre
149
158
  /**
150
- * Styles
159
+ * List of styles.
151
160
  * @example ['Death Metal', 'Heavy Metal']
152
161
  */
153
162
  style?: Array<Style>
154
163
  /**
155
- * Formats
164
+ * List of formats.
156
165
  * @example ['Vinyl', 'CD']
157
166
  */
158
167
  format?: Array<Format>
159
168
  /**
160
- * Format descriptions
169
+ * List of format descriptions.
161
170
  * @example ['Limited Edition', 'Numbered']
162
171
  */
163
172
  formatDescription?: Array<FormatDescription>
164
173
  /**
165
- * Media conditions
174
+ * List of media conditions.
166
175
  * @example ['Mint (M)', 'Very Good Plus (VG+)']
167
176
  */
168
177
  condition?: Array<Condition>
169
178
  /**
170
- * Year (Do not use it with `years`)
179
+ * Release year.
180
+ * Do not use together with `years`.
171
181
  */
172
182
  year?: number
173
183
  /**
174
- * Interval of years (Do not use it with `year`)
184
+ * Range of years.
185
+ * Do not use together with `year`.
175
186
  */
176
187
  years?: {
177
- /** Min */
188
+ /** Minimum year */
178
189
  min: number
179
- /** Max */
190
+ /** Maximum year */
180
191
  max: number
181
192
  }
182
193
  /**
183
- * Is audio sample ?
184
- * @default false
185
- */
186
- isAudioSample?: boolean
187
- /**
188
- * Is make an offer only ?
194
+ * If true, only listings that accept offers are returned.
189
195
  * @default false
190
196
  */
191
197
  isMakeAnOfferOnly?: boolean
192
198
  /**
193
- * Expedition country
199
+ * Expedition country filter (2-letter country code).
194
200
  * @example 'US'
195
201
  */
196
202
  from?: From
197
203
  /**
198
- * Seller name
204
+ * Seller's username filter.
199
205
  */
200
206
  seller?: string
201
207
  /**
202
- * Sort elements by.
203
- * @default 'Listed Newest'
208
+ * Sort order for the results.
209
+ * @default 'listed,desc'
204
210
  */
205
211
  sort?: Sort
206
212
  /**
207
- * Limit of elements to search (25 | 50 | 100 | 250).
213
+ * Number of results to return per page.
214
+ * Allowed values: 25, 50, 100, 250.
208
215
  * @default 25
209
216
  */
210
217
  limit?: Limit
211
218
  /**
212
- * Page (Must be < 401 or discogs will return an error 404).
219
+ * Page number of results.
220
+ * Must be less than 401 to avoid Discogs 404 errors.
213
221
  * @default 1
214
222
  */
215
223
  page?: number
216
224
  /**
217
- * Lang to use for Discogs.
225
+ * Language code for Discogs interface.
218
226
  * @default 'en'
219
227
  */
220
228
  lang?: Lang
221
229
  }
222
230
  ```
223
231
 
224
- If success, it will return:
232
+ On success, it returns a result matching this interface:
225
233
 
226
234
  ```ts
227
235
  interface SearchResult {
@@ -234,6 +242,7 @@ interface SearchResult {
234
242
  formats: Array<string>
235
243
  }
236
244
  url: string
245
+ listedAt: Date | null
237
246
  labels: Array<string>
238
247
  catnos: Array<string>
239
248
  imageUrl: string
@@ -288,28 +297,20 @@ interface SearchResult {
288
297
  }
289
298
  ```
290
299
 
291
- ## 💡 How to contribute
300
+ ## 🛠️ Development & Contribution
292
301
 
293
- There is a [devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) on that project already configured, feel free to use it.
302
+ - Clone the repo and use the included devcontainer/VSCode setup.
303
+ - Run: `npm install`
304
+ - Add your contribution.
305
+ - Use `npm test` to run unit tests.
306
+ - Open a pull request with your new additions! 🎉
294
307
 
295
- Install dependencies with:
308
+ ## 👉 Known Issues
296
309
 
297
- ```sh
298
- npm install
299
- ```
300
-
301
- You can open a pull request with your new additions.
302
-
303
- ## 🐛 Known issues/problems
304
-
305
- ### Playwright
306
-
307
- Install system dependencies:
308
-
309
- ```sh
310
- sudo npx playwright install-deps chromium
311
- ```
310
+ - Requests hitting page >400 will result in a 404.
311
+ - Some search parameters might not be compatible with every type of queries.
312
+ - For other edge cases, feel free to open an [issue on GitHub](https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS/issues).
312
313
 
313
- More information [here](https://playwright.dev/docs/browsers#install-system-dependencies).
314
+ ## 📃 License
314
315
 
315
- 👉 If you find another problem, feel free to open an issue.
316
+ Licensed under [MIT](https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS/blob/master/LICENSE).
@@ -0,0 +1,10 @@
1
+ import type SearchParams from './interfaces/search-params.interface.js';
2
+ /**
3
+ * Get search parameters from a Discogs Marketplace URL
4
+ * @param url Discogs Marketplace URL
5
+ * @returns Search parameters
6
+ * @example
7
+ * const searchParams = getSearchParamsFromUrl('https://www.discogs.com/sell/list?sort=listed,desc&limit=250&artist_id=244819&page=2&genre=Rock')
8
+ * // { searchType: 'artist_id', searchValue: '244819', genre: 'Rock', sort: 'listed,desc', limit: 250, page: 2 }
9
+ */
10
+ export default function getSearchParamsFromUrl(url: string): SearchParams;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ /* eslint-disable no-restricted-syntax */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.default = getSearchParamsFromUrl;
5
+ /**
6
+ * Safely parse an integer from a string
7
+ * @param value String to parse
8
+ * @returns Parsed integer or undefined if parsing fails
9
+ */
10
+ const safeParseInt = (value) => {
11
+ const parsed = parseInt(value ?? '', 10);
12
+ return isNaN(parsed) ? undefined : parsed;
13
+ };
14
+ /**
15
+ * Get search parameters from a Discogs Marketplace URL
16
+ * @param url Discogs Marketplace URL
17
+ * @returns Search parameters
18
+ * @example
19
+ * const searchParams = getSearchParamsFromUrl('https://www.discogs.com/sell/list?sort=listed,desc&limit=250&artist_id=244819&page=2&genre=Rock')
20
+ * // { searchType: 'artist_id', searchValue: '244819', genre: 'Rock', sort: 'listed,desc', limit: 250, page: 2 }
21
+ */
22
+ function getSearchParamsFromUrl(url) {
23
+ const { searchParams: urlSearchParams, pathname, host } = new URL(url);
24
+ if (!host.includes('discogs.com')) {
25
+ throw new Error(`Invalid host: ${host}. Expected 'www.discogs.com' or 'discogs.com'.`);
26
+ }
27
+ const searchParams = {
28
+ searchType: 'q', // Default search type
29
+ };
30
+ // Retrieve the search type and value
31
+ const searchType = ['q', 'master_id', 'release_id', 'label_id', 'artist_id', 'user'].find(type => urlSearchParams.has(type));
32
+ if (searchType) {
33
+ searchParams.searchType = searchType;
34
+ const searchValue = urlSearchParams.get(searchType);
35
+ if (searchValue) {
36
+ searchParams.searchValue = searchValue;
37
+ }
38
+ }
39
+ // Retrieve basic search values
40
+ for (const key of ['currency', 'genre', 'ships_from', 'seller', 'sort']) {
41
+ const value = urlSearchParams.get(key);
42
+ if (value) {
43
+ switch (key) {
44
+ case 'ships_from':
45
+ searchParams.from = value;
46
+ break;
47
+ default:
48
+ searchParams[key] = value;
49
+ break;
50
+ }
51
+ }
52
+ }
53
+ // Retrieve number search values
54
+ for (const key of ['limit', 'page']) {
55
+ const value = safeParseInt(urlSearchParams.get(key));
56
+ if (value) {
57
+ switch (key) {
58
+ case 'limit':
59
+ searchParams.limit = value;
60
+ break;
61
+ default:
62
+ searchParams[key] = value;
63
+ break;
64
+ }
65
+ }
66
+ }
67
+ // Retrieve array search values
68
+ for (const key of ['style', 'format', 'format_desc', 'condition']) {
69
+ const values = urlSearchParams.getAll(key);
70
+ if (values.length) {
71
+ switch (key) {
72
+ case 'format_desc':
73
+ searchParams.formatDescription = values;
74
+ break;
75
+ default:
76
+ searchParams[key] = values;
77
+ break;
78
+ }
79
+ }
80
+ }
81
+ // Check if search is on offers only
82
+ if (urlSearchParams.get('offers') === '1') {
83
+ searchParams.isMakeAnOfferOnly = true;
84
+ }
85
+ // Handle year and years
86
+ const year = safeParseInt(urlSearchParams.get('year'));
87
+ const year1 = safeParseInt(urlSearchParams.get('year1'));
88
+ const year2 = safeParseInt(urlSearchParams.get('year2'));
89
+ if (year) {
90
+ searchParams.year = year;
91
+ }
92
+ else if (year1 && year2) {
93
+ searchParams.years = { min: year1, max: year2 };
94
+ }
95
+ // Retrieve the language from the URL path
96
+ const pathSegments = pathname.split('/').filter(x => x);
97
+ if (/^[a-z]{2}$/i.test(pathSegments[0] ?? '')) {
98
+ searchParams.lang = pathSegments[0]?.toLowerCase();
99
+ }
100
+ // Handle specific case for release ID in the URL path
101
+ const releaseIdMatch = /\/sell\/release\/(\d+)/.exec(url);
102
+ if (releaseIdMatch?.[1]) {
103
+ searchParams.searchType = 'release_id';
104
+ searchParams.searchValue = releaseIdMatch[1];
105
+ }
106
+ // Handle specific case for seller profile in the URL path
107
+ const sellerProfileMatch = /\/seller\/([^/]+)\/profile/.exec(url);
108
+ if (sellerProfileMatch?.[1]) {
109
+ searchParams.seller = sellerProfileMatch[1];
110
+ }
111
+ // Handle specific case for seller name on wantlist in the URL path
112
+ const sellerMyWantsMatch = /\/seller\/([^/]+)\/mywants/.exec(url);
113
+ if (sellerMyWantsMatch?.[1]) {
114
+ searchParams.searchType = 'user';
115
+ searchParams.searchValue = urlSearchParams.get('user') ?? '';
116
+ searchParams.seller = sellerMyWantsMatch[1];
117
+ }
118
+ return searchParams;
119
+ }
package/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
- import search from './search';
2
- import type SearchParams from './interfaces/search-params.interface';
3
- import type SearchResult from './interfaces/search-result.interface';
1
+ import search from './search.js';
2
+ import getSearchParamsFromUrl from './get-search-params.js';
3
+ import type SearchParams from './interfaces/search-params.interface.js';
4
+ import type SearchResult from './interfaces/search-result.interface.js';
4
5
  /**
5
- * Discogs Marketplace API
6
- * @see https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS
6
+ * Discogs Marketplace API, tools for interacting with the Discogs Marketplace.
7
+ * @see {@link https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS GitHub Repository}
7
8
  */
8
9
  export declare const DiscogsMarketplace: {
9
10
  search: typeof search;
11
+ getSearchParamsFromUrl: typeof getSearchParamsFromUrl;
10
12
  };
11
13
  export type { SearchParams, SearchResult };
package/dist/index.js CHANGED
@@ -4,9 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.DiscogsMarketplace = void 0;
7
- const search_1 = __importDefault(require("./search"));
7
+ const search_1 = __importDefault(require("./search.js"));
8
+ const get_search_params_1 = __importDefault(require("./get-search-params.js"));
8
9
  /**
9
- * Discogs Marketplace API
10
- * @see https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS
10
+ * Discogs Marketplace API, tools for interacting with the Discogs Marketplace.
11
+ * @see {@link https://github.com/KirianCaumes/Discogs-Marketplace-API-NodeJS GitHub Repository}
11
12
  */
12
- exports.DiscogsMarketplace = { search: search_1.default };
13
+ exports.DiscogsMarketplace = { search: search_1.default, getSearchParamsFromUrl: get_search_params_1.default };
@@ -0,0 +1,33 @@
1
+ export default interface ShopDetailsResultApi {
2
+ /** Data */
3
+ data?: {
4
+ /** Releases */
5
+ releases?: Array<{
6
+ /** InWantlistCount */
7
+ inWantlistCount?: number;
8
+ /** InCollectionCount */
9
+ inCollectionCount?: number;
10
+ /** Images */
11
+ images?: {
12
+ /** Edges */
13
+ edges?: Array<{
14
+ /** Node */
15
+ node?: {
16
+ /** Thumbnail */
17
+ thumbnail?: {
18
+ /** WebpUrl */
19
+ webpUrl?: string;
20
+ };
21
+ };
22
+ }>;
23
+ };
24
+ /** Ratings */
25
+ ratings?: {
26
+ /** AverageRating */
27
+ averageRating?: number;
28
+ };
29
+ /** DiscogsId */
30
+ discogsId?: number;
31
+ }>;
32
+ };
33
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });