-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCall.ts
37 lines (34 loc) · 1.05 KB
/
Call.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
26
27
28
29
30
31
32
33
34
35
36
37
import { HttpRequest } from "./HttpRequest.ts";
import { Drizzle } from "./Drizzle.ts";
import { RequestFactory } from "./RequestFactory.ts";
/**
* Represents a single HTTP call.
* New HTTP client implementations should extend this class.
*
* @typeParam V - type of the response
*/
export interface Call<T = Response> {
/**
* Executes the HTTP request
*/
execute(request: HttpRequest, argv: unknown[]): Promise<T>;
}
/**
* Builds a {@link Call} for a request.
* Call<V> instances are created in the context of an HTTP request.
*/
export interface CallFactory {
/**
* Additional setupTestServer like register a shutdown hook
* @param drizzle - Drizzle instance
*/
setup(drizzle: Drizzle): void;
/**
* Prepares the Call<V> that will make teh HTTP request.
* It should return a Function you all stuff ready to make the request fast.
*
* @param drizzle - Drizzle instance
* @param requestFactory - {@link RequestFactory} associated with this call
*/
provide(drizzle: Drizzle, requestFactory: RequestFactory): Call<unknown>;
}