({
url,
type,
}: {
url: string;
type?: Maybe<string>;
})
| 153 | }; |
| 154 | |
| 155 | async function getEmbedResponse({ |
| 156 | url, |
| 157 | type, |
| 158 | }: { |
| 159 | url: string; |
| 160 | type?: Maybe<string>; |
| 161 | }) { |
| 162 | const oembedEndpoint = getOembedEndpoint(url, type || undefined); |
| 163 | |
| 164 | if (!oembedEndpoint) { |
| 165 | return { |
| 166 | error: true, |
| 167 | }; |
| 168 | } |
| 169 | |
| 170 | return await fetch( |
| 171 | `${oembedEndpoint}?url=${encodeURIComponent(url)}&maxwidth=1000`, |
| 172 | ).then((response) => response.json()); |
| 173 | } |
| 174 | |
| 175 | export const embedCode: ResolverFn< |
| 176 | Promise<Embed>, |
no test coverage detected