import type { ProgressPromise } from '@prezly/progress-promise'; import type { DeferredJobsApiClient } from '../../api'; import type { BulkDeletePayload, ExtendedStory, Query, Story } from '../../types'; import type { AutosaveRequest, ChangeNewsroomSuccessResponse, ChangeNewsroomUnsafeResponse, CreateRequest, IncludeOptions, LinkTranslationRequest, ListOptions, ListResponse, MoveRequest, PreviewResponse, PreviewOptions, PublishRequest, RevertRequest, ScheduleRequest, SearchOptions, TranslateRequest, UnpublishRequest, UnscheduleRequest, UpdateRequest } from './types'; /** * `uuid` is the preferred way of targeting a Story. Numeric `id` is considered deprecated. */ type StoryId = Story['uuid'] | Story['id']; type Formats = Story.FormatVersion[]; /** * Utility type to forbid arbitrary ad-hoc extensions of generic parameters. * @see https://stackoverflow.com/a/69666350 */ type Exactly = Concrete & Record, never>; type InferExtraFields = T extends Required> ? Pick : unknown; export type Client = ReturnType; export declare function createClient(api: DeferredJobsApiClient): { list: (options?: Exactly) => Promise>>; search: (options?: Exactly) => Promise>>; get: { (id: Story['uuid'], options?: Exactly): Promise>; (ids: Story['uuid'][], options?: Exactly): Promise<(ExtendedStory & InferExtraFields)[]>; (id: Story['id'] | Story['uuid'], options?: Exactly): Promise>; (ids: Story['id'][], options?: Exactly): Promise<(ExtendedStory & InferExtraFields)[]>; }; getBySlug: (slug: Story['slug'], options?: Exactly) => Promise>; create: (payload: CreateRequest, options?: Exactly) => Promise>; duplicate: (id: StoryId, options?: Exactly) => Promise>; translate: (id: StoryId, payload?: TranslateRequest, options?: Exactly) => Promise>; linkTranslation: (id: StoryId, payload: LinkTranslationRequest, options?: Exactly) => Promise>; unlinkTranslation: (id: StoryId, translationId: StoryId, options?: Exactly) => Promise>; move: (id: StoryId, payload: MoveRequest, options?: Exactly) => Promise> | ChangeNewsroomUnsafeResponse>; update: (id: StoryId, payload: UpdateRequest, options?: Exactly) => Promise>; autosave: (id: StoryId, payload: AutosaveRequest, options?: Exactly) => Promise>; revert: (id: StoryId, payload?: RevertRequest, options?: Exactly) => Promise>; publish: (id: StoryId, payload?: PublishRequest, options?: Exactly) => Promise>; unpublish: (id: StoryId, payload?: UnpublishRequest, options?: Exactly) => Promise>; schedule: (id: StoryId, payload?: ScheduleRequest, options?: Exactly) => Promise>; unschedule: (id: StoryId, payload?: UnscheduleRequest, options?: Exactly) => Promise>; pin: (id: StoryId, options?: Exactly) => Promise>; unpin: (id: StoryId, options?: Exactly) => Promise>; delete: (id: StoryId) => Promise; bulkDelete: (payload: BulkDeletePayload) => ProgressPromise<{ records_deleted_number: number; }>; preview: (id: StoryId, options?: PreviewOptions) => Promise; }; export {};