|
| 1 | +import type { |
| 2 | + CachedVersions, |
| 3 | + ComponentResolverFn, |
| 4 | + ISbContentMangmntAPI, |
| 5 | + ISbCustomFetch, |
| 6 | + ISbResponseData, |
| 7 | + ISbResult, |
| 8 | + ISbStories, |
| 9 | + ISbStoriesParams, |
| 10 | + ISbStory, |
| 11 | + ISbStoryParams, |
| 12 | + LinksType, |
| 13 | + RelationsType, |
| 14 | + RichTextResolver, |
| 15 | +} from './interfaces'; |
| 16 | + |
| 17 | +export interface IStoryblok { |
| 18 | + relations: RelationsType; |
| 19 | + links: LinksType; |
| 20 | + richTextResolver: RichTextResolver; |
| 21 | + resolveNestedRelations: boolean; |
| 22 | + |
| 23 | + // Sets the component resolver for rich text |
| 24 | + setComponentResolver: (resolver: ComponentResolverFn) => void; |
| 25 | + |
| 26 | + // Fetches a single story by slug |
| 27 | + get: (slug: string, params?: ISbStoriesParams, fetchOptions?: ISbCustomFetch) => Promise<ISbResult>; |
| 28 | + |
| 29 | + // Fetches all stories matching the given parameters |
| 30 | + getAll: (slug: string, params: ISbStoriesParams, entity?: string, fetchOptions?: ISbCustomFetch) => Promise<any[]>; |
| 31 | + |
| 32 | + // Creates a new story |
| 33 | + post: (slug: string, params: ISbStoriesParams | ISbContentMangmntAPI, fetchOptions?: ISbCustomFetch) => Promise<ISbResponseData>; |
| 34 | + |
| 35 | + // Updates an existing story |
| 36 | + put: (slug: string, params: ISbStoriesParams | ISbContentMangmntAPI, fetchOptions?: ISbCustomFetch) => Promise<ISbResponseData>; |
| 37 | + |
| 38 | + // Deletes a story |
| 39 | + delete: (slug: string, params: ISbStoriesParams | ISbContentMangmntAPI, fetchOptions?: ISbCustomFetch) => Promise<ISbResponseData>; |
| 40 | + |
| 41 | + // Fetches multiple stories |
| 42 | + getStories: (params: ISbStoriesParams, fetchOptions?: ISbCustomFetch) => Promise<ISbStories>; |
| 43 | + |
| 44 | + // Fetches a single story by slug |
| 45 | + getStory: (slug: string, params: ISbStoryParams, fetchOptions?: ISbCustomFetch) => Promise<ISbStory>; |
| 46 | + |
| 47 | + // Wrapper for GraphQL queries |
| 48 | + graphql: (query: string, version: 'draft' | 'published', variables?: Record<string, unknown>) => Promise<any>; |
| 49 | + |
| 50 | + // Ejects the interceptor from the fetch client |
| 51 | + ejectInterceptor: () => void; |
| 52 | + |
| 53 | + // Flushes all caches |
| 54 | + flushCache: () => Promise<this>; |
| 55 | + |
| 56 | + // Returns all cached versions (cv) |
| 57 | + cacheVersions: () => CachedVersions; |
| 58 | + |
| 59 | + // Returns the current cache version (cv) |
| 60 | + cacheVersion: () => number; |
| 61 | + |
| 62 | + // Sets the cache version (cv) |
| 63 | + setCacheVersion: (cv: number) => void; |
| 64 | + |
| 65 | + // Clears the cache version |
| 66 | + clearCacheVersion: () => void; |
| 67 | +} |
0 commit comments