UNPKG

2.19 kBTypeScriptView Raw
1/**
2 * Contentful Management API SDK. Allows you to create instances of a client
3 * with access to the Contentful Content Management API.
4 * @packageDocumentation
5 */
6import type { RestAdapterParams } from './adapters/REST/rest-adapter';
7import type { XOR } from './common-types';
8import type { AdapterParams } from './create-adapter';
9import type { ClientAPI } from './create-contentful-api';
10import type { PlainClientAPI } from './plain/common-types';
11import type { DefaultParams } from './plain/plain-client';
12import * as editorInterfaceDefaults from './constants/editor-interface-defaults';
13export type { ClientAPI } from './create-contentful-api';
14export { asIterator } from './plain/as-iterator';
15export { fetchAll } from './plain/pagination-helper';
16export { isDraft, isPublished, isUpdated } from './plain/checks';
17export type { PlainClientAPI } from './plain/common-types';
18export { createClient };
19export { RestAdapter } from './adapters/REST/rest-adapter';
20export { editorInterfaceDefaults };
21export type PlainClientDefaultParams = DefaultParams;
22export * from './export-types';
23interface UserAgentParams {
24 /**
25 * Application name and version e.g myApp/version
26 */
27 application?: string;
28 /**
29 * Integration name and version e.g react/version
30 */
31 integration?: string;
32 feature?: string;
33}
34/**
35 * @deprecated
36 */
37export type ClientParams = RestAdapterParams & UserAgentParams;
38type ClientOptions = UserAgentParams & XOR<RestAdapterParams, AdapterParams>;
39/**
40 * Create a client instance
41 * @param params - Client initialization parameters
42 *
43 * ```javascript
44 * const client = contentfulManagement.createClient({
45 * accessToken: 'myAccessToken'
46 * })
47 * ```
48 */
49declare function createClient(params: ClientOptions): ClientAPI;
50declare function createClient(params: ClientOptions, opts: {
51 type: 'plain';
52 defaults?: DefaultParams;
53}): PlainClientAPI;
54/**
55 * @deprecated The `alphaFeatures` option is no longer supported. Please use the function without this option.
56 */
57declare function createClient(params: ClientOptions, opts: {
58 type?: 'plain';
59 alphaFeatures: string[];
60 defaults?: DefaultParams;
61}): ClientAPI | PlainClientAPI;