connections module reads and manages a user’s mutual connections (bidirectional relationships, similar to “friends”). Use it to list established connections, inspect pending requests, and accept, decline, or remove connections.
Every function acts on behalf of a named user. Pass that user’s Sublay ID as
userId — your service key performs the operation as that user.fetchConnections
Fetches a paginated list of a user’s established (mutual) connections.The Sublay user ID whose connections to fetch.
Page number (1-indexed). Defaults to
1.Results per page. Defaults to
20.Promise<PaginatedResponse<EstablishedConnection>>
fetchConnectionsCount
Returns the number of established connections for a user.The Sublay user ID.
Promise<{ count: number }>
fetchSentPendingConnections
Returns a paginated list of connection requests the user has sent that are still pending.The Sublay user ID whose sent requests to fetch.
Page number (1-indexed). Defaults to
1.Results per page. Defaults to
20.Promise<PaginatedResponse<PendingConnection>>
fetchReceivedPendingConnections
Returns a paginated list of pending connection requests the user has received.The Sublay user ID whose received requests to fetch.
Page number (1-indexed). Defaults to
1.Results per page. Defaults to
20.Promise<PaginatedResponse<PendingConnection>>
acceptConnection
Accepts a pending connection request received by the user.The ID of the pending connection request to accept.
The Sublay user ID accepting the request (the recipient).
Promise<ConnectionActionResponse> — { id, status, createdAt?, respondedAt? }
declineConnection
Declines a pending connection request received by the user.The ID of the pending connection request to decline.
The Sublay user ID declining the request (the recipient).
Promise<ConnectionActionResponse> — { id, status, createdAt?, respondedAt? }
removeConnection
Removes an established connection (or withdraws a pending request) by its connection ID.The connection ID to remove.
The Sublay user ID on whose behalf the connection is removed.
Promise<void>
