UNPKG

1.29 kBTypeScriptView Raw
1import { GlobalOptions } from './api';
2import { Endpoint } from './endpoint';
3export type EndpointCreator = (options: GlobalOptions, google: {}) => Endpoint;
4export interface DiscoveryOptions {
5 includePrivate?: boolean;
6 debug?: boolean;
7}
8export declare class Discovery {
9 private transporter;
10 private options;
11 /**
12 * Discovery for discovering API endpoints
13 *
14 * @param options Options for discovery
15 */
16 constructor(options: DiscoveryOptions);
17 /**
18 * Generate and Endpoint from an endpoint schema object.
19 *
20 * @param schema The schema from which to generate the Endpoint.
21 * @return A function that creates an endpoint.
22 */
23 private makeEndpoint;
24 /**
25 * Log output of generator. Works just like console.log
26 */
27 private log;
28 /**
29 * Generate all APIs and return as in-memory object.
30 * @param discoveryUrl
31 */
32 discoverAllAPIs(discoveryUrl: string): Promise<{}>;
33 /**
34 * Generate API file given discovery URL
35 *
36 * @param apiDiscoveryUrl URL or filename of discovery doc for API
37 * @returns A promise that resolves with a function that creates the endpoint
38 */
39 discoverAPI(apiDiscoveryUrl: string | {
40 url?: string;
41 }): Promise<EndpointCreator>;
42}