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

Function getEmbedResponse

apps/hash-api/src/graphql/resolvers/embed/index.ts:155–173  ·  view source on GitHub ↗
({
  url,
  type,
}: {
  url: string;
  type?: Maybe<string>;
})

Source from the content-addressed store, hash-verified

153};
154
155async 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
175export const embedCode: ResolverFn<
176 Promise<Embed>,

Callers 1

embedCodeFunction · 0.85

Calls 4

getOembedEndpointFunction · 0.85
fetchFunction · 0.85
thenMethod · 0.80
jsonMethod · 0.80

Tested by

no test coverage detected