File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Member , OperationModel } from "./protocol" ;
2
+ import { HttpRequest } from "./http" ;
3
+
4
+ export interface BodySerializer < SerializedType = string > {
5
+ /**
6
+ * Converts the provided `input` into the serialized format described in the
7
+ * provided `shape`.
8
+ *
9
+ * @param shape The serialization model shape to which the input should be
10
+ * converted
11
+ * @param input The value to convert
12
+ *
13
+ * @throws if a node in the input cannot be converted into the type
14
+ * specified by the serialization model
15
+ */
16
+ build ( shape : Member , input : any ) : SerializedType ;
17
+ }
18
+
19
+ export interface RequestSerializer < StreamType = Uint8Array > {
20
+ /**
21
+ * Converts the provided `input` into an HTTP request
22
+ *
23
+ * @param operation The operation to be executed via the returned HTTP
24
+ * request.
25
+ * @param input The user input to serialize.
26
+ */
27
+ serialize ( operation : OperationModel , input : any ) : HttpRequest < StreamType > ;
28
+ }
Original file line number Diff line number Diff line change
1
+ import { Member , OperationModel } from "./protocol" ;
2
+ import { HttpResponse } from "./http" ;
3
+
4
+ export interface BodyParser < SerializedType = string > {
5
+ /**
6
+ * Convert the provided input into the shape described in the supplied
7
+ * serialization model.
8
+ *
9
+ * @param shape A serialization model describing the expected shape of the
10
+ * value supplied as `input`.
11
+ * @param input The value to parse
12
+ */
13
+ parse < OutputType > (
14
+ shape : Member ,
15
+ input : SerializedType
16
+ ) : OutputType ;
17
+ }
18
+
19
+ export interface ResponseParser < StreamType = Uint8Array > {
20
+ /**
21
+ * Converts the output of an operation into JavaScript types.
22
+ *
23
+ * @param operation The operation model describing the structure of the HTTP
24
+ * response received
25
+ * @param input The HTTP response received from the service
26
+ */
27
+ parse < OutputType > (
28
+ operation : OperationModel ,
29
+ input : HttpResponse < StreamType >
30
+ ) : Promise < OutputType > ;
31
+ }
32
+
33
+ /**
34
+ * A function that converts a stream into an array of bytes.
35
+ */
36
+ export interface StreamCollector < StreamType > {
37
+ ( stream : StreamType ) : Promise < Uint8Array > ;
38
+ }
You can’t perform that action at this time.
0 commit comments