@discordjs/core 0.2.0 → 0.3.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.
package/dist/index.mjs CHANGED
@@ -570,36 +570,57 @@ var InvitesAPI = class {
570
570
  };
571
571
  __name(InvitesAPI, "InvitesAPI");
572
572
 
573
- // src/api/sticker.ts
573
+ // src/api/roleConnections.ts
574
574
  import {
575
575
  Routes as Routes6
576
576
  } from "discord-api-types/v10";
577
+ var RoleConnectionsAPI = class {
578
+ constructor(rest) {
579
+ this.rest = rest;
580
+ }
581
+ async getMetadataRecords(applicationId) {
582
+ return this.rest.get(
583
+ Routes6.applicationRoleConnectionMetadata(applicationId)
584
+ );
585
+ }
586
+ async updateMetadataRecords(applicationId, options) {
587
+ return this.rest.put(Routes6.applicationRoleConnectionMetadata(applicationId), {
588
+ body: options
589
+ });
590
+ }
591
+ };
592
+ __name(RoleConnectionsAPI, "RoleConnectionsAPI");
593
+
594
+ // src/api/sticker.ts
595
+ import {
596
+ Routes as Routes7
597
+ } from "discord-api-types/v10";
577
598
  var StickersAPI = class {
578
599
  constructor(rest) {
579
600
  this.rest = rest;
580
601
  }
581
602
  async getNitroStickers() {
582
- return this.rest.get(Routes6.nitroStickerPacks());
603
+ return this.rest.get(Routes7.nitroStickerPacks());
583
604
  }
584
605
  async get(stickerId) {
585
- return this.rest.get(Routes6.sticker(stickerId));
606
+ return this.rest.get(Routes7.sticker(stickerId));
586
607
  }
587
608
  };
588
609
  __name(StickersAPI, "StickersAPI");
589
610
 
590
611
  // src/api/thread.ts
591
612
  import {
592
- Routes as Routes7
613
+ Routes as Routes8
593
614
  } from "discord-api-types/v10";
594
615
  var ThreadsAPI = class {
595
616
  constructor(rest) {
596
617
  this.rest = rest;
597
618
  }
598
619
  async get(threadId) {
599
- return this.rest.get(Routes7.channel(threadId));
620
+ return this.rest.get(Routes8.channel(threadId));
600
621
  }
601
622
  async create(channelId, { message_id, ...body }) {
602
- return this.rest.post(Routes7.threads(channelId, message_id), { body });
623
+ return this.rest.post(Routes8.threads(channelId, message_id), { body });
603
624
  }
604
625
  async createForumThread(channelId, { message, ...optionsBody }) {
605
626
  const { files, ...messageBody } = message;
@@ -607,25 +628,25 @@ var ThreadsAPI = class {
607
628
  ...optionsBody,
608
629
  message: messageBody
609
630
  };
610
- return this.rest.post(Routes7.threads(channelId), { files, body });
631
+ return this.rest.post(Routes8.threads(channelId), { files, body });
611
632
  }
612
633
  async join(threadId) {
613
- await this.rest.put(Routes7.threadMembers(threadId, "@me"));
634
+ await this.rest.put(Routes8.threadMembers(threadId, "@me"));
614
635
  }
615
636
  async addMember(threadId, userId) {
616
- await this.rest.put(Routes7.threadMembers(threadId, userId));
637
+ await this.rest.put(Routes8.threadMembers(threadId, userId));
617
638
  }
618
639
  async leave(threadId) {
619
- await this.rest.delete(Routes7.threadMembers(threadId, "@me"));
640
+ await this.rest.delete(Routes8.threadMembers(threadId, "@me"));
620
641
  }
621
642
  async removeMember(threadId, userId) {
622
- await this.rest.delete(Routes7.threadMembers(threadId, userId));
643
+ await this.rest.delete(Routes8.threadMembers(threadId, userId));
623
644
  }
624
645
  async getMember(threadId, userId) {
625
- return this.rest.get(Routes7.threadMembers(threadId, userId));
646
+ return this.rest.get(Routes8.threadMembers(threadId, userId));
626
647
  }
627
648
  async getAllMembers(threadId) {
628
- return this.rest.get(Routes7.threadMembers(threadId));
649
+ return this.rest.get(Routes8.threadMembers(threadId));
629
650
  }
630
651
  };
631
652
  __name(ThreadsAPI, "ThreadsAPI");
@@ -633,58 +654,58 @@ __name(ThreadsAPI, "ThreadsAPI");
633
654
  // src/api/user.ts
634
655
  import { makeURLSearchParams as makeURLSearchParams5 } from "@discordjs/rest";
635
656
  import {
636
- Routes as Routes8
657
+ Routes as Routes9
637
658
  } from "discord-api-types/v10";
638
659
  var UsersAPI = class {
639
660
  constructor(rest) {
640
661
  this.rest = rest;
641
662
  }
642
663
  async get(userId) {
643
- return this.rest.get(Routes8.user(userId));
664
+ return this.rest.get(Routes9.user(userId));
644
665
  }
645
666
  async getCurrent() {
646
- return this.rest.get(Routes8.user("@me"));
667
+ return this.rest.get(Routes9.user("@me"));
647
668
  }
648
669
  async getGuilds(options = {}) {
649
- return this.rest.get(Routes8.userGuilds(), {
670
+ return this.rest.get(Routes9.userGuilds(), {
650
671
  query: makeURLSearchParams5(options)
651
672
  });
652
673
  }
653
674
  async leaveGuild(guildId) {
654
- await this.rest.delete(Routes8.userGuild(guildId));
675
+ await this.rest.delete(Routes9.userGuild(guildId));
655
676
  }
656
677
  async edit(user) {
657
- return this.rest.patch(Routes8.user("@me"), { body: user });
678
+ return this.rest.patch(Routes9.user("@me"), { body: user });
658
679
  }
659
680
  async getGuildMember(guildId) {
660
- return this.rest.get(Routes8.userGuildMember(guildId));
681
+ return this.rest.get(Routes9.userGuildMember(guildId));
661
682
  }
662
683
  async editGuildMember(guildId, member = {}, reason) {
663
- return this.rest.patch(Routes8.guildMember(guildId, "@me"), {
684
+ return this.rest.patch(Routes9.guildMember(guildId, "@me"), {
664
685
  reason,
665
686
  body: member
666
687
  });
667
688
  }
668
689
  async setVoiceState(guildId, options = {}) {
669
- return this.rest.patch(Routes8.guildVoiceState(guildId, "@me"), {
690
+ return this.rest.patch(Routes9.guildVoiceState(guildId, "@me"), {
670
691
  body: options
671
692
  });
672
693
  }
673
694
  async createDM(userId) {
674
- return this.rest.post(Routes8.userChannels(), {
695
+ return this.rest.post(Routes9.userChannels(), {
675
696
  body: { recipient_id: userId }
676
697
  });
677
698
  }
678
699
  async getConnections() {
679
- return this.rest.get(Routes8.userConnections());
700
+ return this.rest.get(Routes9.userConnections());
680
701
  }
681
702
  async getApplicationRoleConnection(applicationId) {
682
703
  return this.rest.get(
683
- Routes8.userApplicationRoleConnection(applicationId)
704
+ Routes9.userApplicationRoleConnection(applicationId)
684
705
  );
685
706
  }
686
707
  async updateApplicationRoleConnection(applicationId, options) {
687
- return this.rest.put(Routes8.userApplicationRoleConnection(applicationId), {
708
+ return this.rest.put(Routes9.userApplicationRoleConnection(applicationId), {
688
709
  body: options
689
710
  });
690
711
  }
@@ -692,13 +713,13 @@ var UsersAPI = class {
692
713
  __name(UsersAPI, "UsersAPI");
693
714
 
694
715
  // src/api/voice.ts
695
- import { Routes as Routes9 } from "discord-api-types/v10";
716
+ import { Routes as Routes10 } from "discord-api-types/v10";
696
717
  var VoiceAPI = class {
697
718
  constructor(rest) {
698
719
  this.rest = rest;
699
720
  }
700
721
  async getVoiceRegions() {
701
- return this.rest.get(Routes9.voiceRegions());
722
+ return this.rest.get(Routes10.voiceRegions());
702
723
  }
703
724
  };
704
725
  __name(VoiceAPI, "VoiceAPI");
@@ -706,26 +727,26 @@ __name(VoiceAPI, "VoiceAPI");
706
727
  // src/api/webhook.ts
707
728
  import { makeURLSearchParams as makeURLSearchParams6 } from "@discordjs/rest";
708
729
  import {
709
- Routes as Routes10
730
+ Routes as Routes11
710
731
  } from "discord-api-types/v10";
711
732
  var WebhooksAPI = class {
712
733
  constructor(rest) {
713
734
  this.rest = rest;
714
735
  }
715
736
  async get(id, token) {
716
- return this.rest.get(Routes10.webhook(id, token));
737
+ return this.rest.get(Routes11.webhook(id, token));
717
738
  }
718
739
  async create(channelId, data, reason) {
719
- return this.rest.post(Routes10.channelWebhooks(channelId), {
740
+ return this.rest.post(Routes11.channelWebhooks(channelId), {
720
741
  reason,
721
742
  body: data
722
743
  });
723
744
  }
724
745
  async edit(id, webhook, { token, reason } = {}) {
725
- return this.rest.patch(Routes10.webhook(id, token), { reason, body: webhook });
746
+ return this.rest.patch(Routes11.webhook(id, token), { reason, body: webhook });
726
747
  }
727
748
  async delete(id, { token, reason } = {}) {
728
- await this.rest.delete(Routes10.webhook(id, token), { reason });
749
+ await this.rest.delete(Routes11.webhook(id, token), { reason });
729
750
  }
730
751
  async execute(id, token, {
731
752
  wait,
@@ -733,7 +754,7 @@ var WebhooksAPI = class {
733
754
  files,
734
755
  ...body
735
756
  }) {
736
- return this.rest.post(Routes10.webhook(id, token), {
757
+ return this.rest.post(Routes11.webhook(id, token), {
737
758
  query: makeURLSearchParams6({ wait, thread_id }),
738
759
  files,
739
760
  body,
@@ -741,34 +762,34 @@ var WebhooksAPI = class {
741
762
  });
742
763
  }
743
764
  async executeSlack(id, token, body, options = {}) {
744
- await this.rest.post(Routes10.webhookPlatform(id, token, "slack"), {
765
+ await this.rest.post(Routes11.webhookPlatform(id, token, "slack"), {
745
766
  query: makeURLSearchParams6(options),
746
767
  body,
747
768
  auth: false
748
769
  });
749
770
  }
750
771
  async executeGitHub(id, token, body, options = {}) {
751
- await this.rest.post(Routes10.webhookPlatform(id, token, "github"), {
772
+ await this.rest.post(Routes11.webhookPlatform(id, token, "github"), {
752
773
  query: makeURLSearchParams6(options),
753
774
  body,
754
775
  auth: false
755
776
  });
756
777
  }
757
778
  async getMessage(id, token, messageId, options = {}) {
758
- return this.rest.get(Routes10.webhookMessage(id, token, messageId), {
779
+ return this.rest.get(Routes11.webhookMessage(id, token, messageId), {
759
780
  query: makeURLSearchParams6(options),
760
781
  auth: false
761
782
  });
762
783
  }
763
784
  async editMessage(id, token, messageId, { thread_id, ...body }) {
764
- return this.rest.patch(Routes10.webhookMessage(id, token, messageId), {
785
+ return this.rest.patch(Routes11.webhookMessage(id, token, messageId), {
765
786
  query: makeURLSearchParams6({ thread_id }),
766
787
  auth: false,
767
788
  body
768
789
  });
769
790
  }
770
791
  async deleteMessage(id, token, messageId, options = {}) {
771
- await this.rest.delete(Routes10.webhookMessage(id, token, messageId), {
792
+ await this.rest.delete(Routes11.webhookMessage(id, token, messageId), {
772
793
  query: makeURLSearchParams6(options),
773
794
  auth: false
774
795
  });
@@ -784,6 +805,7 @@ var API = class {
784
805
  this.channels = new ChannelsAPI(rest);
785
806
  this.guilds = new GuildsAPI(rest);
786
807
  this.invites = new InvitesAPI(rest);
808
+ this.roleConnections = new RoleConnectionsAPI(rest);
787
809
  this.stickers = new StickersAPI(rest);
788
810
  this.threads = new ThreadsAPI(rest);
789
811
  this.users = new UsersAPI(rest);
@@ -796,6 +818,7 @@ var API = class {
796
818
  guilds;
797
819
  interactions;
798
820
  invites;
821
+ roleConnections;
799
822
  stickers;
800
823
  threads;
801
824
  users;
@@ -851,6 +874,7 @@ export {
851
874
  GuildsAPI,
852
875
  InteractionsAPI,
853
876
  InvitesAPI,
877
+ RoleConnectionsAPI,
854
878
  StickersAPI,
855
879
  ThreadsAPI,
856
880
  UsersAPI,