@aws-amplify/api

  • Version 6.4.3
  • Published
  • 75.3 kB
  • 5 dependencies
  • Apache-2.0 license

Install

npm i @aws-amplify/api
yarn add @aws-amplify/api
pnpm add @aws-amplify/api

Overview

Api category of aws-amplify

Index

Functions

Type Aliases

Functions

function generateClient

generateClient: {
<
T extends Record<any, any> = never,
Options extends CommonPublicClientOptions = DefaultCommonClientOptions
>(
ctx: AmplifyContext,
options?: Options
): V6Client<T, Options>;
<
T extends Record<any, any> = never,
Options extends CommonPublicClientOptions = DefaultCommonClientOptions
>(
options?: Options
): V6Client<T, Options>;
};
  • 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.

    Parameter ctx

    The AmplifyContext the client should resolve its configuration and auth from.

    Parameter options

    Optional client options.

    Returns

    V6Client

    Throws

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

    Example 1

    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

    Returns

    V6Client

    Throws

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

Type Aliases

type Client

type Client<T extends Record<any, any> = never> = V6Client<T>;

    Package Files (2)

    Dependencies (5)

    Dev Dependencies (2)

    Peer Dependencies (1)

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@aws-amplify/api.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@aws-amplify/api)
    • HTML
      <a href="https://www.jsdocs.io/package/@aws-amplify/api"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>