mirror of
https://github.com/RoboSats/robosats.git
synced 2025-09-13 00:56:22 +00:00
18 lines
710 B
TypeScript
18 lines
710 B
TypeScript
import ApiWebClient from './ApiWebClient';
|
|
import ApiNativeClient from './ApiNativeClient';
|
|
|
|
export interface Auth {
|
|
tokenSHA256: string;
|
|
keys?: { pubKey: string; encPrivKey: string };
|
|
}
|
|
|
|
export interface ApiClient {
|
|
post: (baseUrl: string, path: string, body: object, auth?: Auth) => Promise<object | undefined>;
|
|
put: (baseUrl: string, path: string, body: object, auth?: Auth) => Promise<object | undefined>;
|
|
get: (baseUrl: string, path: string, auth?: Auth) => Promise<object | undefined>;
|
|
delete: (baseUrl: string, path: string, auth?: Auth) => Promise<object | undefined>;
|
|
}
|
|
|
|
export const apiClient: ApiClient =
|
|
window.ReactNativeWebView != null ? new ApiNativeClient() : new ApiWebClient();
|