예제 #1
0
        public static Task ModifyAsync(RestSimpleCommunity community, ulong userId, Action <ModifyCommunityParams> options)
        {
            if (!TokenHelper.TryGetToken(community.Client, userId, out RestTokenInfo info))
            {
                throw new MissingScopeException("communities_edit");
            }
            if (!info.Authorization.Scopes.Contains("communities_edit"))
            {
                throw new MissingScopeException("communities_edit");
            }

            var changes = new ModifyCommunityParams();

            options.Invoke(changes);

            return(community.Client.RestClient.ModifyCommunityInternalAsync(info.Token, community.Id, changes));
        }
예제 #2
0
 public ModifyCommunityRequest(string token, string communityId, ModifyCommunityParams changes)
     : base("PUT", $"communities/{communityId}", token)
 {
     JsonBody = JsonConvert.SerializeObject(changes);
 }