Skip to content

Commit bf8d73e

Browse files
committed
feat: support onboarding
1 parent 6c2242f commit bf8d73e

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

packages/core/src/api/guild.ts

+36
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import type {
2323
RESTGetAPIGuildMembersResult,
2424
RESTGetAPIGuildMembersQuery,
2525
RESTGetAPIGuildMembersSearchResult,
26+
RESTGetAPIGuildOnboardingResult,
2627
RESTGetAPIGuildPreviewResult,
2728
RESTGetAPIGuildPruneCountResult,
2829
RESTGetAPIGuildResult,
@@ -79,6 +80,8 @@ import type {
7980
RESTPostAPIGuildChannelResult,
8081
RESTPostAPIGuildEmojiJSONBody,
8182
RESTPostAPIGuildEmojiResult,
83+
RESTPutAPIGuildOnboardingJSONBody,
84+
RESTPutAPIGuildOnboardingResult,
8285
RESTPostAPIGuildPruneJSONBody,
8386
RESTPostAPIGuildPruneResult,
8487
RESTPostAPIGuildRoleJSONBody,
@@ -1229,4 +1232,37 @@ export class GuildsAPI {
12291232
body,
12301233
}) as Promise<RESTPatchAPIGuildVoiceStateCurrentMemberResult>;
12311234
}
1235+
1236+
/**
1237+
* Fetches a guild onboarding
1238+
*
1239+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-onboarding}
1240+
* @param guildId - The id of the guild to fetch the onboarding from
1241+
* @param options - The options for fetching the guild onboarding
1242+
*/
1243+
public async getOnboarding(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
1244+
return this.rest.get(Routes.guildOnboarding(guildId), {
1245+
signal,
1246+
}) as Promise<RESTGetAPIGuildOnboardingResult>;
1247+
}
1248+
1249+
/**
1250+
* Edits the widget settings for a guild
1251+
*
1252+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-onboarding}
1253+
* @param guildId - The id of the guild to edit the onboarding settings from
1254+
* @param body - The new onboarding settings data
1255+
* @param options - The options for editing the onboarding
1256+
*/
1257+
public async editOnboarding(
1258+
guildId: Snowflake,
1259+
body: RESTPutAPIGuildOnboardingJSONBody,
1260+
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {},
1261+
) {
1262+
return this.rest.patch(Routes.guildWidgetSettings(guildId), {
1263+
reason,
1264+
body,
1265+
signal,
1266+
}) as Promise<RESTPutAPIGuildOnboardingResult>;
1267+
}
12321268
}

0 commit comments

Comments
 (0)