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

    Class Users

    Index

    Constructors

    Methods

    • Retrieves the current terms of service and privacy policy. This is a public endpoint and does not require authentication.

      Returns Promise<Terms>

      A promise that resolves to the terms and privacy policy documents.

      If the request fails.

    • Registers a new user account. This is a public endpoint and does not require authentication.

      Parameters

      • details: {
            name: string;
            email: string;
            password: string;
            is_mail_allowed?: boolean;
            country?: string;
        }

        The registration details, including name, email, and password.

      • appName: string

        The name of the application registering the user.

      • appVersion: string

        The version of the application.

      Returns Promise<{ name: string; email: string; permalink: string; country: string }>

      A promise that resolves to the newly created user's public details.

      If the registration fails (e.g., email already exists).

    • Sends a password reset email to a user. This is a public endpoint and does not require authentication.

      Parameters

      • email: string

        The user's email address.

      Returns Promise<{ detail: string }>

      A promise that resolves to an object with a confirmation message.

      If the request fails.

    • Gets the full profile details of the current authenticated user.

      Returns Promise<User>

      A promise that resolves to the current user's full profile object.

      If the request is not authenticated.

      If the request fails.

    • Updates the profile details of the current authenticated user.

      Parameters

      • details: { name: string; country?: string }

        The details to update (name and/or country).

      Returns Promise<User>

      A promise that resolves to the updated user object.

      If the request is not authenticated.

      If the request fails.

    • Resends the email confirmation to the current authenticated user.

      Returns Promise<{ detail: string }>

      A promise that resolves to an object with a confirmation message.

      If the request is not authenticated.

      If the request fails.

    • Gets aggregated observation statistics for the current authenticated user.

      Parameters

      • params: {
            aggregation: "day" | "month" | "year";
            start_date?: string;
            end_date?: string;
        }

        The aggregation parameters (by day, month, or year, with optional date range).

      Returns Promise<UserStats>

      A promise that resolves to the user's statistics.

      If the request is not authenticated.

      If the request fails.

    • Gets a magic login link key for the current authenticated user. This key can be used to log in without a password.

      Returns Promise<{ sesame: string }>

      A promise that resolves to an object containing the magic login key (sesame).

      If the request is not authenticated.

      If the request fails.

    • Gets the URL of the current user's avatar.

      Returns Promise<{ avatar: null | string }>

      A promise that resolves to an object with the avatar URL, or null if not set.

      If the request is not authenticated.

      If the request fails.

    • Uploads a new avatar for the current user. The image must be a square JPG, max 1000x1000px.

      Parameters

      • avatar: Blob | Buffer<ArrayBufferLike>

        A Blob or Buffer representing the image.

      Returns Promise<{ avatar: null | string }>

      A promise that resolves to an object with the new avatar URL.

      If the request is not authenticated.

      If the upload fails.

    • Deletes the current user's avatar.

      Returns Promise<{ avatar: null | string }>

      A promise that resolves to an object with a null avatar URL.

      If the request is not authenticated.

      If the request fails.