storyblok-js-client
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -59,2 +59,12 @@ 'use strict'; | ||
}, { | ||
key: 'getStories', | ||
value: function getStories(params) { | ||
return this.get('cdn/stories', params); | ||
} | ||
}, { | ||
key: 'getStory', | ||
value: function getStory(slug, params) { | ||
return this.get('cdn/stories/' + slug, params); | ||
} | ||
}, { | ||
key: 'setToken', | ||
@@ -61,0 +71,0 @@ value: function setToken(token) { |
{ | ||
"name": "storyblok-js-client", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Universal JavaScript SDK for Storyblok's API", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
@@ -7,0 +8,0 @@ "build": "babel source --presets babel-preset-es2015 --plugins transform-object-assign --out-dir dist" |
@@ -50,2 +50,10 @@ 'use strict' | ||
getStories(params) { | ||
return this.get('cdn/stories', params) | ||
} | ||
getStory(slug, params) { | ||
return this.get(`cdn/stories/${slug}`, params) | ||
} | ||
setToken(token) { | ||
@@ -52,0 +60,0 @@ this.accessToken = token |
94
test.ts
@@ -1,91 +0,9 @@ | ||
declare global { | ||
interface StoryblokBridgeConfig { | ||
initOnlyOnce?: boolean, | ||
accessToken: string | ||
} | ||
interface StoryblokBridge { | ||
init: (config: StoryblokBridgeConfig) => void | ||
on: (event: any, callback: () => void) => void | ||
} | ||
interface Window { | ||
storyblok: StoryblokBridge | ||
} | ||
} | ||
import StoryblokClient from './dist/index.js' | ||
import { AxiosInstance } from 'axios' | ||
interface StoryblokConfig { | ||
accessToken: string | ||
cache?: StoryblokCache | ||
timeout?: number | ||
headers?: any | ||
} | ||
interface StoryblokCache { | ||
type?: 'memory' | ||
clear?: 'auto' | 'manual' | ||
} | ||
export interface StoryblokResponse { | ||
data: any | ||
perPage: number | ||
total: number | ||
} | ||
interface Params { | ||
token?: string | ||
with_tag?: string | ||
is_startpage?: 0 | 1 | ||
starts_with?: string | ||
by_uuids?: string | ||
excluding_ids?: string | ||
excluding_fields?: string | ||
version?: 'draft' | 'published' | ||
cv?: number | ||
sort_by?: string | ||
search_term?: string | ||
filter_query?: any | ||
per_page?: number | ||
page?: string | ||
} | ||
declare class Storyblok { | ||
throttle: any | ||
cacheVersion: number | ||
accessToken: string | ||
cache: StoryblokCache | ||
client: AxiosInstance | ||
constructor(config: StoryblokConfig, endpoint?: string) | ||
get(slug: string, params?: Params): Promise<StoryblokResponse> | ||
setToken(token: string): void | ||
getToken(): string | ||
cacheResponse(url: string, params: Params): Promise<StoryblokResponse> | ||
newVersion(): number | ||
cacheProvider(): { | ||
get(key: string): any | ||
set(key: string, content: string): void | ||
flush(): void | ||
const client = new StoryblokClient({ | ||
accessToken: 'ddd', | ||
cache: { | ||
type: 'memory', | ||
clear: 'auto' | ||
} | ||
flushCache(): this | ||
} | ||
require('./dist/index.d.ts') | ||
let StoryblokClient = require('./dist/index.js') | ||
function greeter(person) { | ||
return "Hello, " + person; | ||
} | ||
let user = "Jane User"; | ||
document.body.innerHTML = greeter(user); | ||
const client = new StoryblokClient({ | ||
acess: 's' | ||
}) | ||
const c = new Storyblok({accessToken: '32423432'}) | ||
c.get('ssss').then((res) => { | ||
console.log(res.data.stories) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17117
7
432