Profile
TypeScript shapes for profiles, updates, friends, and storage.
Profile
Profile describes a Packbase account. The API always includes id, username, and display_name. The value of display_name can be null. 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 | null
slug?: string
badge?: string
xp?: number
about?: { bio?: string | null; flair?: string }
space_type?: 'default' | 'custom_free' | 'custom_unrestricted'
post_privacy?: 'everyone' | 'followers' | 'friends' | 'private'
images?: { avatar?: string; header?: string | null }
following?: boolean
is_staff?: boolean
is_content_moderator?: boolean
is_dx?: boolean
type?: 'PRIVILEDGED' | 'ALUMNI'
created_at?: string
default_pack?: Pack | null
}The values of about.bio and images.header can be null. null means that Packbase does not have a stored value.
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.
default_pack contains the selected default pack when the endpoint expands it.
It is null when the profile has no default pack.
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?: { avatar?: string; header?: string }
}Image updates accept base64 data URLs. Pass the complete data URL, including its MIME type, to images.avatar or images.header.
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
}Import
import type {
Profile,
UpdateProfileInput,
UpdateProfileResult,
FriendsResponse,
StorageUsage,
} from '@packbase/sdk-ts'