observation-js Documentation - v1.14.0
    Preparing search index...

    Class Challenges

    Index

    Constructors

    Methods

    • Fetches a list of challenges, which can be filtered by various parameters. This endpoint is public, but results may differ for authenticated users.

      Parameters

      • Optionalparams: ChallengeListParams

        Optional parameters to filter the challenges.

      Returns Promise<Paginated<Challenge>>

      A promise that resolves to a paginated list of challenge objects.

      If the request fails.

    • Fetches the details of a specific challenge by its ID. This endpoint is public, but results may differ for authenticated users.

      Parameters

      • id: number

        The unique identifier of the challenge.

      Returns Promise<Challenge>

      A promise that resolves to the challenge details.

      If the request fails.

    • Fetches the user ranking for a specific challenge.

      Parameters

      • id: number

        The unique identifier of the challenge.

      • by: "observations" | "species"

        The criteria to rank by, either 'species' or 'observations'.

      Returns Promise<ChallengeRanking>

      A promise that resolves to the challenge ranking data.

      If the request fails.

    • Gets all the IDs of challenges that a specific observation contributes to.

      Parameters

      • observationId: number

        The unique identifier of the observation.

      Returns Promise<Paginated<{ id: number }>>

      A promise that resolves to a paginated list of challenge IDs.

      If the request is not authenticated.

      If the request fails.

    • Subscribes the authenticated user to a challenge, or unsubscribes them.

      Parameters

      • id: number

        The unique identifier of the challenge.

      • isSubscribed: boolean

        Set to true to subscribe, false to unsubscribe.

      Returns Promise<SubscribeResponse>

      A promise that resolves to the updated subscription status.

      If the request is not authenticated.

      If the request fails.

    • Marks a piece of challenge content (e.g., instructions, results) as "seen" by the authenticated user.

      Parameters

      • contentId: number

        The unique identifier of the challenge content.

      Returns Promise<MarkAsSeenResponse>

      A promise that resolves to an object with the last_seen timestamp.

      If the request is not authenticated.

      If the request fails.