import type { GetUserKarmaForSubredditResponse } from '@devvit/protos/json/devvit/plugin/redditapi/users/users_msg.js'; import { T2, T6 } from '@devvit/shared-types/tid.js'; import type { GetCommentsByUserOptions } from './Comment.js'; import { Comment } from './Comment.js'; import type { UserFlair } from './Flair.js'; import type { ListingFetchOptions } from './Listing.js'; import { Listing } from './Listing.js'; import type { GetPostsByUserOptions } from './Post.js'; import { Post } from './Post.js'; export type GetSubredditUsersByTypeOptions = ListingFetchOptions & { subredditName: string; type: 'banned' | 'muted' | 'wikibanned' | 'contributors' | 'wikicontributors' | 'moderators'; username?: string; }; export type RelationshipType = 'moderator_invite' | 'contributor' | 'banned' | 'muted' | 'wikibanned' | 'wikicontributor'; export type ModeratorPermission = 'all' | 'wiki' | 'posts' | 'access' | 'mail' | 'config' | 'flair' | 'chat_operator' | 'chat_config' | 'channels' | 'community_chat'; export type CreateRelationshipOptions = { subredditName: string; username: string; type: RelationshipType; /** The ID of the post or comment that caused the ban. */ banContext?: string | undefined; banMessage?: string | undefined; banReason?: string | undefined; duration?: number | undefined; note?: string | undefined; permissions?: ModeratorPermission[]; }; export type RemoveRelationshipOptions = { subredditName: string; username: string; type: RelationshipType | 'moderator'; }; export type BanUserOptions = { username: string; subredditName: string; context?: string; message?: string; reason?: string; duration?: number; note?: string; }; export type BanWikiContributorOptions = { username: string; subredditName: string; reason?: string; duration?: number; note?: string; }; export type GetUserOverviewOptions = { username: string; sort?: 'hot' | 'new' | 'top' | 'controversial'; timeframe?: 'hour' | 'day' | 'week' | 'month' | 'year' | 'all'; pageSize?: number; limit?: number; after?: string; before?: string; }; export declare const enum SocialLinkType { Custom = "CUSTOM", Reddit = "REDDIT", Instagram = "INSTAGRAM", Twitter = "TWITTER", Tiktok = "TIKTOK", Twitch = "TWITCH", Facebook = "FACEBOOK", Youtube = "YOUTUBE", Tumblr = "TUMBLR", Spotify = "SPOTIFY", Soundcloud = "SOUNDCLOUD", Beacons = "BEACONS", Linktree = "LINKTREE", Discord = "DISCORD", Venmo = "VENMO", CashApp = "CASH_APP", Patreon = "PATREON", Kofi = "KOFI", Paypal = "PAYPAL", Cameo = "CAMEO", Onlyfans = "ONLYFANS", Substack = "SUBSTACK", Kickstarter = "KICKSTARTER", Indiegogo = "INDIEGOGO", BuyMeACoffee = "BUY_ME_A_COFFEE", Shopify = "SHOPIFY" } /** * @field id: ID of the social link. * * @field handle: Display name of social media link. * * @field outboundUrl: Outbound url of social media link. * * @field type: Type of social media link i.e. Instagram, YouTube. * * @field title: Title or name of social media link. */ export type UserSocialLink = { id: string; handle?: string; outboundUrl: string; type: SocialLinkType; title: string; }; /** * A trophy displayed on a user's profile. * All fields are optional; the API may return null or omit any of them. */ export type Trophy = { /** Trophy ID. */ id: T6 | undefined; /** Display name of the trophy. */ name: string | undefined; /** Description. */ description: string | undefined; /** URL of the trophy icon. Currently 70x70. */ iconUrl: string | undefined; /** URL of the small icon. Currently 40x40. */ iconSmallUrl: string | undefined; /** When the trophy was granted (Unix timestamp). */ grantedAt: number | undefined; /** Award ID. */ awardId: T6 | undefined; /** URL to redirect to when the trophy is clicked. */ url: string | undefined; }; /** * A class representing a user. */ export declare class User { #private; /** * The ID (starting with t2_) of the user to retrieve. * @example 't2_1w72' */ get id(): T2; /** * The username of the user omitting the u/. * @example 'spez' */ get username(): string; /** * The date the user was created. */ get createdAt(): Date; /** * The amount of link karma the user has. */ get linkKarma(): number; /** * The amount of comment karma the user has. */ get commentKarma(): number; /** * Whether the user's profile is marked as NSFW (Not Safe For Work). */ get nsfw(): boolean; /** Whether the user is a Reddit employee. */ get isAdmin(): boolean; /** Whether the user is a moderator of any subreddit. */ get isModerator(): boolean; /** Whether the user has Reddit Premium. */ get hasRedditPremium(): boolean; /** * The permissions the user has on the subreddit. */ get modPermissions(): Map; /** Whether the user is over 18 and wishes to see NSFW content.*/ get showNsfw(): boolean; /** * Returns the HTTP URL for the user */ get url(): string; /** * Returns a permalink path relative to https://www.reddit.com */ get permalink(): string; /** * Indicates whether or not the user has verified their email address. */ get hasVerifiedEmail(): boolean; /** * The display name of the user. May be different from their username. */ get displayName(): string; /** * The user's public description about themselves. May be empty. */ get about(): string; toJSON(): Pick & { modPermissionsBySubreddit: Record; }; /** * Get the mod permissions the user has on the subreddit if they are a moderator. * * @param subredditName - name of the subreddit * @returns the moderator permissions the user has on the subreddit */ getModPermissionsForSubreddit(subredditName: string): Promise; /** * Get the user's comments. * * @param options - Options for the request * @param options.sort - The sort order of the comments. e.g. 'new' * @param options.timeframe - The timeframe of the comments. e.g. 'all' * @param options.limit - The maximum number of comments to return. e.g. 1000 * @param options.pageSize - The number of comments to return per request. e.g. 100 * @returns A Listing of Comment objects. */ getComments(options: Omit): Listing; /** * Get the user's posts. * * @param options - Options for the request * @param options.sort - The sort order of the posts. e.g. 'new' * @param options.timeframe - The timeframe of the posts. e.g. 'all' * @param options.limit - The maximum number of posts to return. e.g. 1000 * @param options.pageSize - The number of posts to return per request. e.g. 100 * @returns A Listing of Post objects. */ getPosts(options: Omit): Listing; /** * Retrieve the user's flair for the subreddit. * * @param subreddit - The name of the subreddit associated with the user's flair. * * @example * ```ts * const username = "badapple" * const subredditName = "mysubreddit" * const user = await reddit.getUserByUsername(username); * const userFlair = await user.getUserFlairBySubreddit(subredditName); * ``` */ getUserFlairBySubreddit(subreddit: string): Promise; getSnoovatarUrl(): Promise; /** * Gets social links of the user * * @returns A Promise that resolves an Array of UserSocialLink objects * @example * ```ts * const socialLinks = await user.getSocialLinks(); * ``` */ getSocialLinks(): Promise; /** * Returns the karma for this User in the current subreddit. * The user making the request must be a moderator of the subreddit to read another user's karma in the subreddit. * An exception is if the specified user is the same as the user making the request. * * @returns The GetUserKarmaForSubredditResponse, containing the user's karma for comments and posts in the subreddit. */ getUserKarmaFromCurrentSubreddit(): Promise; /** * Get the trophies displayed on this user's profile. * * @returns A Promise that resolves to an array of Trophy objects. */ getTrophies(): Promise; } /** * User on a subreddit's banned list; data from the AboutWhere response. * Use `getBannedUsers()` or `subreddit.getBannedUsers()` to receive a listing of these. */ export declare class SubredditBannedUser extends User { /** When the ban was created (UTC). */ readonly date: Date; /** Moderator note (visible only to mods). */ readonly note?: string; /** Days remaining on a temporary ban (undefined if permanent). */ readonly daysLeft?: number; toJSON(): ReturnType & Pick & { note: SubredditBannedUser['note']; daysLeft: SubredditBannedUser['daysLeft']; }; } /** * User on a subreddit's muted list; data from the AboutWhere response. * Use `getMutedUsers()` or `subreddit.getMutedUsers()` to receive a listing of these. */ export declare class SubredditMutedUser extends User { /** When the mute was created (UTC). */ readonly date: Date; toJSON(): ReturnType & Pick; } /** * User on a subreddit's wiki-banned list; data from the AboutWhere response. * Use `getBannedWikiContributors()` or `subreddit.getBannedWikiContributors()` to receive a listing of these. */ export declare class SubredditWikiBannedUser extends User { /** When the wiki ban was created (UTC). */ readonly date: Date; /** Moderator note. */ readonly note?: string; /** Days remaining on a temporary ban (undefined if permanent). */ readonly daysLeft?: number; toJSON(): ReturnType & Pick & { note: SubredditWikiBannedUser['note']; daysLeft: SubredditWikiBannedUser['daysLeft']; }; } /** * User approved to post in a subreddit (contributor); data from the AboutWhere response. * Use `getApprovedUsers()` or `subreddit.getApprovedUsers()` to receive a listing of these. */ export declare class SubredditContributorUser extends User { /** When the contributor relationship was created (UTC). */ readonly date: Date; toJSON(): ReturnType & Pick; } /** * User with wiki contributor access; data from the AboutWhere response. * Use `getWikiContributors()` or `subreddit.getWikiContributors()` to receive a listing of these. */ export declare class SubredditWikiContributorUser extends User { /** When the wiki contributor relationship was created (UTC). */ readonly date: Date; toJSON(): ReturnType & Pick; } /** * Moderator of a subreddit; data from the AboutWhere response. * Use `getModerators()` or `subreddit.getModerators()` to receive a listing of these. */ export declare class SubredditModeratorUser extends User { /** When the moderator relationship was created (UTC). */ readonly date: Date; /** * Moderator relationship data for the subreddit. * Nested to avoid shadowing {@link User.modPermissions}, which stores permissions across all subreddits. */ readonly moderatorInfo: { /** Moderator permissions for this subreddit. */ modPermissions: ModeratorPermission[]; /** User flair CSS class in the subreddit. */ authorFlairCssClass?: string; /** User flair text in the subreddit. */ authorFlairText?: string; }; toJSON(): ReturnType & Pick; } //# sourceMappingURL=User.d.ts.map