Packbase

pb.me

Fetch and update the authenticated profile, settings, friends, packs, badge, and storage usage.

pb.me is the resource for the current signed-in account. Each method on this page requires a valid browser session or API key. Use pb.profiles(username) if you require only a public profile.

Fetch the current user

const  = await .()

.(.)
.(.)

pb.me() sends GET /user/me and returns Promise<Profile>.

Update the profile

const  = await ..({
  : 'New Display Name',
  : { : 'Updated bio text' },
  : 'followers',
  : 'custom_free',
})

This is a partial update. Include only the fields that you want to change. Supported fields are display_name, slug, about.bio, space_type, post_privacy, and images.header. The response contains the fields that the server wrote. It does not contain a new full profile. Call pb.me() after the update if you require the full result.

Settings

const  = await ..()
await ..({
  : true,
  : false,
})

Call settings() with no argument to read the settings. Call it with an object to update them. The read result is Record<string, unknown>. Decode each key that you use. Do not cast the full record.

const  = await ..()
const  = (, {
  : (): boolean => {
    if (typeof  !== 'boolean') throw new ('dark_mode must be boolean')
    return 
  },
})

To cancel a settings read without confusing request options with update keys, pass undefined first: pb.me.settings(undefined, { signal }).

Friends

const { , ,  } = await ..()

for (const  of ) {
  .(., .)
}

A friend is a mutual follow. The server returns up to 100 of them in an object containing friends, count, and sometimes message.

Packs

const  = await ..()

This method returns each pack that the current user belongs to. The response includes membership data. The result is not limited to packs that the user owns.

Select a badge

await ..('founder-badge')

This method sends POST /user/me/badge with the store item ID of an owned badge. The server does not supply a related badge GET operation. The profile from pb.me() contains the active badge.

Storage usage

const  = await ..()

.(., ., .)

pb.me.storage() returns StorageUsage. On a storage-provider failure, the response includes error and totalBytes: 0.

On this page