UNPKG

observation-js

Version:

A fully-typed TypeScript client for the waarneming.nl API.

33 lines (32 loc) 1.36 kB
import type { ObservationClient } from '../core/client'; import type { MediaUploadResponse, MediaItem, Paginated } from '../types'; export declare class Media { #private; /** * @internal */ constructor(client: ObservationClient); /** * Uploads a media file (photo or sound) to get a temporary name. * This temporary name can then be used when creating or updating an observation. * * @param media The media file (as a Blob) to upload. * @param options - Optional parameters. * @param options.identify - If `true`, the system will attempt to identify the species in the media. * @returns A promise that resolves to the media upload response, containing the temporary name. * @throws {AuthenticationError} If the request is not authenticated. * @throws {ApiError} If the request fails. */ upload(media: Blob, options?: { identify?: boolean; }): Promise<MediaUploadResponse>; /** * Fetches similar media items for a given media ID. * This endpoint can be used with or without authentication. * * @param id The unique identifier of the media item. * @returns A promise that resolves to a paginated list of similar media items. * @throws {ApiError} If the request fails. */ getSimilar(id: number): Promise<Paginated<MediaItem>>; }