GameMaker Studio · GML · Friends
gmda_listPendingInvitations
Lists pending friend invitations; the event fires twice, once for incoming and once for outgoing.
Signature
gmda_listPendingInvitations() -> realWhat it does
Fires two POSTs to /friends/invitations/list (status pending): one for direction incoming and one for outgoing. Returns 1 when both requests are fired, 0 with no active session. Each reply arrives as its own invitations_listed event, so the event FIRES TWICE; read response.invitations on each. Every entry is a struct { id, direction, counterpart: { player_key, player_name }, status, message, created_at, responded_at, expires_at }. The direction field on each entry tells you which batch it came from.
Parameters
This function takes no parameters.
How to call it
Fire gmda_listPendingInvitations() once, then read invitations_listed from gmda_pollEvent() TWICE (once for incoming, once for outgoing). Merge both batches in your own inbox list, keyed by entry id.
Result event: invitations_listed { success, response }
Example
gmda_listPendingInvitations();
// In the Step event, two invitations_listed events will arrive:
var _e = gmda_pollEvent();
while (!is_undefined(_e)) {
if (_e.event == "invitations_listed" && _e.success) {
var _list = _e.response.invitations;
for (var _i = 0; _i < array_length(_list); _i++) {
var _inv = _list[_i];
show_debug_message(_inv.direction + " from " + _inv.counterpart.player_name);
}
}
_e = gmda_pollEvent();
}Use cases
- Build an inbox screen showing who invited you and who you've invited.
- Show a badge count of pending friend requests.