packageDocumentation import { getUserAgentHeader } from 'contentful-sdk-core' ; import type { RestAdapterParams } from './adapters/REST/rest-adapter' ; import type { MakeRequest } from './common-types' ; import { AdapterParams , createAdapter } from './create-adapter' ; import createContentfulApi , { ClientAPI } from './create-contentful-api' ; import type { AlphaPlainClientAPI , PlainClientAPI } from './plain/common-types' ; import type { DefaultParams } from './plain/plain-client' ; import { createPlainClient } from './plain/plain-client' ; import * as editorInterfaceDefaults from './constants/editor-interface-defaults' ; export type { ClientAPI } from './create-contentful-api' ; export { asIterator } from './plain/as-iterator' ; export { isDraft , isPublished , isUpdated } from './plain/checks' ; export type { PlainClientAPI , AlphaPlainClientAPI } from './plain/common-types' ; export { createClient } ; export { RestAdapter } from './adapters/REST/rest-adapter' ; export { editorInterfaceDefaults } ; export type PlainClientDefaultParams = DefaultParams ; export * from './export-types' ; interface UserAgentParams { /**
     * Application name and version e.g myApp/version
     */ application ? : string ; /**
     * Integration name and version e.g react/version
     */ integration ? : string ; feature ? : string ; } deprecated export type ClientParams = RestAdapterParams & UserAgentParams ; type ClientOptions = ( RestAdapterParams | AdapterParams ) & UserAgentParams ; param params function createClient ( params ) ; function createClient ( params , opts ) ; function createClient < T extends ( ReadonlyArray < string > | readonly [ 'workflows' ] ) & { [ K in keyof T ] : { [ P in K ] : 'workflows' ; } ; } [ number ] > ( params , opts ) ; function createClient ( params , opts ) ; function createClient ( params , opts = { } ) { const sdkMain = opts . type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js' ; const userAgent = getUserAgentHeader ( `${ sdkMain }/${ __VERSION__ }` , params . application , params . integration , params . feature ) ; const adapter = createAdapter ( params ) ; const makeRequest = ( options ) : ReturnType < MakeRequest > => adapter . makeRequest ( { ... options , userAgent } ) ; if ( opts . type === 'plain' ) { return createPlainClient ( makeRequest , opts . defaults , opts . alphaFeatures ) ; } else { return createContentfulApi ( makeRequest ) as ClientAPI ; } }