@discordjs/structures 0.2.0-dev.1772307299-9ff67a03f → 0.2.0-dev.1772453099-f1949271a

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/dist/index.d.mts CHANGED
@@ -3807,6 +3807,10 @@ declare class Subscription<Omitted extends keyof APISubscription | '' = 'cancele
3807
3807
  * The time the subscription was created at
3808
3808
  */
3809
3809
  get createdAt(): Date | null;
3810
+ /**
3811
+ * {@inheritDoc Structure.toJSON}
3812
+ */
3813
+ toJSON(): APISubscription;
3810
3814
  }
3811
3815
 
3812
3816
  declare function extendTemplate<SuperTemplate extends Record<string, unknown>>(superTemplate: SuperTemplate, additions: Record<string, unknown>): Record<string, unknown> & SuperTemplate;
package/dist/index.d.ts CHANGED
@@ -3807,6 +3807,10 @@ declare class Subscription<Omitted extends keyof APISubscription | '' = 'cancele
3807
3807
  * The time the subscription was created at
3808
3808
  */
3809
3809
  get createdAt(): Date | null;
3810
+ /**
3811
+ * {@inheritDoc Structure.toJSON}
3812
+ */
3813
+ toJSON(): APISubscription;
3810
3814
  }
3811
3815
 
3812
3816
  declare function extendTemplate<SuperTemplate extends Record<string, unknown>>(superTemplate: SuperTemplate, additions: Record<string, unknown>): Record<string, unknown> & SuperTemplate;
package/dist/index.js CHANGED
@@ -5165,6 +5165,25 @@ var Subscription = class extends Structure {
5165
5165
  const createdTimestamp = this.createdTimestamp;
5166
5166
  return createdTimestamp ? new Date(createdTimestamp) : null;
5167
5167
  }
5168
+ /**
5169
+ * {@inheritDoc Structure.toJSON}
5170
+ */
5171
+ toJSON() {
5172
+ const clone = super.toJSON();
5173
+ const currentPeriodStartTimestamp = this[kCurrentPeriodStartTimestamp];
5174
+ const currentPeriodEndTimestamp = this[kCurrentPeriodEndTimestamp];
5175
+ const canceledTimestamp = this[kCanceledTimestamp];
5176
+ if (currentPeriodEndTimestamp) {
5177
+ clone.current_period_end = dateToDiscordISOTimestamp(new Date(currentPeriodEndTimestamp));
5178
+ }
5179
+ if (currentPeriodStartTimestamp) {
5180
+ clone.current_period_start = dateToDiscordISOTimestamp(new Date(currentPeriodStartTimestamp));
5181
+ }
5182
+ if (canceledTimestamp) {
5183
+ clone.canceled_at = dateToDiscordISOTimestamp(new Date(canceledTimestamp));
5184
+ }
5185
+ return clone;
5186
+ }
5168
5187
  };
5169
5188
  // Annotate the CommonJS export names for ESM import in node:
5170
5189
  0 && (module.exports = {