internal static RestCommunityPermissions Create(Model model)
        {
            var entity = new RestCommunityPermissions();

            entity.Update(model);
            return(entity);
        }
Exemple #2
0
        internal static async Task <RestCommunityPermissions> GetPermissionsAsync(RestSimpleCommunity community, ulong userId)
        {
            if (!TokenHelper.TryGetToken(community.Client, userId, out RestTokenInfo info))
            {
                throw new InvalidOperationException("No valid token specified for this user.");
            }

            var model = await community.Client.RestClient.GetCommunityPermissionsInternalAsync(info.Token, community.Id);

            var entity = new RestCommunityPermissions();

            entity.Update(model);
            return(entity);
        }