Edits history of script submission #263 for ' Execute GraphQL Query (faunadb)'

  • deno
    type Faunadb = {
      region: string;
      secret: string;
    };
    export async function main(
      auth: Faunadb,
      query: string,
      variables?: Record<string, any>,
      operationName?: string,
    ) {
      const region = ["us", "eu"].includes(auth.region) ? auth.region : "";
      const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
        method: "POST",
        headers: {
          Authorization: "Bearer " + auth.secret,
        },
        body: JSON.stringify({
          query,
          variables: variables || {},
          operationName: operationName || null,
        }),
      });
      return await response.json();
    }
    

    Submitted by hugo697 398 days ago

  • deno
    type Faunadb = {
      region: string;
      secret: string;
    };
    export async function main(
      auth: Faunadb,
      query: string,
      variables?: Record<string, any>,
      operationName?: string,
    ) {
      const region = ["us", "eu"].includes(auth.region) ? auth.region : "";
      const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
        method: "POST",
        headers: {
          Authorization: "Bearer " + auth.secret,
        },
        body: JSON.stringify({
          query,
          variables: variables || {},
          operationName: operationName || null,
        }),
      });
      return await response.json();
    }
    

    Submitted by admin 1031 days ago

  • deno
    
    type Faunadb = {
      region: string;
      secret: string;
    };
    export async function main(
      auth: Faunadb,
      query: string,
      variables?: Record<string, any>,
      operationName?: string
    ) {
      const region = ['us', 'eu'].includes(auth.region) ? auth.region : '';
      const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
        method: 'POST',
        headers: {
          Authorization: 'Bearer ' + auth.secret
        },
        body: JSON.stringify({
          query,
          variables: variables || {},
          operationName: operationName || null
        })
      });
      return await response.json();
    }
    

    Submitted by admin 1034 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts"
    
    export async function main(
      auth: Resource<'faunadb'>,
      query: string,
      variables?: Record<string, any>,
      operationName?: string
    ) {
      const region = ['us', 'eu'].includes(auth.region) ? auth.region : '';
      const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
        method: 'POST',
        headers: {
          Authorization: 'Bearer ' + auth.secret
        },
        body: JSON.stringify({
          query,
          variables: variables || {},
          operationName: operationName || null
        })
      });
      return await response.json();
    }
    

    Submitted by adam186 1162 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts"
    
    export async function main(
      auth: Resource<'faunadb'>,
      query: string,
      variables?: Record<string, any>,
      operationName?: string
    ) {
      const region = ['us', 'eu'].includes(auth.region) ? auth.region : '';
      const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
        method: 'POST',
        headers: {
          Authorization: 'Bearer ' + auth.secret
        },
        body: JSON.stringify({
          query,
          variables: variables || {},
          operationName: operationName || null
        })
      });
      return await response.json();
    }
    

    Submitted by adam186 1197 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts"
    
    export async function main(
      auth: Resource<'faunadb'>,
      query: string,
      variables?: Record<string, any>,
      operationName?: string
    ) {
      const region = ['us', 'eu'].includes(auth.region) ? auth.region : '';
      const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
        method: 'POST',
        headers: {
          Authorization: 'Bearer ' + auth.secret
        },
        body: JSON.stringify({
          query,
          variables: variables || {},
          operationName: operationName || null
        })
      });
      return await response.json();
    }
    

    Submitted by adam186 1266 days ago