unb-api 1.4.0 → 1.5.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/README.md CHANGED
@@ -89,7 +89,7 @@ Returns: `Promise<{ page: number, totalPages: number, items: InventoryItem[] }>`
89
89
  `getInventoryItem(guildId: string, userId: string, itemId: string)`
90
90
  Returns: `Promise<InventoryItem>`
91
91
 
92
- `addInventoryItem(guildId: string, userId: string, itemId: string, quantity?: string | number, options?: { inventoryUserId?: string })`
92
+ `addInventoryItem(guildId: string, userId: string, itemId: string, quantity?: string | number, options?: { inventoryUserId?: string, ignoreMaxQuantity?: boolean })`
93
93
  Returns: `Promise<InventoryItem>`
94
94
 
95
95
  `removeInventoryItem(guildId: string, userId: string, itemId: string, quantity?: string | number)`
@@ -138,6 +138,7 @@ Returns: `Promise<any>`
138
138
  | Number | `price` | Price of the item. |
139
139
  | Number | `stockRemaining` | Amount of stock remaining for the item. |
140
140
  | Boolean | `unlimitedStock` | Whether the item has unlimited stock. |
141
+ | Number | `maxQuantity?` | Max a user can own, or buy at once if not an inventory item. |
141
142
  | Boolean | `isInventory` | Indicates if the item will be added to a user’s inventory when purchased. |
142
143
  | Date | `expiresAt?` | Expiration date of the item. |
143
144
  | Boolean | `isUsable` | Whether the item can be used by the user. |
package/index.d.ts CHANGED
@@ -37,7 +37,7 @@ declare module 'unb-api' {
37
37
 
38
38
  public getInventoryItem(guildId: string, userId: string, itemId: string): Promise<InventoryItem>
39
39
 
40
- public addInventoryItem(guildId: string, userId: string, itemId: string, quantity?: string | number, options?: { inventoryUserId?: string }): Promise<InventoryItem>
40
+ public addInventoryItem(guildId: string, userId: string, itemId: string, quantity?: string | number, options?: { inventoryUserId?: string, ignoreMaxQuantity?: boolean }): Promise<InventoryItem>
41
41
 
42
42
  public removeInventoryItem(guildId: string, userId: string, itemId: string, quantity?: string | number): Promise<any>
43
43
 
@@ -111,6 +111,7 @@ declare module 'unb-api' {
111
111
  public price: number;
112
112
  public stockRemaining: number;
113
113
  public unlimitedStock: boolean;
114
+ public maxQuantity: number | null;
114
115
  public isInventory: boolean;
115
116
  public expiresAt?: Date;
116
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unb-api",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
4
4
  "description": "API wrapper for UnbelievaBoat Discord Bot API",
5
5
  "main": "src/index.js",
6
6
  "types": "index.d.ts",
@@ -22,6 +22,6 @@
22
22
  "typescript": "^2.6.2"
23
23
  },
24
24
  "dependencies": {
25
- "axios": "1.6.0"
25
+ "axios": "^1.20.0"
26
26
  }
27
27
  }
package/src/lib/Client.js CHANGED
@@ -336,6 +336,7 @@ class Client {
336
336
  * @param {number|string} [quantity=1] - Quantity to add
337
337
  * @param {object} [options]
338
338
  * @param {string} [options.inventoryUserId] - User ID of the inventory to add the item from (can be used if the item no longer exists in the store or the item settings differ)
339
+ * @param {boolean} [options.ignoreMaxQuantity=false] - Add the item even if the user would own more than the item's max quantity
339
340
  * @returns {Promise<InventoryItem>}
340
341
  *
341
342
  * @see {@link https://unbelievaboat-api.readme.io/reference/add-inventory-item|Add Inventory Item}
@@ -8,6 +8,7 @@ class StoreItem extends BaseItem {
8
8
  this.isInventory = data.is_inventory;
9
9
  this.stockRemaining = data.stock_remaining;
10
10
  this.unlimitedStock = data.unlimited_stock;
11
+ this.maxQuantity = data.max_quantity ?? null;
11
12
  if (data.expires_at) {
12
13
  this.expiresAt = new Date(data.expires_at);
13
14
  }