MCPcopy Create free account
hub / github.com/dailydotdev/apps / gql

Function gql

packages/world-cli/src/world.js:36–48  ·  view source on GitHub ↗
(api, query, variables)

Source from the content-addressed store, hash-verified

34}`;
35
36async function gql(api, query, variables) {
37 const res = await fetch(api, {
38 method: "POST",
39 headers: { "content-type": "application/json" },
40 body: JSON.stringify({ query, variables }),
41 });
42 if (!res.ok)
43 throw new Error(`${api} answered ${res.status} ${res.statusText}`);
44 const body = await res.json();
45 if (body.errors?.length)
46 throw new Error(body.errors.map((e) => e.message).join("; "));
47 return body.data;
48}
49
50export async function fetchWorld(handle, { api }) {
51 /* `user` takes a handle, `userWorld` takes the id it resolves to: the world

Callers 15

fetchWorldFunction · 0.85
report.tsFile · 0.85
graphql.tsFile · 0.85
graphql.tsFile · 0.85
graphql.tsFile · 0.85
streakFreeze.tsFile · 0.85
feed.tsFile · 0.85
getFeedPostFragmentFunction · 0.85
fragments.tsFile · 0.85
feedback.tsFile · 0.85
keywords.tsFile · 0.85
paddle.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected