import type { ExoCursorPaginatedCollectionProp, GetFragmentParams, GetSpaceEnvironmentParams } from '../../common-types'; import type { CreateFragmentProps, FragmentProps, FragmentQueryOptions, UpsertFragmentProps } from '../../entities/fragment'; import type { OptionalDefaults } from '../wrappers/wrap'; /** * @deprecated Use {@link ExperienceFragmentPlainClientAPI} (`client.experienceFragment`) instead. * The `fragment` endpoint is superseded by the `experienceFragment` endpoint. */ export type FragmentPlainClientAPI = { /** * Fetches all fragments for a space and environment * @param params the space, environment IDs and query options (see {@link FragmentQueryOptions}) * @returns a collection of fragments * @throws if the request fails, or the space or environment is not found * @internal - Experimental endpoint, subject to breaking changes without notice * @example * ```javascript * const fragments = await client.fragment.getMany({ * spaceId: '', * environmentId: '', * query: { * limit: 10, * }, * }); * ``` */ getMany(params: OptionalDefaults): Promise>; /** * Fetches a single fragment by ID * @param params the space, environment, and fragment IDs * @returns the fragment * @throws if the request fails, or the space, environment, or fragment is not found * @internal - Experimental endpoint, subject to breaking changes without notice * @example * ```javascript * const fragment = await client.fragment.get({ * spaceId: '', * environmentId: '', * fragmentId: '', * }); * ``` */ get(params: OptionalDefaults): Promise; /** * Creates a new fragment * @param params the space and environment IDs * @param data the fragment data * @returns the created fragment * @throws if the request fails, or the space or environment is not found * @internal - Experimental endpoint, subject to breaking changes without notice * @example * ```javascript * const fragment = await client.fragment.create({ * spaceId: '', * environmentId: '', * }, { * name: 'My Fragment', * description: 'A new fragment', * componentType: { sys: { type: 'Link', linkType: 'ComponentType', id: '' } }, * designProperties: {}, * }); * ``` */ create(params: OptionalDefaults, data: CreateFragmentProps): Promise; /** * Upserts a fragment (creates or updates via PUT) * @param params the space, environment, and fragment IDs * @param data the fragment data to upsert (include sys.version for updates, omit for creates) * @returns the upserted fragment * @throws if the request fails, or the space, environment, or fragment is not found * @internal - Experimental endpoint, subject to breaking changes without notice * @example * ```javascript * const fragment = await client.fragment.upsert({ * spaceId: '', * environmentId: '', * fragmentId: '', * }, fragmentData); * ``` */ upsert(params: OptionalDefaults, data: UpsertFragmentProps): Promise; /** * Deletes a fragment * @param params the space, environment, and fragment IDs * @throws if the request fails, or the space, environment, or fragment is not found * @internal - Experimental endpoint, subject to breaking changes without notice * @example * ```javascript * await client.fragment.delete({ * spaceId: '', * environmentId: '', * fragmentId: '', * }); * ``` */ delete(params: OptionalDefaults): Promise; /** * Publishes a fragment * @param params the space, environment, and fragment IDs, plus the current version * @returns the published fragment * @throws if the request fails, or the space, environment, or fragment is not found * @internal - Experimental endpoint, subject to breaking changes without notice * @example * ```javascript * const fragment = await client.fragment.publish({ * spaceId: '', * environmentId: '', * fragmentId: '', * version: 1, * }); * ``` */ publish(params: OptionalDefaults): Promise; /** * Unpublishes a fragment * @param params the space, environment, and fragment IDs, plus the current version * @returns the unpublished fragment * @throws if the request fails, or the space, environment, or fragment is not found * @internal - Experimental endpoint, subject to breaking changes without notice * @example * ```javascript * const fragment = await client.fragment.unpublish({ * spaceId: '', * environmentId: '', * fragmentId: '', * version: 2, * }); * ``` */ unpublish(params: OptionalDefaults): Promise; };