1 | /**
|
2 | * all type that should be sent as parameter to Ovh calls
|
3 | */
|
4 | export type OvhParamType = {
|
5 | [key: string]: any;
|
6 | };
|
7 | /**
|
8 | * Public interface of a silot
|
9 | * you can have one silot per Ovh API call
|
10 | */
|
11 | export interface ICacheSilot {
|
12 | options: ICacheOptions;
|
13 | flush(): Promise<void>;
|
14 | store(path: string, value: any, size: number): Promise<boolean>;
|
15 | get(path: string): Promise<any | undefined>;
|
16 | discard(path: string): Promise<boolean>;
|
17 | }
|
18 | /**
|
19 | * constructor for a silot cache
|
20 | */
|
21 | export type SlotConstructor = new (template: string, options: ICacheOptions) => ICacheSilot;
|
22 | /**
|
23 | * params to configure cache
|
24 | */
|
25 | export interface ICacheOptions {
|
26 | /**
|
27 | * Time to live in second
|
28 | */
|
29 | ttl?: number;
|
30 | /**
|
31 | * max memmory used to store your cache
|
32 | */
|
33 | size?: number;
|
34 | /**
|
35 | * max number of entry in your cache
|
36 | */
|
37 | count?: number;
|
38 | /**
|
39 | * explicite silot construtor used to overwrite in memory default silotCache
|
40 | */
|
41 | silotClass?: SlotConstructor;
|
42 | }
|
43 | /**
|
44 | * 'flush' and 'disable' are the main action, other can be add later
|
45 | */
|
46 | export type CacheAction = 'flush' | 'disable' | string;
|
47 | /**
|
48 | * common interface used to call ovh engine
|
49 | */
|
50 | export interface OvhRequestable {
|
51 | /**
|
52 | * Execute a request on the API with promise
|
53 | *
|
54 | * @param httpMethod: The HTTP method GET POST PUT DELETE
|
55 | * @param path: The request final path
|
56 | * @param pathTemplate: The request path with {pathParams}
|
57 | * @param params: The request parameters (passed as query string or body params)
|
58 | */
|
59 | doRequest(httpMethod: string, path: string, pathTemplate: string, params?: any): Promise<any>;
|
60 | /**
|
61 | * Execute a request on the API with promise
|
62 | *
|
63 | * @param httpMethod: The HTTP method GET POST PUT DELETE
|
64 | * @param path: The request path with {pathParams}
|
65 | * @param params: The request parameters (passed as query string or body params)
|
66 | * @deprecated
|
67 | */
|
68 | /**
|
69 | * cache controle
|
70 | */
|
71 | cache(template: string, param: ICacheOptions | CacheAction): Promise<any>;
|
72 | }
|
73 | /**
|
74 | * Build Ovh API 2.0 Proxy
|
75 | *
|
76 | * @param ovhEngine
|
77 | * @param path
|
78 | */
|
79 | export declare function buildOvhProxy(ovhEngine: OvhRequestable, path: string): any;
|