/** * Media Operations Module * Handles all media-related WordPress REST API operations */ import type { WordPressMedia, MediaQueryParams, UploadMediaRequest, UpdateMediaRequest } from "../../types/wordpress.js"; import type { RequestOptions } from "../../types/client.js"; /** * Interface for the base client methods needed by media operations */ export interface MediaClientBase { get(endpoint: string): Promise; post(endpoint: string, data?: unknown, options?: RequestOptions): Promise; put(endpoint: string, data?: unknown): Promise; delete(endpoint: string): Promise; } /** * Media operations mixin * Provides CRUD operations for WordPress media */ export declare class MediaOperations { private client; constructor(client: MediaClientBase); /** * Get a list of media items with optional filtering */ getMedia(params?: MediaQueryParams): Promise; /** * Get a single media item by ID */ getMediaItem(id: number, context?: "view" | "embed" | "edit"): Promise; /** * Upload media from a file path */ uploadMedia(data: UploadMediaRequest): Promise; /** * Upload a file buffer as media */ uploadFile(fileData: Buffer, filename: string, mimeType: string, meta?: Partial, options?: RequestOptions): Promise; /** * Update media metadata */ updateMedia(data: UpdateMediaRequest): Promise; /** * Delete a media item */ deleteMedia(id: number, force?: boolean): Promise<{ deleted: boolean; previous?: WordPressMedia; }>; /** * Validates that a file's magic bytes match its declared MIME type. * Prevents disguised uploads (e.g. a PHP script renamed to .jpg). */ private validateMagicBytes; /** * Get MIME type from file extension */ private getMimeType; } //# sourceMappingURL=media.d.ts.map