@mastra/connect 0.7.0-alpha.0 → 0.7.0-alpha.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/dist/index.cjs +67 -185
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +67 -185
- package/dist/index.js.map +1 -1
- package/dist/providers/channels.d.ts.map +1 -1
- package/dist/providers/discord/index.d.ts.map +1 -1
- package/dist/providers/discord/tools/_bot-token.d.ts +11 -0
- package/dist/providers/discord/tools/_bot-token.d.ts.map +1 -0
- package/dist/providers/discord/tools/add-guild-member-role.d.ts.map +1 -1
- package/dist/providers/discord/tools/create-channel.d.ts.map +1 -1
- package/dist/providers/discord/tools/create-message.d.ts.map +1 -1
- package/dist/providers/discord/tools/create-reaction.d.ts.map +1 -1
- package/dist/providers/discord/tools/create-role.d.ts.map +1 -1
- package/dist/providers/discord/tools/create-thread-from-message.d.ts.map +1 -1
- package/dist/providers/discord/tools/create-webhook.d.ts.map +1 -1
- package/dist/providers/discord/tools/delete-channel.d.ts.map +1 -1
- package/dist/providers/discord/tools/delete-guild-member.d.ts.map +1 -1
- package/dist/providers/discord/tools/delete-guild.d.ts.map +1 -1
- package/dist/providers/discord/tools/delete-message.d.ts.map +1 -1
- package/dist/providers/discord/tools/delete-reaction.d.ts.map +1 -1
- package/dist/providers/discord/tools/delete-role.d.ts.map +1 -1
- package/dist/providers/discord/tools/delete-webhook.d.ts.map +1 -1
- package/dist/providers/discord/tools/get-channel.d.ts.map +1 -1
- package/dist/providers/discord/tools/get-guild-member.d.ts.map +1 -1
- package/dist/providers/discord/tools/get-guild.d.ts.map +1 -1
- package/dist/providers/discord/tools/get-message.d.ts.map +1 -1
- package/dist/providers/discord/tools/get-role.d.ts.map +1 -1
- package/dist/providers/discord/tools/get-webhook.d.ts.map +1 -1
- package/dist/providers/discord/tools/list-channels.d.ts.map +1 -1
- package/dist/providers/discord/tools/list-guild-members.d.ts.map +1 -1
- package/dist/providers/discord/tools/list-guilds.d.ts.map +1 -1
- package/dist/providers/discord/tools/list-messages.d.ts.map +1 -1
- package/dist/providers/discord/tools/list-roles.d.ts.map +1 -1
- package/dist/providers/discord/tools/list-webhooks.d.ts.map +1 -1
- package/dist/providers/discord/tools/remove-guild-member-role.d.ts.map +1 -1
- package/dist/providers/discord/tools/update-channel.d.ts.map +1 -1
- package/dist/providers/discord/tools/update-guild-member.d.ts.map +1 -1
- package/dist/providers/discord/tools/update-guild.d.ts.map +1 -1
- package/dist/providers/discord/tools/update-message.d.ts.map +1 -1
- package/dist/providers/discord/tools/update-role.d.ts.map +1 -1
- package/dist/providers/discord/tools/update-webhook.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -782,9 +782,11 @@ const CHANNELS$1 = [
|
|
|
782
782
|
return {
|
|
783
783
|
provider,
|
|
784
784
|
async sync() {
|
|
785
|
+
const credential = await runtime.getCredential();
|
|
786
|
+
if (credential.type !== "api_key") throw new MastraConnectError("unsupported_credential_type", `Discord connection ${runtime.getConnectionId()} returned a '${credential.type}' credential, but the Discord channel requires the bot token as an API-key credential (the 'discord' integration). OAuth Discord connections yield user Bearer tokens, which Discord rejects for bot auth.`);
|
|
787
|
+
const botToken = credential.apiKey;
|
|
788
|
+
if (typeof botToken !== "string" || botToken.length === 0) throw new MastraConnectError("no_active_connection", `Discord connection ${runtime.getConnectionId()} has no bot token on its credential.`);
|
|
785
789
|
const metadata = (await runtime.getConnectionContext())?.metadata ?? {};
|
|
786
|
-
const botToken = typeof metadata.botToken === "string" && metadata.botToken || typeof metadata.bot_token === "string" && metadata.bot_token || void 0;
|
|
787
|
-
if (!botToken) throw new MastraConnectError("no_active_connection", `Discord connection ${runtime.getConnectionId()} has no botToken in its metadata. Store the bot token on the connection (Nango setMetadata) to activate the Discord channel.`);
|
|
788
790
|
const applicationId = optionsAppId ?? (typeof metadata.applicationId === "string" ? metadata.applicationId : void 0) ?? (typeof metadata.application_id === "string" ? metadata.application_id : void 0);
|
|
789
791
|
const publicKey = optionsPublicKey ?? (typeof metadata.publicKey === "string" ? metadata.publicKey : void 0) ?? (typeof metadata.public_key === "string" ? metadata.public_key : void 0);
|
|
790
792
|
const credentials = { botToken };
|
|
@@ -3702,8 +3704,25 @@ const clerkProvider = {
|
|
|
3702
3704
|
createTools: createClerkTools
|
|
3703
3705
|
};
|
|
3704
3706
|
//#endregion
|
|
3707
|
+
//#region src/providers/discord/tools/_bot-token.ts
|
|
3708
|
+
/**
|
|
3709
|
+
* Resolves the Discord bot token from the connection's credentials. Nango's
|
|
3710
|
+
* `discord` provider is API_KEY-typed and stores the bot token as its
|
|
3711
|
+
* secret, so the platform serves it back as `credentials.apiKey` (the wire
|
|
3712
|
+
* shape templates are written against). Throws a ToolActionError with a
|
|
3713
|
+
* consistent `missing_credentials` payload so exec bodies don't need to repeat
|
|
3714
|
+
* the guard.
|
|
3715
|
+
*/
|
|
3716
|
+
async function resolveDiscordBotToken(platformProxy) {
|
|
3717
|
+
const credentials = (await platformProxy.getConnectionWithCredentials()).credentials;
|
|
3718
|
+
if (credentials && typeof credentials.apiKey === "string" && credentials.apiKey) return credentials.apiKey;
|
|
3719
|
+
throw new platformProxy.ActionError({
|
|
3720
|
+
type: "missing_credentials",
|
|
3721
|
+
message: "Discord bot token is missing from the connection credentials. Reconnect the discord integration with a valid bot token."
|
|
3722
|
+
});
|
|
3723
|
+
}
|
|
3724
|
+
//#endregion
|
|
3705
3725
|
//#region src/providers/discord/tools/add-guild-member-role.ts
|
|
3706
|
-
const MetadataSchema$7 = z.object({ botToken: z.string() });
|
|
3707
3726
|
const addGuildMemberRoleInputSchema = z.object({
|
|
3708
3727
|
guildId: z.string().describe("Guild ID. Example: \"123456789012345678\""),
|
|
3709
3728
|
userId: z.string().describe("User ID. Example: \"987654321098765432\""),
|
|
@@ -3718,12 +3737,7 @@ function addGuildMemberRoleTool(proxy) {
|
|
|
3718
3737
|
outputSchema: addGuildMemberRoleOutputSchema,
|
|
3719
3738
|
execute: async (input, { requestContext }) => {
|
|
3720
3739
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
3721
|
-
const
|
|
3722
|
-
if (!metadataResult.success) throw new platformProxy.ActionError({
|
|
3723
|
-
type: "invalid_metadata",
|
|
3724
|
-
message: "botToken is required in metadata."
|
|
3725
|
-
});
|
|
3726
|
-
const { botToken } = metadataResult.data;
|
|
3740
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
3727
3741
|
const response = await platformProxy.put({
|
|
3728
3742
|
endpoint: `/api/v10/guilds/${input.guildId}/members/${input.userId}/roles/${input.roleId}`,
|
|
3729
3743
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -3739,7 +3753,6 @@ function addGuildMemberRoleTool(proxy) {
|
|
|
3739
3753
|
}
|
|
3740
3754
|
//#endregion
|
|
3741
3755
|
//#region src/providers/discord/tools/create-channel.ts
|
|
3742
|
-
z.object({ botToken: z.string().describe("Discord bot token from the Discord Developer Portal") });
|
|
3743
3756
|
const createChannelInputSchema$2 = z.object({
|
|
3744
3757
|
guildId: z.string().describe("The ID of the guild to create the channel in. Example: \"41771983423143937\""),
|
|
3745
3758
|
name: z.string().min(1).max(100).describe("Channel name (1-100 characters). Example: \"general\""),
|
|
@@ -3809,11 +3822,7 @@ function createChannelTool$2(proxy) {
|
|
|
3809
3822
|
outputSchema: createChannelOutputSchema$2,
|
|
3810
3823
|
execute: async (input, { requestContext }) => {
|
|
3811
3824
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
3812
|
-
const
|
|
3813
|
-
if (!metadata.botToken) throw new platformProxy.ActionError({
|
|
3814
|
-
type: "invalid_metadata",
|
|
3815
|
-
message: "botToken is required in metadata. Please provide a Discord bot token."
|
|
3816
|
-
});
|
|
3825
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
3817
3826
|
if (!input.guildId) throw new platformProxy.ActionError({
|
|
3818
3827
|
type: "invalid_input",
|
|
3819
3828
|
message: "guildId is required to create a channel."
|
|
@@ -3839,7 +3848,7 @@ function createChannelTool$2(proxy) {
|
|
|
3839
3848
|
const response = await platformProxy.post({
|
|
3840
3849
|
endpoint: `/api/v10/guilds/${input.guildId}/channels`,
|
|
3841
3850
|
data: requestBody,
|
|
3842
|
-
headers: { Authorization: `Bot ${
|
|
3851
|
+
headers: { Authorization: `Bot ${botToken}` },
|
|
3843
3852
|
retries: 3
|
|
3844
3853
|
});
|
|
3845
3854
|
const providerChannel = ProviderChannelSchema$10.parse(response.data);
|
|
@@ -3933,11 +3942,7 @@ function createMessageTool(proxy) {
|
|
|
3933
3942
|
outputSchema: createMessageOutputSchema,
|
|
3934
3943
|
execute: async (input, { requestContext }) => {
|
|
3935
3944
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
3936
|
-
const botToken =
|
|
3937
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
3938
|
-
type: "invalid_metadata",
|
|
3939
|
-
message: "botToken is required in connection metadata."
|
|
3940
|
-
});
|
|
3945
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
3941
3946
|
const requestBody = {};
|
|
3942
3947
|
if (input.content !== void 0) requestBody["content"] = input.content;
|
|
3943
3948
|
if (input.embeds !== void 0) requestBody["embeds"] = input.embeds;
|
|
@@ -3989,11 +3994,7 @@ function createReactionTool(proxy) {
|
|
|
3989
3994
|
outputSchema: createReactionOutputSchema,
|
|
3990
3995
|
execute: async (input, { requestContext }) => {
|
|
3991
3996
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
3992
|
-
const botToken =
|
|
3993
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
3994
|
-
type: "invalid_metadata",
|
|
3995
|
-
message: "botToken is required in metadata. Please configure the Discord bot token."
|
|
3996
|
-
});
|
|
3997
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
3997
3998
|
await platformProxy.put({
|
|
3998
3999
|
endpoint: `/api/v10/channels/${input.channel_id}/messages/${input.message_id}/reactions/${encodeURIComponent(input.emoji)}/@me`,
|
|
3999
4000
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -4068,7 +4069,6 @@ const createRoleOutputSchema = z.object({
|
|
|
4068
4069
|
tags: RoleTagsSchema$3.optional(),
|
|
4069
4070
|
flags: z.number().int()
|
|
4070
4071
|
});
|
|
4071
|
-
z.object({ botToken: z.string() });
|
|
4072
4072
|
function createRoleTool(proxy) {
|
|
4073
4073
|
return createTool({
|
|
4074
4074
|
id: "discord_create_role",
|
|
@@ -4077,11 +4077,7 @@ function createRoleTool(proxy) {
|
|
|
4077
4077
|
outputSchema: createRoleOutputSchema,
|
|
4078
4078
|
execute: async (input, { requestContext }) => {
|
|
4079
4079
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4080
|
-
const botToken =
|
|
4081
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
4082
|
-
type: "invalid_metadata",
|
|
4083
|
-
message: "botToken is required in metadata."
|
|
4084
|
-
});
|
|
4080
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4085
4081
|
const response = await platformProxy.post({
|
|
4086
4082
|
endpoint: `/api/v10/guilds/${input.guildId}/roles`,
|
|
4087
4083
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -4182,7 +4178,7 @@ function createThreadFromMessageTool(proxy) {
|
|
|
4182
4178
|
outputSchema: createThreadFromMessageOutputSchema,
|
|
4183
4179
|
execute: async (input, { requestContext }) => {
|
|
4184
4180
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4185
|
-
const botToken =
|
|
4181
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4186
4182
|
const requestData = { name: input.name };
|
|
4187
4183
|
if (input.auto_archive_duration !== void 0) requestData["auto_archive_duration"] = input.auto_archive_duration;
|
|
4188
4184
|
if (input.rate_limit_per_user !== void 0) requestData["rate_limit_per_user"] = input.rate_limit_per_user;
|
|
@@ -4256,10 +4252,6 @@ const createWebhookOutputSchema$1 = z.object({
|
|
|
4256
4252
|
token: z.string().optional().describe("Webhook token (only for Incoming webhooks)"),
|
|
4257
4253
|
applicationId: z.string().optional()
|
|
4258
4254
|
});
|
|
4259
|
-
z.object({
|
|
4260
|
-
botToken: z.string().describe("Discord bot token for authentication"),
|
|
4261
|
-
channelId: z.string().optional().describe("Optional default channel ID for creating webhooks")
|
|
4262
|
-
});
|
|
4263
4255
|
function createWebhookTool$1(proxy) {
|
|
4264
4256
|
return createTool({
|
|
4265
4257
|
id: "discord_create_webhook",
|
|
@@ -4268,13 +4260,9 @@ function createWebhookTool$1(proxy) {
|
|
|
4268
4260
|
outputSchema: createWebhookOutputSchema$1,
|
|
4269
4261
|
execute: async (input, { requestContext }) => {
|
|
4270
4262
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4263
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4271
4264
|
const metadata = await platformProxy.getMetadata();
|
|
4272
|
-
const botToken = metadata?.botToken;
|
|
4273
4265
|
const channelId = input.channelId ?? metadata?.channelId;
|
|
4274
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
4275
|
-
type: "missing_metadata",
|
|
4276
|
-
message: "botToken is required in connection metadata."
|
|
4277
|
-
});
|
|
4278
4266
|
if (!channelId) throw new platformProxy.ActionError({
|
|
4279
4267
|
type: "missing_channel",
|
|
4280
4268
|
message: "channelId is required in input or metadata."
|
|
@@ -4359,11 +4347,7 @@ function deleteChannelTool$1(proxy) {
|
|
|
4359
4347
|
outputSchema: deleteChannelOutputSchema$1,
|
|
4360
4348
|
execute: async (input, { requestContext }) => {
|
|
4361
4349
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4362
|
-
const botToken =
|
|
4363
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
4364
|
-
type: "invalid_metadata",
|
|
4365
|
-
message: "botToken is required in metadata. Please provide a Discord bot token."
|
|
4366
|
-
});
|
|
4350
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4367
4351
|
const response = await platformProxy.delete({
|
|
4368
4352
|
endpoint: `/api/v10/channels/${input.channelId}`,
|
|
4369
4353
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -4387,7 +4371,6 @@ function deleteChannelTool$1(proxy) {
|
|
|
4387
4371
|
}
|
|
4388
4372
|
//#endregion
|
|
4389
4373
|
//#region src/providers/discord/tools/delete-guild-member.ts
|
|
4390
|
-
z.object({ botToken: z.string().describe("Discord bot token for authentication") });
|
|
4391
4374
|
const deleteGuildMemberInputSchema = z.object({
|
|
4392
4375
|
guild_id: z.string().describe("Guild ID. Example: \"123456789012345678\""),
|
|
4393
4376
|
user_id: z.string().describe("User ID of the member to delete. Example: \"987654321098765432\"")
|
|
@@ -4404,16 +4387,12 @@ function deleteGuildMemberTool(proxy) {
|
|
|
4404
4387
|
outputSchema: deleteGuildMemberOutputSchema,
|
|
4405
4388
|
execute: async (input, { requestContext }) => {
|
|
4406
4389
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4407
|
-
const
|
|
4408
|
-
if (!metadata?.botToken) throw new platformProxy.ActionError({
|
|
4409
|
-
type: "invalid_metadata",
|
|
4410
|
-
message: "botToken is required in connection metadata"
|
|
4411
|
-
});
|
|
4390
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4412
4391
|
let response;
|
|
4413
4392
|
try {
|
|
4414
4393
|
response = await platformProxy.delete({
|
|
4415
4394
|
endpoint: `/api/v10/guilds/${input.guild_id}/members/${input.user_id}`,
|
|
4416
|
-
headers: { Authorization: `Bot ${
|
|
4395
|
+
headers: { Authorization: `Bot ${botToken}` },
|
|
4417
4396
|
retries: 1
|
|
4418
4397
|
});
|
|
4419
4398
|
} catch (err) {
|
|
@@ -4436,7 +4415,6 @@ function deleteGuildMemberTool(proxy) {
|
|
|
4436
4415
|
}
|
|
4437
4416
|
//#endregion
|
|
4438
4417
|
//#region src/providers/discord/tools/delete-guild.ts
|
|
4439
|
-
const MetadataSchema$6 = z.object({ botToken: z.string().describe("Discord bot token from the Discord Developer Portal") });
|
|
4440
4418
|
const deleteGuildInputSchema = z.object({ guild_id: z.string().describe("The ID of the guild for the bot to leave.") });
|
|
4441
4419
|
const deleteGuildOutputSchema = z.object({
|
|
4442
4420
|
success: z.boolean().describe("Whether the bot successfully left the guild"),
|
|
@@ -4450,13 +4428,7 @@ function deleteGuildTool(proxy) {
|
|
|
4450
4428
|
outputSchema: deleteGuildOutputSchema,
|
|
4451
4429
|
execute: async (input, { requestContext }) => {
|
|
4452
4430
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4453
|
-
const
|
|
4454
|
-
const parsedMetadata = MetadataSchema$6.safeParse(metadata);
|
|
4455
|
-
if (!parsedMetadata.success) throw new platformProxy.ActionError({
|
|
4456
|
-
type: "invalid_metadata",
|
|
4457
|
-
message: "botToken is required in metadata. Please configure the bot token in the connection metadata."
|
|
4458
|
-
});
|
|
4459
|
-
const botToken = parsedMetadata.data.botToken;
|
|
4431
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4460
4432
|
const response = await platformProxy.delete({
|
|
4461
4433
|
endpoint: `/api/v10/users/@me/guilds/${input.guild_id}`,
|
|
4462
4434
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -4476,7 +4448,6 @@ function deleteGuildTool(proxy) {
|
|
|
4476
4448
|
}
|
|
4477
4449
|
//#endregion
|
|
4478
4450
|
//#region src/providers/discord/tools/delete-message.ts
|
|
4479
|
-
const MetadataSchema$5 = z.object({ botToken: z.string().describe("Discord bot token") });
|
|
4480
4451
|
const deleteMessageInputSchema$2 = z.object({
|
|
4481
4452
|
channelId: z.string().describe("Channel ID where the message exists. Example: \"1234567890123456789\""),
|
|
4482
4453
|
messageId: z.string().describe("Message ID to delete. Example: \"9876543210987654321\"")
|
|
@@ -4494,12 +4465,7 @@ function deleteMessageTool$2(proxy) {
|
|
|
4494
4465
|
outputSchema: deleteMessageOutputSchema$2,
|
|
4495
4466
|
execute: async (input, { requestContext }) => {
|
|
4496
4467
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4497
|
-
const
|
|
4498
|
-
if (!metadata.success) throw new platformProxy.ActionError({
|
|
4499
|
-
type: "invalid_metadata",
|
|
4500
|
-
message: "Invalid metadata: botToken is required."
|
|
4501
|
-
});
|
|
4502
|
-
const botToken = metadata.data.botToken;
|
|
4468
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4503
4469
|
await platformProxy.delete({
|
|
4504
4470
|
endpoint: `/api/v10/channels/${input.channelId}/messages/${input.messageId}`,
|
|
4505
4471
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -4529,11 +4495,7 @@ function deleteReactionTool(proxy) {
|
|
|
4529
4495
|
outputSchema: deleteReactionOutputSchema,
|
|
4530
4496
|
execute: async (input, { requestContext }) => {
|
|
4531
4497
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4532
|
-
const botToken =
|
|
4533
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
4534
|
-
type: "invalid_metadata",
|
|
4535
|
-
message: "botToken is required in metadata. Please configure the bot token from Discord Developer Portal."
|
|
4536
|
-
});
|
|
4498
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4537
4499
|
await platformProxy.delete({
|
|
4538
4500
|
endpoint: `/api/v10/channels/${input.channel_id}/messages/${input.message_id}/reactions/${encodeURIComponent(input.emoji)}/@me`,
|
|
4539
4501
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -4575,7 +4537,7 @@ function deleteRoleTool(proxy) {
|
|
|
4575
4537
|
outputSchema: deleteRoleOutputSchema,
|
|
4576
4538
|
execute: async (input, { requestContext }) => {
|
|
4577
4539
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4578
|
-
const botToken =
|
|
4540
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4579
4541
|
if (!botToken) throw new platformProxy.ActionError({
|
|
4580
4542
|
type: "invalid_metadata",
|
|
4581
4543
|
message: "botToken is required in metadata. Please provide the Discord bot token from your Discord application settings."
|
|
@@ -4609,11 +4571,7 @@ function deleteWebhookTool$1(proxy) {
|
|
|
4609
4571
|
outputSchema: deleteWebhookOutputSchema$1,
|
|
4610
4572
|
execute: async (input, { requestContext }) => {
|
|
4611
4573
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4612
|
-
const botToken =
|
|
4613
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
4614
|
-
type: "invalid_metadata",
|
|
4615
|
-
message: "botToken is required in metadata. Please ensure the Discord connection has a botToken configured."
|
|
4616
|
-
});
|
|
4574
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4617
4575
|
const response = await platformProxy.delete({
|
|
4618
4576
|
endpoint: `/api/v10/webhooks/${input.webhookId}`,
|
|
4619
4577
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -4717,14 +4675,10 @@ function getChannelTool$2(proxy) {
|
|
|
4717
4675
|
outputSchema: getChannelOutputSchema$2,
|
|
4718
4676
|
execute: async (input, { requestContext }) => {
|
|
4719
4677
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4720
|
-
const
|
|
4721
|
-
if (!metadata?.botToken) throw new platformProxy.ActionError({
|
|
4722
|
-
type: "invalid_metadata",
|
|
4723
|
-
message: "botToken is required in metadata. Please set up the connection with botToken in metadata."
|
|
4724
|
-
});
|
|
4678
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4725
4679
|
const response = await platformProxy.get({
|
|
4726
4680
|
endpoint: `/api/v10/channels/${input.channelId}`,
|
|
4727
|
-
headers: { Authorization: `Bot ${
|
|
4681
|
+
headers: { Authorization: `Bot ${botToken}` },
|
|
4728
4682
|
retries: 3
|
|
4729
4683
|
});
|
|
4730
4684
|
if (!response.data) throw new platformProxy.ActionError({
|
|
@@ -4823,14 +4777,10 @@ function getGuildMemberTool(proxy) {
|
|
|
4823
4777
|
outputSchema: getGuildMemberOutputSchema,
|
|
4824
4778
|
execute: async (input, { requestContext }) => {
|
|
4825
4779
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4826
|
-
const
|
|
4827
|
-
if (!metadata?.botToken) throw new platformProxy.ActionError({
|
|
4828
|
-
type: "invalid_metadata",
|
|
4829
|
-
message: "botToken is required in metadata."
|
|
4830
|
-
});
|
|
4780
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4831
4781
|
const response = await platformProxy.get({
|
|
4832
4782
|
endpoint: `/api/v10/guilds/${input.guild_id}/members/${input.user_id}`,
|
|
4833
|
-
headers: { Authorization: `Bot ${
|
|
4783
|
+
headers: { Authorization: `Bot ${botToken}` },
|
|
4834
4784
|
retries: 3
|
|
4835
4785
|
});
|
|
4836
4786
|
if (response.status === 404) throw new platformProxy.ActionError({
|
|
@@ -4873,11 +4823,7 @@ function getGuildTool(proxy) {
|
|
|
4873
4823
|
outputSchema: getGuildOutputSchema,
|
|
4874
4824
|
execute: async (input, { requestContext }) => {
|
|
4875
4825
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4876
|
-
const botToken =
|
|
4877
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
4878
|
-
type: "invalid_metadata",
|
|
4879
|
-
message: "botToken is required in metadata. Please configure the bot token from Discord Developer Portal."
|
|
4880
|
-
});
|
|
4826
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4881
4827
|
const response = await platformProxy.get({
|
|
4882
4828
|
endpoint: `/api/v10/guilds/${input.guildId}`,
|
|
4883
4829
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -4988,14 +4934,10 @@ function getMessageTool$1(proxy) {
|
|
|
4988
4934
|
outputSchema: getMessageOutputSchema$1,
|
|
4989
4935
|
execute: async (input, { requestContext }) => {
|
|
4990
4936
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
4991
|
-
const
|
|
4992
|
-
if (!metadata?.botToken) throw new platformProxy.ActionError({
|
|
4993
|
-
type: "invalid_metadata",
|
|
4994
|
-
message: "botToken is required in metadata."
|
|
4995
|
-
});
|
|
4937
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
4996
4938
|
const response = await platformProxy.get({
|
|
4997
4939
|
endpoint: `/api/v10/channels/${input.channelId}/messages/${input.messageId}`,
|
|
4998
|
-
headers: { Authorization: `Bot ${
|
|
4940
|
+
headers: { Authorization: `Bot ${botToken}` },
|
|
4999
4941
|
retries: 3
|
|
5000
4942
|
});
|
|
5001
4943
|
if (!response.data) throw new platformProxy.ActionError({
|
|
@@ -5106,14 +5048,10 @@ function getRoleTool(proxy) {
|
|
|
5106
5048
|
outputSchema: getRoleOutputSchema,
|
|
5107
5049
|
execute: async (input, { requestContext }) => {
|
|
5108
5050
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
5109
|
-
const
|
|
5110
|
-
if (!metadata?.botToken) throw new platformProxy.ActionError({
|
|
5111
|
-
type: "invalid_metadata",
|
|
5112
|
-
message: "botToken is required in metadata."
|
|
5113
|
-
});
|
|
5051
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
5114
5052
|
const response = await platformProxy.get({
|
|
5115
5053
|
endpoint: `/api/v10/guilds/${input.guild_id}/roles/${input.role_id}`,
|
|
5116
|
-
headers: { Authorization: `Bot ${
|
|
5054
|
+
headers: { Authorization: `Bot ${botToken}` },
|
|
5117
5055
|
retries: 3
|
|
5118
5056
|
});
|
|
5119
5057
|
if (!response.data) throw new platformProxy.ActionError({
|
|
@@ -5188,14 +5126,10 @@ function getWebhookTool$1(proxy) {
|
|
|
5188
5126
|
outputSchema: getWebhookOutputSchema$1,
|
|
5189
5127
|
execute: async (input, { requestContext }) => {
|
|
5190
5128
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
5191
|
-
const
|
|
5192
|
-
if (!metadata?.botToken) throw new platformProxy.ActionError({
|
|
5193
|
-
type: "invalid_metadata",
|
|
5194
|
-
message: "botToken is required in connection metadata."
|
|
5195
|
-
});
|
|
5129
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
5196
5130
|
const response = await platformProxy.get({
|
|
5197
5131
|
endpoint: `/api/v10/webhooks/${input.webhookId}`,
|
|
5198
|
-
headers: { Authorization: `Bot ${
|
|
5132
|
+
headers: { Authorization: `Bot ${botToken}` },
|
|
5199
5133
|
retries: 3
|
|
5200
5134
|
});
|
|
5201
5135
|
if (!response.data) throw new platformProxy.ActionError({
|
|
@@ -5266,7 +5200,7 @@ function listChannelsTool$2(proxy) {
|
|
|
5266
5200
|
outputSchema: listChannelsOutputSchema$2,
|
|
5267
5201
|
execute: async (input, { requestContext }) => {
|
|
5268
5202
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
5269
|
-
const botToken =
|
|
5203
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
5270
5204
|
if (!botToken) throw new platformProxy.ActionError({
|
|
5271
5205
|
type: "invalid_metadata",
|
|
5272
5206
|
message: "botToken is required in metadata. Please configure the Discord connection with a bot token from your Discord application settings."
|
|
@@ -5359,12 +5293,7 @@ function listGuildMembersTool(proxy) {
|
|
|
5359
5293
|
outputSchema: listGuildMembersOutputSchema,
|
|
5360
5294
|
execute: async (input, { requestContext }) => {
|
|
5361
5295
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
5362
|
-
const
|
|
5363
|
-
const parsedMetadata = z.object({ botToken: z.string() }).safeParse(metadata);
|
|
5364
|
-
if (!parsedMetadata.success) throw new platformProxy.ActionError({
|
|
5365
|
-
type: "missing_bot_token",
|
|
5366
|
-
message: "botToken is required in connection metadata."
|
|
5367
|
-
});
|
|
5296
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
5368
5297
|
const limit = input.limit ?? 100;
|
|
5369
5298
|
const response = await platformProxy.get({
|
|
5370
5299
|
endpoint: `/api/v10/guilds/${input.guild_id}/members`,
|
|
@@ -5372,7 +5301,7 @@ function listGuildMembersTool(proxy) {
|
|
|
5372
5301
|
limit: String(limit),
|
|
5373
5302
|
...input.after !== void 0 && { after: input.after }
|
|
5374
5303
|
},
|
|
5375
|
-
headers: { Authorization: `Bot ${
|
|
5304
|
+
headers: { Authorization: `Bot ${botToken}` },
|
|
5376
5305
|
retries: 3
|
|
5377
5306
|
});
|
|
5378
5307
|
const rawMembers = z.array(z.unknown()).parse(response.data);
|
|
@@ -5442,11 +5371,7 @@ function listGuildsTool(proxy) {
|
|
|
5442
5371
|
outputSchema: listGuildsOutputSchema,
|
|
5443
5372
|
execute: async (input, { requestContext }) => {
|
|
5444
5373
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
5445
|
-
const botToken =
|
|
5446
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
5447
|
-
type: "invalid_metadata",
|
|
5448
|
-
message: "botToken is required in metadata."
|
|
5449
|
-
});
|
|
5374
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
5450
5375
|
const limit = input.limit ?? 200;
|
|
5451
5376
|
const response = await platformProxy.get({
|
|
5452
5377
|
endpoint: "/api/v10/users/@me/guilds",
|
|
@@ -5565,7 +5490,7 @@ function listMessagesTool$1(proxy) {
|
|
|
5565
5490
|
outputSchema: listMessagesOutputSchema$1,
|
|
5566
5491
|
execute: async (input, { requestContext }) => {
|
|
5567
5492
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
5568
|
-
const botToken =
|
|
5493
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
5569
5494
|
if (!botToken) throw new platformProxy.ActionError({
|
|
5570
5495
|
type: "missing_bot_token",
|
|
5571
5496
|
message: "Bot token is required in connection metadata. Please configure the bot token in your Nango connection."
|
|
@@ -5680,11 +5605,7 @@ function listRolesTool$1(proxy) {
|
|
|
5680
5605
|
outputSchema: listRolesOutputSchema$1,
|
|
5681
5606
|
execute: async (input, { requestContext }) => {
|
|
5682
5607
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
5683
|
-
const botToken =
|
|
5684
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
5685
|
-
type: "invalid_metadata",
|
|
5686
|
-
message: "botToken is required in metadata."
|
|
5687
|
-
});
|
|
5608
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
5688
5609
|
const response = await platformProxy.get({
|
|
5689
5610
|
endpoint: `/api/v10/guilds/${input.guild_id}/roles`,
|
|
5690
5611
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -5744,7 +5665,6 @@ const WebhookSchema = z.object({
|
|
|
5744
5665
|
url: z.string().optional()
|
|
5745
5666
|
});
|
|
5746
5667
|
const listWebhooksOutputSchema$1 = z.object({ webhooks: z.array(WebhookSchema) });
|
|
5747
|
-
z.object({ botToken: z.string() });
|
|
5748
5668
|
function listWebhooksTool$1(proxy) {
|
|
5749
5669
|
return createTool({
|
|
5750
5670
|
id: "discord_list_webhooks",
|
|
@@ -5753,14 +5673,10 @@ function listWebhooksTool$1(proxy) {
|
|
|
5753
5673
|
outputSchema: listWebhooksOutputSchema$1,
|
|
5754
5674
|
execute: async (input, { requestContext }) => {
|
|
5755
5675
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
5756
|
-
const
|
|
5757
|
-
if (!metadata?.botToken) throw new platformProxy.ActionError({
|
|
5758
|
-
type: "missing_bot_token",
|
|
5759
|
-
message: "Bot token is required in connection metadata."
|
|
5760
|
-
});
|
|
5676
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
5761
5677
|
const response = await platformProxy.get({
|
|
5762
5678
|
endpoint: `/api/v10/channels/${input.channelId}/webhooks`,
|
|
5763
|
-
headers: { Authorization: `Bot ${
|
|
5679
|
+
headers: { Authorization: `Bot ${botToken}` },
|
|
5764
5680
|
retries: 3
|
|
5765
5681
|
});
|
|
5766
5682
|
return { webhooks: z.array(WebhookSchema).parse(response.data) };
|
|
@@ -5788,11 +5704,7 @@ function removeGuildMemberRoleTool(proxy) {
|
|
|
5788
5704
|
outputSchema: removeGuildMemberRoleOutputSchema,
|
|
5789
5705
|
execute: async (input, { requestContext }) => {
|
|
5790
5706
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
5791
|
-
const botToken =
|
|
5792
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
5793
|
-
type: "missing_bot_token",
|
|
5794
|
-
message: "Bot token is required in metadata. Please configure the botToken in your connection metadata."
|
|
5795
|
-
});
|
|
5707
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
5796
5708
|
const response = await platformProxy.delete({
|
|
5797
5709
|
endpoint: `/api/v10/guilds/${input.guild_id}/members/${input.user_id}/roles/${input.role_id}`,
|
|
5798
5710
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -5858,7 +5770,6 @@ const ProviderChannelSchema$7 = z.object({
|
|
|
5858
5770
|
default_auto_archive_duration: z.number().int().optional(),
|
|
5859
5771
|
flags: z.number().int().optional()
|
|
5860
5772
|
});
|
|
5861
|
-
const MetadataSchema$4 = z.object({ botToken: z.string() });
|
|
5862
5773
|
const updateChannelOutputSchema$1 = z.object({
|
|
5863
5774
|
id: z.string(),
|
|
5864
5775
|
type: z.number().int(),
|
|
@@ -5889,12 +5800,7 @@ function updateChannelTool$1(proxy) {
|
|
|
5889
5800
|
outputSchema: updateChannelOutputSchema$1,
|
|
5890
5801
|
execute: async (input, { requestContext }) => {
|
|
5891
5802
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
5892
|
-
const
|
|
5893
|
-
const metadata = MetadataSchema$4.safeParse(rawMetadata);
|
|
5894
|
-
if (!metadata.success || !metadata.data.botToken) throw new platformProxy.ActionError({
|
|
5895
|
-
type: "invalid_metadata",
|
|
5896
|
-
message: "botToken is required in metadata. Please set the Discord bot token in the connection metadata."
|
|
5897
|
-
});
|
|
5803
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
5898
5804
|
const updateData = {};
|
|
5899
5805
|
if (input["name"] !== void 0) updateData["name"] = input["name"];
|
|
5900
5806
|
if (input["type"] !== void 0) updateData["type"] = input["type"];
|
|
@@ -5910,7 +5816,7 @@ function updateChannelTool$1(proxy) {
|
|
|
5910
5816
|
if (input["flags"] !== void 0) updateData["flags"] = input["flags"];
|
|
5911
5817
|
const response = await platformProxy.patch({
|
|
5912
5818
|
endpoint: `/api/v10/channels/${input.channel_id}`,
|
|
5913
|
-
headers: { Authorization: `Bot ${
|
|
5819
|
+
headers: { Authorization: `Bot ${botToken}` },
|
|
5914
5820
|
data: updateData,
|
|
5915
5821
|
retries: 10
|
|
5916
5822
|
});
|
|
@@ -6018,11 +5924,7 @@ function updateGuildMemberTool(proxy) {
|
|
|
6018
5924
|
outputSchema: updateGuildMemberOutputSchema,
|
|
6019
5925
|
execute: async (input, { requestContext }) => {
|
|
6020
5926
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
6021
|
-
const
|
|
6022
|
-
if (!metadata?.botToken) throw new platformProxy.ActionError({
|
|
6023
|
-
type: "invalid_metadata",
|
|
6024
|
-
message: "botToken is required in metadata. Please provide the bot token from your Discord application."
|
|
6025
|
-
});
|
|
5927
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
6026
5928
|
const body = {};
|
|
6027
5929
|
if (input["nick"] !== void 0) body["nick"] = input["nick"];
|
|
6028
5930
|
if (input["roles"] !== void 0) body["roles"] = input["roles"];
|
|
@@ -6031,7 +5933,7 @@ function updateGuildMemberTool(proxy) {
|
|
|
6031
5933
|
if (input["channel_id"] !== void 0) body["channel_id"] = input["channel_id"];
|
|
6032
5934
|
if (input["communication_disabled_until"] !== void 0) body["communication_disabled_until"] = input["communication_disabled_until"];
|
|
6033
5935
|
if (input["flags"] !== void 0) body["flags"] = input["flags"];
|
|
6034
|
-
const headers = { Authorization: `Bot ${
|
|
5936
|
+
const headers = { Authorization: `Bot ${botToken}` };
|
|
6035
5937
|
if (input.reason) headers["X-Audit-Log-Reason"] = input.reason;
|
|
6036
5938
|
if (input["user_id"] === "@me") {
|
|
6037
5939
|
const currentMemberBody = {};
|
|
@@ -6082,7 +5984,6 @@ function updateGuildMemberTool(proxy) {
|
|
|
6082
5984
|
}
|
|
6083
5985
|
//#endregion
|
|
6084
5986
|
//#region src/providers/discord/tools/update-guild.ts
|
|
6085
|
-
z.object({ botToken: z.string() });
|
|
6086
5987
|
const updateGuildInputSchema = z.object({
|
|
6087
5988
|
guild_id: z.string().describe("Guild ID to update. Example: \"197038439483310086\""),
|
|
6088
5989
|
name: z.string().min(2).max(100).optional().describe("Guild name (2-100 characters)"),
|
|
@@ -6138,11 +6039,7 @@ function updateGuildTool(proxy) {
|
|
|
6138
6039
|
outputSchema: updateGuildOutputSchema,
|
|
6139
6040
|
execute: async (input, { requestContext }) => {
|
|
6140
6041
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
6141
|
-
const
|
|
6142
|
-
if (!metadata?.botToken) throw new platformProxy.ActionError({
|
|
6143
|
-
type: "invalid_metadata",
|
|
6144
|
-
message: "botToken is required in metadata."
|
|
6145
|
-
});
|
|
6042
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
6146
6043
|
const payload = {};
|
|
6147
6044
|
if (input.name !== void 0) payload["name"] = input.name;
|
|
6148
6045
|
if (input.region !== void 0) payload["region"] = input.region;
|
|
@@ -6167,7 +6064,7 @@ function updateGuildTool(proxy) {
|
|
|
6167
6064
|
if (input.safety_alerts_channel_id !== void 0) payload["safety_alerts_channel_id"] = input.safety_alerts_channel_id;
|
|
6168
6065
|
const response = await platformProxy.patch({
|
|
6169
6066
|
endpoint: `/api/v10/guilds/${input.guild_id}`,
|
|
6170
|
-
headers: { Authorization: `Bot ${
|
|
6067
|
+
headers: { Authorization: `Bot ${botToken}` },
|
|
6171
6068
|
data: payload,
|
|
6172
6069
|
retries: 3
|
|
6173
6070
|
});
|
|
@@ -6276,13 +6173,7 @@ function updateMessageTool$1(proxy) {
|
|
|
6276
6173
|
outputSchema: updateMessageOutputSchema$1,
|
|
6277
6174
|
execute: async (input, { requestContext }) => {
|
|
6278
6175
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
6279
|
-
const
|
|
6280
|
-
const parsedMetadata = z.object({ botToken: z.string() }).safeParse(metadata);
|
|
6281
|
-
if (!parsedMetadata.success) throw new platformProxy.ActionError({
|
|
6282
|
-
type: "invalid_metadata",
|
|
6283
|
-
message: "botToken is required in metadata."
|
|
6284
|
-
});
|
|
6285
|
-
const botToken = parsedMetadata.data.botToken;
|
|
6176
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
6286
6177
|
const response = await platformProxy.patch({
|
|
6287
6178
|
endpoint: `/api/v10/channels/${input.channel_id}/messages/${input.message_id}`,
|
|
6288
6179
|
headers: { Authorization: `Bot ${botToken}` },
|
|
@@ -6368,11 +6259,7 @@ function updateRoleTool(proxy) {
|
|
|
6368
6259
|
outputSchema: updateRoleOutputSchema,
|
|
6369
6260
|
execute: async (input, { requestContext }) => {
|
|
6370
6261
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
6371
|
-
const botToken =
|
|
6372
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
6373
|
-
type: "invalid_metadata",
|
|
6374
|
-
message: "botToken is required in metadata."
|
|
6375
|
-
});
|
|
6262
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
6376
6263
|
if (input.icon !== void 0 && input.icon !== null && input.unicodeEmoji !== void 0 && input.unicodeEmoji !== null) throw new platformProxy.ActionError({
|
|
6377
6264
|
type: "invalid_input",
|
|
6378
6265
|
message: "icon and unicodeEmoji are mutually exclusive; provide at most one."
|
|
@@ -6455,12 +6342,7 @@ function updateWebhookTool$1(proxy) {
|
|
|
6455
6342
|
outputSchema: updateWebhookOutputSchema$1,
|
|
6456
6343
|
execute: async (input, { requestContext }) => {
|
|
6457
6344
|
const platformProxy = proxy.withRequestContext(requestContext);
|
|
6458
|
-
const
|
|
6459
|
-
const botToken = metadata && typeof metadata === "object" && "botToken" in metadata && typeof metadata.botToken === "string" ? metadata.botToken : void 0;
|
|
6460
|
-
if (!botToken) throw new platformProxy.ActionError({
|
|
6461
|
-
type: "invalid_metadata",
|
|
6462
|
-
message: "botToken is required in metadata."
|
|
6463
|
-
});
|
|
6345
|
+
const botToken = await resolveDiscordBotToken(platformProxy);
|
|
6464
6346
|
const requestBody = {};
|
|
6465
6347
|
if (input.name !== void 0) requestBody["name"] = input.name;
|
|
6466
6348
|
if (input.avatar !== void 0) requestBody["avatar"] = input.avatar;
|