observation-js
Version:
A fully-typed TypeScript client for the waarneming.nl API.
46 lines (45 loc) • 1.94 kB
TypeScript
import type { ObservationClient } from '../core/client';
import type { CreateSessionPayload, Observation, Paginated, Session, UpdateSessionPayload } from '../types';
export declare class Sessions {
#private;
/**
* @internal
*/
constructor(client: ObservationClient);
/**
* Fetches a list of observation sessions for the authenticated user.
*
* @returns A promise that resolves to a paginated list of sessions.
* @throws {AuthenticationError} If the request is not authenticated.
* @throws {ApiError} If the request fails.
*/
list(): Promise<Paginated<Session>>;
/**
* Creates a new observation session.
*
* @param payload - The data for the new session.
* @returns A promise that resolves to the newly created session object.
* @throws {AuthenticationError} If the request is not authenticated.
* @throws {ApiError} If the request fails.
*/
create(payload: CreateSessionPayload): Promise<Session>;
/**
* Updates an existing observation session.
* If a session with the given UUID does not exist, a new one will be created.
*
* @param payload - The data to update the session with, including its UUID.
* @returns A promise that resolves to the updated or created session object.
* @throws {AuthenticationError} If the request is not authenticated.
* @throws {ApiError} If the request fails.
*/
update(payload: UpdateSessionPayload): Promise<Session>;
/**
* Fetches the observations associated with a specific session.
*
* @param uuid - The unique identifier (UUID) of the session.
* @returns A promise that resolves to a paginated list of observations for the session.
* @throws {AuthenticationError} If the request is not authenticated.
* @throws {ApiError} If the request fails.
*/
listObservations(uuid: string): Promise<Paginated<Observation>>;
}