mirror of
https://github.com/modrinth/code.git
synced 2026-08-31 03:55:59 +00:00
update archiving, move general project settings to v3 (start redesign there), use project id lookups for stable cache keys, advanced in server search
This commit is contained in:
@@ -223,6 +223,70 @@ export class LabrinthProjectsV3Module extends AbstractModule {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a gallery image for a project
|
||||
*
|
||||
* @param id - Project ID or slug
|
||||
* @param file - Image file to upload
|
||||
* @param options - Gallery image options
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* await client.labrinth.projects_v3.createGalleryImage('sodium', imageFile, {
|
||||
* featured: true,
|
||||
* name: 'Screenshot 1',
|
||||
* description: 'Main menu with Sodium enabled'
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
public async createGalleryImage(
|
||||
id: string,
|
||||
file: Blob,
|
||||
options: {
|
||||
ext: string
|
||||
featured: boolean
|
||||
name?: string
|
||||
description?: string
|
||||
ordering?: number
|
||||
},
|
||||
): Promise<void> {
|
||||
const params: Record<string, string> = {
|
||||
ext: options.ext,
|
||||
featured: String(options.featured),
|
||||
}
|
||||
if (options.name) params.name = options.name
|
||||
if (options.description) params.description = options.description
|
||||
if (options.ordering !== undefined) params.ordering = String(options.ordering)
|
||||
|
||||
return this.client.request(`/project/${id}/gallery`, {
|
||||
api: 'labrinth',
|
||||
version: 3,
|
||||
method: 'POST',
|
||||
params,
|
||||
body: file,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a gallery image from a project
|
||||
*
|
||||
* @param id - Project ID or slug
|
||||
* @param url - URL of the gallery image to delete
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* await client.labrinth.projects_v3.deleteGalleryImage('sodium', 'https://cdn.modrinth.com/...')
|
||||
* ```
|
||||
*/
|
||||
public async deleteGalleryImage(id: string, url: string): Promise<void> {
|
||||
return this.client.request(`/project/${id}/gallery`, {
|
||||
api: 'labrinth',
|
||||
version: 3,
|
||||
method: 'DELETE',
|
||||
params: { url },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content disclosures for a project
|
||||
*
|
||||
|
||||
@@ -1343,6 +1343,10 @@ export namespace Labrinth {
|
||||
type: 'paid_features'
|
||||
features: string[]
|
||||
}
|
||||
| {
|
||||
type: 'archived'
|
||||
note?: string | null
|
||||
}
|
||||
|
||||
export type ProjectDisclosureData = ProjectDisclosure & {
|
||||
set_by_moderator: boolean
|
||||
|
||||
Reference in New Issue
Block a user