sound-tank 1.1.0 → 1.2.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # sound-tank
2
2
 
3
+ ## 1.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c29611c: move vitest/coverage-v8 to dev deps
8
+
9
+ ## 1.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 13e1148: Add getAllListings, better testing, remove a few bad options that were assumed but aren't respected by Reverb
14
+
3
15
  ## 1.1.0
4
16
 
5
17
  ### Minor Changes
package/bun.lockb ADDED
Binary file
@@ -0,0 +1,315 @@
1
+ import * as axios from 'axios';
2
+ import { Axios } from 'axios';
3
+
4
+ type Link = {
5
+ href: string;
6
+ method?: 'PUT' | 'POST' | 'GET' | Exclude<string, 'PUT' | 'POST' | 'GET'>;
7
+ };
8
+ type ShippingRate = {
9
+ region_code: string;
10
+ rate: Price;
11
+ carrier_calculated: boolean;
12
+ regional: boolean;
13
+ destination_postal_code_needed: boolean;
14
+ };
15
+ type ListingStateSlug = 'sold' | 'live' | Exclude<string, 'sold' | 'live'>;
16
+ type ListingState = {
17
+ slug: ListingStateSlug;
18
+ description: string;
19
+ };
20
+ type ListingStats = {
21
+ views: number;
22
+ watches: number;
23
+ };
24
+ type ConditionDisplayName = 'Excellent' | 'New' | 'B-Stock' | 'Very Good' | 'Good' | 'Fair' | 'Poor' | Exclude<string, 'Excellent' | 'New' | 'B-Stock' | 'Very Good' | 'Good' | 'Fair' | 'Poor'>;
25
+ type ListingCondition = {
26
+ uuid: string;
27
+ displayName: ConditionDisplayName;
28
+ };
29
+ type ListingShipping = {
30
+ local: boolean;
31
+ rates: ShippingRate[];
32
+ user_region_rate: ShippingRate;
33
+ initial_offer_rate: ShippingRate;
34
+ };
35
+ type ListingLinks = {
36
+ photo: Link;
37
+ self: Link;
38
+ update: Link;
39
+ end: Link;
40
+ want: Link;
41
+ unwant: Link;
42
+ edit: Link;
43
+ web: Link;
44
+ make_offer: Link;
45
+ cart: Link;
46
+ };
47
+ type Category = {
48
+ uuid: string;
49
+ full_name: string;
50
+ };
51
+ type CurrencyCode = string;
52
+ type CurrencySymbol = '$' | Exclude<string, '$'>;
53
+ type Price = {
54
+ amount: `${number}.${number}` | `${number}`;
55
+ amount_cents: number;
56
+ currency: CurrencyCode;
57
+ symbol: CurrencySymbol;
58
+ display: string;
59
+ tax_included_hint?: string;
60
+ tax_included?: boolean;
61
+ tax_included_rate?: number;
62
+ };
63
+ type PhotoLinks = {
64
+ large_crop: Link;
65
+ small_crop: Link;
66
+ full: Link;
67
+ thumbnail: Link;
68
+ };
69
+ type Listing = {
70
+ id: number | string;
71
+ make: string;
72
+ model: string;
73
+ finish: string;
74
+ year: string;
75
+ title: string;
76
+ created_at: ReturnType<typeof Date.toString>;
77
+ shop_name: string;
78
+ description: string;
79
+ condition: ListingCondition;
80
+ price: Price;
81
+ inventory: number;
82
+ has_inventory: boolean;
83
+ offers_enabled: boolean;
84
+ auction: boolean;
85
+ categories: Category[];
86
+ listing_currency: string;
87
+ published_at: ReturnType<typeof Date.toString>;
88
+ buyer_price: Price;
89
+ seller_price: Price;
90
+ state: ListingState;
91
+ shipping_profile_id: number;
92
+ shipping: ListingShipping;
93
+ stats: ListingStats;
94
+ slug: string;
95
+ photos: {
96
+ _links: PhotoLinks;
97
+ }[];
98
+ _links: ListingLinks;
99
+ };
100
+ type OrderStatus = 'unpaid' | 'paid' | 'awaiting_shipment' | 'shipped' | Exclude<string, 'unpaid' | 'awaiting_shipment' | 'shipped'>;
101
+ type ShippingProvider = 'UPS' | 'USPS' | 'FedEx' | 'DHL Deutschland' | 'DHLExpress' | 'DHLGlobalMail' | 'DHL' | 'Canada Post' | 'CanPar' | 'Royal Mail' | 'PostNL' | 'Australia Post' | 'EMS' | 'La Poste - Colissimo' | 'China Post' | 'GLS' | 'Parcelforce' | 'Purolator' | 'Interlogistica' | 'Correos España' | 'Ukraine Post' | 'DPD Germany' | 'DPD UK' | 'DPD France' | 'Hermes' | 'TNT' | 'Other';
102
+ type OrderTaxResponsibleParty = 'reverb' | Exclude<string, 'reverb'>;
103
+ type OrderShippingMethod = 'shipped' | Exclude<string, 'shipped'>;
104
+ type OrderShipmentStatus = 'in_transit' | Exclude<string, 'in_transit'>;
105
+ type OrderType = 'offer' | Exclude<string, 'offer'>;
106
+ type OrderSource = 'reverb' | Exclude<string, 'reverb'>;
107
+ type Order = {
108
+ amount_product: Price;
109
+ presentment_amount_product: Price;
110
+ amount_product_subtotal: Price;
111
+ presentment_amount_product_subtotal: Price;
112
+ shipping: Price;
113
+ presentment_amount_shipping: Price;
114
+ amount_tax: Price;
115
+ presentment_amount_tax: Price;
116
+ total: Price;
117
+ presentment_amount_total: Price;
118
+ shipping_taxed: boolean;
119
+ buyer_name: string;
120
+ buyer_first_name: string;
121
+ buyer_email: string;
122
+ buyer_last_name: string;
123
+ buyer_id: number | string;
124
+ created_at: ReturnType<typeof Date.toString>;
125
+ order_number: number | string;
126
+ tax_rate: number;
127
+ order_source: OrderSource;
128
+ needs_feedback_for_buyer: boolean;
129
+ needs_feedback_for_seller: boolean;
130
+ order_type: OrderType;
131
+ paid_at: ReturnType<typeof Date.toString>;
132
+ quantity: number;
133
+ shipping_address: ShippingAddress;
134
+ shipping_date: ReturnType<typeof Date.toString>;
135
+ shipped_at: ReturnType<typeof Date.toString>;
136
+ shipping_provider: ShippingProvider;
137
+ shipping_code: string;
138
+ shipping_method: OrderShippingMethod;
139
+ shipment_status: OrderShipmentStatus;
140
+ local_pickup: boolean;
141
+ shop_name: string;
142
+ status: OrderStatus;
143
+ title: string;
144
+ updated_at: ReturnType<typeof Date.toString>;
145
+ payment_method: string;
146
+ order_bundle_id: number | string;
147
+ product_id: number | string;
148
+ uuid: string;
149
+ photos: {
150
+ _links: PhotoLinks;
151
+ }[];
152
+ selling_fee: Price;
153
+ bump_fee: Price;
154
+ direct_checkout_fee: Price;
155
+ tax_on_fees: Price;
156
+ tax_responsible_party: OrderTaxResponsibleParty;
157
+ direct_checkout_payout: Price;
158
+ order_notes: any[];
159
+ _links: OrderLinks;
160
+ };
161
+ type OrderLinks = {
162
+ photo: Link;
163
+ feedback_for_buyer: Link;
164
+ feedback_for_seller: Link;
165
+ listing: Link;
166
+ start_conversation: Link;
167
+ web_tracking: Link;
168
+ web: Link;
169
+ web_listing: Link;
170
+ self: Link;
171
+ mark_picked_up: Link;
172
+ payments: Link;
173
+ contact_buyer: {
174
+ web: Link;
175
+ };
176
+ };
177
+ type ShippingAddress = {
178
+ region: string;
179
+ locality: string;
180
+ country_code: string;
181
+ display_location: string;
182
+ id: number | string;
183
+ primary: boolean;
184
+ name: string;
185
+ street_address: string;
186
+ extended_address: string;
187
+ postal_code: string;
188
+ phone: string;
189
+ unformatted_phone: string;
190
+ complete_shipping_address: boolean;
191
+ _links: {
192
+ self: Link;
193
+ };
194
+ };
195
+
196
+ interface GetMyListingsOptions {
197
+ page?: number;
198
+ perPage?: number;
199
+ query?: string;
200
+ state?: string;
201
+ }
202
+ interface GetAllMyListingsOptions {
203
+ query?: string;
204
+ state?: string;
205
+ }
206
+ interface GetOneListingOptions {
207
+ id: string;
208
+ }
209
+
210
+ interface GetMyOrdersOptions {
211
+ page?: number;
212
+ }
213
+
214
+ type PaginatedReverbResponse<T> = T & {
215
+ total: number;
216
+ current_page: number;
217
+ total_pages: number;
218
+ _links: {
219
+ next?: Link;
220
+ prev?: Link;
221
+ };
222
+ };
223
+ type GetArbitraryEndpointOptions = {
224
+ url: string;
225
+ params?: {
226
+ [key: string]: string;
227
+ };
228
+ };
229
+
230
+ type ApiVersion = string;
231
+ type ApiKey = string;
232
+ type Locale = string;
233
+ type ShippingRegion = string;
234
+ type DisplayCurrency = string;
235
+ type RootEndpoint = Domain;
236
+ type Domain = `${string}.${string}` | `${string}.${string}.${string}`;
237
+ interface ReverbOptions {
238
+ apiKey: ApiKey;
239
+ version?: ApiVersion | undefined;
240
+ rootEndpoint?: RootEndpoint | undefined;
241
+ displayCurrency?: DisplayCurrency | undefined;
242
+ shippingRegion?: ShippingRegion | undefined;
243
+ locale?: Locale | undefined;
244
+ }
245
+ type ReverbHeaders = Axios['get']['arguments'][1] & {
246
+ 'Content-Type': string;
247
+ 'Accept-Version': ApiVersion;
248
+ Accept: string;
249
+ 'Accept-Language': Locale;
250
+ 'X-Display-Currency': DisplayCurrency;
251
+ 'X-Shipping-Region'?: ShippingRegion | undefined;
252
+ 'User-Agent'?: string;
253
+ };
254
+ interface AuthReverbHeaders extends ReverbHeaders {
255
+ Authorization: `Bearer ${ApiKey}`;
256
+ }
257
+ declare class Reverb {
258
+ static defaultHeaders: ReverbHeaders;
259
+ private _rootEndpoint;
260
+ private _version;
261
+ private apiKey;
262
+ private _headers;
263
+ private _displayCurrency;
264
+ private _shippingRegion;
265
+ private _locale;
266
+ constructor(options: ReverbOptions);
267
+ private updateHeaders;
268
+ set locale(locale: Locale);
269
+ get locale(): Locale;
270
+ set shippingRegion(shippingRegion: ShippingRegion | undefined);
271
+ get shippingRegion(): ShippingRegion | undefined;
272
+ get headers(): AuthReverbHeaders;
273
+ set displayCurrency(displayCurrency: DisplayCurrency);
274
+ get displayCurrency(): DisplayCurrency;
275
+ set version(version: ApiVersion);
276
+ get version(): ApiVersion;
277
+ set rootEndpoint(rootEndpoint: RootEndpoint);
278
+ get rootEndpoint(): RootEndpoint;
279
+ /**
280
+ * Retrieves the current user's listings.
281
+ * @param options - Optional parameters for the request.
282
+ * @returns A Promise that resolves to the user's listings. Structured as an axios response
283
+ */
284
+ getMyListings(options?: GetMyListingsOptions): Promise<axios.AxiosResponse<PaginatedReverbResponse<{
285
+ listings: Listing[];
286
+ }>, any>>;
287
+ /**
288
+ * Retrieves the orders for the current user.
289
+ * @param options - An optional object containing options for the request.
290
+ * @returns A Promise that resolves with the user's orders. Structured as an axios response
291
+ */
292
+ getMyOrders(options?: GetMyOrdersOptions): Promise<axios.AxiosResponse<PaginatedReverbResponse<{
293
+ orders: Order[];
294
+ }>, any>>;
295
+ /**
296
+ * Retrieves an arbitrary endpoint using the provided options.
297
+ * @param options - The options to use when retrieving the endpoint.
298
+ * @returns A Promise that resolves with the retrieved endpoint. Structured as an axios response
299
+ */
300
+ getArbitraryEndpoint(options: GetArbitraryEndpointOptions): Promise<axios.AxiosResponse<any, any>>;
301
+ /**
302
+ * Retrieves a single listing based on the provided options.
303
+ * @param options - The options to use when retrieving the listing.
304
+ * @returns A Promise that resolves with the retrieved listing.
305
+ */
306
+ getOneListing(options: GetOneListingOptions): Promise<axios.AxiosResponse<Listing, any>>;
307
+ /**
308
+ * Retrieves all listings associated with the current user.
309
+ * @param options - An optional object containing options for the request.
310
+ * @returns A Promise that resolves with an array of listings.
311
+ */
312
+ getAllMyListings(options?: GetAllMyListingsOptions): Promise<axios.AxiosResponse<Listing[], any>>;
313
+ }
314
+
315
+ export { ApiKey, ApiVersion, AuthReverbHeaders, DisplayCurrency, Locale, ReverbHeaders, ReverbOptions, RootEndpoint, ShippingRegion, Reverb as default };
package/dist/index.d.ts CHANGED
@@ -97,7 +97,7 @@ type Listing = {
97
97
  }[];
98
98
  _links: ListingLinks;
99
99
  };
100
- type OrderStatus = 'unpaid' | 'awaiting_shipment' | 'shipped' | Exclude<string, 'unpaid' | 'awaiting_shipment' | 'shipped'>;
100
+ type OrderStatus = 'unpaid' | 'paid' | 'awaiting_shipment' | 'shipped' | Exclude<string, 'unpaid' | 'awaiting_shipment' | 'shipped'>;
101
101
  type ShippingProvider = 'UPS' | 'USPS' | 'FedEx' | 'DHL Deutschland' | 'DHLExpress' | 'DHLGlobalMail' | 'DHL' | 'Canada Post' | 'CanPar' | 'Royal Mail' | 'PostNL' | 'Australia Post' | 'EMS' | 'La Poste - Colissimo' | 'China Post' | 'GLS' | 'Parcelforce' | 'Purolator' | 'Interlogistica' | 'Correos España' | 'Ukraine Post' | 'DPD Germany' | 'DPD UK' | 'DPD France' | 'Hermes' | 'TNT' | 'Other';
102
102
  type OrderTaxResponsibleParty = 'reverb' | Exclude<string, 'reverb'>;
103
103
  type OrderShippingMethod = 'shipped' | Exclude<string, 'shipped'>;
@@ -197,14 +197,18 @@ interface GetMyListingsOptions {
197
197
  page?: number;
198
198
  perPage?: number;
199
199
  query?: string;
200
- sku?: string;
201
200
  state?: string;
202
201
  }
202
+ interface GetAllMyListingsOptions {
203
+ query?: string;
204
+ state?: string;
205
+ }
206
+ interface GetOneListingOptions {
207
+ id: string;
208
+ }
203
209
 
204
210
  interface GetMyOrdersOptions {
205
211
  page?: number;
206
- perPage?: number;
207
- status?: Order['status'] | 'all';
208
212
  }
209
213
 
210
214
  type PaginatedReverbResponse<T> = T & {
@@ -272,13 +276,40 @@ declare class Reverb {
272
276
  get version(): ApiVersion;
273
277
  set rootEndpoint(rootEndpoint: RootEndpoint);
274
278
  get rootEndpoint(): RootEndpoint;
279
+ /**
280
+ * Retrieves the current user's listings.
281
+ * @param options - Optional parameters for the request.
282
+ * @returns A Promise that resolves to the user's listings. Structured as an axios response
283
+ */
275
284
  getMyListings(options?: GetMyListingsOptions): Promise<axios.AxiosResponse<PaginatedReverbResponse<{
276
285
  listings: Listing[];
277
286
  }>, any>>;
287
+ /**
288
+ * Retrieves the orders for the current user.
289
+ * @param options - An optional object containing options for the request.
290
+ * @returns A Promise that resolves with the user's orders. Structured as an axios response
291
+ */
278
292
  getMyOrders(options?: GetMyOrdersOptions): Promise<axios.AxiosResponse<PaginatedReverbResponse<{
279
293
  orders: Order[];
280
294
  }>, any>>;
295
+ /**
296
+ * Retrieves an arbitrary endpoint using the provided options.
297
+ * @param options - The options to use when retrieving the endpoint.
298
+ * @returns A Promise that resolves with the retrieved endpoint. Structured as an axios response
299
+ */
281
300
  getArbitraryEndpoint(options: GetArbitraryEndpointOptions): Promise<axios.AxiosResponse<any, any>>;
301
+ /**
302
+ * Retrieves a single listing based on the provided options.
303
+ * @param options - The options to use when retrieving the listing.
304
+ * @returns A Promise that resolves with the retrieved listing.
305
+ */
306
+ getOneListing(options: GetOneListingOptions): Promise<axios.AxiosResponse<Listing, any>>;
307
+ /**
308
+ * Retrieves all listings associated with the current user.
309
+ * @param options - An optional object containing options for the request.
310
+ * @returns A Promise that resolves with an array of listings.
311
+ */
312
+ getAllMyListings(options?: GetAllMyListingsOptions): Promise<axios.AxiosResponse<Listing[], any>>;
282
313
  }
283
314
 
284
315
  export { ApiKey, ApiVersion, AuthReverbHeaders, DisplayCurrency, Locale, ReverbHeaders, ReverbOptions, RootEndpoint, ShippingRegion, Reverb as default };
package/dist/index.js CHANGED
@@ -1,120 +1,72 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
- var __getProtoOf = Object.getPrototypeOf;
10
- var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __export = (target, all) => {
26
- for (var name in all)
27
- __defProp(target, name, { get: all[name], enumerable: true });
28
- };
29
- var __copyProps = (to, from, except, desc) => {
30
- if (from && typeof from === "object" || typeof from === "function") {
31
- for (let key of __getOwnPropNames(from))
32
- if (!__hasOwnProp.call(to, key) && key !== except)
33
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
- }
35
- return to;
36
- };
37
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
- // If the importer is in node compatibility mode or this is not an ESM
39
- // file that has been converted to a CommonJS file using a Babel-
40
- // compatible transform (i.e. "__esModule" has not been set), then set
41
- // "default" to the CommonJS "module.exports" for node compatibility.
42
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
- mod
44
- ));
45
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
- var __async = (__this, __arguments, generator) => {
47
- return new Promise((resolve, reject) => {
48
- var fulfilled = (value) => {
49
- try {
50
- step(generator.next(value));
51
- } catch (e) {
52
- reject(e);
53
- }
54
- };
55
- var rejected = (value) => {
56
- try {
57
- step(generator.throw(value));
58
- } catch (e) {
59
- reject(e);
60
- }
61
- };
62
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
63
- step((generator = generator.apply(__this, __arguments)).next());
64
- });
65
- };
66
-
67
- // src/index.ts
68
- var src_exports = {};
69
- __export(src_exports, {
70
- default: () => src_default
71
- });
72
- module.exports = __toCommonJS(src_exports);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
73
3
 
74
4
  // src/methods/listings/getListings.ts
75
- var import_axios = __toESM(require("axios"));
76
- var getMyListings = (reverb, options) => __async(void 0, null, function* () {
77
- const { page, perPage, query, sku, state } = options;
5
+ var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
6
+ var getMyListings = /* @__PURE__ */ __name(async (reverb, options) => {
7
+ const { page, perPage, query, state } = options;
78
8
  const baseUrl = `${reverb.rootEndpoint}/my/listings`;
79
9
  const pageString = page ? `&page=${page}` : "";
80
10
  const perPageString = perPage ? `&per_page=${perPage}` : "";
81
11
  const queryString = query ? `&query=${query}` : "";
82
- const skuString = sku ? `&sku=${sku}` : "";
83
12
  const stateString = state ? `&state=${state}` : "";
84
- const url = `${baseUrl}?${pageString}${perPageString}${queryString}${skuString}${stateString}`;
85
- const response = yield import_axios.default.get(url, {
13
+ const url = `${baseUrl}?${pageString}${perPageString}${queryString}${stateString}`;
14
+ const response = await _axios2.default.get(url, {
86
15
  headers: reverb.headers
87
16
  });
88
17
  return response;
89
- });
18
+ }, "getMyListings");
19
+ var getAllMyListings = /* @__PURE__ */ __name(async (reverb, options) => {
20
+ let page = 1;
21
+ const perPage = 50;
22
+ const { query, state } = options;
23
+ let listings = [];
24
+ let response;
25
+ do {
26
+ response = await getMyListings(reverb, { page, perPage, query, state });
27
+ listings = listings.concat(response.data.listings);
28
+ page++;
29
+ } while (response.data.listings.length === perPage);
30
+ return { ...response, data: listings };
31
+ }, "getAllMyListings");
32
+ var getOneListing = /* @__PURE__ */ __name(async (reverb, options) => {
33
+ const { id } = options;
34
+ const baseUrl = `${reverb.rootEndpoint}/listings/${id}`;
35
+ const response = await _axios2.default.get(baseUrl, {
36
+ headers: reverb.headers
37
+ });
38
+ return response;
39
+ }, "getOneListing");
90
40
 
91
41
  // src/methods/orders/getOrders.ts
92
- var import_axios2 = __toESM(require("axios"));
93
- var getMyOrders = (reverb, options) => __async(void 0, null, function* () {
94
- const { page, perPage, status } = options;
95
- const baseUrl = `${reverb.rootEndpoint}/my/orders/selling/${status || "all"}`;
42
+
43
+ var getMyOrders = /* @__PURE__ */ __name(async (reverb, options) => {
44
+ const { page } = options;
45
+ const baseUrl = `${reverb.rootEndpoint}/my/orders/selling/all`;
96
46
  const pageString = page ? `&page=${page}` : "";
97
- const perPageString = perPage ? `&per_page=${perPage}` : "";
98
- const url = `${baseUrl}?${pageString}${perPageString}`;
99
- const response = yield import_axios2.default.get(url, {
47
+ const url = `${baseUrl}?${pageString}`;
48
+ const response = await _axios2.default.get(url, {
100
49
  headers: reverb.headers
101
50
  });
102
51
  return response;
103
- });
52
+ }, "getMyOrders");
104
53
 
105
54
  // src/methods/index.ts
106
- var import_axios3 = __toESM(require("axios"));
107
- var getArbitraryEndpoint = (reverb, options) => __async(void 0, null, function* () {
108
- const { url, params } = options;
109
- const response = yield import_axios3.default.get(url, {
55
+
56
+ var getArbitraryEndpoint = /* @__PURE__ */ __name(async (reverb, options) => {
57
+ const { url, ...requestConfig } = options;
58
+ const isAbsoluteUrl = url.startsWith("http");
59
+ const hasSlash = url.startsWith("/");
60
+ const requestUrl = isAbsoluteUrl ? url : `${reverb.rootEndpoint}${hasSlash ? "" : "/"}${url}`;
61
+ const response = await _axios2.default.get(requestUrl, {
110
62
  headers: reverb.headers,
111
- params
63
+ ...requestConfig
112
64
  });
113
65
  return response;
114
- });
66
+ }, "getArbitraryEndpoint");
115
67
 
116
68
  // src/Reverb.ts
117
- var _Reverb = class {
69
+ var _Reverb = class _Reverb {
118
70
  constructor(options) {
119
71
  this._rootEndpoint = "https://api.reverb.com/api";
120
72
  this._version = _Reverb.defaultHeaders["Accept-Version"];
@@ -147,21 +99,24 @@ var _Reverb = class {
147
99
  this._locale = locale;
148
100
  }
149
101
  this.apiKey = apiKey;
150
- this._headers = __spreadProps(__spreadValues({}, _Reverb.defaultHeaders), {
102
+ this._headers = {
103
+ ..._Reverb.defaultHeaders,
151
104
  Authorization: `Bearer ${this.apiKey}`
152
- });
105
+ };
153
106
  this.updateHeaders();
154
107
  }
155
108
  updateHeaders() {
156
109
  const optionalHeaders = {};
157
110
  if (this._shippingRegion)
158
111
  optionalHeaders["X-Shipping-Region"] = this._shippingRegion;
159
- this._headers = __spreadValues(__spreadProps(__spreadValues({}, this._headers), {
112
+ this._headers = {
113
+ ...this._headers,
160
114
  Authorization: `Bearer ${this.apiKey}`,
161
115
  "Accept-Version": this._version,
162
116
  "X-Display-Currency": this._displayCurrency,
163
- "Accept-Language": this._locale
164
- }), optionalHeaders);
117
+ "Accept-Language": this._locale,
118
+ ...optionalHeaders
119
+ };
165
120
  }
166
121
  set locale(locale) {
167
122
  this._locale = locale;
@@ -200,24 +155,49 @@ var _Reverb = class {
200
155
  get rootEndpoint() {
201
156
  return this._rootEndpoint;
202
157
  }
203
- getMyListings(options) {
204
- return __async(this, null, function* () {
205
- return yield getMyListings(this, options != null ? options : {});
206
- });
207
- }
208
- getMyOrders(options) {
209
- return __async(this, null, function* () {
210
- return yield getMyOrders(this, options != null ? options : {});
211
- });
212
- }
213
- getArbitraryEndpoint(options) {
214
- return __async(this, null, function* () {
215
- return yield getArbitraryEndpoint(this, options);
216
- });
158
+ /**
159
+ * Retrieves the current user's listings.
160
+ * @param options - Optional parameters for the request.
161
+ * @returns A Promise that resolves to the user's listings. Structured as an axios response
162
+ */
163
+ async getMyListings(options) {
164
+ return await getMyListings(this, _nullishCoalesce(options, () => ( {})));
165
+ }
166
+ /**
167
+ * Retrieves the orders for the current user.
168
+ * @param options - An optional object containing options for the request.
169
+ * @returns A Promise that resolves with the user's orders. Structured as an axios response
170
+ */
171
+ async getMyOrders(options) {
172
+ return await getMyOrders(this, _nullishCoalesce(options, () => ( {})));
173
+ }
174
+ /**
175
+ * Retrieves an arbitrary endpoint using the provided options.
176
+ * @param options - The options to use when retrieving the endpoint.
177
+ * @returns A Promise that resolves with the retrieved endpoint. Structured as an axios response
178
+ */
179
+ async getArbitraryEndpoint(options) {
180
+ return await getArbitraryEndpoint(this, options);
181
+ }
182
+ /**
183
+ * Retrieves a single listing based on the provided options.
184
+ * @param options - The options to use when retrieving the listing.
185
+ * @returns A Promise that resolves with the retrieved listing.
186
+ */
187
+ async getOneListing(options) {
188
+ return await getOneListing(this, options);
189
+ }
190
+ /**
191
+ * Retrieves all listings associated with the current user.
192
+ * @param options - An optional object containing options for the request.
193
+ * @returns A Promise that resolves with an array of listings.
194
+ */
195
+ async getAllMyListings(options) {
196
+ return await getAllMyListings(this, _nullishCoalesce(options, () => ( {})));
217
197
  }
218
198
  };
219
- var Reverb = _Reverb;
220
- Reverb.defaultHeaders = {
199
+ __name(_Reverb, "Reverb");
200
+ _Reverb.defaultHeaders = {
221
201
  "Content-Type": "application/hal+json",
222
202
  "Accept-Version": "3.0",
223
203
  Accept: "application/hal+json",
@@ -226,8 +206,11 @@ Reverb.defaultHeaders = {
226
206
  // 'X-Shipping-Region': undefined
227
207
  "User-Agent": "Reverb Node SDK"
228
208
  };
209
+ var Reverb = _Reverb;
229
210
 
230
211
  // src/index.ts
231
212
  var src_default = Reverb;
232
- // Annotate the CommonJS export names for ESM import in node:
233
- 0 && (module.exports = {});
213
+
214
+
215
+ exports.default = src_default;
216
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/methods/listings/getListings.ts","../src/methods/orders/getOrders.ts","../src/methods/index.ts","../src/Reverb.ts","../src/index.ts"],"names":["axios"],"mappings":";;;;AAEA,OAAO,WAA8B;AAqB9B,IAAM,gBAAgB,8BAC3B,QACA,YACG;AACH,QAAM,EAAE,MAAM,SAAS,OAAO,MAAM,IAAI;AAExC,QAAM,UAAU,GAAG,OAAO,YAAY;AACtC,QAAM,aAAa,OAAO,SAAS,IAAI,KAAK;AAC5C,QAAM,gBAAgB,UAAU,aAAa,OAAO,KAAK;AACzD,QAAM,cAAc,QAAQ,UAAU,KAAK,KAAK;AAEhD,QAAM,cAAc,QAAQ,UAAU,KAAK,KAAK;AAEhD,QAAM,MAAM,GAAG,OAAO,IAAI,UAAU,GAAG,aAAa,GAAG,WAAW,GAAG,WAAW;AAEhF,QAAM,WAAW,MAAM,MAAM,IAE3B,KAAK;AAAA,IACL,SAAS,OAAO;AAAA,EAClB,CAAC;AAED,SAAO;AACT,GAtB6B;AA8BtB,IAAM,mBAAmB,8BAC9B,QACA,YACsC;AACtC,MAAI,OAAO;AACX,QAAM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AAAA,EAChB,kBAAkB;AAAA,EAClB,QAAQ;AAAA,EACR,mBAAmB;AAAA,EACnB,sBAAsB;AAAA;AAAA,EAEtB,cAAc;AAChB;AATF,IAAqB,SAArB;;;AChCA,IAAO,cAAQ","sourcesContent":["// import type { } from '~/Reverb';\n\nimport axios, { AxiosResponse } from 'axios';\n\nimport { Listing } from '~/types';\nimport { PaginatedReverbResponse } from '..';\nimport Reverb from '~/Reverb';\n\nexport interface GetMyListingsOptions {\n page?: number;\n perPage?: number;\n query?: string;\n // sku?: string;\n state?: string;\n}\n\n/**\n * Retrieves a paginated list of the authenticated user's listings on Reverb.\n *\n * @param reverb - The Reverb client instance.\n * @param options - The options to use when fetching the listings.\n * @returns A Promise that resolves to the paginated response containing the user's listings.\n */\nexport const getMyListings = async (\n reverb: Reverb,\n options: GetMyListingsOptions,\n) => {\n const { page, perPage, query, state } = options;\n\n const baseUrl = `${reverb.rootEndpoint}/my/listings`;\n const pageString = page ? `&page=${page}` : '';\n const perPageString = perPage ? `&per_page=${perPage}` : '';\n const queryString = query ? `&query=${query}` : '';\n // const skuString = sku ? `&sku=${sku}` : '';\n const stateString = state ? `&state=${state}` : '';\n\n const url = `${baseUrl}?${pageString}${perPageString}${queryString}${stateString}`;\n\n const response = await axios.get<\n PaginatedReverbResponse<{ listings: Listing[] }>\n >(url, {\n headers: reverb.headers,\n });\n\n return response;\n};\n\nexport interface GetAllMyListingsOptions {\n query?: string;\n // sku?: string;\n state?: string;\n}\n\nexport const getAllMyListings = async (\n reverb: Reverb,\n options: GetAllMyListingsOptions,\n): Promise<AxiosResponse<Listing[]>> => {\n let page = 1;\n const perPage = 50;\n\n const { query, state } = options;\n\n let listings: Listing[] = [];\n let response;\n\n do {\n response = await getMyListings(reverb, { page, perPage, query, state });\n listings = listings.concat(response.data.listings);\n page++;\n } while (response.data.listings.length === perPage);\n\n return { ...response, data: listings };\n};\n\nexport interface GetOneListingOptions {\n id: string;\n}\n\n/**\n * Retrieves a single Reverb listing by ID.\n * @param reverb - The Reverb instance to use for the API request.\n * @param options - The options for the API request, including the ID of the listing to retrieve.\n * @returns A Promise that resolves with the retrieved listing. Structured as an axios response\n */\nexport const getOneListing = async (\n reverb: Reverb,\n options: GetOneListingOptions,\n) => {\n const { id } = options;\n\n const baseUrl = `${reverb.rootEndpoint}/listings/${id}`;\n\n const response = await axios.get<Listing>(baseUrl, {\n headers: reverb.headers,\n });\n\n return response;\n};\n","// import type { } from '~/Reverb';\n\nimport { Order } from '~/types';\nimport { PaginatedReverbResponse } from '..';\nimport Reverb from '~/Reverb';\nimport axios from 'axios';\n\nexport interface GetMyOrdersOptions {\n page?: number;\n // perPage?: number;\n // status?: Order['status'] | 'all';\n}\n\n/**\n * Retrieves a paginated list of orders for the authenticated user.\n * @param reverb - The Reverb instance to use for the API request.\n * @param options - The options to use for the API request.\n * @returns A Promise that resolves to the API response containing the list of orders.\n */\nexport const getMyOrders = async (\n reverb: Reverb,\n options: GetMyOrdersOptions,\n) => {\n const { page } = options;\n\n const baseUrl = `${reverb.rootEndpoint}/my/orders/selling/all`;\n const pageString = page ? `&page=${page}` : '';\n\n const url = `${baseUrl}?${pageString}`;\n\n const response = await axios.get<\n PaginatedReverbResponse<{ orders: Order[] }>\n >(url, {\n headers: reverb.headers,\n });\n\n return response;\n};\n","export * from './listings/getListings';\nexport * from './orders/getOrders';\n\nimport { Link } from '~/types';\nimport Reverb from '~/Reverb';\nimport axios from 'axios';\n\nexport const getMyRoot = async <T = any>(reverb: Reverb) => {\n const url = `${reverb.rootEndpoint}/`;\n const response = await axios.get<T>(url, {\n headers: reverb.headers,\n });\n return response;\n};\n\nexport type PaginatedReverbResponse<T> = T & {\n total: number;\n current_page: number;\n total_pages: number;\n _links: {\n next?: Link;\n prev?: Link;\n };\n};\n\nexport type GetArbitraryEndpointOptions = {\n url: string;\n params?: {\n [key: string]: string;\n };\n};\n\n/**\n * Makes a GET request to an arbitrary endpoint.\n * @param reverb - The Reverb instance to use for the request.\n * @param options - The options for the request, including the URL and any additional request configuration.\n * @returns A Promise that resolves with the response data.\n * @template T - The type of the response data.\n */\nexport const getArbitraryEndpoint = async <T = any>(\n reverb: Reverb,\n options: GetArbitraryEndpointOptions,\n) => {\n const { url, ...requestConfig } = options;\n\n // check if url is absolute\n const isAbsoluteUrl = url.startsWith('http');\n //check if url has / at the beginning\n const hasSlash = url.startsWith('/');\n const requestUrl = isAbsoluteUrl\n ? url\n : `${reverb.rootEndpoint}${hasSlash ? '' : '/'}${url}`;\n\n const response = await axios.get<T>(requestUrl, {\n headers: reverb.headers,\n ...requestConfig,\n });\n\n return response;\n};\n","import * as methods from './methods';\n\nimport { Axios } from 'axios';\n\nexport type ApiVersion = string;\nexport type ApiKey = string;\nexport type Locale = string;\nexport type ShippingRegion = string;\nexport type DisplayCurrency = string;\nexport type RootEndpoint = Domain;\n\ntype Domain = `${string}.${string}` | `${string}.${string}.${string}`;\n\nexport interface ReverbOptions {\n apiKey: ApiKey;\n version?: ApiVersion | undefined;\n rootEndpoint?: RootEndpoint | undefined;\n displayCurrency?: DisplayCurrency | undefined;\n shippingRegion?: ShippingRegion | undefined;\n locale?: Locale | undefined;\n}\n\nexport type ReverbHeaders = Axios['get']['arguments'][1] & {\n 'Content-Type': string;\n 'Accept-Version': ApiVersion;\n Accept: string;\n 'Accept-Language': Locale;\n 'X-Display-Currency': DisplayCurrency;\n 'X-Shipping-Region'?: ShippingRegion | undefined;\n 'User-Agent'?: string;\n};\n\nexport interface AuthReverbHeaders extends ReverbHeaders {\n Authorization: `Bearer ${ApiKey}`;\n}\n\nexport default class Reverb {\n static defaultHeaders: ReverbHeaders = {\n 'Content-Type': 'application/hal+json',\n 'Accept-Version': '3.0',\n Accept: 'application/hal+json',\n 'Accept-Language': 'en',\n 'X-Display-Currency': 'USD',\n // 'X-Shipping-Region': undefined\n 'User-Agent': 'Reverb Node SDK',\n };\n\n private _rootEndpoint: RootEndpoint = 'https://api.reverb.com/api';\n private _version: ApiVersion = Reverb.defaultHeaders['Accept-Version'];\n private apiKey: string;\n private _headers: AuthReverbHeaders;\n private _displayCurrency: DisplayCurrency =\n Reverb.defaultHeaders['X-Display-Currency'];\n private _shippingRegion: ShippingRegion | undefined;\n private _locale: Locale = Reverb.defaultHeaders['Accept-Language'];\n\n constructor(options: ReverbOptions) {\n const {\n apiKey,\n version,\n rootEndpoint: defaultEndpoint,\n displayCurrency,\n shippingRegion,\n locale,\n } = options;\n\n // throw if no api key\n if (!apiKey || apiKey === '') {\n throw new Error('Reverb: apiKey is required');\n }\n\n // set version and default endpoint if provided\n if (version) {\n this._version = version;\n }\n if (defaultEndpoint) {\n this._rootEndpoint = defaultEndpoint;\n }\n if (displayCurrency) {\n this._displayCurrency = displayCurrency;\n }\n if (shippingRegion) {\n this._shippingRegion = shippingRegion;\n }\n if (locale) {\n this._locale = locale;\n }\n\n // set api key\n this.apiKey = apiKey;\n\n this._headers = {\n ...Reverb.defaultHeaders,\n Authorization: `Bearer ${this.apiKey}`,\n };\n\n this.updateHeaders();\n }\n\n private updateHeaders() {\n const optionalHeaders = {} as any;\n\n if (this._shippingRegion)\n optionalHeaders['X-Shipping-Region'] = this._shippingRegion;\n\n this._headers = {\n ...this._headers,\n Authorization: `Bearer ${this.apiKey}`,\n 'Accept-Version': this._version,\n 'X-Display-Currency': this._displayCurrency,\n 'Accept-Language': this._locale,\n ...optionalHeaders,\n };\n }\n\n set locale(locale: Locale) {\n this._locale = locale;\n this.updateHeaders();\n }\n get locale() {\n return this._locale;\n }\n\n set shippingRegion(shippingRegion: ShippingRegion | undefined) {\n this._shippingRegion = shippingRegion;\n this.updateHeaders();\n }\n get shippingRegion(): ShippingRegion | undefined {\n return this._shippingRegion;\n }\n\n get headers(): AuthReverbHeaders {\n return this._headers;\n }\n\n set displayCurrency(displayCurrency: DisplayCurrency) {\n this._displayCurrency = displayCurrency;\n this.updateHeaders();\n }\n get displayCurrency(): DisplayCurrency {\n return this._displayCurrency;\n }\n\n set version(version: ApiVersion) {\n this._version = version;\n this.updateHeaders();\n }\n get version(): ApiVersion {\n return this._version;\n }\n\n set rootEndpoint(rootEndpoint: RootEndpoint) {\n this._rootEndpoint = rootEndpoint;\n // this.updateHeaders();\n }\n get rootEndpoint(): RootEndpoint {\n return this._rootEndpoint;\n }\n\n /**\n * Retrieves the current user's listings.\n * @param options - Optional parameters for the request.\n * @returns A Promise that resolves to the user's listings. Structured as an axios response\n */\n async getMyListings(options?: methods.GetMyListingsOptions) {\n return await methods.getMyListings(this, options ?? {});\n }\n\n /**\n * Retrieves the orders for the current user.\n * @param options - An optional object containing options for the request.\n * @returns A Promise that resolves with the user's orders. Structured as an axios response\n */\n async getMyOrders(options?: methods.GetMyOrdersOptions) {\n return await methods.getMyOrders(this, options ?? {});\n }\n\n /**\n * Retrieves an arbitrary endpoint using the provided options.\n * @param options - The options to use when retrieving the endpoint.\n * @returns A Promise that resolves with the retrieved endpoint. Structured as an axios response\n */\n async getArbitraryEndpoint(options: methods.GetArbitraryEndpointOptions) {\n return await methods.getArbitraryEndpoint(this, options);\n }\n\n /**\n * Retrieves a single listing based on the provided options.\n * @param options - The options to use when retrieving the listing.\n * @returns A Promise that resolves with the retrieved listing.\n */\n async getOneListing(options: methods.GetOneListingOptions) {\n return await methods.getOneListing(this, options);\n }\n\n /**\n * Retrieves all listings associated with the current user.\n * @param options - An optional object containing options for the request.\n * @returns A Promise that resolves with an array of listings.\n */\n async getAllMyListings(options?: methods.GetAllMyListingsOptions) {\n return await methods.getAllMyListings(this, options ?? {});\n }\n}\n","export * from './Reverb';\n\nimport Reverb from './Reverb';\n\nexport default Reverb;\n"]}
package/dist/index.mjs CHANGED
@@ -1,87 +1,72 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __async = (__this, __arguments, generator) => {
21
- return new Promise((resolve, reject) => {
22
- var fulfilled = (value) => {
23
- try {
24
- step(generator.next(value));
25
- } catch (e) {
26
- reject(e);
27
- }
28
- };
29
- var rejected = (value) => {
30
- try {
31
- step(generator.throw(value));
32
- } catch (e) {
33
- reject(e);
34
- }
35
- };
36
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
- step((generator = generator.apply(__this, __arguments)).next());
38
- });
39
- };
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
40
3
 
41
4
  // src/methods/listings/getListings.ts
42
5
  import axios from "axios";
43
- var getMyListings = (reverb, options) => __async(void 0, null, function* () {
44
- const { page, perPage, query, sku, state } = options;
6
+ var getMyListings = /* @__PURE__ */ __name(async (reverb, options) => {
7
+ const { page, perPage, query, state } = options;
45
8
  const baseUrl = `${reverb.rootEndpoint}/my/listings`;
46
9
  const pageString = page ? `&page=${page}` : "";
47
10
  const perPageString = perPage ? `&per_page=${perPage}` : "";
48
11
  const queryString = query ? `&query=${query}` : "";
49
- const skuString = sku ? `&sku=${sku}` : "";
50
12
  const stateString = state ? `&state=${state}` : "";
51
- const url = `${baseUrl}?${pageString}${perPageString}${queryString}${skuString}${stateString}`;
52
- const response = yield axios.get(url, {
13
+ const url = `${baseUrl}?${pageString}${perPageString}${queryString}${stateString}`;
14
+ const response = await axios.get(url, {
15
+ headers: reverb.headers
16
+ });
17
+ return response;
18
+ }, "getMyListings");
19
+ var getAllMyListings = /* @__PURE__ */ __name(async (reverb, options) => {
20
+ let page = 1;
21
+ const perPage = 50;
22
+ const { query, state } = options;
23
+ let listings = [];
24
+ let response;
25
+ do {
26
+ response = await getMyListings(reverb, { page, perPage, query, state });
27
+ listings = listings.concat(response.data.listings);
28
+ page++;
29
+ } while (response.data.listings.length === perPage);
30
+ return { ...response, data: listings };
31
+ }, "getAllMyListings");
32
+ var getOneListing = /* @__PURE__ */ __name(async (reverb, options) => {
33
+ const { id } = options;
34
+ const baseUrl = `${reverb.rootEndpoint}/listings/${id}`;
35
+ const response = await axios.get(baseUrl, {
53
36
  headers: reverb.headers
54
37
  });
55
38
  return response;
56
- });
39
+ }, "getOneListing");
57
40
 
58
41
  // src/methods/orders/getOrders.ts
59
42
  import axios2 from "axios";
60
- var getMyOrders = (reverb, options) => __async(void 0, null, function* () {
61
- const { page, perPage, status } = options;
62
- const baseUrl = `${reverb.rootEndpoint}/my/orders/selling/${status || "all"}`;
43
+ var getMyOrders = /* @__PURE__ */ __name(async (reverb, options) => {
44
+ const { page } = options;
45
+ const baseUrl = `${reverb.rootEndpoint}/my/orders/selling/all`;
63
46
  const pageString = page ? `&page=${page}` : "";
64
- const perPageString = perPage ? `&per_page=${perPage}` : "";
65
- const url = `${baseUrl}?${pageString}${perPageString}`;
66
- const response = yield axios2.get(url, {
47
+ const url = `${baseUrl}?${pageString}`;
48
+ const response = await axios2.get(url, {
67
49
  headers: reverb.headers
68
50
  });
69
51
  return response;
70
- });
52
+ }, "getMyOrders");
71
53
 
72
54
  // src/methods/index.ts
73
55
  import axios3 from "axios";
74
- var getArbitraryEndpoint = (reverb, options) => __async(void 0, null, function* () {
75
- const { url, params } = options;
76
- const response = yield axios3.get(url, {
56
+ var getArbitraryEndpoint = /* @__PURE__ */ __name(async (reverb, options) => {
57
+ const { url, ...requestConfig } = options;
58
+ const isAbsoluteUrl = url.startsWith("http");
59
+ const hasSlash = url.startsWith("/");
60
+ const requestUrl = isAbsoluteUrl ? url : `${reverb.rootEndpoint}${hasSlash ? "" : "/"}${url}`;
61
+ const response = await axios3.get(requestUrl, {
77
62
  headers: reverb.headers,
78
- params
63
+ ...requestConfig
79
64
  });
80
65
  return response;
81
- });
66
+ }, "getArbitraryEndpoint");
82
67
 
83
68
  // src/Reverb.ts
84
- var _Reverb = class {
69
+ var _Reverb = class _Reverb {
85
70
  constructor(options) {
86
71
  this._rootEndpoint = "https://api.reverb.com/api";
87
72
  this._version = _Reverb.defaultHeaders["Accept-Version"];
@@ -114,21 +99,24 @@ var _Reverb = class {
114
99
  this._locale = locale;
115
100
  }
116
101
  this.apiKey = apiKey;
117
- this._headers = __spreadProps(__spreadValues({}, _Reverb.defaultHeaders), {
102
+ this._headers = {
103
+ ..._Reverb.defaultHeaders,
118
104
  Authorization: `Bearer ${this.apiKey}`
119
- });
105
+ };
120
106
  this.updateHeaders();
121
107
  }
122
108
  updateHeaders() {
123
109
  const optionalHeaders = {};
124
110
  if (this._shippingRegion)
125
111
  optionalHeaders["X-Shipping-Region"] = this._shippingRegion;
126
- this._headers = __spreadValues(__spreadProps(__spreadValues({}, this._headers), {
112
+ this._headers = {
113
+ ...this._headers,
127
114
  Authorization: `Bearer ${this.apiKey}`,
128
115
  "Accept-Version": this._version,
129
116
  "X-Display-Currency": this._displayCurrency,
130
- "Accept-Language": this._locale
131
- }), optionalHeaders);
117
+ "Accept-Language": this._locale,
118
+ ...optionalHeaders
119
+ };
132
120
  }
133
121
  set locale(locale) {
134
122
  this._locale = locale;
@@ -167,24 +155,49 @@ var _Reverb = class {
167
155
  get rootEndpoint() {
168
156
  return this._rootEndpoint;
169
157
  }
170
- getMyListings(options) {
171
- return __async(this, null, function* () {
172
- return yield getMyListings(this, options != null ? options : {});
173
- });
174
- }
175
- getMyOrders(options) {
176
- return __async(this, null, function* () {
177
- return yield getMyOrders(this, options != null ? options : {});
178
- });
179
- }
180
- getArbitraryEndpoint(options) {
181
- return __async(this, null, function* () {
182
- return yield getArbitraryEndpoint(this, options);
183
- });
158
+ /**
159
+ * Retrieves the current user's listings.
160
+ * @param options - Optional parameters for the request.
161
+ * @returns A Promise that resolves to the user's listings. Structured as an axios response
162
+ */
163
+ async getMyListings(options) {
164
+ return await getMyListings(this, options ?? {});
165
+ }
166
+ /**
167
+ * Retrieves the orders for the current user.
168
+ * @param options - An optional object containing options for the request.
169
+ * @returns A Promise that resolves with the user's orders. Structured as an axios response
170
+ */
171
+ async getMyOrders(options) {
172
+ return await getMyOrders(this, options ?? {});
173
+ }
174
+ /**
175
+ * Retrieves an arbitrary endpoint using the provided options.
176
+ * @param options - The options to use when retrieving the endpoint.
177
+ * @returns A Promise that resolves with the retrieved endpoint. Structured as an axios response
178
+ */
179
+ async getArbitraryEndpoint(options) {
180
+ return await getArbitraryEndpoint(this, options);
181
+ }
182
+ /**
183
+ * Retrieves a single listing based on the provided options.
184
+ * @param options - The options to use when retrieving the listing.
185
+ * @returns A Promise that resolves with the retrieved listing.
186
+ */
187
+ async getOneListing(options) {
188
+ return await getOneListing(this, options);
189
+ }
190
+ /**
191
+ * Retrieves all listings associated with the current user.
192
+ * @param options - An optional object containing options for the request.
193
+ * @returns A Promise that resolves with an array of listings.
194
+ */
195
+ async getAllMyListings(options) {
196
+ return await getAllMyListings(this, options ?? {});
184
197
  }
185
198
  };
186
- var Reverb = _Reverb;
187
- Reverb.defaultHeaders = {
199
+ __name(_Reverb, "Reverb");
200
+ _Reverb.defaultHeaders = {
188
201
  "Content-Type": "application/hal+json",
189
202
  "Accept-Version": "3.0",
190
203
  Accept: "application/hal+json",
@@ -193,9 +206,11 @@ Reverb.defaultHeaders = {
193
206
  // 'X-Shipping-Region': undefined
194
207
  "User-Agent": "Reverb Node SDK"
195
208
  };
209
+ var Reverb = _Reverb;
196
210
 
197
211
  // src/index.ts
198
212
  var src_default = Reverb;
199
213
  export {
200
214
  src_default as default
201
215
  };
216
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/methods/listings/getListings.ts","../src/methods/orders/getOrders.ts","../src/methods/index.ts","../src/Reverb.ts","../src/index.ts"],"sourcesContent":["// import type { } from '~/Reverb';\n\nimport axios, { AxiosResponse } from 'axios';\n\nimport { Listing } from '~/types';\nimport { PaginatedReverbResponse } from '..';\nimport Reverb from '~/Reverb';\n\nexport interface GetMyListingsOptions {\n page?: number;\n perPage?: number;\n query?: string;\n // sku?: string;\n state?: string;\n}\n\n/**\n * Retrieves a paginated list of the authenticated user's listings on Reverb.\n *\n * @param reverb - The Reverb client instance.\n * @param options - The options to use when fetching the listings.\n * @returns A Promise that resolves to the paginated response containing the user's listings.\n */\nexport const getMyListings = async (\n reverb: Reverb,\n options: GetMyListingsOptions,\n) => {\n const { page, perPage, query, state } = options;\n\n const baseUrl = `${reverb.rootEndpoint}/my/listings`;\n const pageString = page ? `&page=${page}` : '';\n const perPageString = perPage ? `&per_page=${perPage}` : '';\n const queryString = query ? `&query=${query}` : '';\n // const skuString = sku ? `&sku=${sku}` : '';\n const stateString = state ? `&state=${state}` : '';\n\n const url = `${baseUrl}?${pageString}${perPageString}${queryString}${stateString}`;\n\n const response = await axios.get<\n PaginatedReverbResponse<{ listings: Listing[] }>\n >(url, {\n headers: reverb.headers,\n });\n\n return response;\n};\n\nexport interface GetAllMyListingsOptions {\n query?: string;\n // sku?: string;\n state?: string;\n}\n\nexport const getAllMyListings = async (\n reverb: Reverb,\n options: GetAllMyListingsOptions,\n): Promise<AxiosResponse<Listing[]>> => {\n let page = 1;\n const perPage = 50;\n\n const { query, state } = options;\n\n let listings: Listing[] = [];\n let response;\n\n do {\n response = await getMyListings(reverb, { page, perPage, query, state });\n listings = listings.concat(response.data.listings);\n page++;\n } while (response.data.listings.length === perPage);\n\n return { ...response, data: listings };\n};\n\nexport interface GetOneListingOptions {\n id: string;\n}\n\n/**\n * Retrieves a single Reverb listing by ID.\n * @param reverb - The Reverb instance to use for the API request.\n * @param options - The options for the API request, including the ID of the listing to retrieve.\n * @returns A Promise that resolves with the retrieved listing. Structured as an axios response\n */\nexport const getOneListing = async (\n reverb: Reverb,\n options: GetOneListingOptions,\n) => {\n const { id } = options;\n\n const baseUrl = `${reverb.rootEndpoint}/listings/${id}`;\n\n const response = await axios.get<Listing>(baseUrl, {\n headers: reverb.headers,\n });\n\n return response;\n};\n","// import type { } from '~/Reverb';\n\nimport { Order } from '~/types';\nimport { PaginatedReverbResponse } from '..';\nimport Reverb from '~/Reverb';\nimport axios from 'axios';\n\nexport interface GetMyOrdersOptions {\n page?: number;\n // perPage?: number;\n // status?: Order['status'] | 'all';\n}\n\n/**\n * Retrieves a paginated list of orders for the authenticated user.\n * @param reverb - The Reverb instance to use for the API request.\n * @param options - The options to use for the API request.\n * @returns A Promise that resolves to the API response containing the list of orders.\n */\nexport const getMyOrders = async (\n reverb: Reverb,\n options: GetMyOrdersOptions,\n) => {\n const { page } = options;\n\n const baseUrl = `${reverb.rootEndpoint}/my/orders/selling/all`;\n const pageString = page ? `&page=${page}` : '';\n\n const url = `${baseUrl}?${pageString}`;\n\n const response = await axios.get<\n PaginatedReverbResponse<{ orders: Order[] }>\n >(url, {\n headers: reverb.headers,\n });\n\n return response;\n};\n","export * from './listings/getListings';\nexport * from './orders/getOrders';\n\nimport { Link } from '~/types';\nimport Reverb from '~/Reverb';\nimport axios from 'axios';\n\nexport const getMyRoot = async <T = any>(reverb: Reverb) => {\n const url = `${reverb.rootEndpoint}/`;\n const response = await axios.get<T>(url, {\n headers: reverb.headers,\n });\n return response;\n};\n\nexport type PaginatedReverbResponse<T> = T & {\n total: number;\n current_page: number;\n total_pages: number;\n _links: {\n next?: Link;\n prev?: Link;\n };\n};\n\nexport type GetArbitraryEndpointOptions = {\n url: string;\n params?: {\n [key: string]: string;\n };\n};\n\n/**\n * Makes a GET request to an arbitrary endpoint.\n * @param reverb - The Reverb instance to use for the request.\n * @param options - The options for the request, including the URL and any additional request configuration.\n * @returns A Promise that resolves with the response data.\n * @template T - The type of the response data.\n */\nexport const getArbitraryEndpoint = async <T = any>(\n reverb: Reverb,\n options: GetArbitraryEndpointOptions,\n) => {\n const { url, ...requestConfig } = options;\n\n // check if url is absolute\n const isAbsoluteUrl = url.startsWith('http');\n //check if url has / at the beginning\n const hasSlash = url.startsWith('/');\n const requestUrl = isAbsoluteUrl\n ? url\n : `${reverb.rootEndpoint}${hasSlash ? '' : '/'}${url}`;\n\n const response = await axios.get<T>(requestUrl, {\n headers: reverb.headers,\n ...requestConfig,\n });\n\n return response;\n};\n","import * as methods from './methods';\n\nimport { Axios } from 'axios';\n\nexport type ApiVersion = string;\nexport type ApiKey = string;\nexport type Locale = string;\nexport type ShippingRegion = string;\nexport type DisplayCurrency = string;\nexport type RootEndpoint = Domain;\n\ntype Domain = `${string}.${string}` | `${string}.${string}.${string}`;\n\nexport interface ReverbOptions {\n apiKey: ApiKey;\n version?: ApiVersion | undefined;\n rootEndpoint?: RootEndpoint | undefined;\n displayCurrency?: DisplayCurrency | undefined;\n shippingRegion?: ShippingRegion | undefined;\n locale?: Locale | undefined;\n}\n\nexport type ReverbHeaders = Axios['get']['arguments'][1] & {\n 'Content-Type': string;\n 'Accept-Version': ApiVersion;\n Accept: string;\n 'Accept-Language': Locale;\n 'X-Display-Currency': DisplayCurrency;\n 'X-Shipping-Region'?: ShippingRegion | undefined;\n 'User-Agent'?: string;\n};\n\nexport interface AuthReverbHeaders extends ReverbHeaders {\n Authorization: `Bearer ${ApiKey}`;\n}\n\nexport default class Reverb {\n static defaultHeaders: ReverbHeaders = {\n 'Content-Type': 'application/hal+json',\n 'Accept-Version': '3.0',\n Accept: 'application/hal+json',\n 'Accept-Language': 'en',\n 'X-Display-Currency': 'USD',\n // 'X-Shipping-Region': undefined\n 'User-Agent': 'Reverb Node SDK',\n };\n\n private _rootEndpoint: RootEndpoint = 'https://api.reverb.com/api';\n private _version: ApiVersion = Reverb.defaultHeaders['Accept-Version'];\n private apiKey: string;\n private _headers: AuthReverbHeaders;\n private _displayCurrency: DisplayCurrency =\n Reverb.defaultHeaders['X-Display-Currency'];\n private _shippingRegion: ShippingRegion | undefined;\n private _locale: Locale = Reverb.defaultHeaders['Accept-Language'];\n\n constructor(options: ReverbOptions) {\n const {\n apiKey,\n version,\n rootEndpoint: defaultEndpoint,\n displayCurrency,\n shippingRegion,\n locale,\n } = options;\n\n // throw if no api key\n if (!apiKey || apiKey === '') {\n throw new Error('Reverb: apiKey is required');\n }\n\n // set version and default endpoint if provided\n if (version) {\n this._version = version;\n }\n if (defaultEndpoint) {\n this._rootEndpoint = defaultEndpoint;\n }\n if (displayCurrency) {\n this._displayCurrency = displayCurrency;\n }\n if (shippingRegion) {\n this._shippingRegion = shippingRegion;\n }\n if (locale) {\n this._locale = locale;\n }\n\n // set api key\n this.apiKey = apiKey;\n\n this._headers = {\n ...Reverb.defaultHeaders,\n Authorization: `Bearer ${this.apiKey}`,\n };\n\n this.updateHeaders();\n }\n\n private updateHeaders() {\n const optionalHeaders = {} as any;\n\n if (this._shippingRegion)\n optionalHeaders['X-Shipping-Region'] = this._shippingRegion;\n\n this._headers = {\n ...this._headers,\n Authorization: `Bearer ${this.apiKey}`,\n 'Accept-Version': this._version,\n 'X-Display-Currency': this._displayCurrency,\n 'Accept-Language': this._locale,\n ...optionalHeaders,\n };\n }\n\n set locale(locale: Locale) {\n this._locale = locale;\n this.updateHeaders();\n }\n get locale() {\n return this._locale;\n }\n\n set shippingRegion(shippingRegion: ShippingRegion | undefined) {\n this._shippingRegion = shippingRegion;\n this.updateHeaders();\n }\n get shippingRegion(): ShippingRegion | undefined {\n return this._shippingRegion;\n }\n\n get headers(): AuthReverbHeaders {\n return this._headers;\n }\n\n set displayCurrency(displayCurrency: DisplayCurrency) {\n this._displayCurrency = displayCurrency;\n this.updateHeaders();\n }\n get displayCurrency(): DisplayCurrency {\n return this._displayCurrency;\n }\n\n set version(version: ApiVersion) {\n this._version = version;\n this.updateHeaders();\n }\n get version(): ApiVersion {\n return this._version;\n }\n\n set rootEndpoint(rootEndpoint: RootEndpoint) {\n this._rootEndpoint = rootEndpoint;\n // this.updateHeaders();\n }\n get rootEndpoint(): RootEndpoint {\n return this._rootEndpoint;\n }\n\n /**\n * Retrieves the current user's listings.\n * @param options - Optional parameters for the request.\n * @returns A Promise that resolves to the user's listings. Structured as an axios response\n */\n async getMyListings(options?: methods.GetMyListingsOptions) {\n return await methods.getMyListings(this, options ?? {});\n }\n\n /**\n * Retrieves the orders for the current user.\n * @param options - An optional object containing options for the request.\n * @returns A Promise that resolves with the user's orders. Structured as an axios response\n */\n async getMyOrders(options?: methods.GetMyOrdersOptions) {\n return await methods.getMyOrders(this, options ?? {});\n }\n\n /**\n * Retrieves an arbitrary endpoint using the provided options.\n * @param options - The options to use when retrieving the endpoint.\n * @returns A Promise that resolves with the retrieved endpoint. Structured as an axios response\n */\n async getArbitraryEndpoint(options: methods.GetArbitraryEndpointOptions) {\n return await methods.getArbitraryEndpoint(this, options);\n }\n\n /**\n * Retrieves a single listing based on the provided options.\n * @param options - The options to use when retrieving the listing.\n * @returns A Promise that resolves with the retrieved listing.\n */\n async getOneListing(options: methods.GetOneListingOptions) {\n return await methods.getOneListing(this, options);\n }\n\n /**\n * Retrieves all listings associated with the current user.\n * @param options - An optional object containing options for the request.\n * @returns A Promise that resolves with an array of listings.\n */\n async getAllMyListings(options?: methods.GetAllMyListingsOptions) {\n return await methods.getAllMyListings(this, options ?? {});\n }\n}\n","export * from './Reverb';\n\nimport Reverb from './Reverb';\n\nexport default Reverb;\n"],"mappings":";;;;AAEA,OAAO,WAA8B;AAqB9B,IAAM,gBAAgB,8BAC3B,QACA,YACG;AACH,QAAM,EAAE,MAAM,SAAS,OAAO,MAAM,IAAI;AAExC,QAAM,UAAU,GAAG,OAAO,YAAY;AACtC,QAAM,aAAa,OAAO,SAAS,IAAI,KAAK;AAC5C,QAAM,gBAAgB,UAAU,aAAa,OAAO,KAAK;AACzD,QAAM,cAAc,QAAQ,UAAU,KAAK,KAAK;AAEhD,QAAM,cAAc,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AAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,cAAc,SAAuC;AACzD,WAAO,MAAc,cAAc,MAAM,OAAO;AAAA,EAClD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,iBAAiB,SAA2C;AAChE,WAAO,MAAc,iBAAiB,MAAM,WAAW,CAAC,CAAC;AAAA,EAC3D;AACF;AAvK4B;AAAP,QACZ,iBAAgC;AAAA,EACrC,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,QAAQ;AAAA,EACR,mBAAmB;AAAA,EACnB,sBAAsB;AAAA;AAAA,EAEtB,cAAc;AAChB;AATF,IAAqB,SAArB;;;AChCA,IAAO,cAAQ;","names":["axios","axios","axios","axios"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sound-tank",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "A library for interacting with the Reverb Marketplace API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -15,20 +15,20 @@
15
15
  "scripts": {
16
16
  "dev": "vitest",
17
17
  "test": "vitest run",
18
- "build": "tsup src/index.ts --dts --format cjs,esm",
18
+ "build": "tsup --config tsup.config.ts",
19
19
  "lint": "tsc",
20
20
  "ci": "yarn install --frozen-lockfile && yarn lint && yarn test && yarn build",
21
21
  "release": "yarn lint && yarn test && yarn build && changeset publish"
22
22
  },
23
23
  "devDependencies": {
24
- "@changesets/cli": "^2.26.1",
25
- "@types/node": "^20.2.1",
26
- "@vitest/coverage-c8": "^0.31.1",
27
- "dotenv": "^16.0.3",
28
- "prettier": "^2.8.8",
29
- "tsup": "^6.7.0",
30
- "typescript": "^5.0.4",
31
- "vitest": "^0.31.1"
24
+ "@changesets/cli": "^2.26.2",
25
+ "@types/node": "^20.4.2",
26
+ "@vitest/coverage-v8": "^0.34.6",
27
+ "dotenv": "^16.3.1",
28
+ "prettier": "^3.0.0",
29
+ "tsup": "^7.1.0",
30
+ "typescript": "^5.1.6",
31
+ "vitest": "^0.33.0"
32
32
  },
33
33
  "dependencies": {
34
34
  "axios": "^1.4.0"
@@ -0,0 +1,10 @@
1
+ // ts-check
2
+ /**
3
+ * @type {import('prettier').Options}
4
+ */
5
+ export default {
6
+ singleQuote: true,
7
+ arrowParens: 'always',
8
+ trailingComma: 'all',
9
+ tabWidth: 2,
10
+ };
package/tsup.config.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ entry: ['src/index.ts'],
5
+ splitting: true,
6
+ format: ['cjs', 'esm'],
7
+ dts: true,
8
+ sourcemap: true,
9
+ tsconfig: 'tsconfig.json',
10
+ clean: true,
11
+ // target: 'es2015',
12
+ platform: 'node',
13
+ external: ['axios'],
14
+ bundle: true,
15
+ outDir: 'dist',
16
+ keepNames: true,
17
+ });