You've already forked AstralRinth
forked from didirus/AstralRinth
feat: start of cross platform page system (#4731)
* feat: abstract api-client DI into ui package * feat: cross platform page system * feat: tanstack as cross platform useAsyncData * feat: archon servers routes + labrinth billing routes * fix: dont use partial * feat: migrate server list page to tanstack + api-client + re-enabled broken features! * feat: migrate servers manage page to api-client before page system * feat: migrate manage page to page system * fix: type issues * fix: upgrade wrapper bugs * refactor: move state types into api-client * feat: disable financial stuff on app frontend * feat: finalize cross platform page system for now * fix: lint * fix: build issues * feat: remove papaparse * fix: lint * fix: interface error --------- Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
@@ -1,115 +0,0 @@
|
||||
export type Environment = 'required' | 'optional' | 'unsupported' | 'unknown'
|
||||
|
||||
export type ProjectStatus =
|
||||
| 'approved'
|
||||
| 'archived'
|
||||
| 'rejected'
|
||||
| 'draft'
|
||||
| 'unlisted'
|
||||
| 'processing'
|
||||
| 'withheld'
|
||||
| 'scheduled'
|
||||
| 'private'
|
||||
| 'unknown'
|
||||
|
||||
export type MonetizationStatus = 'monetized' | 'demonetized' | 'force-demonetized'
|
||||
|
||||
export type ProjectType = 'mod' | 'modpack' | 'resourcepack' | 'shader' | 'plugin' | 'datapack'
|
||||
|
||||
export type GalleryImageV2 = {
|
||||
url: string
|
||||
featured: boolean
|
||||
title?: string
|
||||
description?: string
|
||||
created: string
|
||||
ordering: number
|
||||
}
|
||||
|
||||
export type DonationLinkV2 = {
|
||||
id: string
|
||||
platform: string
|
||||
url: string
|
||||
}
|
||||
|
||||
export type ProjectV2 = {
|
||||
id: string
|
||||
slug: string
|
||||
project_type: ProjectType
|
||||
team: string
|
||||
title: string
|
||||
description: string
|
||||
body: string
|
||||
published: string
|
||||
updated: string
|
||||
approved?: string
|
||||
queued?: string
|
||||
status: ProjectStatus
|
||||
requested_status?: ProjectStatus
|
||||
moderator_message?: {
|
||||
message: string
|
||||
body?: string
|
||||
}
|
||||
license: {
|
||||
id: string
|
||||
name: string
|
||||
url?: string
|
||||
}
|
||||
client_side: Environment
|
||||
server_side: Environment
|
||||
downloads: number
|
||||
followers: number
|
||||
categories: string[]
|
||||
additional_categories: string[]
|
||||
game_versions: string[]
|
||||
loaders: string[]
|
||||
versions: string[]
|
||||
icon_url?: string
|
||||
issues_url?: string
|
||||
source_url?: string
|
||||
wiki_url?: string
|
||||
discord_url?: string
|
||||
donation_urls?: DonationLinkV2[]
|
||||
gallery?: GalleryImageV2[]
|
||||
color?: number
|
||||
thread_id: string
|
||||
monetization_status: MonetizationStatus
|
||||
}
|
||||
|
||||
export type SearchResultHit = {
|
||||
project_id: string
|
||||
project_type: ProjectType
|
||||
slug: string
|
||||
author: string
|
||||
title: string
|
||||
description: string
|
||||
categories: string[]
|
||||
display_categories: string[]
|
||||
versions: string[]
|
||||
downloads: number
|
||||
follows: number
|
||||
icon_url: string
|
||||
date_created: string
|
||||
date_modified: string
|
||||
latest_version?: string
|
||||
license: string
|
||||
client_side: Environment
|
||||
server_side: Environment
|
||||
gallery: string[]
|
||||
color?: number
|
||||
}
|
||||
|
||||
export type SearchResult = {
|
||||
hits: SearchResultHit[]
|
||||
offset: number
|
||||
limit: number
|
||||
total_hits: number
|
||||
}
|
||||
|
||||
export type ProjectSearchParams = {
|
||||
query?: string
|
||||
facets?: string[][]
|
||||
filters?: string
|
||||
index?: 'relevance' | 'downloads' | 'follows' | 'newest' | 'updated'
|
||||
offset?: number
|
||||
limit?: number
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
import type { MonetizationStatus, ProjectStatus } from './v2'
|
||||
|
||||
export type GalleryItemV3 = {
|
||||
url: string
|
||||
raw_url: string
|
||||
featured: boolean
|
||||
name?: string
|
||||
description?: string
|
||||
created: string
|
||||
ordering: number
|
||||
}
|
||||
|
||||
export type LinkV3 = {
|
||||
platform: string
|
||||
donation: boolean
|
||||
url: string
|
||||
}
|
||||
|
||||
export type ProjectV3 = {
|
||||
id: string
|
||||
slug?: string
|
||||
project_types: string[]
|
||||
games: string[]
|
||||
team_id: string
|
||||
organization?: string
|
||||
name: string
|
||||
summary: string
|
||||
description: string
|
||||
published: string
|
||||
updated: string
|
||||
approved?: string
|
||||
queued?: string
|
||||
status: ProjectStatus
|
||||
requested_status?: ProjectStatus
|
||||
license: {
|
||||
id: string
|
||||
name: string
|
||||
url?: string
|
||||
}
|
||||
downloads: number
|
||||
followers: number
|
||||
categories: string[]
|
||||
additional_categories: string[]
|
||||
loaders: string[]
|
||||
versions: string[]
|
||||
icon_url?: string
|
||||
link_urls: Record<string, LinkV3>
|
||||
gallery: GalleryItemV3[]
|
||||
color?: number
|
||||
thread_id: string
|
||||
monetization_status: MonetizationStatus
|
||||
side_types_migration_review_status: 'reviewed' | 'pending'
|
||||
[key: string]: unknown
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AbstractModule } from '../../../core/abstract-module'
|
||||
import type { ProjectSearchParams, ProjectV2, SearchResult } from './types/v2'
|
||||
import type { Labrinth } from '../types'
|
||||
|
||||
export class LabrinthProjectsV2Module extends AbstractModule {
|
||||
public getModuleID(): string {
|
||||
@@ -18,8 +18,8 @@ export class LabrinthProjectsV2Module extends AbstractModule {
|
||||
* console.log(project.title) // "Sodium"
|
||||
* ```
|
||||
*/
|
||||
public async get(id: string): Promise<ProjectV2> {
|
||||
return this.client.request<ProjectV2>(`/project/${id}`, {
|
||||
public async get(id: string): Promise<Labrinth.Projects.v2.Project> {
|
||||
return this.client.request<Labrinth.Projects.v2.Project>(`/project/${id}`, {
|
||||
api: 'labrinth',
|
||||
version: 2,
|
||||
method: 'GET',
|
||||
@@ -37,8 +37,8 @@ export class LabrinthProjectsV2Module extends AbstractModule {
|
||||
* const projects = await client.labrinth.projects_v2.getMultiple(['sodium', 'lithium', 'phosphor'])
|
||||
* ```
|
||||
*/
|
||||
public async getMultiple(ids: string[]): Promise<ProjectV2[]> {
|
||||
return this.client.request<ProjectV2[]>(`/projects`, {
|
||||
public async getMultiple(ids: string[]): Promise<Labrinth.Projects.v2.Project[]> {
|
||||
return this.client.request<Labrinth.Projects.v2.Project[]>(`/projects`, {
|
||||
api: 'labrinth',
|
||||
version: 2,
|
||||
method: 'GET',
|
||||
@@ -61,8 +61,10 @@ export class LabrinthProjectsV2Module extends AbstractModule {
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
public async search(params: ProjectSearchParams): Promise<SearchResult> {
|
||||
return this.client.request<SearchResult>(`/search`, {
|
||||
public async search(
|
||||
params: Labrinth.Projects.v2.ProjectSearchParams,
|
||||
): Promise<Labrinth.Projects.v2.SearchResult> {
|
||||
return this.client.request<Labrinth.Projects.v2.SearchResult>(`/search`, {
|
||||
api: 'labrinth',
|
||||
version: 2,
|
||||
method: 'GET',
|
||||
@@ -83,7 +85,7 @@ export class LabrinthProjectsV2Module extends AbstractModule {
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
public async edit(id: string, data: Partial<ProjectV2>): Promise<void> {
|
||||
public async edit(id: string, data: Partial<Labrinth.Projects.v2.Project>): Promise<void> {
|
||||
return this.client.request(`/project/${id}`, {
|
||||
api: 'labrinth',
|
||||
version: 2,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AbstractModule } from '../../../core/abstract-module'
|
||||
import type { ProjectV3 } from './types/v3'
|
||||
import type { Labrinth } from '../types'
|
||||
|
||||
export class LabrinthProjectsV3Module extends AbstractModule {
|
||||
public getModuleID(): string {
|
||||
@@ -18,8 +18,8 @@ export class LabrinthProjectsV3Module extends AbstractModule {
|
||||
* console.log(project.project_types) // v3 field
|
||||
* ```
|
||||
*/
|
||||
public async get(id: string): Promise<ProjectV3> {
|
||||
return this.client.request<ProjectV3>(`/project/${id}`, {
|
||||
public async get(id: string): Promise<Labrinth.Projects.v3.Project> {
|
||||
return this.client.request<Labrinth.Projects.v3.Project>(`/project/${id}`, {
|
||||
api: 'labrinth',
|
||||
version: 3,
|
||||
method: 'GET',
|
||||
@@ -37,8 +37,8 @@ export class LabrinthProjectsV3Module extends AbstractModule {
|
||||
* const projects = await client.labrinth.projects_v3.getMultiple(['sodium', 'lithium'])
|
||||
* ```
|
||||
*/
|
||||
public async getMultiple(ids: string[]): Promise<ProjectV3[]> {
|
||||
return this.client.request<ProjectV3[]>(`/projects`, {
|
||||
public async getMultiple(ids: string[]): Promise<Labrinth.Projects.v3.Project[]> {
|
||||
return this.client.request<Labrinth.Projects.v3.Project[]>(`/projects`, {
|
||||
api: 'labrinth',
|
||||
version: 3,
|
||||
method: 'GET',
|
||||
@@ -59,7 +59,7 @@ export class LabrinthProjectsV3Module extends AbstractModule {
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
public async edit(id: string, data: Partial<ProjectV3>): Promise<void> {
|
||||
public async edit(id: string, data: Labrinth.Projects.v3.EditProjectRequest): Promise<void> {
|
||||
return this.client.request(`/project/${id}`, {
|
||||
api: 'labrinth',
|
||||
version: 3,
|
||||
|
||||
Reference in New Issue
Block a user