Profile
TypeScript shapes for profiles, updates, friends, storage, and history.
Profile
Profile describes a Packbase account. Only id, username, and display_name are always present. Fields that end in ? can be absent. Use optional chaining such as profile.about?.bio for these fields.
interface Profile {
id: string
username: string
display_name: string
slug?: string
badge?: string
xp?: number
about?: { bio?: string; flair?: string }
space_type?: 'default' | 'custom_free' | 'custom_unrestricted'
post_privacy?: 'everyone' | 'followers' | 'friends' | 'private'
images?: { avatar?: string; header?: string }
following?: boolean
is_staff?: boolean
is_content_moderator?: boolean
is_dx?: boolean
type?: 'PRIVILEDGED' | 'ALUMNI'
created_at?: string
}following identifies whether the current signed-in user follows this profile. It can be absent in an anonymous request. Staff flags and fields such as xp can also be absent if an endpoint returns a smaller profile summary.
UpdateProfileInput
pb.me.update() accepts this object. Each field is optional because the method makes a partial update. Include only the values that you want to change.
interface UpdateProfileInput {
display_name?: string
slug?: string
about?: { bio?: string }
space_type?: 'default' | 'custom_free' | 'custom_unrestricted'
post_privacy?: 'everyone' | 'followers' | 'friends' | 'private'
images?: { header?: string }
}pb.me.update() returns UpdateProfileResult. This type adds id and sometimes username to the submitted fields. It is not a new full Profile. Call pb.me() after the update if you require the full current profile.
Friends and storage
pb.me.friends() returns FriendsResponse:
interface FriendsResponse {
count: number
friends: FriendProfile[]
message?: string
}pb.me.storage() returns StorageUsage:
interface StorageUsage {
totalBytes: number
fileCount?: number
tier?: string
error?: string
}Profile history
ProfileHistoryEntry is a saved version of a profile with its change metadata. The metadata fields are history_id, entity_id, transaction_time, decision_time, operation, and changed_by. Read pb.profiles for the date and order options.
Import
import type {
Profile,
UpdateProfileInput,
UpdateProfileResult,
FriendsResponse,
StorageUsage,
ProfileHistoryEntry,
ProfileHistoryOptions,
} from '@packbase/sdk-ts'