Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc-cloned / node_modules / @grpc / grpc-js / build / src / metadata.d.ts
1 /// <reference types="node" />
2 import * as http2 from 'http2';
3 export declare type MetadataValue = string | Buffer;
4 export declare type MetadataObject = Map<string, MetadataValue[]>;
5 /**
6  * A class for storing metadata. Keys are normalized to lowercase ASCII.
7  */
8 export declare class Metadata {
9     protected internalRepr: MetadataObject;
10     /**
11      * Sets the given value for the given key by replacing any other values
12      * associated with that key. Normalizes the key.
13      * @param key The key to whose value should be set.
14      * @param value The value to set. Must be a buffer if and only
15      *   if the normalized key ends with '-bin'.
16      */
17     set(key: string, value: MetadataValue): void;
18     /**
19      * Adds the given value for the given key by appending to a list of previous
20      * values associated with that key. Normalizes the key.
21      * @param key The key for which a new value should be appended.
22      * @param value The value to add. Must be a buffer if and only
23      *   if the normalized key ends with '-bin'.
24      */
25     add(key: string, value: MetadataValue): void;
26     /**
27      * Removes the given key and any associated values. Normalizes the key.
28      * @param key The key whose values should be removed.
29      */
30     remove(key: string): void;
31     /**
32      * Gets a list of all values associated with the key. Normalizes the key.
33      * @param key The key whose value should be retrieved.
34      * @return A list of values associated with the given key.
35      */
36     get(key: string): MetadataValue[];
37     /**
38      * Gets a plain object mapping each key to the first value associated with it.
39      * This reflects the most common way that people will want to see metadata.
40      * @return A key/value mapping of the metadata.
41      */
42     getMap(): {
43         [key: string]: MetadataValue;
44     };
45     /**
46      * Clones the metadata object.
47      * @return The newly cloned object.
48      */
49     clone(): Metadata;
50     /**
51      * Merges all key-value pairs from a given Metadata object into this one.
52      * If both this object and the given object have values in the same key,
53      * values from the other Metadata object will be appended to this object's
54      * values.
55      * @param other A Metadata object.
56      */
57     merge(other: Metadata): void;
58     /**
59      * Creates an OutgoingHttpHeaders object that can be used with the http2 API.
60      */
61     toHttp2Headers(): http2.OutgoingHttpHeaders;
62     private _getCoreRepresentation;
63     /**
64      * Returns a new Metadata object based fields in a given IncomingHttpHeaders
65      * object.
66      * @param headers An IncomingHttpHeaders object.
67      */
68     static fromHttp2Headers(headers: http2.IncomingHttpHeaders): Metadata;
69 }