1 | import { Field } from "./Field";
|
2 | import { FieldPosition } from "./FieldPosition";
|
3 | export type FieldsOptions = {
|
4 | fields?: Field[];
|
5 | encoding?: string;
|
6 | };
|
7 | /**
|
8 | * Collection of Field entries mapped by name.
|
9 | */
|
10 | export declare class Fields {
|
11 | private readonly entries;
|
12 | private readonly encoding;
|
13 | constructor({ fields, encoding }: FieldsOptions);
|
14 | /**
|
15 | * Set entry for a {`name`
Field} name. The |
16 | * attribute will be used to key the collection.
|
17 | *
|
18 | * set.
field The { Field} to |
19 | */
|
20 | setField(field: Field): void;
|
21 | /**
|
22 | * Retrieve {@link Field} entry by name.
|
23 | *
|
24 | * @param name The name of the {@link Field} entry
|
25 | * to retrieve
|
26 | * @returns The {@link Field} if it exists.
|
27 | */
|
28 | getField(name: string): Field | undefined;
|
29 | /**
|
30 | * Delete entry from collection.
|
31 | *
|
32 | * @param name Name of the entry to delete.
|
33 | */
|
34 | removeField(name: string): void;
|
35 | /**
|
36 | * Helper function for retrieving specific types of fields.
|
37 | * Used to grab all headers or all trailers.
|
38 | *
|
39 | * @param kind {@link FieldPosition} of entries to retrieve.
|
40 | * @returns The {@link Field} entries with the specified
|
41 | * {@link FieldPosition}.
|
42 | */
|
43 | getByType(kind: FieldPosition): Field[];
|
44 | }
|