-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): Add support for role connections (#8930)
- Loading branch information
1 parent
273ba45
commit 3d6fa24
Showing
6 changed files
with
94 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { REST } from '@discordjs/rest'; | ||
import { | ||
Routes, | ||
type RESTGetAPIApplicationRoleConnectionMetadataResult, | ||
type RESTPutAPIApplicationRoleConnectionMetadataResult, | ||
type RESTPutAPIApplicationCommandPermissionsJSONBody, | ||
type Snowflake, | ||
} from 'discord-api-types/v10'; | ||
|
||
export class RoleConnectionsAPI { | ||
public constructor(private readonly rest: REST) {} | ||
|
||
/** | ||
* Gets the role connection metadata records for the application | ||
* | ||
* @see {@link https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records} | ||
* @param applicationId - The id of the application to get role connection metadata records for | ||
*/ | ||
public async getMetadataRecords(applicationId: Snowflake) { | ||
return this.rest.get( | ||
Routes.applicationRoleConnectionMetadata(applicationId), | ||
) as Promise<RESTGetAPIApplicationRoleConnectionMetadataResult>; | ||
} | ||
|
||
/** | ||
* Updates the role connection metadata records for the application | ||
* | ||
* @see {@link https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records} | ||
* @param applicationId - The id of the application to update role connection metadata records for | ||
* @param options - The new role connection metadata records | ||
*/ | ||
public async updateMetadataRecords( | ||
applicationId: Snowflake, | ||
options: RESTPutAPIApplicationCommandPermissionsJSONBody, | ||
) { | ||
return this.rest.put(Routes.applicationRoleConnectionMetadata(applicationId), { | ||
body: options, | ||
}) as Promise<RESTPutAPIApplicationRoleConnectionMetadataResult>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters