Tinylib
DiscoverDocsSign in
Sign in
Tinylib
AboutDiscoverDocsMake an appPricingTermsPrivacyDeveloper TermsContact

Start

  • Quickstart
  • How Tinylib works

Guides

  • Data
  • Rooms and rules
  • Games
  • Friends
  • Places and links
  • Reminders and notifications
  • Publishing
  • Errors and offline
  • Platforms

Client API

  • tinylib
  • tinylib.data
  • tinylib.rooms
  • tinylib.invitations
  • tinylib.friends
    • list()
    • sendApp()
    • data
    • FriendValue
    • RemoteStore
  • tinylib.places
  • tinylib.reminders
  • Types
  • tinylib-sdk/kits

Rules API

  • Kinds
  • ctx

Reference

  • tinylib.json
  • Command line
  • Limits

Plain text

  • llms.txt
  • llms-full.txt

tinylib.friends

Your app sees the user's friends who use it. It can't add or remove friends; people do that in Tinylib.

Reading friends or their values needs "friends" in your app's uses.

tinylib.friends.list()

tinylib.friends.list(): Promise<Member[]>
Lists the user's friends who use your app, leaving out anyone blocked either way.
JavaScript
const friends = await tinylib.friends.list()

Returns

Promise<Member[]>
The friends, sorted by name, each a Member with guest false.

Rejects with

refused
When your app's uses lacks "friends", or the user is a guest.
offline

tinylib.friends.sendApp()

tinylib.friends.sendApp(): Promise<void>
Opens Tinylib's send sheet, where the user picks any of their friends to send your app to. Resolves when the sheet closes, without saying who was picked.

Rejects with

refused
When the user is a guest.
offline

tinylib.friends.data

interface FriendsData
Reads the values the user's friends saved with audience: 'friends'. Nothing tells your client when they change, so read them each time you show them.

Methods

get(key)
Reads every friend's value under key.
of(friendId)
Returns a read-only store of the values one friend saved with audience: 'friends'.

tinylib.friends.data.get()

tinylib.friends.data.get(key: string): Promise<Map<string, FriendValue>>
Reads every friend's value under key.
JavaScript
const best = await tinylib.friends.data.get('best')

Parameters

keystring
The key to read.

Returns

Promise<Map<string, FriendValue>>
A Map from each friend's id to their FriendValue. Friends with no value under key are left out.

Rejects with

refused
When your app's uses lacks "friends", or the user is a guest.
offline

tinylib.friends.data.of()

tinylib.friends.data.of(friendId: string): RemoteStore<FriendValue>
Returns a read-only store of the values one friend saved with audience: 'friends'. The store is empty for anyone who isn't the user's friend.
JavaScript
const days = await tinylib.friends.data.of(friend.id).entries('day/') // [['day/2026-10-20', { value: 280, changedAt: 1792540800000 }], …]

Parameters

friendIdstring
The friend's id, from tinylib.friends.list.

Returns

RemoteStore<FriendValue>
A RemoteStore of the friend's values, each a FriendValue. Its methods reject with refused when your app's uses lacks "friends" or the user is a guest, and with offline without a connection.

FriendValue

interface FriendValue
A value a friend saved with audience: 'friends', and when it last changed.

Properties

valueunknown
The value, as the friend saved it.
changedAtnumber
When the value last changed, in milliseconds on Tinylib's clock.

RemoteStore

interface RemoteStore<V>
A read-only store with the read methods of tinylib.data, reading from Tinylib's servers. The call that returned the store lists what its methods reject with.

Methods

get(key)
Resolves with the value under key, or undefined when there's none.
keys(prefix?)
Resolves with the keys that start with prefix, or every key without it, sorted.
values(prefix?)
Resolves with the values under the keys that start with prefix, or every value without it, sorted by key.
entries(prefix?)
Resolves with the [key, value] pairs whose keys start with prefix, or every pair without it, sorted by key.

RemoteStore.get()

RemoteStore.get(key: string): Promise<V | undefined>
Resolves with the value under key, or undefined when there's none.

RemoteStore.keys()

RemoteStore.keys(prefix?: string): Promise<string[]>
Resolves with the keys that start with prefix, or every key without it, sorted.

RemoteStore.values()

RemoteStore.values(prefix?: string): Promise<V[]>
Resolves with the values under the keys that start with prefix, or every value without it, sorted by key.

RemoteStore.entries()

RemoteStore.entries(prefix?: string): Promise<[string, V][]>
Resolves with the [key, value] pairs whose keys start with prefix, or every pair without it, sorted by key.
Previoustinylib.invitationsNexttinylib.places

On this page

  • list()
  • sendApp()
  • data
  • get()
  • of()
  • FriendValue
  • RemoteStore
  • get()
  • keys()
  • values()
  • entries()