forked from contentstack/contentstack-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontentstack.js
More file actions
45 lines (41 loc) · 1.16 KB
/
contentstack.js
File metadata and controls
45 lines (41 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import Stack from "./stack";
import CacheProvider from './cache-provider/index';
/**
* @method Contentstack
* @description Creates an instance of `Contentstack`.
* @api public
*/
class Contentstack {
constructor(){
/**
* @constant CachePolicy
* @description CachePolicy contains different cache policies constants.
* @example
* Contentstack.CachePolicy.IGNORE_CACHE
* Contentstack.CachePolicy.ONLY_NETWORK
* Contentstack.CachePolicy.CACHE_ELSE_NETWORK
* Contentstack.CachePolicy.NETWORK_ELSE_CACHE
* Contentstack.CachePolicy.CACHE_THEN_NETWORK
*/
this.CachePolicy = CacheProvider.policies;
}
/**
* @method Stack
* @description Initialize "Built.io Contentstack" Stack javascript-SDK instance
* @api public
* @example
* var Stack = Contentstack.Stack('api_key', 'access_token', 'environment');
* OR
* var Stack = Contentstack.Stack({
* 'api_key':'bltsomethingapikey',
* 'access_token':'bltsomethongtoken',
* 'environment':'environment_name'
* });
*
* @returns {Stack}
*/
Stack(...stack_arguments){
return new Stack(...stack_arguments);
}
}
module.exports = new Contentstack();