Fix apps types (#2197)

* Fix apps types

* Remove get overload
This commit is contained in:
Reynaldi Chernando
2025-12-24 03:34:58 +07:00
committed by GitHub
parent 99220b5b18
commit eb23863b6e
+20 -6
View File
@@ -1,4 +1,4 @@
import type { PaginationOptions, RequestCallbacks } from '../shared.d.ts';
import type { RequestCallbacks } from '../shared.d.ts';
export interface App {
uid: string;
@@ -16,12 +16,25 @@ export interface App {
user_count?: number;
}
export interface AppListOptions extends PaginationOptions {
export interface CreateAppResult {
uid: string;
name: string;
title: string;
index_url: string;
subdomain: string;
owner: {
username: string;
uuid: string;
};
app_owner?: Record<string, unknown>;
}
export interface AppListOptions {
stats_period?: string;
icon_size?: null | 16 | 32 | 64 | 128 | 256 | 512;
}
export interface CreateAppOptions extends RequestCallbacks<App> {
export interface CreateAppOptions {
name: string;
indexURL: string;
title?: string;
@@ -34,7 +47,7 @@ export interface CreateAppOptions extends RequestCallbacks<App> {
dedupeName?: boolean;
}
export interface UpdateAppAttributes extends RequestCallbacks<App> {
export interface UpdateAppAttributes {
name?: string;
indexURL?: string;
title?: string;
@@ -48,10 +61,11 @@ export interface UpdateAppAttributes extends RequestCallbacks<App> {
export class Apps {
list (options?: AppListOptions): Promise<App[]>;
create (name: string, indexURL: string, title?: string): Promise<App>;
create (options: CreateAppOptions): Promise<App>;
create (name: string, indexURL: string, title?: string): Promise<CreateAppResult>;
create (options: CreateAppOptions): Promise<CreateAppResult>;
update (name: string, attributes: UpdateAppAttributes): Promise<App>;
get (name: string, options?: AppListOptions): Promise<App>;
delete (name: string): Promise<{ success?: boolean }>;
getDeveloperProfile (options?: RequestCallbacks<Record<string, unknown>>): Promise<Record<string, unknown>>;
getDeveloperProfile (success: (value: Record<string, unknown>) => void, error?: (reason: unknown) => void): Promise<Record<string, unknown>>;
}