Skip to Content
defold-typescript libraries
widgrensitasobi-defold

widgrensit/asobi-defold/asobi.api.social

asobi friends, groups and chat history over REST. A project reaches it as client.social.

  • GitHub: widgrensit/asobi-defold — pinned to v1.18.1
    1. Pick a release from widgrensit/asobi-defold releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as api_social from "asobi.api.social"

Functions

get_friends(client: Client, status?: string, limit?: number, callback?: HttpCallback)

Fetches the signed-in player's friends.

Parameters

  • client: Client — The client.
  • status?: string — Only friendships with this status. Every friendship when left out.
  • limit?: number — The most friends to return. Defaults to 50.
  • callback?: HttpCallback — Receives the friends, or the error.

add_friend(client: Client, friend_id: string, callback?: HttpCallback)

Sends a friend request.

Parameters

  • client: Client — The client.
  • friend_id: string — The player's id.
  • callback?: HttpCallback — Receives the friendship, or the error.

accept_friend(client: Client, friend_id: string, callback?: HttpCallback)

Accepts a friend request, setting the friendship's status to accepted.

Parameters

  • client: Client — The client.
  • friend_id: string — The player's id.
  • callback?: HttpCallback — Receives the friendship, or the error.

block_friend(client: Client, friend_id: string, callback?: HttpCallback)

Blocks a player, setting the friendship's status to blocked.

Parameters

  • client: Client — The client.
  • friend_id: string — The player's id.
  • callback?: HttpCallback — Receives the friendship, or the error.

remove_friend(client: Client, friend_id: string, callback?: HttpCallback)

Removes a friend.

Parameters

  • client: Client — The client.
  • friend_id: string — The player's id.
  • callback?: HttpCallback — Receives the server's answer, or the error.

create_group(client: Client, name: string, description?: string, max_members?: number, open?: boolean, callback?: HttpCallback)

Creates a group.

Parameters

  • client: Client — The client.
  • name: string — The group's name.
  • description?: string — The group's description. Defaults to "".
  • max_members?: number — The most members it holds. Defaults to 50.
  • open?: boolean — Whether any player may join without an invite. Defaults to false.
  • callback?: HttpCallback — Receives the group, or the error.

get_group(client: Client, group_id: string, callback?: HttpCallback)

Fetches a group.

Parameters

  • client: Client — The client.
  • group_id: string — The group's id.
  • callback?: HttpCallback — Receives the group, or the error.

join_group(client: Client, group_id: string, callback?: HttpCallback)

Joins a group.

Parameters

  • client: Client — The client.
  • group_id: string — The group's id.
  • callback?: HttpCallback — Receives the server's answer, or the error.

leave_group(client: Client, group_id: string, callback?: HttpCallback)

Leaves a group.

Parameters

  • client: Client — The client.
  • group_id: string — The group's id.
  • callback?: HttpCallback — Receives the server's answer, or the error.

update_friend(client: Client, friend_id: string, status: string, callback?: HttpCallback)

Sets a friendship's status.

Parameters

  • client: Client — The client.
  • friend_id: string — The player's id.
  • status: string — The new status.
  • callback?: HttpCallback — Receives the friendship, or the error.

update_group(client: Client, group_id: string, fields: Payload, callback?: HttpCallback)

Updates a group.

Parameters

  • client: Client — The client.
  • group_id: string — The group's id.
  • fields: Payload — The group fields to change.
  • callback?: HttpCallback — Receives the group, or the error.

get_group_members(client: Client, group_id: string, callback?: HttpCallback)

Fetches a group's members.

Parameters

  • client: Client — The client.
  • group_id: string — The group's id.
  • callback?: HttpCallback — Receives the members, or the error.

update_member_role(client: Client, group_id: string, player_id: string, role: string, callback?: HttpCallback)

Sets a member's role in a group.

Parameters

  • client: Client — The client.
  • group_id: string — The group's id.
  • player_id: string — The member's player id.
  • role: string — The new role.
  • callback?: HttpCallback — Receives the member, or the error.

remove_member(client: Client, group_id: string, player_id: string, callback?: HttpCallback)

Removes a member from a group.

Parameters

  • client: Client — The client.
  • group_id: string — The group's id.
  • player_id: string — The member's player id.
  • callback?: HttpCallback — Receives the server's answer, or the error.

get_chat_history(client: Client, channel_id: string, limit?: number, callback?: HttpCallback)

Fetches a chat channel's past messages.

Parameters

  • client: Client — The client.
  • channel_id: string — The channel's id.
  • limit?: number — The most messages to return. The server's default applies when left out.
  • callback?: HttpCallback — Receives the messages, or the error.

On this page