Skip to content

Commit b23e69b

Browse files
Rohit MishraRohit Mishra
Rohit Mishra
authored and
Rohit Mishra
committed
Updated the sdk with new method
1 parent f701d59 commit b23e69b

14 files changed

+67
-70
lines changed

csio-templates/tmpl/layout.tmpl

+19-19
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,31 @@
4040
<p>You need Node.js version 4.4.7 or later installed to use the Contentstack JavaScript SDK.</p>
4141
<h3><a id="Setup_and_Installation_13"></a>Setup and Installation</h3>
4242
<h4><a id="For_JavaScript_Browser_15"></a>For JavaScript (Browser)</h4>
43-
<p>To use the JavaScript SDK, download it from <a href="https://contentstack.com/docs/platforms/javascript-browser/javascript_sdk_latest">here</a> and include it in the &lt;script&gt; tag:</p>
44-
<pre><code>&lt;script type="text/javascript" src="/path/to/contentstack.min.js"&gt;&lt;/script&gt;;
43+
<p>To use the JavaScript SDK, download it from <a href="https://www.contentstack.com/docs/platforms/javascript-browser/javascript_sdk_latest">here</a> and include it in the &lt;script&gt; tag:</p>
44+
<pre class="prettyprint"><code>&lt;script type="text/javascript" src="/path/to/contentstack.min.js"&gt;&lt;/script&gt;;
4545
</code></pre>
4646
<p>To initialize the SDK, you will need to specify the API Key, Access Token, and Environment Name of your stack.</p>
47-
<pre><code>const Stack = Contentstack.Stack("api_key", "access_token", "environment_name");
47+
<pre class="prettyprint"><code>const Stack = Contentstack.Stack("api_key", "access_token", "environment_name");
4848
</code></pre>
4949
<h4><a id="For_Nodejs_25"></a>For Node.js</h4>
50-
<p>Node.js uses the Javascript SDK to create apps. To use the JavaScript SDK, download it from <a href="https://contentstack.com/docs/platforms/javascript-browser/javascript_sdk_latest">here</a>, OR install it via npm:</p>
51-
<pre><code>npm -i contentstack
50+
<p>Node.js uses the Javascript SDK to create apps. To use the JavaScript SDK, download it from <a href="https://www.contentstack.com/docs/platforms/javascript-browser/javascript_sdk_latest">here</a>, OR install it via npm:</p>
51+
<pre class="prettyprint"><code>npm -i contentstack
5252
</code></pre>
5353
<p>To import the SDK in your project, use the following command:</p>
54-
<pre><code>import contentstack from ‘contentstack’
54+
<pre class="prettyprint"><code>import contentstack from ‘contentstack’
5555
</code></pre>
5656
<p>To initialize the SDK, you will need to specify the API Key, Access Token, and Environment Name of your stack.</p>
57-
<pre><code>const Stack = Contentstack.Stack("api_key","access_token","environment_name");
57+
<pre class="prettyprint"><code>const Stack = Contentstack.Stack("api_key","access_token","environment_name");
5858
</code></pre>
5959
<h4><a id="For_React_Native_39"></a>For React Native</h4>
60-
<p>React Native uses the Javascript SDK to create apps. To use the JavaScript SDK, download it from <a href="https://contentstack.com/docs/platforms/javascript-browser/javascript_sdk_latest">here</a>, OR install ist via npm:</p>
61-
<pre><code>npm -i contentstack
60+
<p>React Native uses the Javascript SDK to create apps. To use the JavaScript SDK, download it from <a href="https://www.contentstack.com/docs/platforms/javascript-browser/javascript_sdk_latest">here</a>, OR install ist via npm:</p>
61+
<pre class="prettyprint"><code>npm -i contentstack
6262
</code></pre>
6363
<p>To import the SDK in your project, use the following command:</p>
64-
<pre><code>import contentstack from `contentstack/react-native`
64+
<pre class="prettyprint" class="prettyprint"><code>import contentstack from `contentstack/react-native`
6565
</code></pre>
6666
<p>To initialize the SDK, you will need to specify the API Key, Access Token, and Environment Name of your stack.</p>
67-
<pre><code>const Stack = Contentstack.Stack("api_key", "access_token", "environment_name");
67+
<pre class="prettyprint"><code>const Stack = Contentstack.Stack("api_key", "access_token", "environment_name");
6868
</code></pre>
6969
<h3><a id="Key_Concepts_for_using_Contentstack_54"></a>Key Concepts for using Contentstack</h3>
7070
<h4><a id="Stack_56"></a>Stack</h4>
@@ -80,12 +80,12 @@
8080
<h3><a id="Contentstack_JavaScript_SDK_5minute_Quickstart_78"></a>Contentstack JavaScript SDK: 5-minute Quickstart</h3>
8181
<h4><a id="Initializing_your_SDK_80"></a>Initializing your SDK</h4>
8282
<p>You will need to specify the API key, Access token, and Environment Name of your stack to initialize the SDK:</p>
83-
<pre><code>const Stack = Contentstack.Stack("api_key", "access_token", "environment_name");
83+
<pre class="prettyprint"><code>const Stack = Contentstack.Stack("api_key", "access_token", "environment_name");
8484
</code></pre>
8585
<p>Once you have initialized the SDK, you can start getting content in your app.</p>
8686
<h4><a id="Querying_content_from_your_stack_90"></a>Querying content from your stack</h4>
8787
<p>To get a single entry, you need to specify the content type as well as the ID of the entry.</p>
88-
<pre><code>const Query = Stack.ContentType('blog').Entry("blt123something");
88+
<pre class="prettyprint"><code>const Query = Stack.ContentType('blog').Entry("blt123something");
8989

9090
Query.fetch()
9191
.then(function success(entry) {
@@ -96,7 +96,7 @@
9696
});
9797
</code></pre>
9898
<p>To retrieve multiple entries of a content type, you need to specify the content type uid. You can also specify search parameters to filter results.</p>
99-
<pre><code>const Query = Stack.ContentType('blog').Query();
99+
<pre class="prettyprint"><code>const Query = Stack.ContentType('blog').Query();
100100

101101
Query
102102
.where("title", "welcome")
@@ -117,17 +117,17 @@
117117
<p>You can set a cache policy on a stack and/or query object.</p>
118118
<h5><a id="Setting_a_cache_policy_on_a_stack_127"></a>Setting a cache policy on a stack</h5>
119119
<p>This option allows you to globalize a cache policy. This means the cache policy you set will be applied to all the query objects of the stack.</p>
120-
<pre><code>//Setting a cache policy on a stack
120+
<pre class="prettyprint"><code>//Setting a cache policy on a stack
121121
Stack.setCachePolicy(Contentstack.CachePolicy.NETWORK_ELSE_CACHE)
122122
</code></pre>
123123
<h5><a id="Setting_a_cache_policy_on_a_query_object_134"></a>Setting a cache policy on a query object</h5>
124124
<p>This option allows you to set/override a cache policy on a specific query object.</p>
125-
<pre><code>// setting a cache policy on a queryobject
125+
<pre class="prettyprint"><code>// setting a cache policy on a queryobject
126126
Query.setCachePolicy(Contentstack.CachePolicy.CACHE_THEN_NETWORK)
127127
</code></pre>
128128
<h3><a id="Advanced_Queries_141"></a>Advanced Queries</h3>
129129
<p>You can query for content types, entries, assets and more using our JavaScript API Reference.</p>
130-
<p><a href="https://contentstack.com/docs/platforms/javascript-browser/api-reference">JavaScript API Reference Doc</a></p>
130+
<p><a href="https://www.contentstack.com/docs/platforms/javascript-browser/api-reference/">JavaScript API Reference Doc</a></p>
131131
<h3><a id="Working_with_Images_147"></a>Working with Images</h3>
132132
<p>We have introduced Image Delivery APIs that let you retrieve images and then manipulate and optimize them for your digital properties. It lets you perform a host of other actions such as crop, trim, resize, rotate, overlay, and so on.</p>
133133
<p>For example, if you want to crop an image (with width as 300 and height as 400), you simply need to append query parameters at the end of the image URL, such as, <a href="https://images.contentstack.io/v3/assets/blteae40eb499811073/bltc5064f36b5855343/59e0c41ac0eddd140d5a8e3e/download?crop=300,400">https://images.contentstack.io/v3/assets/blteae40eb499811073/bltc5064f36b5855343/59e0c41ac0eddd140d5a8e3e/download?crop=300,400</a>. There are several more parameters that you can use for your images.</p>
@@ -136,8 +136,8 @@
136136
<h3><a id="Helpful_Links_157"></a>Helpful Links</h3>
137137
<ul>
138138
<li><a href="https://www.contentstack.com">Contentstack Website</a></li>
139-
<li><a href="https://contentstack.com/docs">Official Documentation</a></li>
140-
<li><a href="https://contentstack.com/docs/apis/content-delivery-api/">Content Delivery API Docs</a></li>
139+
<li><a href="https://www.contentstack.com/docs">Official Documentation</a></li>
140+
<li><a href="https://www.contentstack.com/docs/apis/content-delivery-api/">Content Delivery API Docs</a></li>
141141
</ul>
142142
<h3><a id="The_MIT_License_MIT_163"></a>The MIT License (MIT)</h3>
143143
<p>Copyright © 2012-2017 <a href="https://www.built.io/">Built.io</a>. All Rights Reserved</p>

js-sdk-reference/Result.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<label for="nav-trigger" class="overlay"></label>
2424

2525
<nav>
26-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Result.html">Result</a></li></ul><h3>Global</h3><ul><li><a href="global.html#Contentstack">Contentstack</a></li><li><a href="global.html#CachePolicy">CachePolicy</a></li><li><a href="global.html#Stack">Stack</a></li><li><a href="global.html#setPort">setPort</a></li><li><a href="global.html#setProtocol">setProtocol</a></li><li><a href="global.html#setHost">setHost</a></li><li><a href="global.html#setCachePolicy">setCachePolicy</a></li><li><a href="global.html#setCacheProvider">setCacheProvider</a></li><li><a href="global.html#getCacheProvider">getCacheProvider</a></li><li><a href="global.html#ContentType">ContentType</a></li><li><a href="global.html#Entry">Entry</a></li><li><a href="global.html#Assets">Assets</a></li><li><a href="global.html#Query">Query</a></li><li><a href="global.html#imageTransform">imageTransform</a></li><li><a href="global.html#only">only</a></li><li><a href="global.html#toJSON">toJSON</a></li><li><a href="global.html#Addparam">Addparam</a></li><li><a href="global.html#fetch">fetch</a></li><li><a href="global.html#except">except</a></li><li><a href="global.html#includeReference">includeReference</a></li><li><a href="global.html#language">language</a></li><li><a href="global.html#addQuery">addQuery</a></li><li><a href="global.html#includeSchema">includeSchema</a></li><li><a href="global.html#includeContentType">includeContentType</a></li><li><a href="global.html#includeOwner">includeOwner</a></li><li><a href="global.html#lessThan">lessThan</a></li><li><a href="global.html#lessThanOrEqualTo">lessThanOrEqualTo</a></li><li><a href="global.html#greaterThan">greaterThan</a></li><li><a href="global.html#greaterThanOrEqualTo">greaterThanOrEqualTo</a></li><li><a href="global.html#notEqualTo">notEqualTo</a></li><li><a href="global.html#containedIn">containedIn</a></li><li><a href="global.html#notContainedIn">notContainedIn</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#notExists">notExists</a></li><li><a href="global.html#ascending">ascending</a></li><li><a href="global.html#descending">descending</a></li><li><a href="global.html#skip">skip</a></li><li><a href="global.html#limit">limit</a></li><li><a href="global.html#or">or</a></li><li><a href="global.html#and">and</a></li><li><a href="global.html#whereequalTo">where</a></li><li><a href="global.html#count">count</a></li><li><a href="global.html#query">query</a></li><li><a href="global.html#tags">tags</a></li><li><a href="global.html#includeCount">includeCount</a></li><li><a href="global.html#getQuery">getQuery</a></li><li><a href="global.html#regex">regex</a></li><li><a href="global.html#search">search</a></li><li><a href="global.html#find">find</a></li><li><a href="global.html#findOne">findOne</a></li><li><a href="global.html#get">get</a></li><li><a href="global.html#getDownloadUrl">getDownloadUrl</a></li></ul>
26+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Result.html">Result</a></li></ul><h3>Global</h3><ul><li><a href="global.html#Contentstack">Contentstack</a></li><li><a href="global.html#CachePolicy">CachePolicy</a></li><li><a href="global.html#Stack">Stack</a></li><li><a href="global.html#setPort">setPort</a></li><li><a href="global.html#setProtocol">setProtocol</a></li><li><a href="global.html#setHost">setHost</a></li><li><a href="global.html#setCachePolicy">setCachePolicy</a></li><li><a href="global.html#setCacheProvider">setCacheProvider</a></li><li><a href="global.html#getCacheProvider">getCacheProvider</a></li><li><a href="global.html#ContentType">ContentType</a></li><li><a href="global.html#Entry">Entry</a></li><li><a href="global.html#Assets">Assets</a></li><li><a href="global.html#Query">Query</a></li><li><a href="global.html#imageTransform">imageTransform</a></li><li><a href="global.html#only">only</a></li><li><a href="global.html#toJSON">toJSON</a></li><li><a href="global.html#AddParam">AddParam</a></li><li><a href="global.html#fetch">fetch</a></li><li><a href="global.html#except">except</a></li><li><a href="global.html#includeReference">includeReference</a></li><li><a href="global.html#language">language</a></li><li><a href="global.html#addQuery">addQuery</a></li><li><a href="global.html#includeSchema">includeSchema</a></li><li><a href="global.html#includeContentType">includeContentType</a></li><li><a href="global.html#includeOwner">includeOwner</a></li><li><a href="global.html#lessThan">lessThan</a></li><li><a href="global.html#lessThanOrEqualTo">lessThanOrEqualTo</a></li><li><a href="global.html#greaterThan">greaterThan</a></li><li><a href="global.html#greaterThanOrEqualTo">greaterThanOrEqualTo</a></li><li><a href="global.html#notEqualTo">notEqualTo</a></li><li><a href="global.html#containedIn">containedIn</a></li><li><a href="global.html#notContainedIn">notContainedIn</a></li><li><a href="global.html#exists">exists</a></li><li><a href="global.html#notExists">notExists</a></li><li><a href="global.html#ascending">ascending</a></li><li><a href="global.html#descending">descending</a></li><li><a href="global.html#skip">skip</a></li><li><a href="global.html#limit">limit</a></li><li><a href="global.html#or">or</a></li><li><a href="global.html#and">and</a></li><li><a href="global.html#whereequalTo">where</a></li><li><a href="global.html#count">count</a></li><li><a href="global.html#query">query</a></li><li><a href="global.html#tags">tags</a></li><li><a href="global.html#includeCount">includeCount</a></li><li><a href="global.html#getQuery">getQuery</a></li><li><a href="global.html#regex">regex</a></li><li><a href="global.html#search">search</a></li><li><a href="global.html#find">find</a></li><li><a href="global.html#findOne">findOne</a></li><li><a href="global.html#get">get</a></li><li><a href="global.html#getDownloadUrl">getDownloadUrl</a></li></ul>
2727
</nav>
2828

2929
<div id="main">

0 commit comments

Comments
 (0)