wip
This commit is contained in:
parent
0853b2fe42
commit
89480d9029
3 changed files with 12 additions and 12 deletions
|
|
@ -42,9 +42,9 @@ export class APIClient {
|
|||
this.fetch = opts.fetch ?? ((...args) => fetch(...args));
|
||||
}
|
||||
|
||||
public request<E extends keyof Endpoints, P extends SchemaOrUndefined<D['defines'][number]['req']>, D extends IEndpointMeta = Endpoints[E], R = ResponseOf<D, P>>(
|
||||
public request<E extends keyof Endpoints, P extends SchemaOrUndefined<D['defines'][number]['req']>, M extends IEndpointMeta = Endpoints[E]>(
|
||||
endpoint: E, params: P, credential?: string | null | undefined,
|
||||
): Promise<R>
|
||||
): Promise<ResponseOf<M, P>>
|
||||
{
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
this.fetch(`${this.origin}/api/${endpoint}`, {
|
||||
|
|
@ -74,6 +74,6 @@ export class APIClient {
|
|||
}).catch(reject);
|
||||
});
|
||||
|
||||
return promise as any;
|
||||
return promise as Promise<ResponseOf<M, P>>;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Endpoints } from './api.types.js';
|
||||
import { Endpoints } from './endpoints.types.js';
|
||||
import Stream, { Connection } from './streaming.js';
|
||||
import { Channels } from './streaming.types.js';
|
||||
import { Acct } from './acct.js';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue