interface MediaProviderProps {
    apiKey: string;
    apiRoot?: string;
    cacheTtlMs?: number;
    logEvents?: boolean;
    children: ReactNode;
    client?: MediaClient;
}

Hierarchy (view full)

Properties

apiKey: string

Pexels API key. Never logged, never re-exported — only used to build the Authorization header.

apiRoot?: string

API root, e.g. for pointing at a mock server in tests. Default 'https://api.pexels.com'.

cacheTtlMs?: number

How long GET responses are cached in-memory, in ms. 0 disables caching (de-dupe of concurrent identical requests still applies). Default 60_000.

logEvents?: boolean

Log every emitted event to the console. Default true — set false to opt out and rely solely on your own listeners.

children: ReactNode
client?: MediaClient

Escape hatch: pass a pre-built MediaClient (tests, storybook, a shared instance) instead of letting the provider build one from apiKey.