forked from elastic/elasticsearch-js-mock
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
25 lines (20 loc) · 845 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
import { Connection } from '@opensearch-project/opensearch'
declare class ClientMock {
constructor()
add(pattern: MockPattern, resolver: ResolverFn): ClientMock
get(pattern: MockPattern): ResolverFn | null
clear(pattern: Pick<MockPattern, 'method' | 'path'>): ClientMock
clearAll(): ClientMock
getConnection(): typeof Connection
}
export declare type ResolverFn = (params: MockPattern) => Record<string, any> | string
export interface MockPattern {
method: string | string[]
path: string | string[]
querystring?: Record<string, string>
body?: Record<string, any> | Record<string, any>[]
}
export default ClientMock