mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 17:14:50 +00:00
feat: allow bulk deleting attribution groups for moderators (#6839)
* feat: allow bulk deleting attribution groups for moderators * prepr
This commit is contained in:
@@ -65,17 +65,34 @@ export class LabrinthAttributionInternalModule extends AbstractModule {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an attribution group and all files inside it.
|
||||
* DELETE /_internal/attribution/group/{group_id}
|
||||
* Delete attribution groups and all files inside them.
|
||||
* DELETE /_internal/attribution/group
|
||||
*
|
||||
* @param groupId - The base62 attribution group id (as returned from listProjectAttribution).
|
||||
* @param groupIds - The base62 attribution group ids (as returned from listProjectAttribution).
|
||||
*/
|
||||
public async deleteGroup(groupId: string): Promise<void> {
|
||||
const numericId = decodeBase62Id(groupId)
|
||||
return this.client.request<void>(`/attribution/group/${numericId}`, {
|
||||
public async deleteGroups(groupIds: string[]): Promise<void> {
|
||||
const body: Labrinth.Attribution.Internal.DeleteGroupsRequest = { groups: groupIds }
|
||||
return this.client.request<void>('/attribution/group', {
|
||||
api: 'labrinth',
|
||||
version: 'internal',
|
||||
method: 'DELETE',
|
||||
body,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all attribution groups and files for a project.
|
||||
* DELETE /_internal/attribution/all-groups
|
||||
*/
|
||||
public async deleteAllGroups(projectId: string): Promise<void> {
|
||||
const body: Labrinth.Attribution.Internal.DeleteAllGroupsRequest = {
|
||||
project_id: projectId,
|
||||
}
|
||||
return this.client.request<void>('/attribution/all-groups', {
|
||||
api: 'labrinth',
|
||||
version: 'internal',
|
||||
method: 'DELETE',
|
||||
body,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -397,6 +397,14 @@ export namespace Labrinth {
|
||||
attribution: AttributionResolution
|
||||
}
|
||||
|
||||
export type DeleteGroupsRequest = {
|
||||
groups: string[]
|
||||
}
|
||||
|
||||
export type DeleteAllGroupsRequest = {
|
||||
project_id: string
|
||||
}
|
||||
|
||||
export type AssignRequest = {
|
||||
sha1: string
|
||||
target_group_id: number
|
||||
|
||||
Reference in New Issue
Block a user