Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | 78x 78x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x | import { GetCommunityReq, JoinCommunityReq, LeaveCommunityReq, ListAdminsReq, ListCommunitiesReq, ListDiscussionsReq, ListGroupsReq, ListGuidesReq, ListMembersReq, ListNearbyUsersReq, ListPlacesReq, ListUserCommunitiesReq, } from "proto/communities_pb"; import client from "./client"; export async function getCommunity(communityId: number) { const req = new GetCommunityReq(); req.setCommunityId(communityId); const response = await client.communities.getCommunity(req); return response.toObject(); } /** * List sub-communities of a given community */ export async function listCommunities(communityId: number, pageToken?: string) { const req = new ListCommunitiesReq(); req.setCommunityId(communityId); Iif (pageToken) { req.setPageToken(pageToken); } const response = await client.communities.listCommunities(req); return response.toObject(); } export async function listGroups(communityId: number, pageToken?: string) { const req = new ListGroupsReq(); req.setCommunityId(communityId); Iif (pageToken) { req.setPageToken(pageToken); } const response = await client.communities.listGroups(req); return response.toObject(); } export async function listAdmins(communityId: number, pageToken?: string) { const req = new ListAdminsReq(); req.setCommunityId(communityId); Iif (pageToken) { req.setPageToken(pageToken); } req.setPageSize(6); const response = await client.communities.listAdmins(req); return response.toObject(); } export async function listMembers(communityId: number, pageToken?: string) { const req = new ListMembersReq(); req.setCommunityId(communityId); Iif (pageToken) { req.setPageToken(pageToken); } const response = await client.communities.listMembers(req); return response.toObject(); } export async function listNearbyUsers(communityId: number, pageToken?: string) { const req = new ListNearbyUsersReq(); req.setCommunityId(communityId); Iif (pageToken) { req.setPageToken(pageToken); } const response = await client.communities.listNearbyUsers(req); return response.toObject(); } export async function listPlaces(communityId: number, pageToken?: string) { const req = new ListPlacesReq(); req.setCommunityId(communityId); Iif (pageToken) { req.setPageToken(pageToken); } const response = await client.communities.listPlaces(req); return response.toObject(); } export async function listGuides(communityId: number, pageToken?: string) { const req = new ListGuidesReq(); req.setCommunityId(communityId); Iif (pageToken) { req.setPageToken(pageToken); } const response = await client.communities.listGuides(req); return response.toObject(); } export async function listDiscussions(communityId: number, pageToken?: string) { const req = new ListDiscussionsReq(); req.setCommunityId(communityId); Iif (pageToken) { req.setPageToken(pageToken); } const response = await client.communities.listDiscussions(req); return response.toObject(); } export async function joinCommunity(communityId: number) { const req = new JoinCommunityReq(); req.setCommunityId(communityId); await client.communities.joinCommunity(req); } export async function leaveCommunity(communityId: number) { const req = new LeaveCommunityReq(); req.setCommunityId(communityId); await client.communities.leaveCommunity(req); } export async function listUserCommunities(pageToken?: string) { const req = new ListUserCommunitiesReq(); Iif (pageToken) req.setPageToken(pageToken); return (await client.communities.listUserCommunities(req)).toObject(); } |