mashroo3 0.1.0 → 0.2.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.
Files changed (3) hide show
  1. package/index.d.ts +4 -1
  2. package/index.js +10 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -41,6 +41,9 @@ export declare class Mashroo3 {
41
41
  catalog: {
42
42
  list: (query?: QueryParams) => Promise<any[]>;
43
43
  };
44
+ categories: {
45
+ list: (query?: QueryParams) => Promise<any[]>;
46
+ };
44
47
  customers: {
45
48
  list: (query?: QueryParams) => Promise<any[]>;
46
49
  create: (payload: unknown) => Promise<any>;
@@ -51,11 +54,11 @@ export declare class Mashroo3 {
51
54
  create: (payload: unknown) => Promise<any>;
52
55
  refund: (orderId: number, payload: unknown) => Promise<any>;
53
56
  };
54
-
55
57
  constructor(apiKey: string, options?: Mashroo3Options);
56
58
  request(method: string, path: string, options?: RequestOptions): Promise<any>;
57
59
 
58
60
  listCatalog(query?: QueryParams): Promise<any[]>;
61
+ listCategories(query?: QueryParams): Promise<any[]>;
59
62
  listCustomers(query?: QueryParams): Promise<any[]>;
60
63
  createCustomer(payload: unknown): Promise<any>;
61
64
  listOrders(query?: QueryParams): Promise<any[]>;
package/index.js CHANGED
@@ -38,6 +38,10 @@ class Mashroo3 {
38
38
  list: (query) => this.listCatalog(query),
39
39
  };
40
40
 
41
+ this.categories = {
42
+ list: (query) => this.listCategories(query),
43
+ };
44
+
41
45
  this.customers = {
42
46
  list: (query) => this.listCustomers(query),
43
47
  create: (payload) => this.createCustomer(payload),
@@ -49,6 +53,7 @@ class Mashroo3 {
49
53
  create: (payload) => this.createOrder(payload),
50
54
  refund: (orderId, payload) => this.refundOrder(orderId, payload),
51
55
  };
56
+
52
57
  }
53
58
 
54
59
  async request(method, path, options = {}) {
@@ -60,6 +65,11 @@ class Mashroo3 {
60
65
  return this._extractList(payload, ["products", "catalog", "items"]);
61
66
  }
62
67
 
68
+ async listCategories(query = {}) {
69
+ const payload = await this._request("GET", "/api/categories", { query });
70
+ return this._extractList(payload, ["categories", "items"]);
71
+ }
72
+
63
73
  async listCustomers(query = {}) {
64
74
  const payload = await this._request("GET", "/api/customers", { query });
65
75
  return this._extractList(payload, ["customers", "items"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mashroo3",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Simple JavaScript client for the Mashroo3 API.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",