Skip to content

Instantly share code, notes, and snippets.

@okysky1121
Created May 8, 2024 17:27
Show Gist options
  • Save okysky1121/9394a0985eb6a6297901633c5aaae490 to your computer and use it in GitHub Desktop.
Save okysky1121/9394a0985eb6a6297901633c5aaae490 to your computer and use it in GitHub Desktop.
export namespace oEmbed {
interface Request {
url: string;
max_width?: number; // maxwidth
max_height?: number; // maxheight
format?: "json" | "xml";
}
interface Response {
type: "photo" | "video" | "link" | "rich";
version: "1.0";
title?: string;
author_name?: string;
author_url?: string;
provider_name?: string;
provider_url?: string;
cache_age?: number;
thumbnail_url?: string;
thumbnail_width?: number;
thumbnail_height?: number;
}
interface SizedResponse {
width: number;
height: number;
}
interface PhotoResponse extends Response, SizedResponse {
type: "photo";
url: string;
}
interface VideoResponse extends Response, SizedResponse {
type: "video";
html: string;
}
interface LinkResponse extends Response {
type: "link";
}
interface RichResponse extends Response, SizedResponse {
type: "rich";
html: string;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment