import { BooleanResponse, CurrencySymbol } from '../..'; import { AuthenticationProvider, AuthToken, ClientAuthenticationProvider, ClientAuthToken, Notification, NotificationId, NotificationSettings, Nullable, PublicUser, ToggleType, Token, Trackable, TutorialType, User, UserId, UserRole, UserToken, UserTrialToken } from '../../models'; import { AuthRequest, OptionalAuthRequest, TrialRequest } from '../common'; /** * GetUserById */ export interface GetUserByIdRequest extends OptionalAuthRequest { id: UserId; } export declare type GetUserByIdResponse = User | PublicUser | null; /** * Gets a user by ID. * @param id The ID of the user. * @param userToken The token of the user being retrieved. If the token is absent or does not match the id, returns a PublicUser object. * @returns A user or null. */ export declare const GetUserById: import("../common").ProtocolFunction; /** * GetUserByUsername */ export interface GetUserByUsernameRequest extends OptionalAuthRequest { username: string; } export declare type GetUserByUsernameResponse = User | PublicUser | null; /** * Gets a user by username. * @param username The username of the user. * @param userToken The token of the user being retrieved. If the token is absent or does not match the id, returns a PublicUser object. * @returns A user or null. */ export declare const GetUserByUsername: import("../common").ProtocolFunction; /** * GetUserByReferralCode */ export interface GetUserByReferralCodeRequest extends OptionalAuthRequest { referralCode: string; } export declare type GetUserByReferralCodeResponse = User | PublicUser | null; /** * Gets a user by referral code. * @param username The referral code of the user. * @param userToken The token of the user being retrieved. If the token is absent or does not match the id, returns a PublicUser object. * @returns A user or null. */ export declare const GetUserByReferralCode: import("../common").ProtocolFunction; /** * EnsureClientAuth */ export interface EnsureClientAuthRequest { email: string; clientAuthToken: ClientAuthToken; provider: ClientAuthenticationProvider; } export interface EnsureClientAuthResponse { authToken: AuthToken; doesExist: boolean; } export declare const EnsureClientAuth: import("../common").ProtocolFunction; /** * CheckClientAuth */ export interface CheckClientAuthRequest extends AuthRequest { } export declare type CheckClientAuthResponse = BooleanResponse; /** * Checks if a user token is valid * @param userToken A user token. * @returns True if the user token is valid, false otherwise. */ export declare const CheckClientAuth: import("../common").ProtocolFunction; /** * SignUpUser */ export interface SignUpUserRequest extends TrialRequest, Trackable { authToken: AuthToken; provider: AuthenticationProvider; providerId: string; firstName: string; lastName: string; username: string; email: string; profilePicture?: string; emoji?: string; referralCode?: string; } export declare type SignUpUserResponse = Nullable<{ token: UserToken; }>; /** * Creates a user. Ensures that the authToken is valid and that the email in the decoded * authToken matches the email for signup. * @param userTrialToken The token of the trial user being signed up. * @param authToken The token created in EnsureClientAuth to ensure the entry is legitimate. * @param provider The login provider being used. * @param providerId The user's ID in the provider. * @param firstName The user's first name. * @param lastName The user's last name. * @param username The user's chosen username. * @param emoji The user's chosen emoji. * @param email The user's email. * @param profilePicture The user's profile picture. * @returns A user token if the user was created, otherwise null. */ export declare const SignUpUser: import("../common").ProtocolFunction>; /** * LogInUser */ export interface LogInUserRequest extends TrialRequest { authToken: string; provider: AuthenticationProvider; providerId: string; email: string; profilePicture?: string; } export declare type LogInUserResponse = Nullable<{ token: UserToken; }>; /** * Logs a user in. Ensures that the authToken is valid and that the email in the decoded * authToken matches the email for log in. * @param userTrialToken A trial user to merge with the user. * @param authToken The token created in EnsureClientAuth to ensure the entry is legitimate. * @param provider The login provider being used. * @param providerId The user's ID in the provider. * @param email The user's email. * @param profilePicture The user's profile picture, if it needs an update. * @returns A user token if the user is logged in, otherwise null. */ export declare const LogInUser: import("../common").ProtocolFunction>; /** * LogInUser */ export interface LogInTrialUserRequest extends Trackable { } export declare type LogInTrialUserResponse = Nullable<{ token: UserTrialToken; }>; /** * Maps an IP address to a trial (incomplete) user, then returns a TrialToken encrypted via the same * secret as a UserToken containing the user's new ID. * @param userIpAddress The user's IP address. * @returns A TrialToken if the user does not exist. Null otherwise. */ export declare const LogInTrialUser: import("../common").ProtocolFunction>; /** * DeleteUser */ export interface DeleteUserRequest extends AuthRequest { } export declare type DeleteUserResponse = BooleanResponse; /** * Deletes the user. * @param userToken The token of the user being deleted. */ export declare const DeleteUser: import("../common").ProtocolFunction; /** * FlagUser */ export interface FlagUserRequest extends AuthRequest { user: UserId; } export declare type FlagUserResponse = void; /** * Flags a user. * @param userToken The token of the user flagging the user. * @param user The ID of the user to flag. */ export declare const FlagUser: import("../common").ProtocolFunction; /** * UserSearch */ export interface UserSearchRequest extends OptionalAuthRequest { query: string; domain?: UserId[]; } export declare type UserSearchResponse = (User | PublicUser)[]; /** * Searches for a user. * @param userToken The token of the user performing the search. * @param query The search string. * @param domain A list of user IDs to limit the search to. * @returns A list of users found in the search. */ export declare const UserSearch: import("../common").ProtocolFunction; /** * UpdateUserRole */ export interface UpdateUserRoleRequest { secret: Token; user: UserId; role: UserRole; } export declare type UpdateUserRoleResponse = BooleanResponse; /** * Updates a user's role. * @param secret The app's admin secret. * @param user The ID of the user to change the role of. * @param role A role enum (i.e. "BASIC", "ADMIN"). * @returns True if the user's role was changed, false otherwise. */ export declare const UpdateUserRole: import("../common").ProtocolFunction; /** * UpdateUser */ export interface UpdateUserRequest extends AuthRequest { firstName?: string; lastName?: string; username?: string; profilePicture?: string; emoji?: string; baseCurrency?: CurrencySymbol; } export declare type UpdateUserResponse = BooleanResponse; /** * Updates user string information. * @param userToken The token of the user being updated. * @param firstName The user's first name. * @param lastName The user's last name. * @param username The user's username. * @param profilePicture The user's profile picture. * @param emoji The user's emoji. * @param baseCurrency The user's base currency. */ export declare const UpdateUser: import("../common").ProtocolFunction; /** * FollowUser */ export interface FollowUserRequest extends AuthRequest { userToFollow: UserId; } export declare type FollowUserResponse = BooleanResponse; /** * Follows a user. * @param userToken The token of the user doing the following. * @param userToFollow The user to follow. */ export declare const FollowUser: import("../common").ProtocolFunction; /** * UnfollowUser */ export interface UnfollowUserRequest extends AuthRequest { userToUnfollow: UserId; } export declare type UnfollowUserResponse = BooleanResponse; /** * Unfollows a user. * @param userToken The token of the user doing the unfollowing. * @param userToFollow The user to unfollow. */ export declare const UnfollowUser: import("../common").ProtocolFunction; /** * UpdateNotificationSettings */ export interface UpdateNotificationSettingsRequest extends AuthRequest { notificationSettings: NotificationSettings; } export declare type UpdateNotificationSettingsResponse = BooleanResponse; /** * Updates a user's notification settings. * @param userToken The token of the user doing the unfollowing. * @param notificationSettings The new settings for the user. */ export declare const UpdateNotificationSettings: import("../common").ProtocolFunction; /** * IsTutorialCompleted */ export interface IsTutorialCompletedRequest extends AuthRequest { tutorialType: TutorialType; } export declare type IsTutorialCompletedResponse = BooleanResponse; /** * Gets completion status of a given tutorial * @param userToken The token of the user being retrieved. If the token is absent or does not match the id, returns a PublicUser object. * @param tutorialType Name of Tutorial to be checked. If tutorial type is empty, returns false * @returns A boolean */ export declare const IsTutorialCompleted: import("../common").ProtocolFunction; /** * CompleteTutorial */ export interface CompleteTutorialRequest extends AuthRequest { tutorialType: TutorialType; } export declare type CompleteTutorialResponse = BooleanResponse; /** * Set status of a tutorial as completed * @param userToken The token of the user being retrieved. If the token is absent or does not match the id, returns a PublicUser object. * @param tutorialType Name of Tutorial to be checked. If tutorial type is empty, returns error * @returns Return so it returns true on success and false on failure, from the client */ export declare const CompleteTutorial: import("../common").ProtocolFunction; /** * GetUserToggle */ export interface GetUserToggleRequest extends AuthRequest { toggleType: ToggleType; } export declare type GetUserToggleResponse = BooleanResponse; /** * Gets status of a given toggle * @param userToken The token of the user being retrieved. If the token is absent or does not match the id, returns a PublicUser object. * @param toggleType Name of toggle to be checked. If tutorial type is empty, returns false * @returns A boolean */ export declare const GetUserToggle: import("../common").ProtocolFunction; /** * ToggleCache */ export interface ToggleCacheRequest extends AuthRequest { toggleType: ToggleType; } export declare type ToggleCacheResponse = BooleanResponse; /** * Update the status of the toggle * @param userToken The token of the user being retrieved. If the token is absent or does not match the id, returns a PublicUser object. * @param toggleType Name of toggle to be checked. If tutorial type is empty, returns error * @returns Return so it returns true on success and false on failure, from the client */ export declare const ToggleCache: import("../common").ProtocolFunction; /** * WatchNotifications */ export interface WatchNotificationsRequest extends AuthRequest { onNotifications: (notifications: Notification[]) => void; } export declare type WatchNotificationsResponse = void; export declare const WatchNotifications: import("../common").ProtocolFunction; /** * GetNotificationById */ export interface GetNotificationByIdRequest extends AuthRequest { notificationId: NotificationId; } export declare type GetNotificationByIdResponse = Nullable; export declare const GetNotificationById: import("../common").ProtocolFunction>; /** * ReadNotification */ export interface ReadNotificationRequest extends AuthRequest { notificationId: NotificationId; } export declare type ReadNotificationResponse = BooleanResponse; export declare const ReadNotification: import("../common").ProtocolFunction; /** * ReadAllNotifications */ export interface ReadAllNotificationsRequest extends AuthRequest { } export declare type ReadAllNotificationsResponse = BooleanResponse; export declare const ReadAllNotifications: import("../common").ProtocolFunction; /** * HideNotification */ export interface HideNotificationRequest extends AuthRequest { notificationId: NotificationId; } export declare type HideNotificationResponse = BooleanResponse; export declare const HideNotification: import("../common").ProtocolFunction; /** * HideAllNotifications */ export interface HideAllNotificationsRequest extends AuthRequest { } export declare type HideAllNotificationsResponse = BooleanResponse; export declare const HideAllNotifications: import("../common").ProtocolFunction; /** * ReportBug */ export interface ReportBugRequest extends OptionalAuthRequest { description: string; page?: string; component?: string; imageUrl?: string; } export declare type ReportBugResponse = BooleanResponse; export declare const ReportBug: import("../common").ProtocolFunction; /** * SubmitFeedback */ export interface SubmitFeedbackRequest extends OptionalAuthRequest { description: string; page?: string; component?: string; imageUrl?: string; } export declare type SubmitFeedbackResponse = BooleanResponse; export declare const SubmitFeedback: import("../common").ProtocolFunction; /** * GetUserPromotionCount */ export interface GetUserPromotionCountRequest extends OptionalAuthRequest { } export declare type GetUserPromotionCountResponse = { spotsLeft: number; totalSpots: number; }; export declare const GetUserPromotionCount: import("../common").ProtocolFunction; /** * SendReferrals */ export interface SendReferralsRequest extends AuthRequest { emails: string[]; } export declare type SendReferralsResponse = BooleanResponse; export declare const SendReferrals: import("../common").ProtocolFunction; /** * GetReferrals */ export interface GetReferralsRequest extends AuthRequest { } export declare type GetReferralsResponse = { referredUsers: PublicUser[]; }; export declare const GetReferrals: import("../common").ProtocolFunction;