grpc.Metadata.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Class: Metadata</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Class: Metadata</h1>
  17. <section>
  18. <header>
  19. <h2>
  20. <span class="ancestors"><a href="grpc.html">grpc</a>.</span>Metadata</h2>
  21. </header>
  22. <article>
  23. <div class="container-overview">
  24. <h4 class="name" id="Metadata"><span class="type-signature"></span>new Metadata<span class="signature">()</span><span class="type-signature"></span></h4>
  25. <div class="description">
  26. <p>Class for storing metadata. Keys are normalized to lowercase ASCII.</p>
  27. </div>
  28. <dl class="details">
  29. <dt class="tag-source">Source:</dt>
  30. <dd class="tag-source"><ul class="dummy"><li>
  31. <a href="src_metadata.js.html">src/metadata.js</a>, <a href="src_metadata.js.html#line50">line 50</a>
  32. </li></ul></dd>
  33. </dl>
  34. <h5>Example</h5>
  35. <pre class="prettyprint"><code>var metadata = new metadata_module.Metadata();
  36. metadata.set('key1', 'value1');
  37. metadata.add('key1', 'value2');
  38. metadata.get('key1') // returns ['value1', 'value2']</code></pre>
  39. </div>
  40. <h3 class="subsection-title">Methods</h3>
  41. <h4 class="name" id="add"><span class="type-signature"></span>add<span class="signature">(key, value)</span><span class="type-signature"></span></h4>
  42. <div class="description">
  43. <p>Adds the given value for the given key. Normalizes the key.</p>
  44. </div>
  45. <h5>Parameters:</h5>
  46. <table class="params">
  47. <thead>
  48. <tr>
  49. <th>Name</th>
  50. <th>Type</th>
  51. <th class="last">Description</th>
  52. </tr>
  53. </thead>
  54. <tbody>
  55. <tr>
  56. <td class="name"><code>key</code></td>
  57. <td class="type">
  58. <span class="param-type">String</span>
  59. </td>
  60. <td class="description last"><p>The key to add to.</p></td>
  61. </tr>
  62. <tr>
  63. <td class="name"><code>value</code></td>
  64. <td class="type">
  65. <span class="param-type">String</span>
  66. |
  67. <span class="param-type">Buffer</span>
  68. </td>
  69. <td class="description last"><p>The value to add. Must be a buffer if and only
  70. if the normalized key ends with '-bin'</p></td>
  71. </tr>
  72. </tbody>
  73. </table>
  74. <dl class="details">
  75. <dt class="tag-source">Source:</dt>
  76. <dd class="tag-source"><ul class="dummy"><li>
  77. <a href="src_metadata.js.html">src/metadata.js</a>, <a href="src_metadata.js.html#line99">line 99</a>
  78. </li></ul></dd>
  79. </dl>
  80. <h4 class="name" id="clone"><span class="type-signature"></span>clone<span class="signature">()</span><span class="type-signature"> &rarr; {Metadata}</span></h4>
  81. <div class="description">
  82. <p>Clone the metadata object.</p>
  83. </div>
  84. <dl class="details">
  85. <dt class="tag-source">Source:</dt>
  86. <dd class="tag-source"><ul class="dummy"><li>
  87. <a href="src_metadata.js.html">src/metadata.js</a>, <a href="src_metadata.js.html#line152">line 152</a>
  88. </li></ul></dd>
  89. </dl>
  90. <h5>Returns:</h5>
  91. <div class="param-desc">
  92. <p>The new cloned object</p>
  93. </div>
  94. <dl>
  95. <dt>
  96. Type
  97. </dt>
  98. <dd>
  99. <span class="param-type">Metadata</span>
  100. </dd>
  101. </dl>
  102. <h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(key)</span><span class="type-signature"> &rarr; {Array.&lt;(String|Buffer)>}</span></h4>
  103. <div class="description">
  104. <p>Gets a list of all values associated with the key. Normalizes the key.</p>
  105. </div>
  106. <h5>Parameters:</h5>
  107. <table class="params">
  108. <thead>
  109. <tr>
  110. <th>Name</th>
  111. <th>Type</th>
  112. <th class="last">Description</th>
  113. </tr>
  114. </thead>
  115. <tbody>
  116. <tr>
  117. <td class="name"><code>key</code></td>
  118. <td class="type">
  119. <span class="param-type">String</span>
  120. </td>
  121. <td class="description last"><p>The key to get</p></td>
  122. </tr>
  123. </tbody>
  124. </table>
  125. <dl class="details">
  126. <dt class="tag-source">Source:</dt>
  127. <dd class="tag-source"><ul class="dummy"><li>
  128. <a href="src_metadata.js.html">src/metadata.js</a>, <a href="src_metadata.js.html#line124">line 124</a>
  129. </li></ul></dd>
  130. </dl>
  131. <h5>Returns:</h5>
  132. <div class="param-desc">
  133. <p>The values associated with that key</p>
  134. </div>
  135. <dl>
  136. <dt>
  137. Type
  138. </dt>
  139. <dd>
  140. <span class="param-type">Array.&lt;(String|Buffer)></span>
  141. </dd>
  142. </dl>
  143. <h4 class="name" id="getMap"><span class="type-signature"></span>getMap<span class="signature">()</span><span class="type-signature"> &rarr; {Object.&lt;String, (String|Buffer)>}</span></h4>
  144. <div class="description">
  145. <p>Get a map of each key to a single associated value. This reflects the most
  146. common way that people will want to see metadata.</p>
  147. </div>
  148. <dl class="details">
  149. <dt class="tag-source">Source:</dt>
  150. <dd class="tag-source"><ul class="dummy"><li>
  151. <a href="src_metadata.js.html">src/metadata.js</a>, <a href="src_metadata.js.html#line138">line 138</a>
  152. </li></ul></dd>
  153. </dl>
  154. <h5>Returns:</h5>
  155. <div class="param-desc">
  156. <p>A key/value mapping of the metadata</p>
  157. </div>
  158. <dl>
  159. <dt>
  160. Type
  161. </dt>
  162. <dd>
  163. <span class="param-type">Object.&lt;String, (String|Buffer)></span>
  164. </dd>
  165. </dl>
  166. <h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">(key)</span><span class="type-signature"></span></h4>
  167. <div class="description">
  168. <p>Remove the given key and any associated values. Normalizes the key.</p>
  169. </div>
  170. <h5>Parameters:</h5>
  171. <table class="params">
  172. <thead>
  173. <tr>
  174. <th>Name</th>
  175. <th>Type</th>
  176. <th class="last">Description</th>
  177. </tr>
  178. </thead>
  179. <tbody>
  180. <tr>
  181. <td class="name"><code>key</code></td>
  182. <td class="type">
  183. <span class="param-type">String</span>
  184. </td>
  185. <td class="description last"><p>The key to remove</p></td>
  186. </tr>
  187. </tbody>
  188. </table>
  189. <dl class="details">
  190. <dt class="tag-source">Source:</dt>
  191. <dd class="tag-source"><ul class="dummy"><li>
  192. <a href="src_metadata.js.html">src/metadata.js</a>, <a href="src_metadata.js.html#line112">line 112</a>
  193. </li></ul></dd>
  194. </dl>
  195. <h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(key, value)</span><span class="type-signature"></span></h4>
  196. <div class="description">
  197. <p>Sets the given value for the given key, replacing any other values associated
  198. with that key. Normalizes the key.</p>
  199. </div>
  200. <h5>Parameters:</h5>
  201. <table class="params">
  202. <thead>
  203. <tr>
  204. <th>Name</th>
  205. <th>Type</th>
  206. <th class="last">Description</th>
  207. </tr>
  208. </thead>
  209. <tbody>
  210. <tr>
  211. <td class="name"><code>key</code></td>
  212. <td class="type">
  213. <span class="param-type">String</span>
  214. </td>
  215. <td class="description last"><p>The key to set</p></td>
  216. </tr>
  217. <tr>
  218. <td class="name"><code>value</code></td>
  219. <td class="type">
  220. <span class="param-type">String</span>
  221. |
  222. <span class="param-type">Buffer</span>
  223. </td>
  224. <td class="description last"><p>The value to set. Must be a buffer if and only
  225. if the normalized key ends with '-bin'</p></td>
  226. </tr>
  227. </tbody>
  228. </table>
  229. <dl class="details">
  230. <dt class="tag-source">Source:</dt>
  231. <dd class="tag-source"><ul class="dummy"><li>
  232. <a href="src_metadata.js.html">src/metadata.js</a>, <a href="src_metadata.js.html#line87">line 87</a>
  233. </li></ul></dd>
  234. </dl>
  235. </article>
  236. </section>
  237. </div>
  238. <nav>
  239. <h2><a href="index.html">Home</a></h2><h3>Externals</h3><ul><li><a href="external-Duplex.html">Duplex</a></li><li><a href="external-EventEmitter.html">EventEmitter</a></li><li><a href="external-GoogleCredential.html">GoogleCredential</a></li><li><a href="external-Readable.html">Readable</a></li><li><a href="external-Writable.html">Writable</a></li></ul><h3>Classes</h3><ul><li><a href="grpc.Client.html">Client</a></li><li><a href="grpc.credentials-CallCredentials.html">CallCredentials</a></li><li><a href="grpc.credentials-ChannelCredentials.html">ChannelCredentials</a></li><li><a href="grpc.Metadata.html">Metadata</a></li><li><a href="grpc.Server.html">Server</a></li><li><a href="grpc.ServerCredentials.html">ServerCredentials</a></li><li><a href="grpc-ClientDuplexStream.html">ClientDuplexStream</a></li><li><a href="grpc-ClientReadableStream.html">ClientReadableStream</a></li><li><a href="grpc-ClientUnaryCall.html">ClientUnaryCall</a></li><li><a href="grpc-ClientWritableStream.html">ClientWritableStream</a></li><li><a href="grpc-ServerDuplexStream.html">ServerDuplexStream</a></li><li><a href="grpc-ServerReadableStream.html">ServerReadableStream</a></li><li><a href="grpc-ServerUnaryCall.html">ServerUnaryCall</a></li><li><a href="grpc-ServerWritableStream.html">ServerWritableStream</a></li></ul><h3>Events</h3><ul><li><a href="grpc-ClientDuplexStream.html#event:metadata">metadata</a></li><li><a href="grpc-ClientDuplexStream.html#event:status">status</a></li><li><a href="grpc-ClientReadableStream.html#event:metadata">metadata</a></li><li><a href="grpc-ClientReadableStream.html#event:status">status</a></li><li><a href="grpc-ClientUnaryCall.html#event:metadata">metadata</a></li><li><a href="grpc-ClientUnaryCall.html#event:status">status</a></li><li><a href="grpc-ClientWritableStream.html#event:metadata">metadata</a></li><li><a href="grpc-ClientWritableStream.html#event:status">status</a></li><li><a href="grpc-ServerDuplexStream.html#~event:cancelled">cancelled</a></li><li><a href="grpc-ServerReadableStream.html#~event:cancelled">cancelled</a></li><li><a href="grpc-ServerUnaryCall.html#~event:cancelled">cancelled</a></li><li><a href="grpc-ServerWritableStream.html#~event:cancelled">cancelled</a></li></ul><h3>Namespaces</h3><ul><li><a href="grpc.html">grpc</a></li><li><a href="grpc.credentials.html">credentials</a></li></ul>
  240. </nav>
  241. <br class="clear">
  242. <footer>
  243. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed Jun 28 2017 09:44:06 GMT-0700 (PDT)
  244. </footer>
  245. <script> prettyPrint(); </script>
  246. <script src="scripts/linenumber.js"> </script>
  247. </body>
  248. </html>