prismic.io
Version:
JavaScript development kit for prismic.io
371 lines (120 loc) • 7.13 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Api</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">Class: Api</h1>
<section>
<header>
<h2>Api</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Api"><span class="type-signature"></span>new Api<span class="signature">(url)</span><span class="type-signature"> → {<a href="Api.html">Api</a>}</span></h4>
<div class="description">
The kit's main entry point; initialize your API like this: Prismic.api(url, {accessToken: "XXX"})
</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>url</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The mandatory URL of the prismic.io API endpoint (like: https://lesbonneschoses.prismic.io/api)</td>
</tr>
<tr>
<td class="name"><code>options.callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Optional callback function that is called after the API was retrieved, which will be called with two parameters: a potential error object and the API object</td>
</tr>
<tr>
<td class="name"><code>options.accessToken</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The accessToken, necessary if the API is set as private</td>
</tr>
<tr>
<td class="name"><code>options.req</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The NodeJS request (only use in a NodeJS context)</td>
</tr>
<tr>
<td class="name"><code>options.requestHandler</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Environment specific HTTP request handling function</td>
</tr>
<tr>
<td class="name"><code>options.apiCache</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A cache object with get/set functions for caching API responses</td>
</tr>
<tr>
<td class="name"><code>options.apiDataTTL</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last">How long (in seconds) to cache data used by the client to make calls (e.g. refs). Defaults to 5 seconds</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="prismic.io.js.html">prismic.io.js</a>, <a href="prismic.io.js.html#line3556">line 3556</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- The Api object that can be manipulated
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Api.html">Api</a></span>
</dd>
</dl>
</div>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Api.html">Api</a></li><li><a href="Doc.html">Doc</a></li><li><a href="Fragments_Color.html">Fragments:Color</a></li><li><a href="Fragments_Date.html">Fragments:Date</a></li><li><a href="Fragments_DocumentLink.html">Fragments:DocumentLink</a></li><li><a href="Fragments_Embed.html">Fragments:Embed</a></li><li><a href="Fragments_FileLink.html">Fragments:FileLink</a></li><li><a href="Fragments_GeoPoint.html">Fragments:GeoPoint</a></li><li><a href="Fragments_Group.html">Fragments:Group</a></li><li><a href="Fragments_ImageEl.html">Fragments:ImageEl</a></li><li><a href="Fragments_ImageLink.html">Fragments:ImageLink</a></li><li><a href="Fragments_ImageView.html">Fragments:ImageView</a></li><li><a href="Fragments_Num.html">Fragments:Num</a></li><li><a href="Fragments_Select.html">Fragments:Select</a></li><li><a href="Fragments_Separator.html">Fragments:Separator</a></li><li><a href="Fragments_Slice.html">Fragments:Slice</a></li><li><a href="Fragments_SliceZone.html">Fragments:SliceZone</a></li><li><a href="Fragments_StructuredText.html">Fragments:StructuredText</a></li><li><a href="Fragments_Text.html">Fragments:Text</a></li><li><a href="Fragments_Timestamp.html">Fragments:Timestamp</a></li><li><a href="Fragments_WebLink.html">Fragments:WebLink</a></li><li><a href="Ref.html">Ref</a></li><li><a href="Response.html">Response</a></li><li><a href="SearchForm.html">SearchForm</a></li></ul><h3>Namespaces</h3><ul><li><a href="Predicates.html">Predicates</a></li></ul><h3>Global</h3><ul><li><a href="global.html">all</a></li><li><a href="global.html#catch">catch</a></li><li><a href="global.html#punycode">punycode</a></li><li><a href="global.html">race</a></li><li><a href="global.html">reject</a></li><li><a href="global.html">resolve</a></li><li><a href="global.html#then">then</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Thu Oct 06 2016 15:07:13 GMT+0200 (CEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>