blob: 0f13b43e9e4005e9776871bcb1447c956e861851 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Module: odata/batch</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Module: odata/batch</h1>
<section>
<header>
<h2>
odata/batch
</h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line21">line 21</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<dt>
<h4 class="name" id="batchHandler"><span class="type-signature">&lt;static> </span>batchHandler<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
batchHandler (see <a href="batch.html#batchParser">module:odata/batch~batchParser</a>)
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line371">line 371</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="batchSerializer"><span class="type-signature">&lt;static> </span>batchSerializer<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
batchSerializer (see <a href="batch.html#batchSerializer">module:odata/batch~batchSerializer</a>)
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line374">line 374</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="writeRequest"><span class="type-signature">&lt;static> </span>writeRequest<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
writeRequest (see <a href="batch.html#writeRequest">module:odata/batch~writeRequest</a>)
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line377">line 377</a>
</li></ul></dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="batchParser"><span class="type-signature">&lt;inner> </span>batchParser<span class="signature">(handler, text, context)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Parses a batch response.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>handler</code></td>
<td class="type">
</td>
<td class="description last">This handler.</td>
</tr>
<tr>
<td class="name"><code>text</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Batch text.</td>
</tr>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Object with parsing context.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line88">line 88</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
An object representation of the batch.
</div>
</dd>
<dt>
<h4 class="name" id="batchSerializer"><span class="type-signature">&lt;inner> </span>batchSerializer<span class="signature">(handler, data, context)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Serializes a batch object representation into text.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>handler</code></td>
<td class="type">
</td>
<td class="description last">This handler.</td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Representation of a batch.</td>
</tr>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Object with parsing context.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line100">line 100</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
An text representation of the batch object; undefined if not applicable.#
</div>
</dd>
<dt>
<h4 class="name" id="createBoundary"><span class="type-signature">&lt;inner> </span>createBoundary<span class="signature">(<span class="optional">prefix</span>)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
Creates a string that can be used as a multipart request boundary.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>prefix</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">-</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line59">line 59</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Boundary string of the format: <prefix><hex16>-<hex16>-<hex16>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="currentBoundary"><span class="type-signature">&lt;inner> </span>currentBoundary<span class="signature">(context)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
Gets the current boundary used for parsing the body of a multipart response.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
</td>
<td class="description last">Context used for parsing a multipart response.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line77">line 77</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Boundary string.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="hex16"><span class="type-signature">&lt;inner> </span>hex16<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
Calculates a random 16 bit number and returns it in hexadecimal format.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line50">line 50</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A 16-bit number in hex format.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="partHandler"><span class="type-signature">&lt;inner> </span>partHandler<span class="signature">(context)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Gets the handler for data serialization of individual requests / responses in a batch.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
</td>
<td class="description last">Context used for data serialization.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line68">line 68</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Handler object
</div>
</dd>
<dt>
<h4 class="name" id="readBatch"><span class="type-signature">&lt;inner> </span>readBatch<span class="signature">(text, context)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Parses a multipart/mixed response body from from the position defined by the context.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>text</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Body of the multipart/mixed response.</td>
</tr>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
</td>
<td class="description last">Context used for parsing.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line113">line 113</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Array of objects representing the individual responses.
</div>
</dd>
<dt>
<h4 class="name" id="readHeaders"><span class="type-signature">&lt;inner> </span>readHeaders<span class="signature">(text, context)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Parses the http headers in the text from the position defined by the context.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>text</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Text containing an http response's headers</td>
</tr>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
</td>
<td class="description last">Context used for parsing.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line178">line 178</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Object containing the headers as key value pairs. This function doesn't support split headers and it will stop reading when it hits two consecutive line breaks.
</div>
</dd>
<dt>
<h4 class="name" id="readLine"><span class="type-signature">&lt;inner> </span>readLine<span class="signature">(text, context)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
Returns a substring from the position defined by the context up to the next line break (CRLF).
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>text</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Input string.</td>
</tr>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
</td>
<td class="description last">Context used for reading the input string.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line238">line 238</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Substring to the first ocurrence of a line break or null if none can be found.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="readResponse"><span class="type-signature">&lt;inner> </span>readResponse<span class="signature">(text, context, delimiter)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Parses an HTTP response.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>text</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Text representing the http response.</td>
</tr>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
</td>
<td class="description last">optional - Context used for parsing.</td>
</tr>
<tr>
<td class="name"><code>delimiter</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">String used as delimiter of the multipart response parts.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line207">line 207</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Object representing the http response.
</div>
</dd>
<dt>
<h4 class="name" id="readTo"><span class="type-signature">&lt;inner> </span>readTo<span class="signature">(text, context, <span class="optional">str</span>)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
Returns a substring from the position given by the context up to value defined by the str parameter and increments the position in the context.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>text</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">Input string.</td>
</tr>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="description last">Context used for reading the input string.</td>
</tr>
<tr>
<td class="name"><code>str</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">Substring to read up to.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line249">line 249</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Substring to the first ocurrence of str or the end of the input string if str is not specified. Null if the marker is not found.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="writeBatch"><span class="type-signature">&lt;inner> </span>writeBatch<span class="signature">(data, context)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
Serializes a batch request object to a string.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
</td>
<td class="description last">Batch request object in payload representation format</td>
</tr>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
</td>
<td class="description last">Context used for the serialization</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line270">line 270</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
String representing the batch request
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="writeBatchPart"><span class="type-signature">&lt;inner> </span>writeBatchPart<span class="signature">(part, context, <span class="optional">nested</span>)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
Serializes a part of a batch request to a string. A part can be either a GET request or a change set grouping several CUD (create, update, delete) requests.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>part</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="description last">Request or change set object in payload representation format</td>
</tr>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="description last">Object containing context information used for the serialization</td>
</tr>
<tr>
<td class="name"><code>nested</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">-</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line314">line 314</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
String representing the serialized part A change set is an array of request objects and they cannot be nested inside other change sets.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="writeBatchPartDelimiter"><span class="type-signature">&lt;inner> </span>writeBatchPartDelimiter<span class="signature">(boundary, close)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
Creates the delimiter that indicates that start or end of an individual request.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>boundary</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Boundary string used to indicate the start of the request</td>
</tr>
<tr>
<td class="name"><code>close</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="description last">Flag indicating that a close delimiter string should be generated</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line297">line 297</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Delimiter string
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="writeRequest"><span class="type-signature">&lt;inner> </span>writeRequest<span class="signature">(request)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
Serializes a request object to a string.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>request</code></td>
<td class="type">
</td>
<td class="description last">Request object to serialize</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line351">line 351</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
String representing the serialized request
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils.html">odata/utils</a></li><li><a href="deferred.html">odatajs/deferred</a></li><li><a href="utils_.html">odatajs/utils</a></li><li><a href="xml.html">odatajs/xml</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a href="DjsDeferred.html">DjsDeferred</a></li><li><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Thu Apr 09 2015 08:31:26 GMT+0200 (MESZ)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>