mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
feat(types,rest,bot): Add ApplicationRoleConnectionMetadata types (#4125)
* add applicationRoleConnectionMetadata types * Update packages/rest/src/manager.ts Co-authored-by: LTS (Link) <lts20050703@gmail.com> * Update packages/rest/src/manager.ts Co-authored-by: LTS (Link) <lts20050703@gmail.com> --------- Co-authored-by: LTS (Link) <lts20050703@gmail.com>
This commit is contained in:
@@ -32,6 +32,7 @@ import type {
|
|||||||
DiscordActivityInstance,
|
DiscordActivityInstance,
|
||||||
DiscordApplicationCommandPermissions,
|
DiscordApplicationCommandPermissions,
|
||||||
DiscordApplicationRoleConnection,
|
DiscordApplicationRoleConnection,
|
||||||
|
DiscordApplicationRoleConnectionMetadata,
|
||||||
DiscordArchivedThreads,
|
DiscordArchivedThreads,
|
||||||
DiscordAuditLog,
|
DiscordAuditLog,
|
||||||
DiscordBan,
|
DiscordBan,
|
||||||
@@ -600,6 +601,12 @@ export function createBotHelpers<TProps extends TransformersDesiredProperties, T
|
|||||||
getApplicationActivityInstance: async (applicationId, instanceId) => {
|
getApplicationActivityInstance: async (applicationId, instanceId) => {
|
||||||
return await bot.rest.getApplicationActivityInstance(applicationId, instanceId)
|
return await bot.rest.getApplicationActivityInstance(applicationId, instanceId)
|
||||||
},
|
},
|
||||||
|
listApplicationRoleConnectionsMetadataRecords: async (applicationId) => {
|
||||||
|
return await bot.rest.listApplicationRoleConnectionsMetadataRecords(applicationId)
|
||||||
|
},
|
||||||
|
updateApplicationRoleConnectionsMetadataRecords: async (applicationId, options) => {
|
||||||
|
return await bot.rest.updateApplicationRoleConnectionsMetadataRecords(applicationId, options)
|
||||||
|
},
|
||||||
// All useless void return functions here
|
// All useless void return functions here
|
||||||
addReaction: async (channelId, messageId, reaction) => {
|
addReaction: async (channelId, messageId, reaction) => {
|
||||||
return await bot.rest.addReaction(channelId, messageId, reaction)
|
return await bot.rest.addReaction(channelId, messageId, reaction)
|
||||||
@@ -1063,6 +1070,11 @@ export type BotHelpers<TProps extends TransformersDesiredProperties, TBehavior e
|
|||||||
) => Promise<SetupDesiredProps<Member, TProps, TBehavior>[]>
|
) => Promise<SetupDesiredProps<Member, TProps, TBehavior>[]>
|
||||||
bulkBanMembers: (guildId: BigString, options: CreateGuildBulkBan, reason?: string) => Promise<{ bannedUsers: bigint[]; failedUsers: bigint[] }>
|
bulkBanMembers: (guildId: BigString, options: CreateGuildBulkBan, reason?: string) => Promise<{ bannedUsers: bigint[]; failedUsers: bigint[] }>
|
||||||
getApplicationActivityInstance: (applicationId: BigString, instanceId: string) => Promise<Camelize<DiscordActivityInstance>>
|
getApplicationActivityInstance: (applicationId: BigString, instanceId: string) => Promise<Camelize<DiscordActivityInstance>>
|
||||||
|
listApplicationRoleConnectionsMetadataRecords: (applicationId: BigString) => Promise<Camelize<DiscordApplicationRoleConnectionMetadata>[]>
|
||||||
|
updateApplicationRoleConnectionsMetadataRecords: (
|
||||||
|
applicationId: BigString,
|
||||||
|
options: Camelize<DiscordApplicationRoleConnectionMetadata>[],
|
||||||
|
) => Promise<Camelize<DiscordApplicationRoleConnectionMetadata>[]>
|
||||||
// functions return Void so dont need any special handling
|
// functions return Void so dont need any special handling
|
||||||
addReaction: (channelId: BigString, messageId: BigString, reaction: string) => Promise<void>
|
addReaction: (channelId: BigString, messageId: BigString, reaction: string) => Promise<void>
|
||||||
addReactions: (channelId: BigString, messageId: BigString, reactions: string[], ordered?: boolean) => Promise<void>
|
addReactions: (channelId: BigString, messageId: BigString, reactions: string[], ordered?: boolean) => Promise<void>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
type DiscordApplication,
|
type DiscordApplication,
|
||||||
type DiscordApplicationCommand,
|
type DiscordApplicationCommand,
|
||||||
type DiscordApplicationRoleConnection,
|
type DiscordApplicationRoleConnection,
|
||||||
|
type DiscordApplicationRoleConnectionMetadata,
|
||||||
type DiscordAuditLog,
|
type DiscordAuditLog,
|
||||||
type DiscordAutoModerationRule,
|
type DiscordAutoModerationRule,
|
||||||
type DiscordBan,
|
type DiscordBan,
|
||||||
@@ -1699,6 +1700,16 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async listApplicationRoleConnectionsMetadataRecords(applicationId) {
|
||||||
|
return await rest.get<DiscordApplicationRoleConnectionMetadata[]>(rest.routes.applicationRoleConnectionMetadata(applicationId))
|
||||||
|
},
|
||||||
|
|
||||||
|
async updateApplicationRoleConnectionsMetadataRecords(applicationId, options) {
|
||||||
|
return await rest.put<DiscordApplicationRoleConnectionMetadata[]>(rest.routes.applicationRoleConnectionMetadata(applicationId), {
|
||||||
|
body: options,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
preferSnakeCase(enabled: boolean) {
|
preferSnakeCase(enabled: boolean) {
|
||||||
const camelizer = enabled ? (x: any) => x : camelize
|
const camelizer = enabled ? (x: any) => x : camelize
|
||||||
|
|
||||||
|
|||||||
@@ -638,6 +638,10 @@ export function createRoutes(): RestRoutes {
|
|||||||
return `/applications/${applicationId}/emojis`
|
return `/applications/${applicationId}/emojis`
|
||||||
},
|
},
|
||||||
|
|
||||||
|
applicationRoleConnectionMetadata(applicationId) {
|
||||||
|
return `/applications/${applicationId}/role-connections/metadata`
|
||||||
|
},
|
||||||
|
|
||||||
// User endpoints
|
// User endpoints
|
||||||
user(userId) {
|
user(userId) {
|
||||||
return `/users/${userId}`
|
return `/users/${userId}`
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import type {
|
|||||||
DiscordApplicationCommand,
|
DiscordApplicationCommand,
|
||||||
DiscordApplicationCommandPermissions,
|
DiscordApplicationCommandPermissions,
|
||||||
DiscordApplicationRoleConnection,
|
DiscordApplicationRoleConnection,
|
||||||
|
DiscordApplicationRoleConnectionMetadata,
|
||||||
DiscordArchivedThreads,
|
DiscordArchivedThreads,
|
||||||
DiscordAuditLog,
|
DiscordAuditLog,
|
||||||
DiscordAutoModerationRule,
|
DiscordAutoModerationRule,
|
||||||
@@ -3137,6 +3138,27 @@ export interface RestManager {
|
|||||||
* For other sounds, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
|
* For other sounds, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
|
||||||
*/
|
*/
|
||||||
deleteGuildSoundboardSound: (guildId: BigString, soundId: BigString, reason?: string) => Promise<void>
|
deleteGuildSoundboardSound: (guildId: BigString, soundId: BigString, reason?: string) => Promise<void>
|
||||||
|
/**
|
||||||
|
* Returns a list of application role connection metadata objects for the given application.
|
||||||
|
*
|
||||||
|
* @param applicationId - The application to get the role connections from
|
||||||
|
* @returns A list of application role connection metadata objects
|
||||||
|
*/
|
||||||
|
listApplicationRoleConnectionsMetadataRecords: (applicationId: BigString) => Promise<Camelize<DiscordApplicationRoleConnectionMetadata>[]>
|
||||||
|
/**
|
||||||
|
* Updates and returns a list of application role connection metadata objects for the given application.
|
||||||
|
*
|
||||||
|
* @param applicationId - The application to get the role connections from
|
||||||
|
* @param options - The options to update the role connections
|
||||||
|
* @returns A list of application role connection metadata objects
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* An application can have a maximum of 5 metadata records.
|
||||||
|
*/
|
||||||
|
updateApplicationRoleConnectionsMetadataRecords: (
|
||||||
|
applicationId: BigString,
|
||||||
|
options: Camelize<DiscordApplicationRoleConnectionMetadata>[],
|
||||||
|
) => Promise<Camelize<DiscordApplicationRoleConnectionMetadata>[]>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RequestMethods = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'PUT'
|
export type RequestMethods = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'PUT'
|
||||||
|
|||||||
@@ -295,6 +295,8 @@ export interface RestRoutes {
|
|||||||
}
|
}
|
||||||
/** Route to list / create an application emoji */
|
/** Route to list / create an application emoji */
|
||||||
applicationEmojis: (applicationId: BigString) => string
|
applicationEmojis: (applicationId: BigString) => string
|
||||||
|
/** Route to list / update application role connection metadata records */
|
||||||
|
applicationRoleConnectionMetadata: (applicationId: BigString) => string
|
||||||
/** Route to get / edit / delete an application emoji */
|
/** Route to get / edit / delete an application emoji */
|
||||||
applicationEmoji: (applicationId: BigString, emojiId: BigString) => string
|
applicationEmoji: (applicationId: BigString, emojiId: BigString) => string
|
||||||
/** Get information about the current OAuth2 user / bot user. If used with a OAuth2 token requires the `identify` OAuth2 scope */
|
/** Get information about the current OAuth2 user / bot user. If used with a OAuth2 token requires the `identify` OAuth2 scope */
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/** Types for: https://discord.com/developers/docs/resources/application-role-connection-metadata */
|
||||||
|
|
||||||
|
import type { Localization } from './reference.js'
|
||||||
|
|
||||||
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-structure */
|
||||||
|
export interface DiscordApplicationRoleConnectionMetadata {
|
||||||
|
/** Type of metadata value */
|
||||||
|
type: DiscordApplicationRoleConnectionMetadataType
|
||||||
|
/**
|
||||||
|
* Dictionary key for the metadata field
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* Must be a-z, 0-9, or _ characters; 1-50 characters
|
||||||
|
*/
|
||||||
|
key: string
|
||||||
|
/**
|
||||||
|
* Name of the metadata field
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* 1-100 characters
|
||||||
|
*/
|
||||||
|
name: string
|
||||||
|
/** Translations of the name */
|
||||||
|
name_localizations?: Localization
|
||||||
|
/**
|
||||||
|
* Description of the metadata field
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* 1-200 characters
|
||||||
|
*/
|
||||||
|
description: string
|
||||||
|
/** Translations of the description */
|
||||||
|
description_localizations: Localization
|
||||||
|
}
|
||||||
|
|
||||||
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-type */
|
||||||
|
export enum DiscordApplicationRoleConnectionMetadataType {
|
||||||
|
/** The metadata value (integer) is less than or equal to the guild's configured value (integer) */
|
||||||
|
IntegerLessThanOrEqual = 1,
|
||||||
|
/** The metadata value (integer) is greater than or equal to the guild's configured value (integer) */
|
||||||
|
IntegerGreaterThanOrEqual = 2,
|
||||||
|
/** The metadata value (integer) is equal to the guild's configured value (integer) */
|
||||||
|
IntegerEqual = 3,
|
||||||
|
/** The metadata value (integer) is not equal to the guild's configured value (integer) */
|
||||||
|
IntegerNotEqual = 4,
|
||||||
|
/** The metadata value (ISO8601 string) is less than or equal to the guild's configured value (integer; days before current date) */
|
||||||
|
DatetimeLessThanOrEqual = 5,
|
||||||
|
/** The metadata value (ISO8601 string) is greater than or equal to the guild's configured value (integer; days before current date) */
|
||||||
|
DatetimeGreaterThanOrEqual = 6,
|
||||||
|
/** The metadata value (integer) is equal to the guild's configured value (integer; 1) */
|
||||||
|
BooleanEqual = 7,
|
||||||
|
/** The metadata value (integer) is not equal to the guild's configured value (integer; 1) */
|
||||||
|
BooleanNotEqual = 8,
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
export * from './discord/application.js'
|
export * from './discord/application.js'
|
||||||
|
export * from './discord/applicationRoleConnectionMetadata.js'
|
||||||
export * from './discord/auditLog.js'
|
export * from './discord/auditLog.js'
|
||||||
export * from './discord/autoModeration.js'
|
export * from './discord/autoModeration.js'
|
||||||
export * from './discord/channel.js'
|
export * from './discord/channel.js'
|
||||||
|
|||||||
Reference in New Issue
Block a user