@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
49 lines • 2.72 kB
TypeScript
import type { ByteSpool } from '../../io/spool.ts';
import { type ByteWindow } from '../../utils/ranges.ts';
import { TokenManager as OAuthTokenManager } from '../api/oauth.ts';
import { ApiError } from '../api/errors.ts';
export interface BoxConfig {
timeout?: number;
endpoint?: string;
clientId?: string;
clientSecret?: string;
refreshToken?: string;
enterpriseId?: string;
accessToken?: string;
refreshFn?: (refreshToken: string) => Promise<{
accessToken: string;
refreshToken: string;
expiresIn: number;
}>;
onRefreshTokenRotated?: (newRefreshToken: string) => void | Promise<void>;
}
export declare class BoxApiError extends ApiError {
readonly status: number;
readonly conflict: string | null;
constructor(message: string, status: number, conflict?: string | null);
}
/**
* The type of the item a 409 names in `context_info.conflicts`, or null.
* Mirrors Python's `conflict_of`.
*/
export declare function conflictOf(text: string): string | null;
export declare class BoxTokenManager extends OAuthTokenManager {
readonly apiBase: string;
readonly uploadBase: string;
private readonly config;
private readonly devTokenMode;
private readonly ccgMode;
private currentRefreshToken;
constructor(config: BoxConfig);
protected refreshPair(): Promise<[string, number]>;
}
export declare function boxGet(tm: BoxTokenManager, url: string, params?: Record<string, string | number>): Promise<unknown>;
export declare function boxOptions(tm: BoxTokenManager, url: string): Promise<unknown>;
export declare function boxGetBytes(tm: BoxTokenManager, url: string, params?: Record<string, string | number>, window?: ByteWindow): Promise<Uint8Array>;
export declare function boxGetStream(tm: BoxTokenManager, url: string, params?: Record<string, string | number>): AsyncIterable<Uint8Array>;
export declare function boxPostJson(tm: BoxTokenManager, url: string, body: Record<string, unknown>): Promise<unknown>;
export declare function boxPutJson(tm: BoxTokenManager, url: string, body: Record<string, unknown>): Promise<unknown>;
export declare function boxDelete(tm: BoxTokenManager, url: string, params?: Record<string, string | number>, headers?: Record<string, string>, signal?: AbortSignal): Promise<void>;
export declare function boxUploadMultipart(tm: BoxTokenManager, url: string, attributes: Record<string, unknown>, filename: string, data: Uint8Array, headers?: Record<string, string>): Promise<unknown>;
export declare function boxUploadSession(tm: BoxTokenManager, url: string, metadata: Record<string, unknown>, spool: ByteSpool, etag?: string | null): Promise<unknown>;
//# sourceMappingURL=client.d.ts.map