@duque.edits/sdk 0.0.9 → 0.1.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.
@@ -10,7 +10,7 @@ import { GuildTicketManager } from "../../managers/ticket/GuildTicketManager";
10
10
  import { GuildUserManager } from "../../managers/user/GuildUserManager";
11
11
  import { REST } from "../../rest/REST";
12
12
  import { Daily, GuildBlacklist } from "../../types/api";
13
- import { APIGuild, DailyCategories, GuildScores, GuildStatus, GuildTicketConfiguration } from "../../types/api/APIGuild";
13
+ import { APIGuild, DailyCategories, GuildPrices, GuildScores, GuildStatus, GuildTicketConfiguration } from "../../types/api/APIGuild";
14
14
  import { APIGuildEmoji } from "../../types/api/APIGuildEmoji";
15
15
  import { APIGuildPermissions } from "../../types/api/APIGuildPermissions";
16
16
  import { APIGuildRole } from "../../types/api/APIGuildRole";
@@ -71,6 +71,8 @@ export declare class Guild {
71
71
  emojis: APIGuildEmoji[];
72
72
  /** Guild Roles */
73
73
  roles: APIGuildRole[];
74
+ /** Guild Prices Used */
75
+ prices: GuildPrices;
74
76
  /** Guild Shop */
75
77
  shop: GuildShop;
76
78
  permissionsManager: GuildPermissionManager;
@@ -68,6 +68,8 @@ class Guild {
68
68
  emojis;
69
69
  /** Guild Roles */
70
70
  roles;
71
+ /** Guild Prices Used */
72
+ prices;
71
73
  /** Guild Shop */
72
74
  shop;
73
75
  permissionsManager;
@@ -93,6 +95,7 @@ class Guild {
93
95
  this.emojis = data?.emojis;
94
96
  this.pricesAvailable = data?.pricesAvailable;
95
97
  this.pricesOn = data?.pricesOn;
98
+ this.prices = data?.prices;
96
99
  this.shop = new GuildShop_1.GuildShop(data?.shop, this, rest);
97
100
  this.createdAt = data?.createdAt ? new Date(data?.createdAt) : new Date();
98
101
  this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : new Date();
@@ -181,30 +184,28 @@ class Guild {
181
184
  }
182
185
  async addPrice(price) {
183
186
  Assertion_1.Assertion.assertNumber(price);
184
- const route = Routes_1.Routes.fields(Routes_1.Routes.guilds.resource(this.id, "price"), "pricesOn");
187
+ const route = Routes_1.Routes.fields(Routes_1.Routes.guilds.resource(this.id, "prices"), "used");
185
188
  const payload = { price };
186
189
  const response = await this.rest.request({
187
- method: "PATCH",
190
+ method: "POST",
188
191
  url: route,
189
192
  payload,
190
193
  });
191
- this.pricesAvailable = response.pricesAvailable;
192
- this.pricesOn = response.pricesOn;
194
+ this.prices.used = response;
193
195
  this.rest.guilds.cache.set(this.id, this);
194
196
  this.rest.emit("guildUpdate", this);
195
197
  return this;
196
198
  }
197
199
  async removePrice(price) {
198
200
  Assertion_1.Assertion.assertNumber(price);
199
- const route = Routes_1.Routes.fields(Routes_1.Routes.guilds.resource(this.id, "price"), "pricesOn");
201
+ const route = Routes_1.Routes.fields(Routes_1.Routes.guilds.resource(this.id, "prices"), "used", price.toString());
200
202
  const payload = { price };
201
203
  const response = await this.rest.request({
202
204
  method: "DELETE",
203
205
  url: route,
204
206
  payload,
205
207
  });
206
- this.pricesAvailable = response.pricesAvailable;
207
- this.pricesOn = response.pricesOn;
208
+ this.prices.used = response;
208
209
  this.rest.guilds.cache.set(this.id, this);
209
210
  this.rest.emit("guildUpdate", this);
210
211
  return this;
@@ -27,6 +27,10 @@ export interface GuildStatus {
27
27
  createVoiceChannels: "on" | "off";
28
28
  }
29
29
  export type DailyCategories = "coins" | "credit" | "wins" | "points" | "losses" | "mvps";
30
+ export interface GuildPrices {
31
+ on: number[];
32
+ used: number[];
33
+ }
30
34
  export interface GuildScores {
31
35
  /** Win */
32
36
  win: number;
@@ -68,6 +72,8 @@ export interface APIGuild {
68
72
  pricesAvailable: number[];
69
73
  /** Guild Prices Used */
70
74
  pricesOn: number[];
75
+ /** Guild Prices Used */
76
+ prices: GuildPrices;
71
77
  /** Guild Creation Date */
72
78
  createdAt: Date;
73
79
  /** Guild Updated Date */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duque.edits/sdk",
3
- "version": "0.0.9",
3
+ "version": "0.1.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "typings": "./dist/index.d.ts",