UNPKG

4.62 kBTypeScriptView Raw
1import { GraphQLOptions, GraphQLResult } from '@aws-amplify/api-graphql';
2import Observable from 'zen-observable-ts';
3/**
4 * @deprecated
5 * Use RestApi or GraphQLAPI to reduce your application bundle size
6 * Export Cloud Logic APIs
7 */
8export declare class APIClass {
9 /**
10 * Initialize API with AWS configuration
11 * @param {Object} options - Configuration object for API
12 */
13 private _options;
14 private _restApi;
15 private _graphqlApi;
16 Auth: import("@aws-amplify/auth/lib-esm/Auth").AuthClass;
17 Cache: import("@aws-amplify/cache/lib-esm/types").ICache;
18 Credentials: import("@aws-amplify/core").CredentialsClass;
19 /**
20 * Initialize API with AWS configuration
21 * @param {Object} options - Configuration object for API
22 */
23 constructor(options: any);
24 getModuleName(): string;
25 /**
26 * Configure API part with aws configurations
27 * @param {Object} config - Configuration of the API
28 * @return {Object} - The current configuration
29 */
30 configure(options: any): any;
31 /**
32 * Make a GET request
33 * @param {string} apiName - The api name of the request
34 * @param {string} path - The path of the request
35 * @param {json} [init] - Request extra params
36 * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
37 */
38 get(apiName: any, path: any, init: any): Promise<any>;
39 /**
40 * Make a POST request
41 * @param {string} apiName - The api name of the request
42 * @param {string} path - The path of the request
43 * @param {json} [init] - Request extra params
44 * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
45 */
46 post(apiName: any, path: any, init: any): Promise<any>;
47 /**
48 * Make a PUT request
49 * @param {string} apiName - The api name of the request
50 * @param {string} path - The path of the request
51 * @param {json} [init] - Request extra params
52 * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
53 */
54 put(apiName: any, path: any, init: any): Promise<any>;
55 /**
56 * Make a PATCH request
57 * @param {string} apiName - The api name of the request
58 * @param {string} path - The path of the request
59 * @param {json} [init] - Request extra params
60 * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
61 */
62 patch(apiName: any, path: any, init: any): Promise<any>;
63 /**
64 * Make a DEL request
65 * @param {string} apiName - The api name of the request
66 * @param {string} path - The path of the request
67 * @param {json} [init] - Request extra params
68 * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
69 */
70 del(apiName: any, path: any, init: any): Promise<any>;
71 /**
72 * Make a HEAD request
73 * @param {string} apiName - The api name of the request
74 * @param {string} path - The path of the request
75 * @param {json} [init] - Request extra params
76 * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
77 */
78 head(apiName: any, path: any, init: any): Promise<any>;
79 /**
80 * Checks to see if an error thrown is from an api request cancellation
81 * @param {any} error - Any error
82 * @return {boolean} - A boolean indicating if the error was from an api request cancellation
83 */
84 isCancel(error: any): boolean;
85 /**
86 * Cancels an inflight request
87 * @param {any} request - request to cancel
88 * @return {boolean} - A boolean indicating if the request was cancelled
89 */
90 cancel(request: Promise<any>, message?: string): boolean;
91 /**
92 * Getting endpoint for API
93 * @param {string} apiName - The name of the api
94 * @return {string} - The endpoint of the api
95 */
96 endpoint(apiName: any): Promise<string>;
97 /**
98 * to get the operation type
99 * @param operation
100 */
101 getGraphqlOperationType(operation: any): any;
102 /**
103 * Executes a GraphQL operation
104 *
105 * @param {GraphQLOptions} GraphQL Options
106 * @param {object} additionalHeaders headers to merge in after any `graphql_headers` set in the config
107 * @returns {Promise<GraphQLResult> | Observable<object>}
108 */
109 graphql(options: GraphQLOptions, additionalHeaders?: {
110 [key: string]: string;
111 }): Promise<GraphQLResult> | Observable<object>;
112}
113export declare const API: APIClass;