@aws-amplify/api

  • Version 4.0.40
  • Published
  • 1.66 MB
  • 2 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

Variables

variable API

const API: APIClass;

    Classes

    class APIClass

    class APIClass {}
    • Deprecated

      Use RestApi or GraphQLAPI to reduce your application bundle size Export Cloud Logic APIs

    constructor

    constructor(options: any);
    • Initialize API with AWS configuration

      Parameter options

      Configuration object for API

    property Auth

    Auth: any;

      property Cache

      Cache: any;

        property Credentials

        Credentials: any;

          method cancel

          cancel: (request: Promise<any>, message?: string) => boolean;
          • Cancels an inflight request for either a GraphQL request or a Rest API request.

            Parameter request

            request to cancel

            Parameter message

            custom error message If the request was cancelled

          method configure

          configure: (options: any) => any;
          • Configure API part with aws configurations

            Parameter config

            Configuration of the API {Object} - The current configuration

          method del

          del: (
          apiName: string,
          path: string,
          init: { [key: string]: any }
          ) => Promise<any>;
          • Make a DEL request

            Parameter apiName

            The api name of the request

            Parameter path

            The path of the request

            Parameter init

            Request extra params A promise that resolves to an object with response status and JSON data, if successful.

          method endpoint

          endpoint: (apiName: string) => Promise<string>;
          • Getting endpoint for API

            Parameter apiName

            The name of the api The endpoint of the api

          method get

          get: (
          apiName: string,
          path: string,
          init: { [key: string]: any }
          ) => Promise<any>;
          • Make a GET request

            Parameter apiName

            The api name of the request

            Parameter path

            The path of the request

            Parameter init

            Request extra params A promise that resolves to an object with response status and JSON data, if successful.

          method getGraphqlOperationType

          getGraphqlOperationType: (operation: GraphQLOperation) => OperationTypeNode;
          • to get the operation type

            Parameter operation

          method getModuleName

          getModuleName: () => string;

            method graphql

            graphql: <T>(
            options: GraphQLOptions,
            additionalHeaders?: { [key: string]: string }
            ) => T extends GraphQLQuery<T>
            ? Promise<GraphQLResult<T>>
            : T extends GraphQLSubscription<T>
            ? Observable<{
            provider: AWSAppSyncRealTimeProvider;
            value: GraphQLResult<T>;
            }>
            : Promise<GraphQLResult<any>> | Observable<object>;
            • Executes a GraphQL operation

              Parameter options

              GraphQL Options

              Parameter additionalHeaders

              headers to merge in after any graphql_headers set in the config

              Returns

              An Observable if queryType is 'subscription', else a promise of the graphql result from the query.

            method head

            head: (
            apiName: string,
            path: string,
            init: { [key: string]: any }
            ) => Promise<any>;
            • Make a HEAD request

              Parameter apiName

              The api name of the request

              Parameter path

              The path of the request

              Parameter init

              Request extra params A promise that resolves to an object with response status and JSON data, if successful.

            method isCancel

            isCancel: (error: any) => boolean;
            • Checks to see if an error thrown is from an api request cancellation

              Parameter error

              Any error If the error was from an api request cancellation

            method patch

            patch: (
            apiName: string,
            path: string,
            init: { [key: string]: any }
            ) => Promise<any>;
            • Make a PATCH request

              Parameter apiName

              The api name of the request

              Parameter path

              The path of the request

              Parameter init

              Request extra params A promise that resolves to an object with response status and JSON data, if successful.

            method post

            post: (
            apiName: string,
            path: string,
            init: { [key: string]: any }
            ) => Promise<any>;
            • Make a POST request

              Parameter apiName

              The api name of the request

              Parameter path

              The path of the request

              Parameter init

              Request extra params A promise that resolves to an object with response status and JSON data, if successful.

            method put

            put: (
            apiName: string,
            path: string,
            init: { [key: string]: any }
            ) => Promise<any>;
            • Make a PUT request

              Parameter apiName

              The api name of the request

              Parameter path

              The path of the request

              Parameter init

              Request extra params A promise that resolves to an object with response status and JSON data, if successful.

            Type Aliases

            type GraphQLQuery

            type GraphQLQuery<T> = T & {
            readonly [queryType]: 'query';
            };

              type GraphQLSubscription

              type GraphQLSubscription<T> = T & {
              readonly [queryType]: 'subscription';
              };

                Package Files (3)

                Dependencies (2)

                Dev Dependencies (1)

                Peer Dependencies (0)

                No peer dependencies.

                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>