Skip to main content

Overview

The Profile_Model class represents a user profile in the Threadly application. It contains user information, statistics, and relationship status with other users.

Fields

userid
string
required
Unique identifier for the user
username
string
required
The user’s username/display name
profilepic
string
required
URL to the user’s profile picture
bio
string
User’s biography/about text
dob
string
Date of birth of the user
followers
int
required
Number of followers the user has
following
int
required
Number of accounts the user is following
posts
int
required
Total number of posts created by the user
isFollowingMe
boolean
required
Whether this user follows the current user
isFollowedByMe
boolean
required
Whether the current user follows this user
isPrivate
boolean
Whether the user’s profile is private (requires follow approval)
isFollowRequestApproved
boolean
Whether a follow request to this user has been approved

Methods

The model provides standard getter and setter methods for all fields:
  • getUserid() / setUserid(String)
  • getUsername() / setUsername(String)
  • getProfilepic() / setProfilepic(String)
  • getBio() / setBio(String)
  • getDob() / setDob(String)
  • getFollowers() / setFollowers(int)
  • getFollowing() / setFollowing(int)
  • getPosts() / setPosts(int)
  • isFollowingMe() / setFollowingMe(boolean)
  • isFollowedByMe() / setFollowedByMe(boolean)
  • isPrivate() / setPrivate(boolean)
  • isFollowRequestApproved() / setFollowRequestApproved(boolean)

Constructors

The model has two constructors:

Basic Constructor

Accepts basic profile information and follow status:
Profile_Model(String userid, String username, String profilepic, 
              String bio, String dob, int followers, int following, 
              int posts, int isFollowedByMe, int isFollowingMe)

Extended Constructor

Includes privacy settings:
Profile_Model(String userid, String username, String profilepic, 
              String bio, String dob, int followers, int following, 
              int posts, int isFollowedByMe, int isFollowingMe,
              boolean isPrivate, boolean isFollowRequestApproved)

Example

{
  "userid": "user_456",
  "username": "janedoe",
  "profilepic": "https://example.com/profiles/janedoe.jpg",
  "bio": "Photography enthusiast | Travel lover",
  "dob": "1995-06-15",
  "followers": 1234,
  "following": 567,
  "posts": 89,
  "isFollowingMe": true,
  "isFollowedByMe": true,
  "isPrivate": false,
  "isFollowRequestApproved": true
}

Usage Notes

  • The isFollowedByMe and isFollowingMe fields are derived from integer values during construction (>0 = true)
  • The isPrivate field determines whether the user’s content requires follow approval to view
  • The isFollowRequestApproved field is only relevant when isPrivate is true and indicates whether a pending follow request has been approved
  • Profile statistics (followers, following, posts) are updated as the user’s activity changes

Build docs developers (and LLMs) love