UNPKG

observation-js

Version:

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

95 lines (94 loc) 3.83 kB
import type { ObservationClient } from '../core/client'; import type { Badge, Paginated } from '../types'; export declare class Badges { #private; /** * @internal */ constructor(client: ObservationClient); /** * Fetches a list of badges. * - For unauthenticated users, this returns a list of public "onboarding" badges. * - For authenticated users, this returns their personalized list of badges including progress. * * @returns A promise that resolves to a paginated list of badge objects. * @throws {ApiError} If the request fails. */ list(): Promise<Paginated<Badge>>; /** * Fetches the details of a specific badge by its ID. * - For unauthenticated users, this returns the public details of the badge. * - For authenticated users, this returns personalized details including their progress. * * @param id The unique identifier for the badge. * @returns A promise that resolves to the badge object. * @throws {ApiError} If the request fails. */ get(id: number): Promise<Badge>; /** * Gets all badge IDs that a specific observation contributes to. * * @param observationId The unique identifier for the observation. * @returns A promise that resolves to a paginated list of badge IDs. * @throws {AuthenticationError} If the request is not authenticated. * @throws {ApiError} If the request fails. */ getForObservation(observationId: number): Promise<Paginated<{ id: number; }>>; /** * Marks all regular badges as "seen" for the current user. * This updates the `last_seen` timestamp for all of the user's regular badges. * * @returns A promise that resolves to an object with the `last_seen` timestamp. * @throws {AuthenticationError} If the request is not authenticated. * @throws {ApiError} If the request fails. */ markAllAsSeen(): Promise<{ last_seen: string; }>; /** * Gets the `last_seen` timestamp for a specific regular user badge. * * @param userBadgeId The unique identifier for the user badge. * @returns A promise that resolves to an object with the `last_seen` timestamp. * @throws {AuthenticationError} If the request is not authenticated. * @throws {ApiError} If the request fails. */ getLastSeen(userBadgeId: number): Promise<{ last_seen: string; }>; /** * Marks a specific regular user badge as "seen". * * @param userBadgeId The unique identifier for the user badge. * @returns A promise that resolves to an object with the updated `last_seen` timestamp. * @throws {AuthenticationError} If the request is not authenticated. * @throws {ApiError} If the request fails. */ markAsSeen(userBadgeId: number): Promise<{ last_seen: string; }>; /** * Gets the `last_seen` timestamp for a specific user season badge. * * @param userSeasonBadgeId The unique identifier for the user season badge. * @returns A promise that resolves to an object with the `last_seen` timestamp. * @throws {AuthenticationError} If the request is not authenticated. * @throws {ApiError} If the request fails. */ getSeasonLastSeen(userSeasonBadgeId: number): Promise<{ last_seen: string; }>; /** * Marks a specific user season badge as "seen". * * @param userSeasonBadgeId The unique identifier for the user season badge. * @returns A promise that resolves to an object with the updated `last_seen` timestamp. * @throws {AuthenticationError} If the request is not authenticated. * @throws {ApiError} If the request fails. */ markSeasonAsSeen(userSeasonBadgeId: number): Promise<{ last_seen: string; }>; }