MCPcopy Create free account
hub / github.com/hashintel/hash / embedCode

Function embedCode

apps/hash-api/src/graphql/resolvers/embed/index.ts:180–208  ·  view source on GitHub ↗
(_, { url, type })

Source from the content-addressed store, hash-verified

178 GraphQLContext,
179 QueryEmbedCodeArgs
180> = async (_, { url, type }) => {
181 const embedResponse = (await getEmbedResponse({
182 url,
183 type,
184 }).catch((__) => {
185 throw Error.notFound(
186 `Embed Code for URL ${url} not found${
187 type?.trim() ? ` for type ${type}` : ""
188 }`,
189 );
190 })) as OembedResponse & { error: boolean };
191
192 const { html, error, provider_name, height, width } = embedResponse;
193
194 if (error) {
195 throw Error.notFound(
196 `Embed Code for URL ${url} not found${
197 type?.trim() ? ` for type ${type}` : ""
198 }`,
199 );
200 }
201
202 return {
203 html: html ? sanitizeOembedHtml(html) : html,
204 providerName: provider_name,
205 height,
206 width,
207 };
208};

Callers

nothing calls this directly

Calls 2

getEmbedResponseFunction · 0.85
sanitizeOembedHtmlFunction · 0.85

Tested by

no test coverage detected