1 | import type RAL from './ral';
|
2 | import { Message } from './messages';
|
3 | export interface FunctionContentEncoder {
|
4 | name: string;
|
5 | encode(input: Uint8Array): Promise<Uint8Array>;
|
6 | }
|
7 | export interface StreamContentEncoder {
|
8 | name: string;
|
9 | create(): RAL.WritableStream;
|
10 | }
|
11 | export type ContentEncoder = FunctionContentEncoder | (FunctionContentEncoder & StreamContentEncoder);
|
12 | export interface FunctionContentDecoder {
|
13 | name: string;
|
14 | decode(buffer: Uint8Array): Promise<Uint8Array>;
|
15 | }
|
16 | export interface StreamContentDecoder {
|
17 | name: string;
|
18 | create(): RAL.WritableStream;
|
19 | }
|
20 | export type ContentDecoder = FunctionContentDecoder | (FunctionContentDecoder & StreamContentDecoder);
|
21 | export interface ContentTypeEncoderOptions {
|
22 | charset: RAL.MessageBufferEncoding;
|
23 | }
|
24 | export interface FunctionContentTypeEncoder {
|
25 | name: string;
|
26 | encode(msg: Message, options: ContentTypeEncoderOptions): Promise<Uint8Array>;
|
27 | }
|
28 | export interface StreamContentTypeEncoder {
|
29 | name: string;
|
30 | create(options: ContentTypeEncoderOptions): RAL.WritableStream;
|
31 | }
|
32 | export type ContentTypeEncoder = FunctionContentTypeEncoder | (FunctionContentTypeEncoder & StreamContentTypeEncoder);
|
33 | export interface ContentTypeDecoderOptions {
|
34 | charset: RAL.MessageBufferEncoding;
|
35 | }
|
36 | export interface FunctionContentTypeDecoder {
|
37 | name: string;
|
38 | decode(buffer: Uint8Array, options: ContentTypeDecoderOptions): Promise<Message>;
|
39 | }
|
40 | export interface StreamContentTypeDecoder {
|
41 | name: string;
|
42 | create(options: ContentTypeDecoderOptions): RAL.WritableStream;
|
43 | }
|
44 | export type ContentTypeDecoder = FunctionContentTypeDecoder | (FunctionContentTypeDecoder & StreamContentTypeDecoder);
|
45 | interface Named {
|
46 | name: string;
|
47 | }
|
48 | export declare namespace Encodings {
|
49 | function getEncodingHeaderValue(encodings: Named[]): string | undefined;
|
50 | function parseEncodingHeaderValue(value: string): string[];
|
51 | }
|
52 | export {};
|