import { AWSAppSyncRealTimeProvider } from '@aws-amplify/pubsub'; import { GraphQLOptions, GraphQLResult, GraphQLOperation, OperationTypeNode } from '@aws-amplify/api-graphql'; import Observable from 'zen-observable-ts'; import { GraphQLQuery, GraphQLSubscription } from './types'; /** * @deprecated * Use RestApi or GraphQLAPI to reduce your application bundle size * Export Cloud Logic APIs */ export declare class APIClass { /** * Initialize API with AWS configuration * @param {Object} options - Configuration object for API */ private _options; private _restApi; private _graphqlApi; Auth: import("@aws-amplify/auth/lib-esm/Auth").AuthClass; Cache: import("@aws-amplify/cache/lib-esm/types").ICache; Credentials: import("@aws-amplify/core").CredentialsClass; /** * Initialize API with AWS configuration * @param {Object} options - Configuration object for API */ constructor(options: any); getModuleName(): string; /** * Configure API part with aws configurations * @param {Object} config - Configuration of the API * @return {Object} - The current configuration */ configure(options: any): any; /** * Make a GET request * @param apiName - The api name of the request * @param path - The path of the request * @param [init] - Request extra params * @return A promise that resolves to an object with response status and JSON data, if successful. */ get(apiName: string, path: string, init: { [key: string]: any; }): Promise; /** * Make a POST request * @param apiName - The api name of the request * @param path - The path of the request * @param [init] - Request extra params * @return A promise that resolves to an object with response status and JSON data, if successful. */ post(apiName: string, path: string, init: { [key: string]: any; }): Promise; /** * Make a PUT request * @param apiName - The api name of the request * @param path - The path of the request * @param [init] - Request extra params * @return A promise that resolves to an object with response status and JSON data, if successful. */ put(apiName: string, path: string, init: { [key: string]: any; }): Promise; /** * Make a PATCH request * @param apiName - The api name of the request * @param path - The path of the request * @param [init] - Request extra params * @return A promise that resolves to an object with response status and JSON data, if successful. */ patch(apiName: string, path: string, init: { [key: string]: any; }): Promise; /** * Make a DEL request * @param apiName - The api name of the request * @param path - The path of the request * @param [init] - Request extra params * @return A promise that resolves to an object with response status and JSON data, if successful. */ del(apiName: string, path: string, init: { [key: string]: any; }): Promise; /** * Make a HEAD request * @param apiName - The api name of the request * @param path - The path of the request * @param [init] - Request extra params * @return A promise that resolves to an object with response status and JSON data, if successful. */ head(apiName: string, path: string, init: { [key: string]: any; }): Promise; /** * Checks to see if an error thrown is from an api request cancellation * @param error - Any error * @return If the error was from an api request cancellation */ isCancel(error: any): boolean; /** * Cancels an inflight request for either a GraphQL request or a Rest API request. * @param request - request to cancel * @param [message] - custom error message * @return If the request was cancelled */ cancel(request: Promise, message?: string): boolean; /** * Getting endpoint for API * @param apiName - The name of the api * @return The endpoint of the api */ endpoint(apiName: string): Promise; /** * to get the operation type * @param operation */ getGraphqlOperationType(operation: GraphQLOperation): OperationTypeNode; /** * Executes a GraphQL operation * * @param options - GraphQL Options * @param [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. */ graphql(options: GraphQLOptions, additionalHeaders?: { [key: string]: string; }): T extends GraphQLQuery ? Promise> : T extends GraphQLSubscription ? Observable<{ provider: AWSAppSyncRealTimeProvider; value: GraphQLResult; }> : Promise> | Observable; } export declare const API: APIClass;