@datalayer/core
Version:
[](https://datalayer.io)
87 lines (86 loc) • 2.43 kB
TypeScript
/**
* User model for the Datalayer SDK with rich functionality.
*
* @module models/UserDTO
*/
import type { DatalayerClient } from '../index';
/**
* Represents a user in the Datalayer platform
* @interface UserData
*/
export interface UserData {
/** uuid for the user */
id: string;
/** ulid for the user */
uid: string;
/** User's handle or nickname */
handle_s: string;
/** User's email address */
email_s: string;
/** User's first name */
first_name_t: string;
/** User's last name */
last_name_t: string;
/** Display name shown in the UI */
avatar_url_s: string;
/** Additional fields that may be present in the response */
[]: any;
}
export interface UserJSON {
/** uuid for the user */
id: string;
/** ulid for the user */
uid: string;
/** First name of the user */
firstName: string;
/** Last name of the user */
lastName: string;
/** Display name of the user */
displayName: string;
/** Email address of the user */
email: string;
/** Description of the user */
handle: string;
/** URL to the user's avatar image */
avatarUrl: string;
}
/**
* User model representing a Datalayer platform user.
* Provides rich functionality for accessing user data and authentication providers.
*/
export declare class UserDTO {
protected _data: UserData;
/**
* Create a User instance.
*
* @param data - User data from API
* @param sdk - SDK instance (currently unused but kept for compatibility)
*/
constructor(data: UserData, sdk?: DatalayerClient);
get id(): string;
get uid(): string;
get email(): string;
get handle(): string;
get firstName(): string;
get lastName(): string;
get displayName(): string;
get avatarUrl(): string;
/**
* Get user data in camelCase format.
* Returns only the core fields that consumers need.
* This provides a stable interface regardless of API changes.
*
* @returns Core user data with camelCase properties
*/
toJSON(): UserJSON;
/**
* Get the raw user data exactly as received from the API.
* This preserves the original snake_case naming from the API response.
*
* @returns Raw user data from API
*/
rawData(): UserData;
/** String representation of the user. */
toString(): string;
}
export default UserDTO;