internal static SocketApplicationCommandOption Create(Model model) { var entity = new SocketApplicationCommandOption(); entity.Update(model); return(entity); }
internal void Update(Model model) { Name = model.Name; Type = model.Type; Description = model.Description; IsDefault = model.Default.ToNullable(); IsRequired = model.Required.ToNullable(); MinValue = model.MinValue.ToNullable(); MaxValue = model.MaxValue.ToNullable(); IsAutocomplete = model.Autocomplete.ToNullable(); Choices = model.Choices.IsSpecified ? model.Choices.Value.Select(SocketApplicationCommandChoice.Create).ToImmutableArray() : ImmutableArray.Create <SocketApplicationCommandChoice>(); Options = model.Options.IsSpecified ? model.Options.Value.Select(Create).ToImmutableArray() : ImmutableArray.Create <SocketApplicationCommandOption>(); ChannelTypes = model.ChannelTypes.IsSpecified ? model.ChannelTypes.Value.ToImmutableArray() : ImmutableArray.Create <ChannelType>(); }
internal static RestApplicationCommandOption Create(Model model) { var options = new RestApplicationCommandOption(); options.Update(model); return(options); }
internal void Update(Model model) { Type = model.Type; Name = model.Name; Description = model.Description; if (model.Default.IsSpecified) { IsDefault = model.Default.Value; } if (model.Required.IsSpecified) { IsRequired = model.Required.Value; } if (model.MinValue.IsSpecified) { MinValue = model.MinValue.Value; } if (model.MaxValue.IsSpecified) { MaxValue = model.MaxValue.Value; } if (model.Autocomplete.IsSpecified) { IsAutocomplete = model.Autocomplete.Value; } Options = model.Options.IsSpecified ? model.Options.Value.Select(Create).ToImmutableArray() : ImmutableArray.Create <RestApplicationCommandOption>(); Choices = model.Choices.IsSpecified ? model.Choices.Value.Select(x => new RestApplicationCommandChoice(x)).ToImmutableArray() : ImmutableArray.Create <RestApplicationCommandChoice>(); ChannelTypes = model.ChannelTypes.IsSpecified ? model.ChannelTypes.Value.ToImmutableArray() : ImmutableArray.Create <ChannelType>(); }
internal void Update(Model model) { this.Name = model.Name; this.Type = model.Type; this.Description = model.Description; this.Default = model.Default.IsSpecified ? model.Default.Value : (bool?)null; this.Required = model.Required.IsSpecified ? model.Required.Value : (bool?)null; this.Choices = model.Choices.IsSpecified ? model.Choices.Value.Select(x => SocketApplicationCommandChoice.Create(x)).ToImmutableArray().ToReadOnlyCollection() : null; this.Options = model.Options.IsSpecified ? model.Options.Value.Select(x => SocketApplicationCommandOption.Create(x)).ToImmutableArray().ToReadOnlyCollection() : null; }
internal void Update(Model model) { Type = model.Type; Name = model.Name; Description = model.Description; if (model.Default.IsSpecified) { Default = model.Default.Value; } if (model.Required.IsSpecified) { Required = model.Required.Value; } Options = model.Options.IsSpecified ? model.Options.Value.Select(Create).ToImmutableArray().ToReadOnlyCollection() : null; Choices = model.Choices.IsSpecified ? model.Choices.Value.Select(x => new RestApplicationCommandChoice(x)).ToImmutableArray().ToReadOnlyCollection() : null; }
internal void Update(Model model) { this.Type = model.Type; this.Name = model.Name; this.Description = model.Description; if (model.Default.IsSpecified) { this.Default = model.Default.Value; } if (model.Required.IsSpecified) { this.Required = model.Required.Value; } this.Options = model.Options.IsSpecified ? model.Options.Value.Select(x => Create(x)).ToImmutableArray() : null; this.Choices = model.Choices.IsSpecified ? model.Choices.Value.Select(x => new RestApplicationCommandChoice(x)).ToImmutableArray() : null; }