implement functionality with staging api

This commit is contained in:
Prospector
2026-08-02 16:52:19 -07:00
parent 21a31b337f
commit 57be502f99
26 changed files with 1620 additions and 385 deletions
@@ -222,4 +222,52 @@ export class LabrinthProjectsV3Module extends AbstractModule {
method: 'DELETE',
})
}
/**
* Get content disclosures for a project
*
* @param id - Project ID or slug
* @returns Promise resolving to the project's disclosures
*
* @example
* ```typescript
* const { disclosures } = await client.labrinth.projects_v3.getDisclosures('sodium')
* ```
*/
public async getDisclosures(id: string): Promise<Labrinth.Projects.v3.GetProjectDisclosures> {
return this.client.request<Labrinth.Projects.v3.GetProjectDisclosures>(
`/project/${id}/disclosures`,
{
api: 'labrinth',
version: 3,
method: 'GET',
},
)
}
/**
* Modify content disclosures for a project
*
* @param id - Project ID or slug
* @param data - Disclosures to set and types to remove
*
* @example
* ```typescript
* await client.labrinth.projects_v3.modifyDisclosures('sodium', {
* set: [{ type: 'ai_content', uses: ['text'], note: 'Translations are AI-generated.' }],
* remove: ['advertisements'],
* })
* ```
*/
public async modifyDisclosures(
id: string,
data: Labrinth.Projects.v3.ModifyProjectDisclosures,
): Promise<void> {
return this.client.request(`/project/${id}/disclosures`, {
api: 'labrinth',
version: 3,
method: 'PATCH',
body: data,
})
}
}
@@ -1300,6 +1300,70 @@ export namespace Labrinth {
projects: Project[]
versions: Labrinth.Versions.v3.Version[]
}
export type TelemetryConsent = 'opt_in' | 'opt_out' | 'always_active'
export type AiUsage = 'code' | 'assets' | 'text' | 'functionality'
export type DerivativeSource = {
label: string
link?: string | null
note?: string | null
}
export type ProjectDisclosure =
| {
type: 'ai_content'
uses: AiUsage[]
note?: string | null
}
| {
type: 'advertisements'
note?: string | null
}
| {
type: 'epilepsy_triggers'
note?: string | null
}
| {
type: 'system_interactions'
note?: string | null
}
| {
type: 'telemetry'
consent: TelemetryConsent
data_collected: string[]
}
| {
type: 'derivative_work'
sources: DerivativeSource[]
}
| {
type: 'paid_features'
features: string[]
}
export type ProjectDisclosureData = ProjectDisclosure & {
set_by_moderator: boolean
updated_at: string
updated_by?: string | null
}
export type ProjectDisclosureType = ProjectDisclosure['type']
export type ProjectDisclosureOf<T extends ProjectDisclosureType> = Extract<
ProjectDisclosureData,
{ type: T }
>
export type GetProjectDisclosures = {
disclosures: ProjectDisclosureData[]
}
export type ModifyProjectDisclosures = {
set: ProjectDisclosure[]
remove: ProjectDisclosureType[]
}
}
}