using System; using System.Collections.Generic; using System.Threading.Tasks; namespace LineMessaging { public partial class LineMessagingClient { private const string RoomMemberApiPath = "/v2/bot/room/{0}/member/{1}"; private const string RoomMembersApiPath = "/v2/bot/room/{0}/members/ids"; private const string LeaveRoomApiPath = "/v2/bot/room/{0}/leave"; public async Task GetRoomMember(string roomId, string userId) { if (string.IsNullOrEmpty(roomId)) { throw new ArgumentException($"{nameof(roomId)} is null or empty."); } if (string.IsNullOrEmpty(userId)) { throw new ArgumentException($"{nameof(userId)} is null or empty."); } return await Get(string.Format(RoomMemberApiPath, roomId, userId)); } public async Task GetRoomMembers(string roomId, string start = null) { if (string.IsNullOrEmpty(roomId)) { throw new ArgumentException($"{nameof(roomId)} is null or empty."); } var query = new Dictionary(); if (start != null) { query["start"] = start; } return await Get(string.Format(RoomMembersApiPath, roomId), query); } public async Task LeaveRoom(string roomId) { if (string.IsNullOrEmpty(roomId)) { throw new ArgumentException($"{nameof(roomId)} is null or empty."); } await Post(string.Format(LeaveRoomApiPath, roomId)); } } }