Amplify JS API Documentation
    Preparing search index...

    Function generateClient

    • Generates an API client bound to a specific AmplifyContext instead of the global Amplify singleton. Use this overload when you need to scope a client to an explicit context (e.g. multi-tenant or server-side rendering scenarios) rather than the shared singleton configuration.

      Type Parameters

      • T extends Record<any, any> = never
      • Options extends CommonPublicClientOptions = DefaultCommonClientOptions

      Parameters

      Returns V6Client<T, Options>

      V6Client

      Error - Throws error when client cannot be generated due to configuration issues.

      import { generateClient } from 'aws-amplify/api';
      // `listTodos` is a generated GraphQL query document (from your API's codegen output).

      const client = generateClient(ctx);
      const result = await client.graphql({ query: listTodos });
    • Generates an API client that can work with models or raw GraphQL

      Type Parameters

      • T extends Record<any, any> = never
      • Options extends CommonPublicClientOptions = DefaultCommonClientOptions

      Parameters

      Returns V6Client<T, Options>

      V6Client

      Error - Throws error when client cannot be generated due to configuration issues.