Beispiel #1
0
        public static RoomRole Parse(JObject m)
        {
            RoomRole role = new RoomRole();

            if (m["_id"] != null)
            {
                role.Id = m["_id"].Value <string>();
            }

            if (m["u"] != null)
            {
                role.User = User.Parse(m["u"] as JObject);
            }

            role.Roles = new List <string>();
            if (m["roles"] != null)
            {
                foreach (var r in m["roles"] as JArray)
                {
                    role.Roles.Add(r.Value <string>());
                }
            }

            if (m["rid"] != null)
            {
                role.RoomId = m["rid"].Value <string>();
            }

            return(role);
        }
Beispiel #2
0
        /// <summary>
        /// This method call is used to get room-wide special users and their roles. You may send an collection of room id (at least one).
        /// </summary>
        /// <returns> collection of users and its roles per room.</returns>
        public async Task <List <RoomRole> > GetRoles()
        {
            var res = await _meteor.CallWithResult("getRoomRoles", new object[] { Id });

            var roles = new List <RoomRole>();

            if (res["result"] != null)
            {
                foreach (var role in res["result"] as JArray)
                {
                    roles.Add(RoomRole.Parse(role as JObject));
                }
            }

            return(roles);
        }