grpc.Metadata.html 13 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015
  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><span class="attribs"><span class="type-signature"></span></span>
  20. <span class="ancestors"><a href="grpc.html">grpc</a>.</span>Metadata<span class="signature">()</span><span class="type-signature"></span></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#line35">line 35</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#line84">line 84</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#line137">line 137</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#line109">line 109</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#line123">line 123</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#line97">line 97</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#line72">line 72</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.5.3</a> on Fri Sep 08 2017 11:10:31 GMT-0700 (PDT)
  244. </footer>
  245. <script> prettyPrint(); </script>
  246. <script src="scripts/linenumber.js"> </script>
  247. </body>
  248. </html>