21 lines
560 B
TypeScript
21 lines
560 B
TypeScript
/**
|
|
* The interface every link provider implements.
|
|
*
|
|
* @module
|
|
*/
|
|
|
|
import type { RichContent } from "../../../shared/dump.ts";
|
|
|
|
/** Metadata for the links one kind of site serves. */
|
|
export interface RichContentProvider {
|
|
/** The provider's name, for logs. */
|
|
name: string;
|
|
/** Checks whether this provider handles `url`. */
|
|
matches(url: string): boolean;
|
|
/**
|
|
* Fetches `url`'s preview. Rejects when the page can't be fetched; a page
|
|
* that isn't HTML yields a preview with no metadata.
|
|
*/
|
|
fetch(url: string): Promise<RichContent>;
|
|
}
|