protobuf.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  1. /*
  2. * Copyright 2012 The Closure Compiler Authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * @fileoverview Externs for ProtoBuf.js.
  18. * @see https://github.com/dcodeIO/ProtoBuf.js
  19. * @externs
  20. */
  21. /**
  22. BEGIN_NODE_INCLUDE
  23. var ProtoBuf = require('protobufjs');
  24. END_NODE_INCLUDE
  25. */
  26. /**
  27. * @typedef {Array}
  28. */
  29. var Buffer;
  30. /**
  31. * @typedef {Object}
  32. */
  33. var dcodeIO;
  34. /**
  35. * {@type Object.<string.*>}
  36. */
  37. var ProtoBuf = {};
  38. /**
  39. * @type {string}
  40. * @const
  41. */
  42. ProtoBuf.VERSION;
  43. /**
  44. * @type {!Object.<string,number>}
  45. * @const
  46. */
  47. ProtoBuf.WIRE_TYPES = {};
  48. /**
  49. * @type {number}
  50. * @const
  51. */
  52. ProtoBuf.WIRE_TYPES.VARINT;
  53. /**
  54. * @type {number}
  55. * @const
  56. */
  57. ProtoBuf.WIRE_TYPES.BITS64;
  58. /**
  59. * @type {number}
  60. * @const
  61. */
  62. ProtoBuf.WIRE_TYPES.LDELIM;
  63. /**
  64. * @type {number}
  65. * @const
  66. */
  67. ProtoBuf.WIRE_TYPES.STARTGROUP;
  68. /**
  69. * @type {number}
  70. * @const
  71. */
  72. ProtoBuf.WIRE_TYPES.ENDGROUP;
  73. /**
  74. * @type {number}
  75. * @const
  76. */
  77. ProtoBuf.WIRE_TYPES.BITS32;
  78. /**
  79. * @type {!Array.<number>}
  80. * @const
  81. */
  82. ProtoBuf.PACKABLE_WIRE_TYPES;
  83. /**
  84. * @type {boolean}
  85. */
  86. ProtoBuf.convertFieldsToCamelCase;
  87. /**
  88. * @type {boolean}
  89. */
  90. ProtoBuf.populateAccessors;
  91. /**
  92. * @dict
  93. * @type {!Object<string,{name: string, wireType: number}>}
  94. * @const
  95. */
  96. ProtoBuf.TYPES;
  97. /**
  98. * @type {number}
  99. */
  100. ProtoBuf.ID_MIN;
  101. /**
  102. * @type {number}
  103. */
  104. ProtoBuf.ID_MAX;
  105. /**
  106. * @type {!function(new: ByteBuffer, ...*)}
  107. */
  108. ProtoBuf.ByteBuffer;
  109. /**
  110. * @type {?function(new: Long, ...*)}
  111. */
  112. ProtoBuf.Long;
  113. /**
  114. * @type {!Object<string,string|RegExp>}
  115. */
  116. ProtoBuf.Lang;
  117. /**
  118. * @type {Object<string, function(*)>}
  119. */
  120. ProtoBuf.DotProto;
  121. /**
  122. * @param {string} proto
  123. * @constructor
  124. */
  125. ProtoBuf.DotProto.Tokenizer = function(proto) {};
  126. /**
  127. * @type {string}
  128. */
  129. ProtoBuf.DotProto.Tokenizer.prototype.source;
  130. /**
  131. * @type {number}
  132. */
  133. ProtoBuf.DotProto.Tokenizer.prototype.index;
  134. /**
  135. * @type {number}
  136. */
  137. ProtoBuf.DotProto.Tokenizer.prototype.line;
  138. /**
  139. * @type {Array.<string>}
  140. */
  141. ProtoBuf.DotProto.Tokenizer.prototype.stack;
  142. /**
  143. * @type {boolean}
  144. */
  145. ProtoBuf.DotProto.Tokenizer.prototype.readingString;
  146. /**
  147. * @return {?string}
  148. * @throws {Error}
  149. */
  150. ProtoBuf.DotProto.Tokenizer.prototype.next = function() {};
  151. /**
  152. * @return {?string}
  153. * @throws {Error}
  154. */
  155. ProtoBuf.DotProto.Tokenizer.prototype.peek = function() {};
  156. /**
  157. * @return {string}
  158. * @nosideeffects
  159. */
  160. ProtoBuf.DotProto.Tokenizer.prototype.toString = function() {};
  161. /**
  162. * @param {string} proto
  163. * @constructor
  164. */
  165. ProtoBuf.DotProto.Parser = function(proto) {};
  166. /**
  167. * @type {!ProtoBuf.DotProto.Tokenizer}
  168. */
  169. ProtoBuf.DotProto.Parser.prototype.tn;
  170. /**
  171. * @return {{package: (string|null), messages: Array.<Object>, enums: Array.<Object>, imports: Array.<string>, options: Object<string,*>}}
  172. * @throws {Error}
  173. */
  174. ProtoBuf.DotProto.Parser.prototype.parse = function() {};
  175. /**
  176. * @return {string}
  177. * @nosideeffects
  178. */
  179. ProtoBuf.DotProto.Parser.prototype.toString = function() {};
  180. /**
  181. * @type {Object<string, function(*)>}
  182. */
  183. ProtoBuf.Reflect.Reflect = {};
  184. /**
  185. * @constructor
  186. * @param {ProtoBuf.Reflect.T} parent
  187. * @param {string} name Object name
  188. */
  189. ProtoBuf.Reflect.T = function(parent, name) {};
  190. /**
  191. * @type {?ProtoBuf.Reflect.T}
  192. */
  193. ProtoBuf.Reflect.T.prototype.parent;
  194. /**
  195. * @type {string}
  196. */
  197. ProtoBuf.Reflect.T.prototype.name;
  198. /**
  199. * @returns {string}
  200. * @nosideeffects
  201. */
  202. ProtoBuf.Reflect.T.prototype.fqn = function() {};
  203. /**
  204. * @param {boolean=} includeClass
  205. * @returns {string}
  206. * @nosideeffects
  207. */
  208. ProtoBuf.Reflect.T.prototype.toString = function(includeClass) {};
  209. /**
  210. * @throws {Error}
  211. */
  212. ProtoBuf.Reflect.T.prototype.build = function() {};
  213. /**
  214. * @param {?ProtoBuf.Reflect.Namespace} parent
  215. * @param {string} name
  216. * @constructor
  217. * @extends ProtoBuf.Reflect.T
  218. */
  219. ProtoBuf.Reflect.Namespace = function(parent, name) {};
  220. /**
  221. * @type {Array.<ProtoBuf.Reflect.T>}
  222. */
  223. ProtoBuf.Reflect.Namespace.prototype.children;
  224. /**
  225. * @param {ProtoBuf.Reflect.T=} type
  226. * @return {Array.<ProtoBuf.Reflect.T>}
  227. * @nosideeffects
  228. */
  229. ProtoBuf.Reflect.Namespace.prototype.getChildren = function(type) {};
  230. /**
  231. * @param {ProtoBuf.Reflect.T} child
  232. * @throws {Error}
  233. */
  234. ProtoBuf.Reflect.Namespace.prototype.addChild = function(child) {};
  235. /**
  236. * @param {string|number} nameOrId
  237. * @returns {boolean}
  238. * @nosideeffects
  239. */
  240. ProtoBuf.Reflect.Namespace.prototype.hasChild = function(nameOrId) {};
  241. /**
  242. * @param {string|number} nameOrId
  243. * @return {?ProtoBuf.Reflect.T}
  244. * @nosideeffects
  245. */
  246. ProtoBuf.Reflect.Namespace.prototype.getChild = function(nameOrId) {};
  247. /**
  248. * @param {string} qn
  249. * @param {boolean=} excludeFields
  250. * @return {?ProtoBuf.Reflect.Namespace}
  251. * @nosideeffects
  252. */
  253. ProtoBuf.Reflect.Namespace.prototype.resolve = function(qn, excludeFields) {};
  254. /**
  255. * @return {Object.<string,Function|Object>}
  256. */
  257. ProtoBuf.Reflect.Namespace.prototype.build = function() {};
  258. /**
  259. * @param {!ProtoBuf.Reflect.Namespace} parent
  260. * @param {string} name
  261. * @constructor
  262. * @extends ProtoBuf.Reflect.Namespace
  263. */
  264. ProtoBuf.Reflect.Message = function(parent, name) {};
  265. /**
  266. * @type {?Array.<number>}
  267. */
  268. ProtoBuf.Reflect.Message.prototype.extensions;
  269. /**
  270. * @type {?ProtoBuf.Builder.Message}
  271. */
  272. ProtoBuf.Reflect.Message.prototype.clazz;
  273. /**
  274. * @return {!ProtoBuf.Builder.Message}
  275. * @throws {Error}
  276. */
  277. ProtoBuf.Reflect.Message.prototype.build = function() {};
  278. /**
  279. * @param {!ProtoBuf.Builder.Message} message
  280. * @param {!ByteBuffer} buffer
  281. * @return {!ByteBuffer}
  282. * @throws {Error}
  283. */
  284. ProtoBuf.Reflect.Message.prototype.encode = function(message, buffer) {};
  285. /**
  286. * @param {!ProtoBuf.Builder.Message} message
  287. * @return {number}
  288. * @throws {Error}
  289. */
  290. ProtoBuf.Reflect.Message.prototype.calculate = function(message) {};
  291. /**
  292. * @param {!ProtoBuf.Builder.Message} message
  293. * @param {!ByteBuffer} buffer
  294. * @param {boolean} noVerify
  295. * @return {!ByteBuffer}
  296. * @throws {Error}
  297. */
  298. ProtoBuf.Reflect.Message.prototype.encodeDelimited = function(message, buffer, noVerify) {};
  299. /**
  300. * @param {!ByteBuffer} buffer
  301. * @param {number=} length
  302. * @return {!ProtoBuf.Builder.Message}
  303. * @throws {Error}
  304. */
  305. ProtoBuf.Reflect.Message.prototype.decode = function(buffer, length) {};
  306. /**
  307. * @param {!ByteBuffer} buffer
  308. * @param {number=} length
  309. * @return {!ProtoBuf.Builder.Message}
  310. * @throws {Error}
  311. */
  312. ProtoBuf.Reflect.Message.prototype.decodeDelimited = function(buffer, length) {};
  313. /**
  314. * @param {!ProtoBuf.Reflect.Message} message
  315. * @param {string} rule
  316. * @param {string} type
  317. * @param {string} name
  318. * @param {number} id
  319. * @param {Object<string>=} options
  320. * @constructor
  321. * @extends ProtoBuf.Reflect.T
  322. */
  323. ProtoBuf.Reflect.Message.Field = function(message, rule, type, name, id, options) {};
  324. /**
  325. * @type {boolean}
  326. */
  327. ProtoBuf.Reflect.Message.Field.prototype.required;
  328. /**
  329. * @type {boolean}
  330. */
  331. ProtoBuf.Reflect.Message.Field.prototype.repeated;
  332. /**
  333. * @type {string|{name: string, wireType: number}}
  334. */
  335. ProtoBuf.Reflect.Message.Field.prototype.type;
  336. /**
  337. * @type {number}
  338. */
  339. ProtoBuf.Reflect.Message.Field.prototype.id;
  340. /**
  341. * @type {!Object.<string,*>}
  342. */
  343. ProtoBuf.Reflect.Message.Field.prototype.options;
  344. /**
  345. * @type {?ProtoBuf.Reflect.T}
  346. */
  347. ProtoBuf.Reflect.Message.Field.prototype.resolvedType;
  348. /**
  349. * @type {string}
  350. */
  351. ProtoBuf.Reflect.Message.Field.prototype.originalName;
  352. /**
  353. * @param {*} value
  354. * @param {boolean=} skipRepeated
  355. * @return {*}
  356. * @throws {Error}
  357. * @nosideeffects
  358. */
  359. ProtoBuf.Reflect.Message.Field.prototype.verifyValue = function(value, skipRepeated) {};
  360. /**
  361. * @param {*} value
  362. * @param {!ByteBuffer} buffer
  363. * @return {!ByteBuffer}
  364. * @throws {Error}
  365. */
  366. ProtoBuf.Reflect.Message.Field.prototype.encode = function(value, buffer) {};
  367. /**
  368. * @param {*} value
  369. * @return {number}
  370. * @throws {Error}
  371. * @nosideeffects
  372. */
  373. ProtoBuf.Reflect.Message.Field.prototype.calculate = function(value) {};
  374. /**
  375. * @param {number} wireType
  376. * @param {!ByteBuffer} buffer
  377. * @return {*}
  378. * @throws {Error}
  379. */
  380. ProtoBuf.Reflect.Message.Field.prototype.decode = function(wireType, buffer) {};
  381. /**
  382. * @param {*} value
  383. * @param {!ByteBuffer} buffer
  384. * @return {!ByteBuffer}
  385. * @throws {Error}
  386. */
  387. ProtoBuf.Reflect.Message.Field.prototype.encodeValue = function(value, buffer) {};
  388. /**
  389. * @param {!ProtoBuf.Reflect.T} parent
  390. * @param {string} name
  391. * @constructor
  392. * @extends ProtoBuf.Reflect.Namespace
  393. */
  394. ProtoBuf.Reflect.Enum = function(parent, name) {};
  395. /**
  396. * @return {Object<string,*>}
  397. */
  398. ProtoBuf.Reflect.Enum.prototype.build = function() {};
  399. /**
  400. * @type {?Object.<string,number>}
  401. */
  402. ProtoBuf.Reflect.Enum.prototype.object;
  403. /**
  404. * @param {!ProtoBuf.Reflect.Enum} enm
  405. * @param {string} name
  406. * @param {number} id
  407. * @constructor
  408. * @extends ProtoBuf.Reflect.T
  409. */
  410. ProtoBuf.Reflect.Enum.Value = function(enm, name, id) {};
  411. /**
  412. * @type {number}
  413. */
  414. ProtoBuf.Reflect.Enum.Value.prototype.id;
  415. /**
  416. * @param {!ProtoBuf.Reflect.Namespace} root
  417. * @param {string} name Service name
  418. * @param {Object.<string,*>=} options
  419. * @constructor
  420. * @extends ProtoBuf.Reflect.Namespace
  421. */
  422. ProtoBuf.Reflect.Service = function(root, name, options) {};
  423. /**
  424. * @type {ProtoBuf.Builder.Service}
  425. */
  426. ProtoBuf.Reflect.Service.prototype.clazz;
  427. /**
  428. * @return {!ProtoBuf.Builder.Service}
  429. * @throws {Error}
  430. */
  431. ProtoBuf.Reflect.Service.prototype.build = function() {};
  432. /**
  433. * @param {!ProtoBuf.Reflect.Service} svc
  434. * @param {string} name
  435. * @param {Object.<string,*>=} options
  436. * @constructor
  437. * @extends ProtoBuf.Reflect.T
  438. */
  439. ProtoBuf.Reflect.Service.Method = function(svc, name, options) {};
  440. /**
  441. * @return {Object.<string,*>}
  442. */
  443. ProtoBuf.Reflect.Service.Method.prototype.buildOpt = function() {};
  444. /**
  445. * @param {!ProtoBuf.Reflect.Service} svc
  446. * @param {string} name
  447. * @param {string} request
  448. * @param {string} response
  449. * @param {Object.<string,*>=} options
  450. * @constructor
  451. * @extends ProtoBuf.Reflect.Service.Method
  452. */
  453. ProtoBuf.Reflect.Service.RPCMethod = function(svc, name, request, response, options) {};
  454. /**
  455. * @type {string}
  456. */
  457. ProtoBuf.Reflect.Service.RPCMethod.prototype.requestName;
  458. /**
  459. * @type {string}
  460. */
  461. ProtoBuf.Reflect.Service.RPCMethod.prototype.responseName;
  462. /**
  463. * @type {ProtoBuf.Reflect.Message}
  464. */
  465. ProtoBuf.Reflect.Service.RPCMethod.prototype.resolvedRequestType;
  466. /**
  467. * @type {ProtoBuf.Reflect.Message}
  468. */
  469. ProtoBuf.Reflect.Service.RPCMethod.prototype.resolvedResponseType;
  470. /**
  471. * @constructor
  472. */
  473. ProtoBuf.Builder = function() {};
  474. /**
  475. * @type {!ProtoBuf.Reflect.Namespace}
  476. */
  477. ProtoBuf.Builder.prototype.ns;
  478. /**
  479. * @type {?ProtoBuf.Reflect.T}
  480. */
  481. ProtoBuf.Builder.prototype.ptr;
  482. /**
  483. * @type {boolean}
  484. */
  485. ProtoBuf.Builder.prototype.resolved;
  486. /**
  487. * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
  488. */
  489. ProtoBuf.Builder.prototype.result;
  490. /**
  491. * @type {Array.<string>}
  492. */
  493. ProtoBuf.Builder.prototype.files;
  494. /**
  495. * @type {?string}
  496. */
  497. ProtoBuf.Builder.prototype.importRoot;
  498. /**
  499. */
  500. ProtoBuf.Builder.prototype.reset = function() {};
  501. /**
  502. * @param {string} pkg
  503. * @return {!ProtoBuf.Builder}
  504. * @throws {Error}
  505. */
  506. ProtoBuf.Builder.prototype.define = function(pkg) {};
  507. /**
  508. * @param {Object.<string,*>} def
  509. * @return {boolean}
  510. * @nosideeffects
  511. */
  512. ProtoBuf.Builder.isValidMessage = function(def) {};
  513. /**
  514. * @param {Object.<string,*>} def
  515. * @return {boolean}
  516. * @nosideeffects
  517. */
  518. ProtoBuf.Builder.isValidMessageField = function(def) {};
  519. /**
  520. * @param {Object.<string,*>} def
  521. * @return {boolean}
  522. */
  523. ProtoBuf.Builder.isValidEnum = function(def) {};
  524. /**
  525. * @param {Object.<string,*>} def
  526. * @return {boolean}
  527. */
  528. ProtoBuf.Builder.isValidService = function(def) {};
  529. /**
  530. * @param {Object.<string,*>} def
  531. * @return {boolean}
  532. */
  533. ProtoBuf.Builder.isValidExtend = function(def) {};
  534. /**
  535. * @param {Array.<Object.<string,*>>} messages
  536. * @return {ProtoBuf.Builder}
  537. * @throws {Error}
  538. */
  539. ProtoBuf.Builder.prototype.create = function(messages) {};
  540. /**
  541. * @name ProtoBuf.Builder.prototype.import
  542. * @function
  543. * @param {ProtoBuf.Builder} builder
  544. * @param {(string|{root: string, file: string})=} filename
  545. * @return {!ProtoBuf.Builder}
  546. * @throws {Error}
  547. */
  548. ProtoBuf.Builder.prototype["import"] = function(builder, filename) {};
  549. /**
  550. * @throws {Error}
  551. */
  552. ProtoBuf.Builder.prototype.resolveAll = function() {};
  553. /**
  554. * @param {string=} path
  555. * @return {ProtoBuf.Builder.Message|Object.<string,*>}
  556. * @throws {Error}
  557. */
  558. ProtoBuf.Builder.prototype.build = function(path) {};
  559. /**
  560. * @param {string=} path
  561. * @return {?ProtoBuf.Reflect.T}
  562. */
  563. ProtoBuf.Builder.prototype.lookup = function(path) {};
  564. /**
  565. * @return {string}
  566. * @nosideeffects
  567. */
  568. ProtoBuf.Builder.prototype.toString = function() {};
  569. /**
  570. * @param {Object.<string,*>} values
  571. * @constructor
  572. * @throws {Error}
  573. */
  574. ProtoBuf.Builder.Message = function(values) {};
  575. /**
  576. * @param {string} key
  577. * @param {*} value
  578. * @param {boolean=} noAssert
  579. * @throws {Error}
  580. */
  581. ProtoBuf.Builder.Message.prototype.add = function(key, value, noAssert) {};
  582. /**
  583. * @param {string} key
  584. * @param {*} value
  585. * @param {boolean=} noAssert
  586. * @throws {Error}
  587. */
  588. ProtoBuf.Builder.Message.prototype.$add = function(key, value, noAssert) {};
  589. /**
  590. * @param {string} key
  591. * @param {*} value
  592. * @param {boolean=} noAssert
  593. * @throws {Error}
  594. */
  595. ProtoBuf.Builder.Message.prototype.set = function(key, value, noAssert) {};
  596. /**
  597. * @param {string} key
  598. * @param {*} value
  599. * @param {boolean=} noAssert
  600. * @throws {Error}
  601. */
  602. ProtoBuf.Builder.Message.prototype.$set = function(key, value, noAssert) {};
  603. /**
  604. * @param {string} key
  605. * @return {*}
  606. * @throws {Error}
  607. * @nosideeffects
  608. */
  609. ProtoBuf.Builder.Message.prototype.get = function(key) {};
  610. /**
  611. * @param {string} key
  612. * @return {*}
  613. * @throws {Error}
  614. * @nosideeffects
  615. */
  616. ProtoBuf.Builder.Message.prototype.$get = function(key) {};
  617. /**
  618. * @param {ByteBuffer=} buffer
  619. * @return {!ByteBuffer}
  620. * @throws {Error}
  621. */
  622. ProtoBuf.Builder.Message.prototype.encode = function(buffer) {};
  623. /**
  624. * @return {number}
  625. * @throws {Error}
  626. * @nosideeffects
  627. */
  628. ProtoBuf.Builder.Message.prototype.calculate = function() {};
  629. /**
  630. * @return {!ArrayBuffer}
  631. * @throws {Error}
  632. */
  633. ProtoBuf.Builder.Message.prototype.encodeAB = function() {};
  634. /**
  635. * @return {!ArrayBuffer}
  636. * @throws {Error}
  637. * @nosideeffects
  638. */
  639. ProtoBuf.Builder.Message.prototype.toArrayBuffer = function() {};
  640. /**
  641. * @return {!Buffer}
  642. * @throws {Error}
  643. */
  644. ProtoBuf.Builder.Message.prototype.encodeNB = function() {};
  645. /**
  646. * @return {!Buffer}
  647. * @throws {Error}
  648. * @nosideeffects
  649. */
  650. ProtoBuf.Builder.Message.prototype.toBuffer = function() {};
  651. /**
  652. * @return {string}
  653. * @throws {Error}
  654. * @nosideeffects
  655. */
  656. ProtoBuf.Builder.Message.prototype.encode64 = function() {};
  657. /**
  658. * @return {string}
  659. * @throws {Error}
  660. * @nosideeffects
  661. */
  662. ProtoBuf.Builder.Message.prototype.toBase64 = function() {};
  663. /**
  664. * @return {string}
  665. * @throws {Error}
  666. * @nosideeffects
  667. */
  668. ProtoBuf.Builder.Message.prototype.encodeHex = function() {};
  669. /**
  670. * @return {string}
  671. * @throws {Error}
  672. * @nosideeffects
  673. */
  674. ProtoBuf.Builder.Message.prototype.toHex = function() {};
  675. /**
  676. * @param {boolean=} includeBuffers
  677. * @return {Object.<string,*>}
  678. * @nosideeffects
  679. */
  680. ProtoBuf.Builder.Message.prototype.toRaw = function(includeBuffers) {};
  681. /**
  682. * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer
  683. * @param {string=} enc
  684. * @return {!ProtoBuf.Builder.Message}
  685. * @throws {Error}
  686. * @nosideeffects
  687. */
  688. ProtoBuf.Builder.Message.decode = function(buffer, enc) {};
  689. /**
  690. * @param {string} str
  691. * @return {!ProtoBuf.Builder.Message}
  692. * @throws {Error}
  693. * @nosideeffects
  694. */
  695. ProtoBuf.Builder.Message.decode64 = function(str) {};
  696. /**
  697. * @param {string} str
  698. * @return {!ProtoBuf.Builder.Message}
  699. * @throws {Error}
  700. * @nosideeffects
  701. */
  702. ProtoBuf.Builder.Message.decodeHex = function(str) {};
  703. /**
  704. * @return {string}
  705. * @nosideeffects
  706. */
  707. ProtoBuf.Builder.Message.prototype.toString = function() {};
  708. /**
  709. * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl
  710. * @constructor
  711. */
  712. ProtoBuf.Builder.Service = function(rpcImpl) {};
  713. /**
  714. * @type {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
  715. */
  716. ProtoBuf.Builder.prototype.rpcImpl;
  717. /**
  718. * @param {string} proto
  719. * @param {(ProtoBuf.Builder|string)=} builder
  720. * @param {(string|{root: string, file: string})=} filename
  721. * @return {!ProtoBuf.Builder}
  722. * @throws {Error}
  723. */
  724. ProtoBuf.loadProto = function(proto, builder, filename) {};
  725. /**
  726. * @param {string} proto
  727. * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder
  728. * @param {(string|{root: string, file: string})=} filename
  729. * @return {!ProtoBuf.Builder}
  730. * @throws {Error}
  731. */
  732. ProtoBuf.protoFromString = function(proto, builder, filename) {};
  733. /**
  734. * @param {string|{root: string, file: string}} filename
  735. * @param {(function(ProtoBuf.Builder)|ProtoBuf.Builder)=} callback
  736. * @param {ProtoBuf.Builder=} builder
  737. * @return {ProtoBuf.Builder|undefined}
  738. * @throws {Error}
  739. */
  740. ProtoBuf.loadProtoFile = function(filename, callback, builder) {};
  741. /**
  742. * @param {string|{root: string, file: string}} filename
  743. * @param {(function(ProtoBuf.Builder)|ProtoBuf.Builder)=} callback
  744. * @param {ProtoBuf.Builder=} builder
  745. * @return {ProtoBuf.Builder|undefined}
  746. * @throws {Error}
  747. */
  748. ProtoBuf.protoFromFile = function(filename, callback, builder) {};
  749. /**
  750. * @param {!*|string} json
  751. * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder
  752. * @param {(string|{root: string, file: string})=} filename
  753. * @return {!ProtoBuf.Builder}
  754. * @throws {Error}
  755. */
  756. ProtoBuf.loadJson = function(json, builder, filename) {};
  757. /**
  758. * @param {string|{root: string, file: string}} filename
  759. * @param {(function(ProtoBuf.Builder)|ProtoBuf.Builder)=} callback
  760. * @param {ProtoBuf.Builder=} builder
  761. * @return {ProtoBuf.Builder|undefined}
  762. * @throws {Error}
  763. */
  764. ProtoBuf.loadJsonFile = function(filename, callback, builder) {};
  765. /**
  766. * @param {string=} pkg
  767. * @return {!ProtoBuf.Builder}
  768. */
  769. ProtoBuf.newBuilder = function(pkg) {};
  770. ProtoBuf.Util = {};
  771. /**
  772. * @type {boolean}
  773. */
  774. ProtoBuf.Util.IS_NODE;
  775. /**
  776. * @return {XMLHttpRequest}
  777. */
  778. ProtoBuf.Util.XHR = function() {};
  779. /**
  780. * @param {string} path
  781. * @param {function(?string)=} callback
  782. * @return {?string|undefined}
  783. */
  784. ProtoBuf.Util.fetch = function(path, callback) {};
  785. /**
  786. * @param {*} obj
  787. * @return {boolean}
  788. */
  789. ProtoBuf.Util.isArray = function(obj) {};