42 lines
1.7 KiB
TypeScript
42 lines
1.7 KiB
TypeScript
import type { ApiResponse, ClientConfig, SessionResponse } from './types.js';
|
|
export interface SkillClientOptions {
|
|
/** Override AUTH_BASE (gateway URL for token acquisition) */
|
|
authBase?: string;
|
|
/** Override CLIENT_KEY */
|
|
clientKey?: string;
|
|
/** Override base URL for business API calls (defaults to authBase) */
|
|
apiBase?: string;
|
|
/** Dry run mode — no real HTTP calls */
|
|
dryRun?: boolean;
|
|
/** Cache directory (default: /tmp/skill-auth-cache) */
|
|
cacheDir?: string;
|
|
/** Min TTL before token refresh, seconds (default: 60) */
|
|
minTtlSec?: number;
|
|
}
|
|
export declare class SkillClient {
|
|
private config;
|
|
private apiBase;
|
|
private readonly dryRun;
|
|
private readonly options;
|
|
constructor(options?: SkillClientOptions);
|
|
/** Fetch raw session info (token + expiresIn) */
|
|
session(): Promise<SessionResponse>;
|
|
/** Fetch client config (metadata with hook info, provider keys, etc.) */
|
|
clientConfig(): Promise<ClientConfig>;
|
|
get(path: string): Promise<ApiResponse>;
|
|
post(path: string, body?: unknown): Promise<ApiResponse>;
|
|
put(path: string, body?: unknown): Promise<ApiResponse>;
|
|
patch(path: string, body?: unknown): Promise<ApiResponse>;
|
|
delete(path: string, body?: unknown): Promise<ApiResponse>;
|
|
private request;
|
|
private getToken;
|
|
private refreshToken;
|
|
/**
|
|
* Re-read ~/.openclaw/.env and rebuild config.
|
|
* Called when auth keeps failing — the CLIENT_KEY may have been updated on disk.
|
|
*/
|
|
private reloadConfig;
|
|
private fetchSession;
|
|
}
|
|
export declare function createSkillClient(options?: SkillClientOptions): SkillClient;
|
|
//# sourceMappingURL=client.d.ts.map
|