Skip to content

Commit b0c4ffb

Browse files
Rohit MishraRohit Mishra
authored andcommitted
Updated the sdk with new method
1 parent 98903c0 commit b0c4ffb

File tree

4 files changed

+24
-26
lines changed

4 files changed

+24
-26
lines changed

csio-templates/tmpl/layout.tmpl

Lines changed: 19 additions & 19 deletions
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>

src/core/modules/assets.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ export default class Assets {
6464
}
6565

6666
/**
67-
* @method Addparam
67+
* @method AddParam
6868
* @description This method includes query parameter in query.
69-
* @example Assets().Query().addParam('include_dimension', 'true')
70-
* @returns {Query}
69+
* @example Stack.Assets('bltsomething123').addParam('include_dimension', 'true').fetch()
7170
*/
7271
addParam(key, value) {
7372
if (key && typeof key === 'string' && value && typeof value === 'string') {

src/core/modules/entry.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,9 @@ export default class Entry {
192192
}
193193

194194
/**
195-
* @method Addparam
195+
* @method AddParam
196196
* @description This method includes query parameter in query.
197-
* @example blogQuery.addParam('include_count', 'true')
198-
* @returns {Query}
197+
* @example blogQuery.addParam('include_count', 'true').fetch()
199198
*/
200199
addParam(key, value) {
201200
if (key && value && typeof key === 'string' && typeof value === 'string') {

src/core/modules/query.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ export default class Query extends Entry {
367367
}
368368

369369
/**
370-
* @method Addparam
370+
* @method AddParam
371371
* @description This method includes query parameter in query.
372372
* @example blogQuery.addParam('include_count', 'true')
373373
* @returns {Query}

0 commit comments

Comments
 (0)