@j3lte/frigate-api
Version:
Get Frigate data from the Frigate Data API
145 lines (144 loc) • 4.21 kB
TypeScript
import type { paths } from "./frigate-api";
import type { LogsService, LogsServiceReturn } from "./types";
/**
* A Frigate client
*
* This client is a wrapper around the Frigate API.
*
* @see https://jsr.io/@j3lte/frigate-api/doc
*
* @example
* ```typescript
* const frigate = new FrigateClient("http://localhost:8000/api");
* const version = await frigate.version();
* console.log(version);
* ```
*/
declare class FrigateClient {
/**
* The raw client
*/
private _client;
/**
* Create a new Frigate client
*
* _Note: The apiURL should be the complete url to the API, not just the base URL_
*
* @param apiURL - The API URL of the Frigate instance
*/
constructor(apiURL: string);
/**
* Get the raw client
* @returns The raw client
*/
get client(): typeof this._client;
/**
* Do a GET request
* @param path - The path to request
* @param options - The options to pass to the request
* @returns The response
*/
get get(): typeof this._client.GET;
/**
* Do a POST request
* @param path - The path to request
* @param options - The options to pass to the request
* @returns The response
*/
get post(): typeof this._client.POST;
/**
* Do a DELETE request
* @param path - The path to request
* @param options - The options to pass to the request
* @returns The response
*/
get delete(): typeof this._client.DELETE;
/**
* Do a PUT request
* @param path - The path to request
* @param options - The options to pass to the request
* @returns The response
*/
get put(): typeof this._client.PUT;
/**
* Do a OPTIONS request
* @param path - The path to request
* @param options - The options to pass to the request
* @returns The response
*/
get options(): typeof this._client.OPTIONS;
/**
* Do a HEAD request
* @param path - The path to request
* @param options - The options to pass to the request
* @returns The response
*/
get head(): typeof this._client.HEAD;
/**
* Do a PATCH request
* @param path - The path to request
* @param options - The options to pass to the request
* @returns The response
*/
get patch(): typeof this._client.PATCH;
/**
* Do a TRACE request
* @param path - The path to request
* @param options - The options to pass to the request
* @returns The response
*/
get trace(): typeof this._client.TRACE;
/**
* Check if the Frigate instance is healthy
* @returns True if the Frigate instance is healthy, false otherwise
*/
isHealthy(): Promise<boolean>;
/**
* Get the version of the Frigate instance
* @returns The version of the Frigate instance
*/
version(): Promise<string>;
/**
* Get the config of the Frigate instance
* @returns The config of the Frigate instance
*/
config(): Promise<unknown>;
/**
* Get the raw config (yaml) of the Frigate instance
* @returns The raw config of the Frigate instance
*/
configRaw(): Promise<string>;
/**
* Get the config schema of the Frigate instance
* @returns The config schema of the Frigate instance
*/
configSchema(): Promise<unknown>;
/**
* Get the stats of the Frigate instance
* @returns The stats of the Frigate instance
*/
stats(): Promise<unknown>;
/**
* Get the stats history of the Frigate instance
* @returns The stats history of the Frigate instance
*/
statsHistory(query?: {
keys?: string;
}): Promise<unknown>;
/**
* Get the timeline of the Frigate instance
* @returns The timeline of the Frigate instance
*/
timeline(query?: {
camera?: string;
limit?: number;
source_id?: string;
}): Promise<unknown>;
/**
* Get the logs of the Frigate instance
* @param service - The service to get the logs for
* @returns The logs of the Frigate instance
*/
logs(service?: LogsService): Promise<LogsServiceReturn>;
}
export { FrigateClient, type paths };