UNPKG

@haelp/teto

Version:

A typescript-based controllable TETR.IO client.

45 lines (44 loc) 1.55 kB
export const relationship = (get, post, __)=>{ const removeRelationship = async (id)=>{ const res = await post({ uri: "relationships/remove", body: { user: id } }); if (res.success === false) throw new Error("Failed to remove relationship"); return true; }; return { /** Block a user */ block: async (id)=>{ const res = await post({ uri: "relationships/block", body: { user: id } }); if (res.success === false) throw new Error(res.error.msg); return res.success; }, /** Unblock a user. Note: unblocking a user will unfriend them if they are friended. */ unblock: removeRelationship, /** Friend a user */ friend: async (id)=>{ const res = await post({ uri: "relationships/friend", body: { user: id } }); if (res.success === false) throw new Error(res.error.msg); return res.success; }, /** Unfriend a user. Note: unfriending a user will unblock them if they are blocked. */ unfriend: removeRelationship, dms: async (id)=>{ const res = await get({ uri: `dms/${id}` }); if (res.success === false) throw new Error(res.error.msg); return res.dms; } }; }; //# sourceMappingURL=relationship.js.map