UNPKG

@dragonaxe/i18n

Version:
42 lines (41 loc) 1.65 kB
import { IMultilangualValueCdnService } from '..'; import { LocaleInfo } from '../../../../models/data'; import { PrismicClient } from '../../../../models/prismic'; export declare class PrismicMultilangualCdnService implements IMultilangualValueCdnService { private readonly _client; private _locales; private _selectedLocale; constructor(_client: PrismicClient); getLocales(): Promise<LocaleInfo[]>; private _hasLocale; private _tryInit; setLocale(localeId: string): Promise<void>; getLocale(): Promise<LocaleInfo>; /** * @description * format of the key to get the field: type.uid.fieldName * format of the key to get the document: type.uid * The type represent the Prismic type of the document holding the string field. */ getString(key: string, locale: string): Promise<string | undefined>; /** * @description * Will fetch all the resources of a given type. * format of the key to get the field: type */ getResources<T>(key: string, locale: string, limit?: number | undefined): Promise<T[]>; /** * @description * Will fetch a resource of a given type, with a uid. If the field is provided, that particular field will be fetched. * format of the key to get the field: type.uid.fieldName * format of the key to get the document: type.uid */ getResource<T>(key: string, locale: string): Promise<T | undefined>; private _getKeyType; private _getResourceWithId; private _getResourceField; private _parseFieldKey; private _parseKey; private _getPageDoc; private _convertResultToDocuments; }