diff --git a/src/index.ts b/src/index.ts index 496edac2..50481a2a 100755 --- a/src/index.ts +++ b/src/index.ts @@ -224,11 +224,11 @@ class Storyblok { return this.cacheResponse(url, query, undefined, fetchOptions) } - public get( + public get( slug: string, params?: ISbStoriesParams, fetchOptions?: ISbCustomFetch - ): Promise { + ): Promise> { if (!params) params = {} as ISbStoriesParams const url = `/${slug}` const query = this.factoryParamOptions(url, params) @@ -236,12 +236,12 @@ class Storyblok { return this.cacheResponse(url, query, undefined, fetchOptions) } - public async getAll( + public async getAll( slug: string, params: ISbStoriesParams, entity?: string, fetchOptions?: ISbCustomFetch - ): Promise { + ): Promise { const perPage = params?.per_page || 25 const url = `/${slug}` const urlParts = url.split('/') @@ -299,20 +299,20 @@ class Storyblok { return Promise.resolve(this.throttle('delete', url, params, fetchOptions)) } - public getStories( + public getStories( params: ISbStoriesParams, fetchOptions?: ISbCustomFetch - ): Promise { + ): Promise> { this._addResolveLevel(params) return this.get('cdn/stories', params, fetchOptions) } - public getStory( + public getStory( slug: string, params: ISbStoryParams, fetchOptions?: ISbCustomFetch - ): Promise { + ): Promise> { this._addResolveLevel(params) return this.get(`cdn/stories/${slug}`, params, fetchOptions) diff --git a/src/interfaces.ts b/src/interfaces.ts index 9c009e8a..a7466b45 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -230,8 +230,8 @@ export interface ISbConfig { endpoint?: string } -export interface ISbResult { - data: any +export interface ISbResult { + data: T perPage: number total: number headers: Headers