internal static RestTeam Create(BaseDiscordClient discord, Model model) { var entity = new RestTeam(discord, model.Id); entity.Update(model); return(entity); }
internal void Update(Model model) { Description = model.Description; RPCOrigins = model.RPCOrigins.IsSpecified ? model.RPCOrigins.Value.ToImmutableArray() : ImmutableArray <string> .Empty; Name = model.Name; IconId = model.Icon; IsBotPublic = model.IsBotPublic; BotRequiresCodeGrant = model.BotRequiresCodeGrant; Tags = model.Tags.GetValueOrDefault(null)?.ToImmutableArray() ?? ImmutableArray <string> .Empty; PrivacyPolicy = model.PrivacyPolicy; TermsOfService = model.TermsOfService; var installParams = model.InstallParams.GetValueOrDefault(null); InstallParams = new ApplicationInstallParams(installParams?.Scopes ?? new string[0], (GuildPermission?)installParams?.Permission ?? null); if (model.Flags.IsSpecified) { Flags = model.Flags.Value; } if (model.Owner.IsSpecified) { Owner = RestUser.Create(Discord, model.Owner.Value); } if (model.Team != null) { Team = RestTeam.Create(Discord, model.Team); } }
internal void Update(Model model) { Description = model.Description; RPCOrigins = model.RPCOrigins; Name = model.Name; _iconId = model.Icon; IsBotPublic = model.IsBotPublic; BotRequiresCodeGrant = model.BotRequiresCodeGrant; if (model.Flags.IsSpecified) { Flags = model.Flags.Value; //TODO: Do we still need this? } if (model.Owner.IsSpecified) { Owner = RestUser.Create(Discord, model.Owner.Value); } if (model.Team != null) { Team = RestTeam.Create(Discord, model.Team); } }