mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-29 10:06:44 -06:00
add FetchLike (#19)
This commit is contained in:
parent
39270c782a
commit
893fa691a7
1 changed files with 11 additions and 1 deletions
12
src/api.ts
12
src/api.ts
|
@ -14,10 +14,20 @@ export function isAPIError(reason: any): reason is APIError {
|
||||||
return reason[MK_API_ERROR] === true;
|
return reason[MK_API_ERROR] === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type FetchLike = (input: string, init?: {
|
||||||
|
method?: string;
|
||||||
|
body?: string;
|
||||||
|
credentials?: RequestCredentials;
|
||||||
|
cache?: RequestCache;
|
||||||
|
}) => Promise<{
|
||||||
|
status: number;
|
||||||
|
json(): Promise<any>;
|
||||||
|
}>;
|
||||||
|
|
||||||
export class APIClient {
|
export class APIClient {
|
||||||
public origin: string;
|
public origin: string;
|
||||||
public credential: string | null | undefined;
|
public credential: string | null | undefined;
|
||||||
public fetch: (typeof fetch);
|
public fetch: FetchLike;
|
||||||
|
|
||||||
constructor(opts: {
|
constructor(opts: {
|
||||||
origin: APIClient['origin'];
|
origin: APIClient['origin'];
|
||||||
|
|
Loading…
Reference in a new issue