Skip to content

Commit 131e296

Browse files
author
Hyunje Jun
authored
Merge pull request #15 from chooco13/master
add api "Get group/room member profiles"
2 parents 3d748d3 + 5ccf9e9 commit 131e296

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

lib/client.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ export default class Client {
3838
return this.get(URL.profile(userId));
3939
}
4040

41+
public getGroupMemberProfile(groupId: string, userId: string): Promise<Line.Profile> {
42+
return this.get(URL.groupMemberProfile(groupId, userId));
43+
}
44+
45+
public getRoomMemberProfile(roomId: string, userId: string): Promise<Line.Profile> {
46+
return this.get(URL.roomMemberProfile(roomId, userId));
47+
}
48+
4149
public getMessageContent(messageId: string): NodeJS.ReadableStream {
4250
return this.stream(URL.content(messageId));
4351
}

lib/urls.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ export const push: string = apiURL("message/push");
77
export const multicast: string = apiURL("message/multicast");
88
export const content = (messageId: string) => apiURL(`message/${messageId}/content`);
99
export const profile = (userId: string) => apiURL(`profile/${userId}`);
10+
export const groupMemberProfile = (groupId: string, userId: string) => apiURL(`group/${groupId}/member/${userId}`);
11+
export const roomMemberProfile = (roomId: string, userId: string) => apiURL(`room/${roomId}/member/${userId}`);
1012
export const leaveGroup = (groupId: string) => apiURL(`group/${groupId}/leave`);
1113
export const leaveRoom = (roomId: string) => apiURL(`room/${roomId}/leave`);

test/client.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@ describe("client", () => {
5959
});
6060
});
6161

62+
it("getGroupMemberProfile", () => {
63+
return client.getGroupMemberProfile("test_group_id", "test_user_id")
64+
.then((res: any) => {
65+
equal(res.headers.authorization, "Bearer test_channel_access_token");
66+
equal(res.path, "/group/test_group_id/member/test_user_id");
67+
equal(res.method, "GET");
68+
});
69+
});
70+
71+
it("getRoomMemberProfile", () => {
72+
return client.getRoomMemberProfile("test_room_id", "test_user_id")
73+
.then((res: any) => {
74+
equal(res.headers.authorization, "Bearer test_channel_access_token");
75+
equal(res.path, "/room/test_room_id/member/test_user_id");
76+
equal(res.method, "GET");
77+
});
78+
});
79+
6280
it("getMessageContent", () => {
6381
const s = client.getMessageContent("test_message_id");
6482
return getStreamData(s)

0 commit comments

Comments
 (0)