/// /// import { URLSearchParams } from 'url'; import { WP_Post_Type_Name, WP_REST_API_Application_Password, WP_REST_API_Block, WP_REST_API_Block_Directory_Item, WP_REST_API_Block_Type, WP_REST_API_Rendered_Block, WP_REST_API_Search_Result, WP_REST_API_Settings, WP_REST_API_Status, WP_REST_API_Taxonomy, WP_REST_API_Type } from 'wp-types'; import { FetchClient } from './fetch-client'; import { DefaultEndpoint, DefaultEndpointWithRevision, EndpointCreate, EndpointDelete, EndpointDeleteUntrashable, EndpointFind, EndpointFindAll, EndpointFindOnly, EndpointTotal, EndpointUpdateMedia, EndpointUpdatePartial, RenderedBlockDto, WpApiOptions, WPCategory, WPComment, WPMedia, WPPage, WPPlugin, WPPost, WpRestApiContext, WPTag, WPTheme, WPUser } from './types'; export declare class WpApiClient { protected readonly options: WpApiOptions; protected readonly authHeader?: { Authorization: string; } | { 'X-WP-Nonce': string; }; protected readonly headers?: Record; protected readonly http: FetchClient; protected readonly baseUrl: URL; constructor(baseUrl: string, options?: WpApiOptions); protected createEndpointGet

(endpoint: string, defaultQuery?: URLSearchParams): EndpointFind

; protected createEndpointGetAll

(endpoint: string, defaultQuery?: URLSearchParams): EndpointFindAll

; protected createEndpointPost

(endpoint: string): (body: Partial

, id?: number) => Promise

; protected createEndpointDelete

(endpoint: string, params?: URLSearchParams): EndpointDelete

; protected createEndpointCustomGet(endPoint: string): () => Promise; protected createEndpointCustomPost(endPoint: string): (body: T) => Promise; protected createEndpointTotal(endpoint: string, defaultQuery?: URLSearchParams): EndpointTotal; protected defaultEndpoints

(endpoint: string, defaultParams?: URLSearchParams): DefaultEndpoint

; protected addPostType

(endpoint: string, withRevisions: true, defaultParams?: URLSearchParams): DefaultEndpointWithRevision

; protected addPostType

(endpoint: string, withRevisions?: false, defaultParams?: URLSearchParams): DefaultEndpoint

; blockType

(): Promise; blockType

(blockType: WP_Post_Type_Name | string): Promise

; blockDirectory

(term: string, page?: number, perPage?: number): Promise; comment

(): DefaultEndpoint

; media

(): { find: EndpointFind

; create: (fileName: string, file: Buffer, mimeType?: string, data?: Partial

, caption?: string) => Promise

; delete: EndpointDeleteUntrashable

; update: EndpointUpdateMedia

; }; page

(): DefaultEndpointWithRevision

; plugin

(): { create: (plugin: string, status?: 'active' | 'inactive') => Promise

; find: (plugin?: string) => Promise; update: (plugin: string, status?: 'active' | 'inactive', context?: WpRestApiContext) => Promise

; delete: (plugin: string) => Promise

; }; post

(): DefaultEndpointWithRevision

; postCategory

(): DefaultEndpoint

; postTag

(): DefaultEndpoint

; postType

(): Promise; postType

(postType: WP_Post_Type_Name | string): Promise

; renderedBlock

(body: RenderedBlockDto): Promise

; reusableBlock

(): DefaultEndpoint

& { autosave: (blockId: number) => { create: EndpointCreate

; find: EndpointFind

; }; }; search(search?: string, params?: Record & Partial<{ context: string; page: string; per_page: string; type: string; subtype: string; }>): Promise; siteSettings

(): { find: EndpointFindOnly

; update: EndpointUpdatePartial

; }; status

(): Promise; status

(status: WP_Post_Type_Name | string): Promise

; user

(): { find: EndpointFind

; findMe: EndpointFindOnly

; create: (body: Partial

& Required<{ email: string; username: string; password: string; }>) => Promise

; update: (body: Partial

& Required<{ password: string; }>, userId: number) => Promise

; delete: (reassign: number, ...userIds: number[]) => Promise<(P | null)[]>; deleteMe: (reassign: number) => Promise

; }; taxonomy

(query: { context?: 'edit' | 'embed' | 'view'; type?: string; }, ...slugs: string[]): Promise; taxonomy

(...slugs: string[]): Promise; theme

(): Promise; applicationPassword(): { create: (userId: number, appId: string, name: string) => Promise>; delete: (userId: number, uuid: string) => Promise; find: (userId: number, uuids?: string[]) => Promise; update: (userId: number, uuid: string, appId?: string, name?: string) => Promise; }; }