diff --git a/build/Build.Announce.cs b/build/Build.Announce.cs index c3a09433f..f8ecc1c58 100644 --- a/build/Build.Announce.cs +++ b/build/Build.Announce.cs @@ -87,7 +87,7 @@ partial class Build .Executes(async () => { await SendSlackMessageAsync(_ => _ - .AddAttachment(_ => _ + .AddAttachments(_ => _ .SetFallback(AnnouncementTitle) .SetAuthorName(AnnouncementTitle) .SetAuthorLink(AnnouncementLink) @@ -117,10 +117,10 @@ await SendSlackMessageAsync(_ => _ { await SendDiscordMessageAsync(_ => _ .SetContent("@everyone") - .AddEmbed(_ => _ + .AddEmbeds(_ => _ .SetTitle(AnnouncementTitle) .SetColor(AnnouncementColor) - .SetThumbnail(new DiscordEmbedThumbnail() + .SetThumbnail(_ => _ .SetUrl(AnnouncementThumbnailUrl)) .SetDescription(new StringBuilder() .Append($"This [release]({AnnouncementLink}) includes *[{AnnouncementGitInfo.CommitsText}]({AnnouncementComparisonUrl})*") @@ -132,7 +132,7 @@ await SendDiscordMessageAsync(_ => _ .AppendLine() .AppendLine(AnnouncementReleaseNotes).ToString() .Replace("*", "**")) - .SetFooter(new DiscordEmbedFooter() + .SetFooter(_ => _ .SetText($"Powered by {AnnouncementSponsors.Select(x => x.Text).JoinCommaAnd()}.") .SetIconUrl("https://cdn.discordapp.com/emojis/674275938757771306.webp?size=240&quality=lossless"))), DiscordWebhook); diff --git a/build/Build.CodeGeneration.cs b/build/Build.CodeGeneration.cs index 8d8500ae0..f2b195e0d 100644 --- a/build/Build.CodeGeneration.cs +++ b/build/Build.CodeGeneration.cs @@ -43,7 +43,7 @@ partial class Build "CorFlags.json", "CoverallsNet.json", "Coverlet.json", - // "Discord.json", + "Discord.json", "DocFX.json", "Docker.json", "DotCover.json", @@ -63,7 +63,7 @@ partial class Build "MSBuild.json", "MSpec.json", "MakeNSIS.json", - // "Mastodon.json", + "Mastodon.json", "MauiCheck.json", "MinVer.json", // "NSwag.json", @@ -83,7 +83,7 @@ partial class Build "ReportGenerator.json", "SignClient.json", "SignTool.json", - // "Slack.json", + "Slack.json", "SonarScanner.json", "SpecFlow.json", "Squirrel.json", diff --git a/source/Nuke.Common.Tests/SettingsTest.TestDiscord.verified.txt b/source/Nuke.Common.Tests/SettingsTest.TestDiscord.verified.txt new file mode 100644 index 000000000..7ce32b71e --- /dev/null +++ b/source/Nuke.Common.Tests/SettingsTest.TestDiscord.verified.txt @@ -0,0 +1,11 @@ +{ + "nonce": "nonce", + "channel_id": "channel-id", + "embeds": [ + { + "author": { + "name": "author-name" + } + } + ] +} \ No newline at end of file diff --git a/source/Nuke.Common.Tests/SettingsTest.cs b/source/Nuke.Common.Tests/SettingsTest.cs index 01915a9c6..56f10d1fa 100644 --- a/source/Nuke.Common.Tests/SettingsTest.cs +++ b/source/Nuke.Common.Tests/SettingsTest.cs @@ -150,10 +150,11 @@ public Task TestDiscord() var result = new DiscordMessage() .SetNonce("nonce") .SetChannelId("channel-id") - .SetEmbeds(new DiscordEmbed() - .SetAuthor(new DiscordEmbedAuthor() - .SetName("author-name"))); + .AddEmbeds(_ => _ + .SetAuthor(_ => _ + .SetName("author-name"))) + .ToJson(Options.JsonSerializerSettings); - return Verifier.Verify(result.ToJson()); + return Verifier.Verify(result); } } diff --git a/source/Nuke.Common/Tools/Codecov/Codecov.Generated.cs b/source/Nuke.Common/Tools/Codecov/Codecov.Generated.cs index 13e0cddb9..af52b25e2 100644 --- a/source/Nuke.Common/Tools/Codecov/Codecov.Generated.cs +++ b/source/Nuke.Common/Tools/Codecov/Codecov.Generated.cs @@ -86,7 +86,7 @@ public partial class CodecovSettings : ToolOptions /// Verbose mode. [Argument(Format = "--verbose")] public bool? Verbose => Get(() => Verbose); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region CodecovSettingsExtensions diff --git a/source/Nuke.Common/Tools/Discord/Discord.Generated.cs b/source/Nuke.Common/Tools/Discord/Discord.Generated.cs index 3cb14367b..894b08242 100644 --- a/source/Nuke.Common/Tools/Discord/Discord.Generated.cs +++ b/source/Nuke.Common/Tools/Discord/Discord.Generated.cs @@ -6,6 +6,7 @@ using Nuke.Common.Tooling; using Nuke.Common.Tools; using Nuke.Common.Utilities.Collections; +using Nuke.Tooling; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -18,1232 +19,492 @@ namespace Nuke.Common.Tools.Discord; #region DiscordMessage -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class DiscordMessage : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class DiscordMessage : Options { - /// - /// Id of the channel. - /// - [JsonProperty("channel_id")] - public virtual string ChannelId { get; internal set; } - /// - /// Message contents (up to 2000 characters). - /// - [JsonProperty("content")] - public virtual string Content { get; internal set; } - /// - /// Can be used to verify a message was sent (up to 25 characters). Value will appear in the Message Create event. - /// - [JsonProperty("nonce")] - public virtual string Nonce { get; internal set; } - /// - /// Whether this is a TTS message. - /// - [JsonProperty("tts")] - public virtual bool? TTS { get; internal set; } - /// - /// Embedded rich content (up to 6000 characters). See Discord Embed Builder. - /// - [JsonIgnore] - public virtual IReadOnlyList Embeds => EmbedsInternal.AsReadOnly(); - [JsonProperty("embeds")] - internal List EmbedsInternal { get; set; } = new List(); + /// Id of the channel. + [JsonProperty("channel_id")] public string ChannelId => Get(() => ChannelId); + /// Message contents (up to 2000 characters). + [JsonProperty("content")] public string Content => Get(() => Content); + /// Can be used to verify a message was sent (up to 25 characters). Value will appear in the Message Create event. + [JsonProperty("nonce")] public string Nonce => Get(() => Nonce); + /// Whether this is a TTS message. + [JsonProperty("tts")] public bool? TTS => Get(() => TTS); + /// Embedded rich content (up to 6000 characters). See Discord Embed Builder. + [JsonProperty("embeds")] public IReadOnlyList Embeds => Get>(() => Embeds); } #endregion #region DiscordEmbed -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class DiscordEmbed : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class DiscordEmbed : Options { - /// - /// Title of embed. - /// - [JsonProperty("title")] - public virtual string Title { get; internal set; } - /// - /// Type of embed (always rich for webhook embeds). - /// - [JsonProperty("type")] - public virtual DiscordEmbedType Type { get; internal set; } - /// - /// Description of embed. - /// - [JsonProperty("description")] - public virtual string Description { get; internal set; } - /// - /// Url of embed. - /// - [JsonProperty("url")] - public virtual string Url { get; internal set; } - /// - /// ISO8601 timestamp of embed. - /// - [JsonProperty("timestamp")] - public virtual string Timestamp { get; internal set; } - /// - /// Color code of the embed. - /// - [JsonProperty("color")] - public virtual int? Color { get; internal set; } - /// - /// Footer information. - /// - [JsonProperty("footer")] - public virtual DiscordEmbedFooter Footer { get; internal set; } - /// - /// Image information. - /// - [JsonProperty("image")] - public virtual DiscordEmbedImage Image { get; internal set; } - /// - /// Thumbnail information. - /// - [JsonProperty("thumbnail")] - public virtual DiscordEmbedThumbnail Thumbnail { get; internal set; } - /// - /// Author information. - /// - [JsonProperty("author")] - public virtual DiscordEmbedAuthor Author { get; internal set; } - /// - /// Fields information. - /// - [JsonIgnore] - public virtual IReadOnlyList Fields => FieldsInternal.AsReadOnly(); - [JsonProperty("fields")] - internal List FieldsInternal { get; set; } = new List(); + /// Title of embed. + [JsonProperty("title")] public string Title => Get(() => Title); + /// Type of embed (always rich for webhook embeds). + [JsonProperty("type")] public DiscordEmbedType Type => Get(() => Type); + /// Description of embed. + [JsonProperty("description")] public string Description => Get(() => Description); + /// Url of embed. + [JsonProperty("url")] public string Url => Get(() => Url); + /// ISO8601 timestamp of embed. + [JsonProperty("timestamp")] public string Timestamp => Get(() => Timestamp); + /// Color code of the embed. + [JsonProperty("color")] public int? Color => Get(() => Color); + /// Footer information. + [JsonProperty("footer")] public DiscordEmbedFooter Footer => Get(() => Footer); + /// Image information. + [JsonProperty("image")] public DiscordEmbedImage Image => Get(() => Image); + /// Thumbnail information. + [JsonProperty("thumbnail")] public DiscordEmbedThumbnail Thumbnail => Get(() => Thumbnail); + /// Author information. + [JsonProperty("author")] public DiscordEmbedAuthor Author => Get(() => Author); + /// Fields information. + [JsonProperty("fields")] public IReadOnlyList Fields => Get>(() => Fields); } #endregion #region DiscordEmbedFooter -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class DiscordEmbedFooter : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class DiscordEmbedFooter : Options { - /// - /// Footer text. - /// - [JsonProperty("text")] - public virtual string Text { get; internal set; } - /// - /// Url of footer icon (only supports http(s) and attachments). - /// - [JsonProperty("icon_url")] - public virtual string IconUrl { get; internal set; } + /// Footer text. + [JsonProperty("text")] public string Text => Get(() => Text); + /// Url of footer icon (only supports http(s) and attachments). + [JsonProperty("icon_url")] public string IconUrl => Get(() => IconUrl); } #endregion #region DiscordEmbedImage -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class DiscordEmbedImage : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class DiscordEmbedImage : Options { - /// - /// Source url of image (only supports http(s) and attachments). - /// - [JsonProperty("url")] - public virtual string Url { get; internal set; } - /// - /// Height of image. - /// - [JsonProperty("height")] - public virtual int? Height { get; internal set; } - /// - /// Width of image. - /// - [JsonProperty("width")] - public virtual int? Width { get; internal set; } + /// Source url of image (only supports http(s) and attachments). + [JsonProperty("url")] public string Url => Get(() => Url); + /// Height of image. + [JsonProperty("height")] public int? Height => Get(() => Height); + /// Width of image. + [JsonProperty("width")] public int? Width => Get(() => Width); } #endregion #region DiscordEmbedThumbnail -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class DiscordEmbedThumbnail : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class DiscordEmbedThumbnail : Options { - /// - /// Source url of thumbnail (only supports http(s) and attachments). - /// - [JsonProperty("url")] - public virtual string Url { get; internal set; } - /// - /// Height of thumbnail. - /// - [JsonProperty("height")] - public virtual int? Height { get; internal set; } - /// - /// Width of thumbnail. - /// - [JsonProperty("width")] - public virtual int? Width { get; internal set; } + /// Source url of thumbnail (only supports http(s) and attachments). + [JsonProperty("url")] public string Url => Get(() => Url); + /// Height of thumbnail. + [JsonProperty("height")] public int? Height => Get(() => Height); + /// Width of thumbnail. + [JsonProperty("width")] public int? Width => Get(() => Width); } #endregion #region DiscordEmbedAuthor -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class DiscordEmbedAuthor : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class DiscordEmbedAuthor : Options { - /// - /// Name of author. - /// - [JsonProperty("name")] - public virtual string Name { get; internal set; } - /// - /// Url of author. - /// - [JsonProperty("url")] - public virtual string Url { get; internal set; } - /// - /// Url of author icon (only supports http(s) and attachments). - /// - [JsonProperty("icon_url")] - public virtual string IconUrl { get; internal set; } + /// Name of author. + [JsonProperty("name")] public string Name => Get(() => Name); + /// Url of author. + [JsonProperty("url")] public string Url => Get(() => Url); + /// Url of author icon (only supports http(s) and attachments). + [JsonProperty("icon_url")] public string IconUrl => Get(() => IconUrl); } #endregion #region DiscordEmbedField -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class DiscordEmbedField : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class DiscordEmbedField : Options { - /// - /// Name of the field. - /// - [JsonProperty("name")] - public virtual string Name { get; internal set; } - /// - /// Value of the field. - /// - [JsonProperty("value")] - public virtual string Value { get; internal set; } - /// - /// Whether or not this field should siplay inline. - /// - [JsonProperty("inline")] - public virtual bool? Inline { get; internal set; } + /// Name of the field. + [JsonProperty("name")] public string Name => Get(() => Name); + /// Value of the field. + [JsonProperty("value")] public string Value => Get(() => Value); + /// Whether or not this field should siplay inline. + [JsonProperty("inline")] public bool? Inline => Get(() => Inline); } #endregion #region DiscordMessageExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DiscordMessageExtensions { #region ChannelId - /// - ///

Sets

- ///

Id of the channel.

- ///
- [Pure] - public static T SetChannelId(this T toolSettings, string channelId) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ChannelId = channelId; - return toolSettings; - } - /// - ///

Resets

- ///

Id of the channel.

- ///
- [Pure] - public static T ResetChannelId(this T toolSettings) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ChannelId = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.ChannelId))] + public static T SetChannelId(this T o, string v) where T : DiscordMessage => o.Modify(b => b.Set(() => o.ChannelId, v)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.ChannelId))] + public static T ResetChannelId(this T o) where T : DiscordMessage => o.Modify(b => b.Remove(() => o.ChannelId)); #endregion #region Content - /// - ///

Sets

- ///

Message contents (up to 2000 characters).

- ///
- [Pure] - public static T SetContent(this T toolSettings, string content) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Content = content; - return toolSettings; - } - /// - ///

Resets

- ///

Message contents (up to 2000 characters).

- ///
- [Pure] - public static T ResetContent(this T toolSettings) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Content = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Content))] + public static T SetContent(this T o, string v) where T : DiscordMessage => o.Modify(b => b.Set(() => o.Content, v)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Content))] + public static T ResetContent(this T o) where T : DiscordMessage => o.Modify(b => b.Remove(() => o.Content)); #endregion #region Nonce - /// - ///

Sets

- ///

Can be used to verify a message was sent (up to 25 characters). Value will appear in the Message Create event.

- ///
- [Pure] - public static T SetNonce(this T toolSettings, string nonce) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Nonce = nonce; - return toolSettings; - } - /// - ///

Resets

- ///

Can be used to verify a message was sent (up to 25 characters). Value will appear in the Message Create event.

- ///
- [Pure] - public static T ResetNonce(this T toolSettings) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Nonce = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Nonce))] + public static T SetNonce(this T o, string v) where T : DiscordMessage => o.Modify(b => b.Set(() => o.Nonce, v)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Nonce))] + public static T ResetNonce(this T o) where T : DiscordMessage => o.Modify(b => b.Remove(() => o.Nonce)); #endregion #region TTS - /// - ///

Sets

- ///

Whether this is a TTS message.

- ///
- [Pure] - public static T SetTTS(this T toolSettings, bool? tts) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.TTS = tts; - return toolSettings; - } - /// - ///

Resets

- ///

Whether this is a TTS message.

- ///
- [Pure] - public static T ResetTTS(this T toolSettings) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.TTS = null; - return toolSettings; - } - /// - ///

Enables

- ///

Whether this is a TTS message.

- ///
- [Pure] - public static T EnableTTS(this T toolSettings) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.TTS = true; - return toolSettings; - } - /// - ///

Disables

- ///

Whether this is a TTS message.

- ///
- [Pure] - public static T DisableTTS(this T toolSettings) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.TTS = false; - return toolSettings; - } - /// - ///

Toggles

- ///

Whether this is a TTS message.

- ///
- [Pure] - public static T ToggleTTS(this T toolSettings) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.TTS = !toolSettings.TTS; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.TTS))] + public static T SetTTS(this T o, bool? v) where T : DiscordMessage => o.Modify(b => b.Set(() => o.TTS, v)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.TTS))] + public static T ResetTTS(this T o) where T : DiscordMessage => o.Modify(b => b.Remove(() => o.TTS)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.TTS))] + public static T EnableTTS(this T o) where T : DiscordMessage => o.Modify(b => b.Set(() => o.TTS, true)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.TTS))] + public static T DisableTTS(this T o) where T : DiscordMessage => o.Modify(b => b.Set(() => o.TTS, false)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.TTS))] + public static T ToggleTTS(this T o) where T : DiscordMessage => o.Modify(b => b.Set(() => o.TTS, !o.TTS)); #endregion #region Embeds - /// - ///

Sets to a new list

- ///

Embedded rich content (up to 6000 characters). See Discord Embed Builder.

- ///
- [Pure] - public static T SetEmbeds(this T toolSettings, params DiscordEmbed[] embeds) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.EmbedsInternal = embeds.ToList(); - return toolSettings; - } - /// - ///

Sets to a new list

- ///

Embedded rich content (up to 6000 characters). See Discord Embed Builder.

- ///
- [Pure] - public static T SetEmbeds(this T toolSettings, IEnumerable embeds) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.EmbedsInternal = embeds.ToList(); - return toolSettings; - } - /// - ///

Adds values to

- ///

Embedded rich content (up to 6000 characters). See Discord Embed Builder.

- ///
- [Pure] - public static T AddEmbeds(this T toolSettings, params DiscordEmbed[] embeds) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.EmbedsInternal.AddRange(embeds); - return toolSettings; - } - /// - ///

Adds a value to

- ///

Embedded rich content (up to 6000 characters). See Discord Embed Builder.

- ///
- [Pure] - public static T AddEmbed(this T toolSettings, Configure configurator) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.EmbedsInternal.Add(configurator.InvokeSafe(new DiscordEmbed())); - return toolSettings; - } - /// - ///

Adds values to

- ///

Embedded rich content (up to 6000 characters). See Discord Embed Builder.

- ///
- [Pure] - public static T AddEmbeds(this T toolSettings, IEnumerable embeds) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.EmbedsInternal.AddRange(embeds); - return toolSettings; - } - /// - ///

Clears

- ///

Embedded rich content (up to 6000 characters). See Discord Embed Builder.

- ///
- [Pure] - public static T ClearEmbeds(this T toolSettings) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.EmbedsInternal.Clear(); - return toolSettings; - } - /// - ///

Removes values from

- ///

Embedded rich content (up to 6000 characters). See Discord Embed Builder.

- ///
- [Pure] - public static T RemoveEmbeds(this T toolSettings, params DiscordEmbed[] embeds) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(embeds); - toolSettings.EmbedsInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } - /// - ///

Removes values from

- ///

Embedded rich content (up to 6000 characters). See Discord Embed Builder.

- ///
- [Pure] - public static T RemoveEmbeds(this T toolSettings, IEnumerable embeds) where T : DiscordMessage - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(embeds); - toolSettings.EmbedsInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Embeds))] + public static T SetEmbeds(this T o, params DiscordEmbed[] v) where T : DiscordMessage => o.Modify(b => b.Set(() => o.Embeds, v)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Embeds))] + public static T SetEmbeds(this T o, IEnumerable v) where T : DiscordMessage => o.Modify(b => b.Set(() => o.Embeds, v)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Embeds))] + public static T AddEmbeds(this T o, params DiscordEmbed[] v) where T : DiscordMessage => o.Modify(b => b.AddCollection(() => o.Embeds, v)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Embeds))] + public static T AddEmbeds(this T o, IEnumerable v) where T : DiscordMessage => o.Modify(b => b.AddCollection(() => o.Embeds, v)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Embeds))] + public static T AddEmbeds(this T o, Configure v) where T : DiscordMessage => o.Modify(b => b.AddCollection(() => o.Embeds, v.InvokeSafe(new()))); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Embeds))] + public static T RemoveEmbeds(this T o, params DiscordEmbed[] v) where T : DiscordMessage => o.Modify(b => b.RemoveCollection(() => o.Embeds, v)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Embeds))] + public static T RemoveEmbeds(this T o, IEnumerable v) where T : DiscordMessage => o.Modify(b => b.RemoveCollection(() => o.Embeds, v)); + /// + [Pure] [Builder(Type = typeof(DiscordMessage), Property = nameof(DiscordMessage.Embeds))] + public static T ClearEmbeds(this T o) where T : DiscordMessage => o.Modify(b => b.ClearCollection(() => o.Embeds)); #endregion } #endregion #region DiscordEmbedExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DiscordEmbedExtensions { #region Title - /// - ///

Sets

- ///

Title of embed.

- ///
- [Pure] - public static T SetTitle(this T toolSettings, string title) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Title = title; - return toolSettings; - } - /// - ///

Resets

- ///

Title of embed.

- ///
- [Pure] - public static T ResetTitle(this T toolSettings) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Title = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Title))] + public static T SetTitle(this T o, string v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Title, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Title))] + public static T ResetTitle(this T o) where T : DiscordEmbed => o.Modify(b => b.Remove(() => o.Title)); #endregion #region Type - /// - ///

Sets

- ///

Type of embed (always rich for webhook embeds).

- ///
- [Pure] - public static T SetType(this T toolSettings, DiscordEmbedType type) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Type = type; - return toolSettings; - } - /// - ///

Resets

- ///

Type of embed (always rich for webhook embeds).

- ///
- [Pure] - public static T ResetType(this T toolSettings) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Type = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Type))] + public static T SetType(this T o, DiscordEmbedType v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Type, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Type))] + public static T ResetType(this T o) where T : DiscordEmbed => o.Modify(b => b.Remove(() => o.Type)); #endregion #region Description - /// - ///

Sets

- ///

Description of embed.

- ///
- [Pure] - public static T SetDescription(this T toolSettings, string description) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Description = description; - return toolSettings; - } - /// - ///

Resets

- ///

Description of embed.

- ///
- [Pure] - public static T ResetDescription(this T toolSettings) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Description = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Description))] + public static T SetDescription(this T o, string v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Description, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Description))] + public static T ResetDescription(this T o) where T : DiscordEmbed => o.Modify(b => b.Remove(() => o.Description)); #endregion #region Url - /// - ///

Sets

- ///

Url of embed.

- ///
- [Pure] - public static T SetUrl(this T toolSettings, string url) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Url = url; - return toolSettings; - } - /// - ///

Resets

- ///

Url of embed.

- ///
- [Pure] - public static T ResetUrl(this T toolSettings) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Url = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Url))] + public static T SetUrl(this T o, string v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Url, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Url))] + public static T ResetUrl(this T o) where T : DiscordEmbed => o.Modify(b => b.Remove(() => o.Url)); #endregion #region Timestamp - /// - ///

Sets

- ///

ISO8601 timestamp of embed.

- ///
- [Pure] - public static T SetTimestamp(this T toolSettings, string timestamp) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Timestamp = timestamp; - return toolSettings; - } - /// - ///

Resets

- ///

ISO8601 timestamp of embed.

- ///
- [Pure] - public static T ResetTimestamp(this T toolSettings) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Timestamp = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Timestamp))] + public static T SetTimestamp(this T o, string v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Timestamp, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Timestamp))] + public static T ResetTimestamp(this T o) where T : DiscordEmbed => o.Modify(b => b.Remove(() => o.Timestamp)); #endregion #region Color - /// - ///

Sets

- ///

Color code of the embed.

- ///
- [Pure] - public static T SetColor(this T toolSettings, int? color) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Color = color; - return toolSettings; - } - /// - ///

Resets

- ///

Color code of the embed.

- ///
- [Pure] - public static T ResetColor(this T toolSettings) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Color = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Color))] + public static T SetColor(this T o, int? v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Color, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Color))] + public static T ResetColor(this T o) where T : DiscordEmbed => o.Modify(b => b.Remove(() => o.Color)); #endregion #region Footer - /// - ///

Sets

- ///

Footer information.

- ///
- [Pure] - public static T SetFooter(this T toolSettings, DiscordEmbedFooter footer) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Footer = footer; - return toolSettings; - } - /// - ///

Resets

- ///

Footer information.

- ///
- [Pure] - public static T ResetFooter(this T toolSettings) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Footer = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Footer))] + public static T SetFooter(this T o, DiscordEmbedFooter v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Footer, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Footer))] + public static T SetFooter(this T o, Configure v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Footer, v.InvokeSafe(new()))); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Footer))] + public static T ResetFooter(this T o) where T : DiscordEmbed => o.Modify(b => b.Remove(() => o.Footer)); #endregion #region Image - /// - ///

Sets

- ///

Image information.

- ///
- [Pure] - public static T SetImage(this T toolSettings, DiscordEmbedImage image) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Image = image; - return toolSettings; - } - /// - ///

Resets

- ///

Image information.

- ///
- [Pure] - public static T ResetImage(this T toolSettings) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Image = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Image))] + public static T SetImage(this T o, DiscordEmbedImage v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Image, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Image))] + public static T SetImage(this T o, Configure v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Image, v.InvokeSafe(new()))); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Image))] + public static T ResetImage(this T o) where T : DiscordEmbed => o.Modify(b => b.Remove(() => o.Image)); #endregion #region Thumbnail - /// - ///

Sets

- ///

Thumbnail information.

- ///
- [Pure] - public static T SetThumbnail(this T toolSettings, DiscordEmbedThumbnail thumbnail) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Thumbnail = thumbnail; - return toolSettings; - } - /// - ///

Resets

- ///

Thumbnail information.

- ///
- [Pure] - public static T ResetThumbnail(this T toolSettings) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Thumbnail = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Thumbnail))] + public static T SetThumbnail(this T o, DiscordEmbedThumbnail v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Thumbnail, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Thumbnail))] + public static T SetThumbnail(this T o, Configure v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Thumbnail, v.InvokeSafe(new()))); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Thumbnail))] + public static T ResetThumbnail(this T o) where T : DiscordEmbed => o.Modify(b => b.Remove(() => o.Thumbnail)); #endregion #region Author - /// - ///

Sets

- ///

Author information.

- ///
- [Pure] - public static T SetAuthor(this T toolSettings, DiscordEmbedAuthor author) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Author = author; - return toolSettings; - } - /// - ///

Resets

- ///

Author information.

- ///
- [Pure] - public static T ResetAuthor(this T toolSettings) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Author = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Author))] + public static T SetAuthor(this T o, DiscordEmbedAuthor v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Author, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Author))] + public static T SetAuthor(this T o, Configure v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Author, v.InvokeSafe(new()))); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Author))] + public static T ResetAuthor(this T o) where T : DiscordEmbed => o.Modify(b => b.Remove(() => o.Author)); #endregion #region Fields - /// - ///

Sets to a new list

- ///

Fields information.

- ///
- [Pure] - public static T SetFields(this T toolSettings, params DiscordEmbedField[] fields) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal = fields.ToList(); - return toolSettings; - } - /// - ///

Sets to a new list

- ///

Fields information.

- ///
- [Pure] - public static T SetFields(this T toolSettings, IEnumerable fields) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal = fields.ToList(); - return toolSettings; - } - /// - ///

Adds values to

- ///

Fields information.

- ///
- [Pure] - public static T AddFields(this T toolSettings, params DiscordEmbedField[] fields) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal.AddRange(fields); - return toolSettings; - } - /// - ///

Adds a value to

- ///

Fields information.

- ///
- [Pure] - public static T AddField(this T toolSettings, Configure configurator) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal.Add(configurator.InvokeSafe(new DiscordEmbedField())); - return toolSettings; - } - /// - ///

Adds values to

- ///

Fields information.

- ///
- [Pure] - public static T AddFields(this T toolSettings, IEnumerable fields) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal.AddRange(fields); - return toolSettings; - } - /// - ///

Clears

- ///

Fields information.

- ///
- [Pure] - public static T ClearFields(this T toolSettings) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal.Clear(); - return toolSettings; - } - /// - ///

Removes values from

- ///

Fields information.

- ///
- [Pure] - public static T RemoveFields(this T toolSettings, params DiscordEmbedField[] fields) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(fields); - toolSettings.FieldsInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } - /// - ///

Removes values from

- ///

Fields information.

- ///
- [Pure] - public static T RemoveFields(this T toolSettings, IEnumerable fields) where T : DiscordEmbed - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(fields); - toolSettings.FieldsInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Fields))] + public static T SetFields(this T o, params DiscordEmbedField[] v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Fields))] + public static T SetFields(this T o, IEnumerable v) where T : DiscordEmbed => o.Modify(b => b.Set(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Fields))] + public static T AddFields(this T o, params DiscordEmbedField[] v) where T : DiscordEmbed => o.Modify(b => b.AddCollection(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Fields))] + public static T AddFields(this T o, IEnumerable v) where T : DiscordEmbed => o.Modify(b => b.AddCollection(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Fields))] + public static T AddFields(this T o, Configure v) where T : DiscordEmbed => o.Modify(b => b.AddCollection(() => o.Fields, v.InvokeSafe(new()))); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Fields))] + public static T RemoveFields(this T o, params DiscordEmbedField[] v) where T : DiscordEmbed => o.Modify(b => b.RemoveCollection(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Fields))] + public static T RemoveFields(this T o, IEnumerable v) where T : DiscordEmbed => o.Modify(b => b.RemoveCollection(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbed), Property = nameof(DiscordEmbed.Fields))] + public static T ClearFields(this T o) where T : DiscordEmbed => o.Modify(b => b.ClearCollection(() => o.Fields)); #endregion } #endregion #region DiscordEmbedFooterExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DiscordEmbedFooterExtensions { #region Text - /// - ///

Sets

- ///

Footer text.

- ///
- [Pure] - public static T SetText(this T toolSettings, string text) where T : DiscordEmbedFooter - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = text; - return toolSettings; - } - /// - ///

Resets

- ///

Footer text.

- ///
- [Pure] - public static T ResetText(this T toolSettings) where T : DiscordEmbedFooter - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedFooter), Property = nameof(DiscordEmbedFooter.Text))] + public static T SetText(this T o, string v) where T : DiscordEmbedFooter => o.Modify(b => b.Set(() => o.Text, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedFooter), Property = nameof(DiscordEmbedFooter.Text))] + public static T ResetText(this T o) where T : DiscordEmbedFooter => o.Modify(b => b.Remove(() => o.Text)); #endregion #region IconUrl - /// - ///

Sets

- ///

Url of footer icon (only supports http(s) and attachments).

- ///
- [Pure] - public static T SetIconUrl(this T toolSettings, string iconUrl) where T : DiscordEmbedFooter - { - toolSettings = toolSettings.NewInstance(); - toolSettings.IconUrl = iconUrl; - return toolSettings; - } - /// - ///

Resets

- ///

Url of footer icon (only supports http(s) and attachments).

- ///
- [Pure] - public static T ResetIconUrl(this T toolSettings) where T : DiscordEmbedFooter - { - toolSettings = toolSettings.NewInstance(); - toolSettings.IconUrl = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedFooter), Property = nameof(DiscordEmbedFooter.IconUrl))] + public static T SetIconUrl(this T o, string v) where T : DiscordEmbedFooter => o.Modify(b => b.Set(() => o.IconUrl, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedFooter), Property = nameof(DiscordEmbedFooter.IconUrl))] + public static T ResetIconUrl(this T o) where T : DiscordEmbedFooter => o.Modify(b => b.Remove(() => o.IconUrl)); #endregion } #endregion #region DiscordEmbedImageExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DiscordEmbedImageExtensions { #region Url - /// - ///

Sets

- ///

Source url of image (only supports http(s) and attachments).

- ///
- [Pure] - public static T SetUrl(this T toolSettings, string url) where T : DiscordEmbedImage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Url = url; - return toolSettings; - } - /// - ///

Resets

- ///

Source url of image (only supports http(s) and attachments).

- ///
- [Pure] - public static T ResetUrl(this T toolSettings) where T : DiscordEmbedImage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Url = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedImage), Property = nameof(DiscordEmbedImage.Url))] + public static T SetUrl(this T o, string v) where T : DiscordEmbedImage => o.Modify(b => b.Set(() => o.Url, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedImage), Property = nameof(DiscordEmbedImage.Url))] + public static T ResetUrl(this T o) where T : DiscordEmbedImage => o.Modify(b => b.Remove(() => o.Url)); #endregion #region Height - /// - ///

Sets

- ///

Height of image.

- ///
- [Pure] - public static T SetHeight(this T toolSettings, int? height) where T : DiscordEmbedImage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Height = height; - return toolSettings; - } - /// - ///

Resets

- ///

Height of image.

- ///
- [Pure] - public static T ResetHeight(this T toolSettings) where T : DiscordEmbedImage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Height = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedImage), Property = nameof(DiscordEmbedImage.Height))] + public static T SetHeight(this T o, int? v) where T : DiscordEmbedImage => o.Modify(b => b.Set(() => o.Height, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedImage), Property = nameof(DiscordEmbedImage.Height))] + public static T ResetHeight(this T o) where T : DiscordEmbedImage => o.Modify(b => b.Remove(() => o.Height)); #endregion #region Width - /// - ///

Sets

- ///

Width of image.

- ///
- [Pure] - public static T SetWidth(this T toolSettings, int? width) where T : DiscordEmbedImage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Width = width; - return toolSettings; - } - /// - ///

Resets

- ///

Width of image.

- ///
- [Pure] - public static T ResetWidth(this T toolSettings) where T : DiscordEmbedImage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Width = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedImage), Property = nameof(DiscordEmbedImage.Width))] + public static T SetWidth(this T o, int? v) where T : DiscordEmbedImage => o.Modify(b => b.Set(() => o.Width, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedImage), Property = nameof(DiscordEmbedImage.Width))] + public static T ResetWidth(this T o) where T : DiscordEmbedImage => o.Modify(b => b.Remove(() => o.Width)); #endregion } #endregion #region DiscordEmbedThumbnailExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DiscordEmbedThumbnailExtensions { #region Url - /// - ///

Sets

- ///

Source url of thumbnail (only supports http(s) and attachments).

- ///
- [Pure] - public static T SetUrl(this T toolSettings, string url) where T : DiscordEmbedThumbnail - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Url = url; - return toolSettings; - } - /// - ///

Resets

- ///

Source url of thumbnail (only supports http(s) and attachments).

- ///
- [Pure] - public static T ResetUrl(this T toolSettings) where T : DiscordEmbedThumbnail - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Url = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedThumbnail), Property = nameof(DiscordEmbedThumbnail.Url))] + public static T SetUrl(this T o, string v) where T : DiscordEmbedThumbnail => o.Modify(b => b.Set(() => o.Url, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedThumbnail), Property = nameof(DiscordEmbedThumbnail.Url))] + public static T ResetUrl(this T o) where T : DiscordEmbedThumbnail => o.Modify(b => b.Remove(() => o.Url)); #endregion #region Height - /// - ///

Sets

- ///

Height of thumbnail.

- ///
- [Pure] - public static T SetHeight(this T toolSettings, int? height) where T : DiscordEmbedThumbnail - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Height = height; - return toolSettings; - } - /// - ///

Resets

- ///

Height of thumbnail.

- ///
- [Pure] - public static T ResetHeight(this T toolSettings) where T : DiscordEmbedThumbnail - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Height = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedThumbnail), Property = nameof(DiscordEmbedThumbnail.Height))] + public static T SetHeight(this T o, int? v) where T : DiscordEmbedThumbnail => o.Modify(b => b.Set(() => o.Height, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedThumbnail), Property = nameof(DiscordEmbedThumbnail.Height))] + public static T ResetHeight(this T o) where T : DiscordEmbedThumbnail => o.Modify(b => b.Remove(() => o.Height)); #endregion #region Width - /// - ///

Sets

- ///

Width of thumbnail.

- ///
- [Pure] - public static T SetWidth(this T toolSettings, int? width) where T : DiscordEmbedThumbnail - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Width = width; - return toolSettings; - } - /// - ///

Resets

- ///

Width of thumbnail.

- ///
- [Pure] - public static T ResetWidth(this T toolSettings) where T : DiscordEmbedThumbnail - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Width = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedThumbnail), Property = nameof(DiscordEmbedThumbnail.Width))] + public static T SetWidth(this T o, int? v) where T : DiscordEmbedThumbnail => o.Modify(b => b.Set(() => o.Width, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedThumbnail), Property = nameof(DiscordEmbedThumbnail.Width))] + public static T ResetWidth(this T o) where T : DiscordEmbedThumbnail => o.Modify(b => b.Remove(() => o.Width)); #endregion } #endregion #region DiscordEmbedAuthorExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DiscordEmbedAuthorExtensions { #region Name - /// - ///

Sets

- ///

Name of author.

- ///
- [Pure] - public static T SetName(this T toolSettings, string name) where T : DiscordEmbedAuthor - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Name = name; - return toolSettings; - } - /// - ///

Resets

- ///

Name of author.

- ///
- [Pure] - public static T ResetName(this T toolSettings) where T : DiscordEmbedAuthor - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Name = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedAuthor), Property = nameof(DiscordEmbedAuthor.Name))] + public static T SetName(this T o, string v) where T : DiscordEmbedAuthor => o.Modify(b => b.Set(() => o.Name, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedAuthor), Property = nameof(DiscordEmbedAuthor.Name))] + public static T ResetName(this T o) where T : DiscordEmbedAuthor => o.Modify(b => b.Remove(() => o.Name)); #endregion #region Url - /// - ///

Sets

- ///

Url of author.

- ///
- [Pure] - public static T SetUrl(this T toolSettings, string url) where T : DiscordEmbedAuthor - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Url = url; - return toolSettings; - } - /// - ///

Resets

- ///

Url of author.

- ///
- [Pure] - public static T ResetUrl(this T toolSettings) where T : DiscordEmbedAuthor - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Url = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedAuthor), Property = nameof(DiscordEmbedAuthor.Url))] + public static T SetUrl(this T o, string v) where T : DiscordEmbedAuthor => o.Modify(b => b.Set(() => o.Url, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedAuthor), Property = nameof(DiscordEmbedAuthor.Url))] + public static T ResetUrl(this T o) where T : DiscordEmbedAuthor => o.Modify(b => b.Remove(() => o.Url)); #endregion #region IconUrl - /// - ///

Sets

- ///

Url of author icon (only supports http(s) and attachments).

- ///
- [Pure] - public static T SetIconUrl(this T toolSettings, string iconUrl) where T : DiscordEmbedAuthor - { - toolSettings = toolSettings.NewInstance(); - toolSettings.IconUrl = iconUrl; - return toolSettings; - } - /// - ///

Resets

- ///

Url of author icon (only supports http(s) and attachments).

- ///
- [Pure] - public static T ResetIconUrl(this T toolSettings) where T : DiscordEmbedAuthor - { - toolSettings = toolSettings.NewInstance(); - toolSettings.IconUrl = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedAuthor), Property = nameof(DiscordEmbedAuthor.IconUrl))] + public static T SetIconUrl(this T o, string v) where T : DiscordEmbedAuthor => o.Modify(b => b.Set(() => o.IconUrl, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedAuthor), Property = nameof(DiscordEmbedAuthor.IconUrl))] + public static T ResetIconUrl(this T o) where T : DiscordEmbedAuthor => o.Modify(b => b.Remove(() => o.IconUrl)); #endregion } #endregion #region DiscordEmbedFieldExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DiscordEmbedFieldExtensions { #region Name - /// - ///

Sets

- ///

Name of the field.

- ///
- [Pure] - public static T SetName(this T toolSettings, string name) where T : DiscordEmbedField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Name = name; - return toolSettings; - } - /// - ///

Resets

- ///

Name of the field.

- ///
- [Pure] - public static T ResetName(this T toolSettings) where T : DiscordEmbedField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Name = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedField), Property = nameof(DiscordEmbedField.Name))] + public static T SetName(this T o, string v) where T : DiscordEmbedField => o.Modify(b => b.Set(() => o.Name, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedField), Property = nameof(DiscordEmbedField.Name))] + public static T ResetName(this T o) where T : DiscordEmbedField => o.Modify(b => b.Remove(() => o.Name)); #endregion #region Value - /// - ///

Sets

- ///

Value of the field.

- ///
- [Pure] - public static T SetValue(this T toolSettings, string value) where T : DiscordEmbedField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Value = value; - return toolSettings; - } - /// - ///

Resets

- ///

Value of the field.

- ///
- [Pure] - public static T ResetValue(this T toolSettings) where T : DiscordEmbedField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Value = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedField), Property = nameof(DiscordEmbedField.Value))] + public static T SetValue(this T o, string v) where T : DiscordEmbedField => o.Modify(b => b.Set(() => o.Value, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedField), Property = nameof(DiscordEmbedField.Value))] + public static T ResetValue(this T o) where T : DiscordEmbedField => o.Modify(b => b.Remove(() => o.Value)); #endregion #region Inline - /// - ///

Sets

- ///

Whether or not this field should siplay inline.

- ///
- [Pure] - public static T SetInline(this T toolSettings, bool? inline) where T : DiscordEmbedField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Inline = inline; - return toolSettings; - } - /// - ///

Resets

- ///

Whether or not this field should siplay inline.

- ///
- [Pure] - public static T ResetInline(this T toolSettings) where T : DiscordEmbedField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Inline = null; - return toolSettings; - } - /// - ///

Enables

- ///

Whether or not this field should siplay inline.

- ///
- [Pure] - public static T EnableInline(this T toolSettings) where T : DiscordEmbedField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Inline = true; - return toolSettings; - } - /// - ///

Disables

- ///

Whether or not this field should siplay inline.

- ///
- [Pure] - public static T DisableInline(this T toolSettings) where T : DiscordEmbedField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Inline = false; - return toolSettings; - } - /// - ///

Toggles

- ///

Whether or not this field should siplay inline.

- ///
- [Pure] - public static T ToggleInline(this T toolSettings) where T : DiscordEmbedField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Inline = !toolSettings.Inline; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(DiscordEmbedField), Property = nameof(DiscordEmbedField.Inline))] + public static T SetInline(this T o, bool? v) where T : DiscordEmbedField => o.Modify(b => b.Set(() => o.Inline, v)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedField), Property = nameof(DiscordEmbedField.Inline))] + public static T ResetInline(this T o) where T : DiscordEmbedField => o.Modify(b => b.Remove(() => o.Inline)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedField), Property = nameof(DiscordEmbedField.Inline))] + public static T EnableInline(this T o) where T : DiscordEmbedField => o.Modify(b => b.Set(() => o.Inline, true)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedField), Property = nameof(DiscordEmbedField.Inline))] + public static T DisableInline(this T o) where T : DiscordEmbedField => o.Modify(b => b.Set(() => o.Inline, false)); + /// + [Pure] [Builder(Type = typeof(DiscordEmbedField), Property = nameof(DiscordEmbedField.Inline))] + public static T ToggleInline(this T o) where T : DiscordEmbedField => o.Modify(b => b.Set(() => o.Inline, !o.Inline)); #endregion } #endregion #region DiscordEmbedType -/// -/// Used within . -/// +/// Used within . [PublicAPI] [Serializable] [ExcludeFromCodeCoverage] diff --git a/source/Nuke.Common/Tools/Docker/Docker.Generated.cs b/source/Nuke.Common/Tools/Docker/Docker.Generated.cs index 2f7569cb7..f170221ff 100644 --- a/source/Nuke.Common/Tools/Docker/Docker.Generated.cs +++ b/source/Nuke.Common/Tools/Docker/Docker.Generated.cs @@ -6255,19 +6255,19 @@ public partial class DockerOptionsBase : ToolOptions public partial class DockerRunTargetSettings : DockerRunSettings { /// Whether to execute a docker pull before running the container. - [Argument()] public bool? PullImage => Get(() => PullImage); + public bool? PullImage => Get(() => PullImage); /// The .NET Runtime Identifier (RID) to use to publish the build project. For example, linux-x64, linux-arm64, win-x64. - [Argument()] public string DotNetRuntime => Get(() => DotNetRuntime); + public string DotNetRuntime => Get(() => DotNetRuntime); /// Enables caching of the build executable. - [Argument()] public bool? BuildCaching => Get(() => BuildCaching); + public bool? BuildCaching => Get(() => BuildCaching); /// Whether to keep the .env.<target> file located under build/bin/<rid> after the target is complete. - [Argument()] public bool? KeepEnvFile => Get(() => KeepEnvFile); + public bool? KeepEnvFile => Get(() => KeepEnvFile); /// The username for docker login. - [Argument()] public string Username => Get(() => Username); + public string Username => Get(() => Username); /// The password for docker login. - [Argument()] public string Password => Get(() => Password); + public string Password => Get(() => Password); /// The server for docker login. - [Argument()] public string Server => Get(() => Server); + public string Server => Get(() => Server); } #endregion #region DockerConfigRmSettingsExtensions diff --git a/source/Nuke.Common/Tools/GitVersion/GitVersion.Generated.cs b/source/Nuke.Common/Tools/GitVersion/GitVersion.Generated.cs index 5897adddf..beca38a83 100644 --- a/source/Nuke.Common/Tools/GitVersion/GitVersion.Generated.cs +++ b/source/Nuke.Common/Tools/GitVersion/GitVersion.Generated.cs @@ -96,7 +96,7 @@ public partial class GitVersionSettings : ToolOptions /// Set Verbosity level (debug, info, warn, error, none). Default is info. [Argument(Format = "/verbosity {value}")] public GitVersionVerbosity Verbosity => Get(() => Verbosity); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region GitVersionSettingsExtensions diff --git a/source/Nuke.Common/Tools/MSBuild/MSBuild.Generated.cs b/source/Nuke.Common/Tools/MSBuild/MSBuild.Generated.cs index 0d131bf67..bda3f7097 100644 --- a/source/Nuke.Common/Tools/MSBuild/MSBuild.Generated.cs +++ b/source/Nuke.Common/Tools/MSBuild/MSBuild.Generated.cs @@ -65,11 +65,11 @@ public partial class MSBuildSettings : ToolOptions ///

Specifies the version of the Toolset to use to build the project, as the following example shows: /toolsversion:3.5

By using this switch, you can build a project and specify a version that differs from the version that's specified in the Project Element (MSBuild). For more information, see Overriding ToolsVersion Settings.

For MSBuild 4.5, you can specify the following values for version: 2.0, 3.5, and 4.0. If you specify 4.0, the VisualStudioVersion build property specifies which sub-toolset to use. For more information, see the Sub-toolsets section of Toolset (ToolsVersion).

A Toolset consists of tasks, targets, and tools that are used to build an application. The tools include compilers such as csc.exe and vbc.exe. For more information about Toolsets, see Toolset (ToolsVersion), Standard and Custom Toolset Configurations, and Multitargeting. Note: The toolset version isn't the same as the target framework, which is the version of the .NET Framework on which a project is built to run. For more information, see Target Framework and Target Platform.

[Argument(Format = "/toolsversion:{value}")] public MSBuildToolsVersion ToolsVersion => Get(() => ToolsVersion); /// Specifies the version of MSBuild for building. - [Argument()] public MSBuildVersion? MSBuildVersion => Get(() => MSBuildVersion); + public MSBuildVersion? MSBuildVersion => Get(() => MSBuildVersion); ///

Specifies the amount of information to display in the build log. Each logger displays events based on the verbosity level that you set for that logger.

You can specify the following verbosity levels: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].

The following setting is an example: /verbosity:quiet

[Argument(Format = "/verbosity:{value}")] public MSBuildVerbosity Verbosity => Get(() => Verbosity); /// Specifies the platform to use when building. - [Argument()] public MSBuildPlatform? MSBuildPlatform => Get(() => MSBuildPlatform); + public MSBuildPlatform? MSBuildPlatform => Get(() => MSBuildPlatform); /// Specifies the loggers to use to log events from MSBuild. [Argument(Format = "/logger:{value}")] public IReadOnlyList Loggers => Get>(() => Loggers); /// Disable the default console logger, and don't log events to the console. diff --git a/source/Nuke.Common/Tools/Mastodon/Mastodon.Generated.cs b/source/Nuke.Common/Tools/Mastodon/Mastodon.Generated.cs index 721b851aa..62ddbc98c 100644 --- a/source/Nuke.Common/Tools/Mastodon/Mastodon.Generated.cs +++ b/source/Nuke.Common/Tools/Mastodon/Mastodon.Generated.cs @@ -6,6 +6,7 @@ using Nuke.Common.Tooling; using Nuke.Common.Tools; using Nuke.Common.Utilities.Collections; +using Nuke.Tooling; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -18,137 +19,54 @@ namespace Nuke.Common.Tools.Mastodon; #region MastodonStatus -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class MastodonStatus : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class MastodonStatus : Options { - /// - /// Text of the status. - /// - public virtual string Text { get; internal set; } - /// - /// Media files to attach to the status. - /// - public virtual IReadOnlyList MediaFiles => MediaFilesInternal.AsReadOnly(); - internal List MediaFilesInternal { get; set; } = new List(); + /// Text of the status. + public string Text => Get(() => Text); + /// Media files to attach to the status. + public IReadOnlyList MediaFiles => Get>(() => MediaFiles); } #endregion #region MastodonStatusExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class MastodonStatusExtensions { #region Text - /// - ///

Sets

- ///

Text of the status.

- ///
- [Pure] - public static T SetText(this T toolSettings, string text) where T : MastodonStatus - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = text; - return toolSettings; - } - /// - ///

Resets

- ///

Text of the status.

- ///
- [Pure] - public static T ResetText(this T toolSettings) where T : MastodonStatus - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(MastodonStatus), Property = nameof(MastodonStatus.Text))] + public static T SetText(this T o, string v) where T : MastodonStatus => o.Modify(b => b.Set(() => o.Text, v)); + /// + [Pure] [Builder(Type = typeof(MastodonStatus), Property = nameof(MastodonStatus.Text))] + public static T ResetText(this T o) where T : MastodonStatus => o.Modify(b => b.Remove(() => o.Text)); #endregion #region MediaFiles - /// - ///

Sets to a new list

- ///

Media files to attach to the status.

- ///
- [Pure] - public static T SetMediaFiles(this T toolSettings, params string[] mediaFiles) where T : MastodonStatus - { - toolSettings = toolSettings.NewInstance(); - toolSettings.MediaFilesInternal = mediaFiles.ToList(); - return toolSettings; - } - /// - ///

Sets to a new list

- ///

Media files to attach to the status.

- ///
- [Pure] - public static T SetMediaFiles(this T toolSettings, IEnumerable mediaFiles) where T : MastodonStatus - { - toolSettings = toolSettings.NewInstance(); - toolSettings.MediaFilesInternal = mediaFiles.ToList(); - return toolSettings; - } - /// - ///

Adds values to

- ///

Media files to attach to the status.

- ///
- [Pure] - public static T AddMediaFiles(this T toolSettings, params string[] mediaFiles) where T : MastodonStatus - { - toolSettings = toolSettings.NewInstance(); - toolSettings.MediaFilesInternal.AddRange(mediaFiles); - return toolSettings; - } - /// - ///

Adds values to

- ///

Media files to attach to the status.

- ///
- [Pure] - public static T AddMediaFiles(this T toolSettings, IEnumerable mediaFiles) where T : MastodonStatus - { - toolSettings = toolSettings.NewInstance(); - toolSettings.MediaFilesInternal.AddRange(mediaFiles); - return toolSettings; - } - /// - ///

Clears

- ///

Media files to attach to the status.

- ///
- [Pure] - public static T ClearMediaFiles(this T toolSettings) where T : MastodonStatus - { - toolSettings = toolSettings.NewInstance(); - toolSettings.MediaFilesInternal.Clear(); - return toolSettings; - } - /// - ///

Removes values from

- ///

Media files to attach to the status.

- ///
- [Pure] - public static T RemoveMediaFiles(this T toolSettings, params string[] mediaFiles) where T : MastodonStatus - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(mediaFiles); - toolSettings.MediaFilesInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } - /// - ///

Removes values from

- ///

Media files to attach to the status.

- ///
- [Pure] - public static T RemoveMediaFiles(this T toolSettings, IEnumerable mediaFiles) where T : MastodonStatus - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(mediaFiles); - toolSettings.MediaFilesInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(MastodonStatus), Property = nameof(MastodonStatus.MediaFiles))] + public static T SetMediaFiles(this T o, params string[] v) where T : MastodonStatus => o.Modify(b => b.Set(() => o.MediaFiles, v)); + /// + [Pure] [Builder(Type = typeof(MastodonStatus), Property = nameof(MastodonStatus.MediaFiles))] + public static T SetMediaFiles(this T o, IEnumerable v) where T : MastodonStatus => o.Modify(b => b.Set(() => o.MediaFiles, v)); + /// + [Pure] [Builder(Type = typeof(MastodonStatus), Property = nameof(MastodonStatus.MediaFiles))] + public static T AddMediaFiles(this T o, params string[] v) where T : MastodonStatus => o.Modify(b => b.AddCollection(() => o.MediaFiles, v)); + /// + [Pure] [Builder(Type = typeof(MastodonStatus), Property = nameof(MastodonStatus.MediaFiles))] + public static T AddMediaFiles(this T o, IEnumerable v) where T : MastodonStatus => o.Modify(b => b.AddCollection(() => o.MediaFiles, v)); + /// + [Pure] [Builder(Type = typeof(MastodonStatus), Property = nameof(MastodonStatus.MediaFiles))] + public static T RemoveMediaFiles(this T o, params string[] v) where T : MastodonStatus => o.Modify(b => b.RemoveCollection(() => o.MediaFiles, v)); + /// + [Pure] [Builder(Type = typeof(MastodonStatus), Property = nameof(MastodonStatus.MediaFiles))] + public static T RemoveMediaFiles(this T o, IEnumerable v) where T : MastodonStatus => o.Modify(b => b.RemoveCollection(() => o.MediaFiles, v)); + /// + [Pure] [Builder(Type = typeof(MastodonStatus), Property = nameof(MastodonStatus.MediaFiles))] + public static T ClearMediaFiles(this T o) where T : MastodonStatus => o.Modify(b => b.ClearCollection(() => o.MediaFiles)); #endregion } #endregion diff --git a/source/Nuke.Common/Tools/MinVer/MinVer.Generated.cs b/source/Nuke.Common/Tools/MinVer/MinVer.Generated.cs index 34f62b3bd..1bc03827d 100644 --- a/source/Nuke.Common/Tools/MinVer/MinVer.Generated.cs +++ b/source/Nuke.Common/Tools/MinVer/MinVer.Generated.cs @@ -60,36 +60,7 @@ public partial class MinVerSettings : ToolOptions /// [Argument(Format = "--verbosity {value}")] public MinVerVerbosity Verbosity => Get(() => Verbosity); /// - [Argument()] public string Framework => Get(() => Framework); -} -#endregion -#region MinVer -/// Used within . -[PublicAPI] -[ExcludeFromCodeCoverage] -[TypeConverter(typeof(TypeConverter))] -public partial class MinVer : Options -{ - /// - [Argument()] public string MinVerVersion => Get(() => MinVerVersion); - /// - [Argument()] public string MinVerMajor => Get(() => MinVerMajor); - /// - [Argument()] public string MinVerMinor => Get(() => MinVerMinor); - /// - [Argument()] public string MinVerPatch => Get(() => MinVerPatch); - /// - [Argument()] public string MinVerPreRelease => Get(() => MinVerPreRelease); - /// - [Argument()] public string MinVerBuildMetadata => Get(() => MinVerBuildMetadata); - /// - [Argument()] public string AssemblyVersion => Get(() => AssemblyVersion); - /// - [Argument()] public string FileVersion => Get(() => FileVersion); - /// - [Argument()] public string PackageVersion => Get(() => PackageVersion); - /// - [Argument()] public string Version => Get(() => Version); + public string Framework => Get(() => Framework); } #endregion #region MinVerSettingsExtensions diff --git a/source/Nuke.Common/Tools/MinVer/MinVer.json b/source/Nuke.Common/Tools/MinVer/MinVer.json index 91ea950d6..7db408ba7 100644 --- a/source/Nuke.Common/Tools/MinVer/MinVer.json +++ b/source/Nuke.Common/Tools/MinVer/MinVer.json @@ -52,53 +52,6 @@ } } ], - "dataClasses": [ - { - "name": "MinVer", - "properties": [ - { - "name": "MinVerVersion", - "type": "string" - }, - { - "name": "MinVerMajor", - "type": "string" - }, - { - "name": "MinVerMinor", - "type": "string" - }, - { - "name": "MinVerPatch", - "type": "string" - }, - { - "name": "MinVerPreRelease", - "type": "string" - }, - { - "name": "MinVerBuildMetadata", - "type": "string" - }, - { - "name": "AssemblyVersion", - "type": "string" - }, - { - "name": "FileVersion", - "type": "string" - }, - { - "name": "PackageVersion", - "type": "string" - }, - { - "name": "Version", - "type": "string" - } - ] - } - ], "enumerations": [ { "name": "MinVerVerbosity", diff --git a/source/Nuke.Common/Tools/MinVer/MinVerTasks.cs b/source/Nuke.Common/Tools/MinVer/MinVerTasks.cs index 0736087b3..dfe8a320d 100644 --- a/source/Nuke.Common/Tools/MinVer/MinVerTasks.cs +++ b/source/Nuke.Common/Tools/MinVer/MinVerTasks.cs @@ -24,12 +24,12 @@ protected override string GetToolPath(ToolOptions options = null) protected override object GetResult(ToolOptions options, IReadOnlyCollection output) { var versionString = output.Select(x => x.Text).Single(x => !x.StartsWith("MinVer:")); - return new MinVer2(versionString); + return new MinVer(versionString); } } [PublicAPI] -public record MinVer2(string MinVerVersion) +public record MinVer(string MinVerVersion) { public string MinVerMajor => MinVerVersion.Split('.')[0]; public string MinVerMinor => MinVerVersion.Split('.')[1]; diff --git a/source/Nuke.Common/Tools/OctoVersion/OctoVersion.Generated.cs b/source/Nuke.Common/Tools/OctoVersion/OctoVersion.Generated.cs index c3172d073..a0d7789e2 100644 --- a/source/Nuke.Common/Tools/OctoVersion/OctoVersion.Generated.cs +++ b/source/Nuke.Common/Tools/OctoVersion/OctoVersion.Generated.cs @@ -82,7 +82,7 @@ public partial class OctoVersionGetVersionSettings : ToolOptions /// Emit json to the specified file. Ensure that either the `JsonFile` output formatter is added, or that `DetectEnvironment` is `true`. [Argument(Format = "--OutputJsonFile {value}")] public string OutputJsonFile => Get(() => OutputJsonFile); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region OctoVersionExecuteSettings @@ -118,7 +118,7 @@ public partial class OctoVersionExecuteSettings : ToolOptions /// Emit json to the specified file. Ensure that either the `JsonFile` output formatter is added, or that `DetectEnvironment` is `true`. [Argument(Format = "--OutputJsonFile {value}")] public string OutputJsonFile => Get(() => OutputJsonFile); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region OctoVersionGetVersionSettingsExtensions diff --git a/source/Nuke.Common/Tools/Octopus/Octopus.Generated.cs b/source/Nuke.Common/Tools/Octopus/Octopus.Generated.cs index 513889f96..e25870cc5 100644 --- a/source/Nuke.Common/Tools/Octopus/Octopus.Generated.cs +++ b/source/Nuke.Common/Tools/Octopus/Octopus.Generated.cs @@ -110,7 +110,7 @@ public partial class OctopusPackSettings : ToolOptions /// Allow an existing package file of the same ID/version to be overwritten. [Argument(Format = "--overwrite")] public bool? Overwrite => Get(() => Overwrite); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region OctopusPushSettings @@ -154,7 +154,7 @@ public partial class OctopusPushSettings : ToolOptions /// The log level. Valid options are verbose, debug, information, warning, error and fatal. Defaults to 'debug'. [Argument(Format = "--logLevel={value}")] public string LogLevel => Get(() => LogLevel); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region OctopusCreateReleaseSettings @@ -256,7 +256,7 @@ public partial class OctopusCreateReleaseSettings : ToolOptions /// The log level. Valid options are verbose, debug, information, warning, error and fatal. Defaults to 'debug'. [Argument(Format = "--logLevel={value}")] public string LogLevel => Get(() => LogLevel); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region OctopusDeployReleaseSettings @@ -338,7 +338,7 @@ public partial class OctopusDeployReleaseSettings : ToolOptions /// The log level. Valid options are verbose, debug, information, warning, error and fatal. Defaults to 'debug'. [Argument(Format = "--logLevel={value}")] public string LogLevel => Get(() => LogLevel); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region OctopusBuildInformationSettings @@ -386,7 +386,7 @@ public partial class OctopusBuildInformationSettings : ToolOptions /// The log level. Valid options are verbose, debug, information, warning, error and fatal. Defaults to 'debug'. [Argument(Format = "--logLevel={value}")] public string LogLevel => Get(() => LogLevel); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region OctopusPackSettingsExtensions diff --git a/source/Nuke.Common/Tools/ReSharper/ReSharper.Generated.cs b/source/Nuke.Common/Tools/ReSharper/ReSharper.Generated.cs index f29a7f0e4..b483b7580 100644 --- a/source/Nuke.Common/Tools/ReSharper/ReSharper.Generated.cs +++ b/source/Nuke.Common/Tools/ReSharper/ReSharper.Generated.cs @@ -226,7 +226,7 @@ public partial class ReSharperDupFinderSettings : ToolOptions public partial class ReSharperSettingsBase : ToolOptions { /// Allows adding ReSharper plugins that will get included during execution. To add a plugin, specify its ID and version. Available plugins are listed in the Plugin Repository. The ID can be grabbed from the download URL. Using ReSharperPluginLatest or null will download the latest version. - [Argument()] public IReadOnlyDictionary Plugins => Get>(() => Plugins); + public IReadOnlyDictionary Plugins => Get>(() => Plugins); } #endregion #region ReSharperInspectCodeSettingsExtensions diff --git a/source/Nuke.Common/Tools/ReportGenerator/ReportGenerator.Generated.cs b/source/Nuke.Common/Tools/ReportGenerator/ReportGenerator.Generated.cs index 347e66efe..d96430d42 100644 --- a/source/Nuke.Common/Tools/ReportGenerator/ReportGenerator.Generated.cs +++ b/source/Nuke.Common/Tools/ReportGenerator/ReportGenerator.Generated.cs @@ -68,7 +68,7 @@ public partial class ReportGeneratorSettings : ToolOptions /// The verbosity level of the log messages. Default is Verbose. [Argument(Format = "-verbosity:{value}")] public ReportGeneratorVerbosity Verbosity => Get(() => Verbosity); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region ReportGeneratorSettingsExtensions diff --git a/source/Nuke.Common/Tools/Slack/Slack.Generated.cs b/source/Nuke.Common/Tools/Slack/Slack.Generated.cs index f38f7886b..f192960e0 100644 --- a/source/Nuke.Common/Tools/Slack/Slack.Generated.cs +++ b/source/Nuke.Common/Tools/Slack/Slack.Generated.cs @@ -6,6 +6,7 @@ using Nuke.Common.Tooling; using Nuke.Common.Tools; using Nuke.Common.Utilities.Collections; +using Nuke.Tooling; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -18,1550 +19,572 @@ namespace Nuke.Common.Tools.Slack; #region SlackMessage -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class SlackMessage : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class SlackMessage : Options { - [JsonProperty("ts")] - public virtual string Timestamp { get; internal set; } - [JsonProperty("thread_ts")] - public virtual string ThreadTimestamp { get; internal set; } - [JsonProperty("channel")] - public virtual string Channel { get; internal set; } - [JsonProperty("username")] - public virtual string Username { get; internal set; } - /// - /// Slack messages may be formatted using a simple markup language similar to Markdown. Supported formatting includes: ```pre```, `code`, _italic_, *bold*, and even ~strike~.; full details are available on our help site. - /// - [JsonProperty("text")] - public virtual string Text { get; internal set; } - /// - /// By default bot message text will be formatted. To disable formatting on a non-user message, set the mrkdwn property to false. - /// - [JsonProperty("mrkdwn")] - public virtual bool? Markdown { get; internal set; } - [JsonProperty("icon_emoji")] - public virtual string Emoji { get; internal set; } - [JsonProperty("icon_url")] - public virtual string Icon { get; internal set; } - /// - /// Attachments let you add more context to a message, making them more useful and effective. - /// - [JsonIgnore] - public virtual IReadOnlyList Attachments => AttachmentsInternal.AsReadOnly(); - [JsonProperty("attachments")] - internal List AttachmentsInternal { get; set; } = new List(); + /// + [JsonProperty("ts")] public string Timestamp => Get(() => Timestamp); + /// + [JsonProperty("thread_ts")] public string ThreadTimestamp => Get(() => ThreadTimestamp); + /// + [JsonProperty("channel")] public string Channel => Get(() => Channel); + /// + [JsonProperty("username")] public string Username => Get(() => Username); + /// Slack messages may be formatted using a simple markup language similar to Markdown. Supported formatting includes: ```pre```, `code`, _italic_, *bold*, and even ~strike~.; full details are available on our help site. + [JsonProperty("text")] public string Text => Get(() => Text); + /// By default bot message text will be formatted. To disable formatting on a non-user message, set the mrkdwn property to false. + [JsonProperty("mrkdwn")] public bool? Markdown => Get(() => Markdown); + /// + [JsonProperty("icon_emoji")] public string Emoji => Get(() => Emoji); + /// + [JsonProperty("icon_url")] public string Icon => Get(() => Icon); + /// Attachments let you add more context to a message, making them more useful and effective. + [JsonProperty("attachments")] public IReadOnlyList Attachments => Get>(() => Attachments); } #endregion #region SlackMessageAttachment -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class SlackMessageAttachment : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class SlackMessageAttachment : Options { - /// - /// The title is displayed as larger, bold text near the top of a message attachment. - /// - [JsonProperty("title")] - public virtual string Title { get; internal set; } - /// - /// Hyperlink used for the title. - /// - [JsonProperty("title_link")] - public virtual string TitleLink { get; internal set; } - /// - /// This is optional text that appears above the message attachment block. - /// - [JsonProperty("pretext")] - public virtual string PreText { get; internal set; } - /// - /// This is the main text in a message attachment, and can contain standard message markup. The content will automatically collapse if it contains 700+ characters or 5+ linebreaks, and will display a "Show more..." link to expand the content. Links posted in the text field will not unfurl. - /// - [JsonProperty("text")] - public virtual string Text { get; internal set; } - /// - /// By default bot message attachments will not be formatted. To enable formatting on attachment fields, set the mrkdwn_in array on each attachment to the list of fields to process. - /// - [JsonIgnore] - public virtual IReadOnlyList MarkdownIn => MarkdownInInternal.AsReadOnly(); - [JsonProperty("mrkdwn_in")] - internal List MarkdownInInternal { get; set; } = new List(); - /// - /// A plain-text summary of the attachment. This text will be used in clients that don't show formatted text (eg. IRC, mobile notifications) and should not contain any markup. - /// - [JsonProperty("fallback")] - public virtual string Fallback { get; internal set; } - /// - /// Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.An optional value that can either be one of good, warning, danger, or any hex color code (eg. #439FE0). This value is used to color the border along the left side of the message attachment. - /// - [JsonProperty("color")] - public virtual string Color { get; internal set; } - /// - /// Small text used to display the author's name. - /// - [JsonProperty("author_name")] - public virtual string AuthorName { get; internal set; } - /// - /// A valid URL that will hyperlink the author_name text mentioned above. Will only work if author_name is present. - /// - [JsonProperty("author_link")] - public virtual string AuthorLink { get; internal set; } - /// - /// A valid URL that displays a small 16x16px image to the left of the author_name text. Will only work if author_name is present. - /// - [JsonProperty("author_icon")] - public virtual string AuthorIcon { get; internal set; } - /// - /// A valid URL to an image file that will be displayed inside a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.Large images will be resized to a maximum width of 360px or a maximum height of 500px, while still maintaining the original aspect ratio. - /// - [JsonProperty("image_url")] - public virtual string ImageUrl { get; internal set; } - /// - /// A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.The thumbnail's longest dimension will be scaled down to 75px while maintaining the aspect ratio of the image. The filesize of the image must also be less than 500 KB.For best results, please use images that are already 75px by 75px. - /// - [JsonProperty("thumb_url")] - public virtual string ThumbUrl { get; internal set; } - /// - /// Add some brief text to help contextualize and identify an attachment. Limited to 300 characters, and may be truncated further when displayed to users in environments with limited screen real estate. - /// - [JsonProperty("footer")] - public virtual string Footer { get; internal set; } - /// - /// To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field. You must also provide a footer for the field to be recognized.We'll render what you provide at 16px by 16px. It's best to use an image that is similarly sized.Example: https://platform.slack-edge.com/img/default_application_icon.png - /// - [JsonProperty("footer_icon")] - public virtual string FooterIcon { get; internal set; } - /// - /// Does your attachment relate to something happening at a specific time?By providing the ts field with an integer value in "epoch time", the attachment will display an additional timestamp value as part of the attachment's footer.Use ts when referencing articles or happenings. Your message will have its own timestamp when published.Example: Providing 123456789 would result in a rendered timestamp of Nov 29th, 1973. - /// - [JsonProperty("ts")] - public virtual string Timestamp { get; internal set; } - /// - /// Fields get displayed in a table-like way. - /// - [JsonIgnore] - public virtual IReadOnlyList Fields => FieldsInternal.AsReadOnly(); - [JsonProperty("fields")] - internal List FieldsInternal { get; set; } = new List(); - /// - /// A collection of Action objects to include in the attachment. Cannot exceed 5 elements. - /// - [JsonIgnore] - public virtual IReadOnlyList Actions => ActionsInternal.AsReadOnly(); - [JsonProperty("actions")] - internal List ActionsInternal { get; set; } = new List(); - /// - /// The callback id sent to the interactive message endpoint. - /// - [JsonProperty("callback_id")] - public virtual string CallbackId { get; internal set; } + /// The title is displayed as larger, bold text near the top of a message attachment. + [JsonProperty("title")] public string Title => Get(() => Title); + /// Hyperlink used for the title. + [JsonProperty("title_link")] public string TitleLink => Get(() => TitleLink); + /// This is optional text that appears above the message attachment block. + [JsonProperty("pretext")] public string PreText => Get(() => PreText); + /// This is the main text in a message attachment, and can contain standard message markup. The content will automatically collapse if it contains 700+ characters or 5+ linebreaks, and will display a "Show more..." link to expand the content. Links posted in the text field will not unfurl. + [JsonProperty("text")] public string Text => Get(() => Text); + /// By default bot message attachments will not be formatted. To enable formatting on attachment fields, set the mrkdwn_in array on each attachment to the list of fields to process. + [JsonProperty("mrkdwn_in")] public IReadOnlyList MarkdownIn => Get>(() => MarkdownIn); + /// A plain-text summary of the attachment. This text will be used in clients that don't show formatted text (eg. IRC, mobile notifications) and should not contain any markup. + [JsonProperty("fallback")] public string Fallback => Get(() => Fallback); + /// Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.An optional value that can either be one of good, warning, danger, or any hex color code (eg. #439FE0). This value is used to color the border along the left side of the message attachment. + [JsonProperty("color")] public string Color => Get(() => Color); + /// Small text used to display the author's name. + [JsonProperty("author_name")] public string AuthorName => Get(() => AuthorName); + /// A valid URL that will hyperlink the author_name text mentioned above. Will only work if author_name is present. + [JsonProperty("author_link")] public string AuthorLink => Get(() => AuthorLink); + /// A valid URL that displays a small 16x16px image to the left of the author_name text. Will only work if author_name is present. + [JsonProperty("author_icon")] public string AuthorIcon => Get(() => AuthorIcon); + /// A valid URL to an image file that will be displayed inside a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.Large images will be resized to a maximum width of 360px or a maximum height of 500px, while still maintaining the original aspect ratio. + [JsonProperty("image_url")] public string ImageUrl => Get(() => ImageUrl); + /// A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.The thumbnail's longest dimension will be scaled down to 75px while maintaining the aspect ratio of the image. The filesize of the image must also be less than 500 KB.For best results, please use images that are already 75px by 75px. + [JsonProperty("thumb_url")] public string ThumbUrl => Get(() => ThumbUrl); + /// Add some brief text to help contextualize and identify an attachment. Limited to 300 characters, and may be truncated further when displayed to users in environments with limited screen real estate. + [JsonProperty("footer")] public string Footer => Get(() => Footer); + /// To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field. You must also provide a footer for the field to be recognized.We'll render what you provide at 16px by 16px. It's best to use an image that is similarly sized.Example: https://platform.slack-edge.com/img/default_application_icon.png + [JsonProperty("footer_icon")] public string FooterIcon => Get(() => FooterIcon); + /// Does your attachment relate to something happening at a specific time?By providing the ts field with an integer value in "epoch time", the attachment will display an additional timestamp value as part of the attachment's footer.Use ts when referencing articles or happenings. Your message will have its own timestamp when published.Example: Providing 123456789 would result in a rendered timestamp of Nov 29th, 1973. + [JsonProperty("ts")] public string Timestamp => Get(() => Timestamp); + /// Fields get displayed in a table-like way. + [JsonProperty("fields")] public IReadOnlyList Fields => Get>(() => Fields); + /// A collection of Action objects to include in the attachment. Cannot exceed 5 elements. + [JsonProperty("actions")] public IReadOnlyList Actions => Get>(() => Actions); + /// The callback id sent to the interactive message endpoint. + [JsonProperty("callback_id")] public string CallbackId => Get(() => CallbackId); } #endregion #region SlackMessageField -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class SlackMessageField : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class SlackMessageField : Options { - /// - /// Shown as a bold heading above the value text. It cannot contain markup and will be escaped for you. - /// - [JsonProperty("title")] - public virtual string Title { get; internal set; } - /// - /// The text value of the field. It may contain standard message markup and must be escaped as normal. May be multi-line. - /// - [JsonProperty("value")] - public virtual string Value { get; internal set; } - /// - /// An optional flag indicating whether the value is short enough to be displayed side-by-side with other values. - /// - [JsonProperty("short")] - public virtual bool? Short { get; internal set; } + /// Shown as a bold heading above the value text. It cannot contain markup and will be escaped for you. + [JsonProperty("title")] public string Title => Get(() => Title); + /// The text value of the field. It may contain standard message markup and must be escaped as normal. May be multi-line. + [JsonProperty("value")] public string Value => Get(() => Value); + /// An optional flag indicating whether the value is short enough to be displayed side-by-side with other values. + [JsonProperty("short")] public bool? Short => Get(() => Short); } #endregion #region SlackMessageAction -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class SlackMessageAction : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class SlackMessageAction : Options { - /// - /// Name this specific action. The name will be returned to your Action URL along with the message's callback_id when this action is invoked. Use it to identify this particular response path. - /// - [JsonProperty("name")] - public virtual string Name { get; internal set; } - /// - /// The user-facing label for the message button or menu representing this action. Cannot contain markup. - /// - [JsonProperty("text")] - public virtual string Text { get; internal set; } - /// - /// Provide a string identifying this specific action. It will be sent to your Action URL along with the name and attachment's callback_id . If providing multiple actions with the same name, value can be strategically used to differentiate intent. Cannot exceed 2000 characters. - /// - [JsonProperty("value")] - public virtual string Value { get; internal set; } - /// - /// Leave blank to indicate that this is an ordinary button. Use primary or danger to mark important buttons. - /// - [JsonProperty("style")] - public virtual SlackMessageActionStyle Style { get; internal set; } - /// - /// Shows a confirmation dialog when the action is selected. - /// - [JsonProperty("confirm")] - public virtual SlackMessageConfirmation Confirmation { get; internal set; } + /// Name this specific action. The name will be returned to your Action URL along with the message's callback_id when this action is invoked. Use it to identify this particular response path. + [JsonProperty("name")] public string Name => Get(() => Name); + /// The user-facing label for the message button or menu representing this action. Cannot contain markup. + [JsonProperty("text")] public string Text => Get(() => Text); + /// Provide a string identifying this specific action. It will be sent to your Action URL along with the name and attachment's callback_id . If providing multiple actions with the same name, value can be strategically used to differentiate intent. Cannot exceed 2000 characters. + [JsonProperty("value")] public string Value => Get(() => Value); + /// Leave blank to indicate that this is an ordinary button. Use primary or danger to mark important buttons. + [JsonProperty("style")] public SlackMessageActionStyle Style => Get(() => Style); + /// Shows a confirmation dialog when the action is selected. + [JsonProperty("confirm")] public SlackMessageConfirmation Confirmation => Get(() => Confirmation); } #endregion #region SlackMessageConfirmation -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] -[Serializable] -public partial class SlackMessageConfirmation : ISettingsEntity +[TypeConverter(typeof(TypeConverter))] +public partial class SlackMessageConfirmation : Options { - /// - /// Title of the confirmation dialog. - /// - [JsonProperty("title")] - public virtual string Title { get; internal set; } - /// - /// Text of the confirmation dialog. - /// - [JsonProperty("text")] - public virtual string Text { get; internal set; } - /// - /// Confirm button text of the confirmation dialog. - /// - [JsonProperty("ok_text")] - public virtual string OkText { get; internal set; } - /// - /// Dismiss button text of the confirmation dialog. - /// - [JsonProperty("dismiss_text")] - public virtual string DismissText { get; internal set; } + /// Title of the confirmation dialog. + [JsonProperty("title")] public string Title => Get(() => Title); + /// Text of the confirmation dialog. + [JsonProperty("text")] public string Text => Get(() => Text); + /// Confirm button text of the confirmation dialog. + [JsonProperty("ok_text")] public string OkText => Get(() => OkText); + /// Dismiss button text of the confirmation dialog. + [JsonProperty("dismiss_text")] public string DismissText => Get(() => DismissText); } #endregion #region SlackMessageExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class SlackMessageExtensions { #region Timestamp - /// - ///

Sets

- ///
- [Pure] - public static T SetTimestamp(this T toolSettings, string timestamp) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Timestamp = timestamp; - return toolSettings; - } - /// - ///

Resets

- ///
- [Pure] - public static T ResetTimestamp(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Timestamp = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Timestamp))] + public static T SetTimestamp(this T o, string v) where T : SlackMessage => o.Modify(b => b.Set(() => o.Timestamp, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Timestamp))] + public static T ResetTimestamp(this T o) where T : SlackMessage => o.Modify(b => b.Remove(() => o.Timestamp)); #endregion #region ThreadTimestamp - /// - ///

Sets

- ///
- [Pure] - public static T SetThreadTimestamp(this T toolSettings, string threadTimestamp) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ThreadTimestamp = threadTimestamp; - return toolSettings; - } - /// - ///

Resets

- ///
- [Pure] - public static T ResetThreadTimestamp(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ThreadTimestamp = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.ThreadTimestamp))] + public static T SetThreadTimestamp(this T o, string v) where T : SlackMessage => o.Modify(b => b.Set(() => o.ThreadTimestamp, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.ThreadTimestamp))] + public static T ResetThreadTimestamp(this T o) where T : SlackMessage => o.Modify(b => b.Remove(() => o.ThreadTimestamp)); #endregion #region Channel - /// - ///

Sets

- ///
- [Pure] - public static T SetChannel(this T toolSettings, string channel) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Channel = channel; - return toolSettings; - } - /// - ///

Resets

- ///
- [Pure] - public static T ResetChannel(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Channel = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Channel))] + public static T SetChannel(this T o, string v) where T : SlackMessage => o.Modify(b => b.Set(() => o.Channel, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Channel))] + public static T ResetChannel(this T o) where T : SlackMessage => o.Modify(b => b.Remove(() => o.Channel)); #endregion #region Username - /// - ///

Sets

- ///
- [Pure] - public static T SetUsername(this T toolSettings, string username) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Username = username; - return toolSettings; - } - /// - ///

Resets

- ///
- [Pure] - public static T ResetUsername(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Username = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Username))] + public static T SetUsername(this T o, string v) where T : SlackMessage => o.Modify(b => b.Set(() => o.Username, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Username))] + public static T ResetUsername(this T o) where T : SlackMessage => o.Modify(b => b.Remove(() => o.Username)); #endregion #region Text - /// - ///

Sets

- ///

Slack messages may be formatted using a simple markup language similar to Markdown. Supported formatting includes: ```pre```, `code`, _italic_, *bold*, and even ~strike~.; full details are available on our help site.

- ///
- [Pure] - public static T SetText(this T toolSettings, string text) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = text; - return toolSettings; - } - /// - ///

Resets

- ///

Slack messages may be formatted using a simple markup language similar to Markdown. Supported formatting includes: ```pre```, `code`, _italic_, *bold*, and even ~strike~.; full details are available on our help site.

- ///
- [Pure] - public static T ResetText(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Text))] + public static T SetText(this T o, string v) where T : SlackMessage => o.Modify(b => b.Set(() => o.Text, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Text))] + public static T ResetText(this T o) where T : SlackMessage => o.Modify(b => b.Remove(() => o.Text)); #endregion #region Markdown - /// - ///

Sets

- ///

By default bot message text will be formatted. To disable formatting on a non-user message, set the mrkdwn property to false.

- ///
- [Pure] - public static T SetMarkdown(this T toolSettings, bool? markdown) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Markdown = markdown; - return toolSettings; - } - /// - ///

Resets

- ///

By default bot message text will be formatted. To disable formatting on a non-user message, set the mrkdwn property to false.

- ///
- [Pure] - public static T ResetMarkdown(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Markdown = null; - return toolSettings; - } - /// - ///

Enables

- ///

By default bot message text will be formatted. To disable formatting on a non-user message, set the mrkdwn property to false.

- ///
- [Pure] - public static T EnableMarkdown(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Markdown = true; - return toolSettings; - } - /// - ///

Disables

- ///

By default bot message text will be formatted. To disable formatting on a non-user message, set the mrkdwn property to false.

- ///
- [Pure] - public static T DisableMarkdown(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Markdown = false; - return toolSettings; - } - /// - ///

Toggles

- ///

By default bot message text will be formatted. To disable formatting on a non-user message, set the mrkdwn property to false.

- ///
- [Pure] - public static T ToggleMarkdown(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Markdown = !toolSettings.Markdown; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Markdown))] + public static T SetMarkdown(this T o, bool? v) where T : SlackMessage => o.Modify(b => b.Set(() => o.Markdown, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Markdown))] + public static T ResetMarkdown(this T o) where T : SlackMessage => o.Modify(b => b.Remove(() => o.Markdown)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Markdown))] + public static T EnableMarkdown(this T o) where T : SlackMessage => o.Modify(b => b.Set(() => o.Markdown, true)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Markdown))] + public static T DisableMarkdown(this T o) where T : SlackMessage => o.Modify(b => b.Set(() => o.Markdown, false)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Markdown))] + public static T ToggleMarkdown(this T o) where T : SlackMessage => o.Modify(b => b.Set(() => o.Markdown, !o.Markdown)); #endregion #region Emoji - /// - ///

Sets

- ///
- [Pure] - public static T SetEmoji(this T toolSettings, string emoji) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Emoji = emoji; - return toolSettings; - } - /// - ///

Resets

- ///
- [Pure] - public static T ResetEmoji(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Emoji = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Emoji))] + public static T SetEmoji(this T o, string v) where T : SlackMessage => o.Modify(b => b.Set(() => o.Emoji, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Emoji))] + public static T ResetEmoji(this T o) where T : SlackMessage => o.Modify(b => b.Remove(() => o.Emoji)); #endregion #region Icon - /// - ///

Sets

- ///
- [Pure] - public static T SetIcon(this T toolSettings, string icon) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Icon = icon; - return toolSettings; - } - /// - ///

Resets

- ///
- [Pure] - public static T ResetIcon(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Icon = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Icon))] + public static T SetIcon(this T o, string v) where T : SlackMessage => o.Modify(b => b.Set(() => o.Icon, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Icon))] + public static T ResetIcon(this T o) where T : SlackMessage => o.Modify(b => b.Remove(() => o.Icon)); #endregion #region Attachments - /// - ///

Sets to a new list

- ///

Attachments let you add more context to a message, making them more useful and effective.

- ///
- [Pure] - public static T SetAttachments(this T toolSettings, params SlackMessageAttachment[] attachments) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AttachmentsInternal = attachments.ToList(); - return toolSettings; - } - /// - ///

Sets to a new list

- ///

Attachments let you add more context to a message, making them more useful and effective.

- ///
- [Pure] - public static T SetAttachments(this T toolSettings, IEnumerable attachments) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AttachmentsInternal = attachments.ToList(); - return toolSettings; - } - /// - ///

Adds values to

- ///

Attachments let you add more context to a message, making them more useful and effective.

- ///
- [Pure] - public static T AddAttachments(this T toolSettings, params SlackMessageAttachment[] attachments) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AttachmentsInternal.AddRange(attachments); - return toolSettings; - } - /// - ///

Adds a value to

- ///

Attachments let you add more context to a message, making them more useful and effective.

- ///
- [Pure] - public static T AddAttachment(this T toolSettings, Configure configurator) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AttachmentsInternal.Add(configurator.InvokeSafe(new SlackMessageAttachment())); - return toolSettings; - } - /// - ///

Adds values to

- ///

Attachments let you add more context to a message, making them more useful and effective.

- ///
- [Pure] - public static T AddAttachments(this T toolSettings, IEnumerable attachments) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AttachmentsInternal.AddRange(attachments); - return toolSettings; - } - /// - ///

Clears

- ///

Attachments let you add more context to a message, making them more useful and effective.

- ///
- [Pure] - public static T ClearAttachments(this T toolSettings) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AttachmentsInternal.Clear(); - return toolSettings; - } - /// - ///

Removes values from

- ///

Attachments let you add more context to a message, making them more useful and effective.

- ///
- [Pure] - public static T RemoveAttachments(this T toolSettings, params SlackMessageAttachment[] attachments) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(attachments); - toolSettings.AttachmentsInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } - /// - ///

Removes values from

- ///

Attachments let you add more context to a message, making them more useful and effective.

- ///
- [Pure] - public static T RemoveAttachments(this T toolSettings, IEnumerable attachments) where T : SlackMessage - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(attachments); - toolSettings.AttachmentsInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Attachments))] + public static T SetAttachments(this T o, params SlackMessageAttachment[] v) where T : SlackMessage => o.Modify(b => b.Set(() => o.Attachments, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Attachments))] + public static T SetAttachments(this T o, IEnumerable v) where T : SlackMessage => o.Modify(b => b.Set(() => o.Attachments, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Attachments))] + public static T AddAttachments(this T o, params SlackMessageAttachment[] v) where T : SlackMessage => o.Modify(b => b.AddCollection(() => o.Attachments, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Attachments))] + public static T AddAttachments(this T o, IEnumerable v) where T : SlackMessage => o.Modify(b => b.AddCollection(() => o.Attachments, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Attachments))] + public static T AddAttachments(this T o, Configure v) where T : SlackMessage => o.Modify(b => b.AddCollection(() => o.Attachments, v.InvokeSafe(new()))); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Attachments))] + public static T RemoveAttachments(this T o, params SlackMessageAttachment[] v) where T : SlackMessage => o.Modify(b => b.RemoveCollection(() => o.Attachments, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Attachments))] + public static T RemoveAttachments(this T o, IEnumerable v) where T : SlackMessage => o.Modify(b => b.RemoveCollection(() => o.Attachments, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessage), Property = nameof(SlackMessage.Attachments))] + public static T ClearAttachments(this T o) where T : SlackMessage => o.Modify(b => b.ClearCollection(() => o.Attachments)); #endregion } #endregion #region SlackMessageAttachmentExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class SlackMessageAttachmentExtensions { #region Title - /// - ///

Sets

- ///

The title is displayed as larger, bold text near the top of a message attachment.

- ///
- [Pure] - public static T SetTitle(this T toolSettings, string title) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Title = title; - return toolSettings; - } - /// - ///

Resets

- ///

The title is displayed as larger, bold text near the top of a message attachment.

- ///
- [Pure] - public static T ResetTitle(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Title = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Title))] + public static T SetTitle(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.Title, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Title))] + public static T ResetTitle(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.Title)); #endregion #region TitleLink - /// - ///

Sets

- ///

Hyperlink used for the title.

- ///
- [Pure] - public static T SetTitleLink(this T toolSettings, string titleLink) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.TitleLink = titleLink; - return toolSettings; - } - /// - ///

Resets

- ///

Hyperlink used for the title.

- ///
- [Pure] - public static T ResetTitleLink(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.TitleLink = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.TitleLink))] + public static T SetTitleLink(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.TitleLink, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.TitleLink))] + public static T ResetTitleLink(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.TitleLink)); #endregion #region PreText - /// - ///

Sets

- ///

This is optional text that appears above the message attachment block.

- ///
- [Pure] - public static T SetPreText(this T toolSettings, string preText) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.PreText = preText; - return toolSettings; - } - /// - ///

Resets

- ///

This is optional text that appears above the message attachment block.

- ///
- [Pure] - public static T ResetPreText(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.PreText = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.PreText))] + public static T SetPreText(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.PreText, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.PreText))] + public static T ResetPreText(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.PreText)); #endregion #region Text - /// - ///

Sets

- ///

This is the main text in a message attachment, and can contain standard message markup. The content will automatically collapse if it contains 700+ characters or 5+ linebreaks, and will display a "Show more..." link to expand the content. Links posted in the text field will not unfurl.

- ///
- [Pure] - public static T SetText(this T toolSettings, string text) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = text; - return toolSettings; - } - /// - ///

Resets

- ///

This is the main text in a message attachment, and can contain standard message markup. The content will automatically collapse if it contains 700+ characters or 5+ linebreaks, and will display a "Show more..." link to expand the content. Links posted in the text field will not unfurl.

- ///
- [Pure] - public static T ResetText(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Text))] + public static T SetText(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.Text, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Text))] + public static T ResetText(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.Text)); #endregion #region MarkdownIn - /// - ///

Sets to a new list

- ///

By default bot message attachments will not be formatted. To enable formatting on attachment fields, set the mrkdwn_in array on each attachment to the list of fields to process.

- ///
- [Pure] - public static T SetMarkdownIn(this T toolSettings, params string[] markdownIn) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.MarkdownInInternal = markdownIn.ToList(); - return toolSettings; - } - /// - ///

Sets to a new list

- ///

By default bot message attachments will not be formatted. To enable formatting on attachment fields, set the mrkdwn_in array on each attachment to the list of fields to process.

- ///
- [Pure] - public static T SetMarkdownIn(this T toolSettings, IEnumerable markdownIn) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.MarkdownInInternal = markdownIn.ToList(); - return toolSettings; - } - /// - ///

Adds values to

- ///

By default bot message attachments will not be formatted. To enable formatting on attachment fields, set the mrkdwn_in array on each attachment to the list of fields to process.

- ///
- [Pure] - public static T AddMarkdownIn(this T toolSettings, params string[] markdownIn) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.MarkdownInInternal.AddRange(markdownIn); - return toolSettings; - } - /// - ///

Adds values to

- ///

By default bot message attachments will not be formatted. To enable formatting on attachment fields, set the mrkdwn_in array on each attachment to the list of fields to process.

- ///
- [Pure] - public static T AddMarkdownIn(this T toolSettings, IEnumerable markdownIn) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.MarkdownInInternal.AddRange(markdownIn); - return toolSettings; - } - /// - ///

Clears

- ///

By default bot message attachments will not be formatted. To enable formatting on attachment fields, set the mrkdwn_in array on each attachment to the list of fields to process.

- ///
- [Pure] - public static T ClearMarkdownIn(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.MarkdownInInternal.Clear(); - return toolSettings; - } - /// - ///

Removes values from

- ///

By default bot message attachments will not be formatted. To enable formatting on attachment fields, set the mrkdwn_in array on each attachment to the list of fields to process.

- ///
- [Pure] - public static T RemoveMarkdownIn(this T toolSettings, params string[] markdownIn) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(markdownIn); - toolSettings.MarkdownInInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } - /// - ///

Removes values from

- ///

By default bot message attachments will not be formatted. To enable formatting on attachment fields, set the mrkdwn_in array on each attachment to the list of fields to process.

- ///
- [Pure] - public static T RemoveMarkdownIn(this T toolSettings, IEnumerable markdownIn) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(markdownIn); - toolSettings.MarkdownInInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.MarkdownIn))] + public static T SetMarkdownIn(this T o, params string[] v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.MarkdownIn, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.MarkdownIn))] + public static T SetMarkdownIn(this T o, IEnumerable v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.MarkdownIn, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.MarkdownIn))] + public static T AddMarkdownIn(this T o, params string[] v) where T : SlackMessageAttachment => o.Modify(b => b.AddCollection(() => o.MarkdownIn, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.MarkdownIn))] + public static T AddMarkdownIn(this T o, IEnumerable v) where T : SlackMessageAttachment => o.Modify(b => b.AddCollection(() => o.MarkdownIn, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.MarkdownIn))] + public static T RemoveMarkdownIn(this T o, params string[] v) where T : SlackMessageAttachment => o.Modify(b => b.RemoveCollection(() => o.MarkdownIn, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.MarkdownIn))] + public static T RemoveMarkdownIn(this T o, IEnumerable v) where T : SlackMessageAttachment => o.Modify(b => b.RemoveCollection(() => o.MarkdownIn, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.MarkdownIn))] + public static T ClearMarkdownIn(this T o) where T : SlackMessageAttachment => o.Modify(b => b.ClearCollection(() => o.MarkdownIn)); #endregion #region Fallback - /// - ///

Sets

- ///

A plain-text summary of the attachment. This text will be used in clients that don't show formatted text (eg. IRC, mobile notifications) and should not contain any markup.

- ///
- [Pure] - public static T SetFallback(this T toolSettings, string fallback) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Fallback = fallback; - return toolSettings; - } - /// - ///

Resets

- ///

A plain-text summary of the attachment. This text will be used in clients that don't show formatted text (eg. IRC, mobile notifications) and should not contain any markup.

- ///
- [Pure] - public static T ResetFallback(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Fallback = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Fallback))] + public static T SetFallback(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.Fallback, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Fallback))] + public static T ResetFallback(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.Fallback)); #endregion #region Color - /// - ///

Sets

- ///

Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.An optional value that can either be one of good, warning, danger, or any hex color code (eg. #439FE0). This value is used to color the border along the left side of the message attachment.

- ///
- [Pure] - public static T SetColor(this T toolSettings, string color) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Color = color; - return toolSettings; - } - /// - ///

Resets

- ///

Like traffic signals, color-coding messages can quickly communicate intent and help separate them from the flow of other messages in the timeline.An optional value that can either be one of good, warning, danger, or any hex color code (eg. #439FE0). This value is used to color the border along the left side of the message attachment.

- ///
- [Pure] - public static T ResetColor(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Color = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Color))] + public static T SetColor(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.Color, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Color))] + public static T ResetColor(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.Color)); #endregion #region AuthorName - /// - ///

Sets

- ///

Small text used to display the author's name.

- ///
- [Pure] - public static T SetAuthorName(this T toolSettings, string authorName) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AuthorName = authorName; - return toolSettings; - } - /// - ///

Resets

- ///

Small text used to display the author's name.

- ///
- [Pure] - public static T ResetAuthorName(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AuthorName = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.AuthorName))] + public static T SetAuthorName(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.AuthorName, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.AuthorName))] + public static T ResetAuthorName(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.AuthorName)); #endregion #region AuthorLink - /// - ///

Sets

- ///

A valid URL that will hyperlink the author_name text mentioned above. Will only work if author_name is present.

- ///
- [Pure] - public static T SetAuthorLink(this T toolSettings, string authorLink) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AuthorLink = authorLink; - return toolSettings; - } - /// - ///

Resets

- ///

A valid URL that will hyperlink the author_name text mentioned above. Will only work if author_name is present.

- ///
- [Pure] - public static T ResetAuthorLink(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AuthorLink = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.AuthorLink))] + public static T SetAuthorLink(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.AuthorLink, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.AuthorLink))] + public static T ResetAuthorLink(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.AuthorLink)); #endregion #region AuthorIcon - /// - ///

Sets

- ///

A valid URL that displays a small 16x16px image to the left of the author_name text. Will only work if author_name is present.

- ///
- [Pure] - public static T SetAuthorIcon(this T toolSettings, string authorIcon) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AuthorIcon = authorIcon; - return toolSettings; - } - /// - ///

Resets

- ///

A valid URL that displays a small 16x16px image to the left of the author_name text. Will only work if author_name is present.

- ///
- [Pure] - public static T ResetAuthorIcon(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.AuthorIcon = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.AuthorIcon))] + public static T SetAuthorIcon(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.AuthorIcon, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.AuthorIcon))] + public static T ResetAuthorIcon(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.AuthorIcon)); #endregion #region ImageUrl - /// - ///

Sets

- ///

A valid URL to an image file that will be displayed inside a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.Large images will be resized to a maximum width of 360px or a maximum height of 500px, while still maintaining the original aspect ratio.

- ///
- [Pure] - public static T SetImageUrl(this T toolSettings, string imageUrl) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ImageUrl = imageUrl; - return toolSettings; - } - /// - ///

Resets

- ///

A valid URL to an image file that will be displayed inside a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.Large images will be resized to a maximum width of 360px or a maximum height of 500px, while still maintaining the original aspect ratio.

- ///
- [Pure] - public static T ResetImageUrl(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ImageUrl = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.ImageUrl))] + public static T SetImageUrl(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.ImageUrl, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.ImageUrl))] + public static T ResetImageUrl(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.ImageUrl)); #endregion #region ThumbUrl - /// - ///

Sets

- ///

A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.The thumbnail's longest dimension will be scaled down to 75px while maintaining the aspect ratio of the image. The filesize of the image must also be less than 500 KB.For best results, please use images that are already 75px by 75px.

- ///
- [Pure] - public static T SetThumbUrl(this T toolSettings, string thumbUrl) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ThumbUrl = thumbUrl; - return toolSettings; - } - /// - ///

Resets

- ///

A valid URL to an image file that will be displayed as a thumbnail on the right side of a message attachment. We currently support the following formats: GIF, JPEG, PNG, and BMP.The thumbnail's longest dimension will be scaled down to 75px while maintaining the aspect ratio of the image. The filesize of the image must also be less than 500 KB.For best results, please use images that are already 75px by 75px.

- ///
- [Pure] - public static T ResetThumbUrl(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ThumbUrl = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.ThumbUrl))] + public static T SetThumbUrl(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.ThumbUrl, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.ThumbUrl))] + public static T ResetThumbUrl(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.ThumbUrl)); #endregion #region Footer - /// - ///

Sets

- ///

Add some brief text to help contextualize and identify an attachment. Limited to 300 characters, and may be truncated further when displayed to users in environments with limited screen real estate.

- ///
- [Pure] - public static T SetFooter(this T toolSettings, string footer) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Footer = footer; - return toolSettings; - } - /// - ///

Resets

- ///

Add some brief text to help contextualize and identify an attachment. Limited to 300 characters, and may be truncated further when displayed to users in environments with limited screen real estate.

- ///
- [Pure] - public static T ResetFooter(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Footer = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Footer))] + public static T SetFooter(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.Footer, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Footer))] + public static T ResetFooter(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.Footer)); #endregion #region FooterIcon - /// - ///

Sets

- ///

To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field. You must also provide a footer for the field to be recognized.We'll render what you provide at 16px by 16px. It's best to use an image that is similarly sized.Example: https://platform.slack-edge.com/img/default_application_icon.png

- ///
- [Pure] - public static T SetFooterIcon(this T toolSettings, string footerIcon) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FooterIcon = footerIcon; - return toolSettings; - } - /// - ///

Resets

- ///

To render a small icon beside your footer text, provide a publicly accessible URL string in the footer_icon field. You must also provide a footer for the field to be recognized.We'll render what you provide at 16px by 16px. It's best to use an image that is similarly sized.Example: https://platform.slack-edge.com/img/default_application_icon.png

- ///
- [Pure] - public static T ResetFooterIcon(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FooterIcon = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.FooterIcon))] + public static T SetFooterIcon(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.FooterIcon, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.FooterIcon))] + public static T ResetFooterIcon(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.FooterIcon)); #endregion #region Timestamp - /// - ///

Sets

- ///

Does your attachment relate to something happening at a specific time?By providing the ts field with an integer value in "epoch time", the attachment will display an additional timestamp value as part of the attachment's footer.Use ts when referencing articles or happenings. Your message will have its own timestamp when published.Example: Providing 123456789 would result in a rendered timestamp of Nov 29th, 1973.

- ///
- [Pure] - public static T SetTimestamp(this T toolSettings, string timestamp) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Timestamp = timestamp; - return toolSettings; - } - /// - ///

Resets

- ///

Does your attachment relate to something happening at a specific time?By providing the ts field with an integer value in "epoch time", the attachment will display an additional timestamp value as part of the attachment's footer.Use ts when referencing articles or happenings. Your message will have its own timestamp when published.Example: Providing 123456789 would result in a rendered timestamp of Nov 29th, 1973.

- ///
- [Pure] - public static T ResetTimestamp(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Timestamp = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Timestamp))] + public static T SetTimestamp(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.Timestamp, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Timestamp))] + public static T ResetTimestamp(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.Timestamp)); #endregion #region Fields - /// - ///

Sets to a new list

- ///

Fields get displayed in a table-like way.

- ///
- [Pure] - public static T SetFields(this T toolSettings, params SlackMessageField[] fields) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal = fields.ToList(); - return toolSettings; - } - /// - ///

Sets to a new list

- ///

Fields get displayed in a table-like way.

- ///
- [Pure] - public static T SetFields(this T toolSettings, IEnumerable fields) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal = fields.ToList(); - return toolSettings; - } - /// - ///

Adds values to

- ///

Fields get displayed in a table-like way.

- ///
- [Pure] - public static T AddFields(this T toolSettings, params SlackMessageField[] fields) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal.AddRange(fields); - return toolSettings; - } - /// - ///

Adds a value to

- ///

Fields get displayed in a table-like way.

- ///
- [Pure] - public static T AddField(this T toolSettings, Configure configurator) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal.Add(configurator.InvokeSafe(new SlackMessageField())); - return toolSettings; - } - /// - ///

Adds values to

- ///

Fields get displayed in a table-like way.

- ///
- [Pure] - public static T AddFields(this T toolSettings, IEnumerable fields) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal.AddRange(fields); - return toolSettings; - } - /// - ///

Clears

- ///

Fields get displayed in a table-like way.

- ///
- [Pure] - public static T ClearFields(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.FieldsInternal.Clear(); - return toolSettings; - } - /// - ///

Removes values from

- ///

Fields get displayed in a table-like way.

- ///
- [Pure] - public static T RemoveFields(this T toolSettings, params SlackMessageField[] fields) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(fields); - toolSettings.FieldsInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } - /// - ///

Removes values from

- ///

Fields get displayed in a table-like way.

- ///
- [Pure] - public static T RemoveFields(this T toolSettings, IEnumerable fields) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(fields); - toolSettings.FieldsInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Fields))] + public static T SetFields(this T o, params SlackMessageField[] v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Fields))] + public static T SetFields(this T o, IEnumerable v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Fields))] + public static T AddFields(this T o, params SlackMessageField[] v) where T : SlackMessageAttachment => o.Modify(b => b.AddCollection(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Fields))] + public static T AddFields(this T o, IEnumerable v) where T : SlackMessageAttachment => o.Modify(b => b.AddCollection(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Fields))] + public static T AddFields(this T o, Configure v) where T : SlackMessageAttachment => o.Modify(b => b.AddCollection(() => o.Fields, v.InvokeSafe(new()))); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Fields))] + public static T RemoveFields(this T o, params SlackMessageField[] v) where T : SlackMessageAttachment => o.Modify(b => b.RemoveCollection(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Fields))] + public static T RemoveFields(this T o, IEnumerable v) where T : SlackMessageAttachment => o.Modify(b => b.RemoveCollection(() => o.Fields, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Fields))] + public static T ClearFields(this T o) where T : SlackMessageAttachment => o.Modify(b => b.ClearCollection(() => o.Fields)); #endregion #region Actions - /// - ///

Sets to a new list

- ///

A collection of Action objects to include in the attachment. Cannot exceed 5 elements.

- ///
- [Pure] - public static T SetActions(this T toolSettings, params SlackMessageAction[] actions) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ActionsInternal = actions.ToList(); - return toolSettings; - } - /// - ///

Sets to a new list

- ///

A collection of Action objects to include in the attachment. Cannot exceed 5 elements.

- ///
- [Pure] - public static T SetActions(this T toolSettings, IEnumerable actions) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ActionsInternal = actions.ToList(); - return toolSettings; - } - /// - ///

Adds values to

- ///

A collection of Action objects to include in the attachment. Cannot exceed 5 elements.

- ///
- [Pure] - public static T AddActions(this T toolSettings, params SlackMessageAction[] actions) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ActionsInternal.AddRange(actions); - return toolSettings; - } - /// - ///

Adds a value to

- ///

A collection of Action objects to include in the attachment. Cannot exceed 5 elements.

- ///
- [Pure] - public static T AddAction(this T toolSettings, Configure configurator) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ActionsInternal.Add(configurator.InvokeSafe(new SlackMessageAction())); - return toolSettings; - } - /// - ///

Adds values to

- ///

A collection of Action objects to include in the attachment. Cannot exceed 5 elements.

- ///
- [Pure] - public static T AddActions(this T toolSettings, IEnumerable actions) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ActionsInternal.AddRange(actions); - return toolSettings; - } - /// - ///

Clears

- ///

A collection of Action objects to include in the attachment. Cannot exceed 5 elements.

- ///
- [Pure] - public static T ClearActions(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.ActionsInternal.Clear(); - return toolSettings; - } - /// - ///

Removes values from

- ///

A collection of Action objects to include in the attachment. Cannot exceed 5 elements.

- ///
- [Pure] - public static T RemoveActions(this T toolSettings, params SlackMessageAction[] actions) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(actions); - toolSettings.ActionsInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } - /// - ///

Removes values from

- ///

A collection of Action objects to include in the attachment. Cannot exceed 5 elements.

- ///
- [Pure] - public static T RemoveActions(this T toolSettings, IEnumerable actions) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - var hashSet = new HashSet(actions); - toolSettings.ActionsInternal.RemoveAll(x => hashSet.Contains(x)); - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Actions))] + public static T SetActions(this T o, params SlackMessageAction[] v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.Actions, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Actions))] + public static T SetActions(this T o, IEnumerable v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.Actions, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Actions))] + public static T AddActions(this T o, params SlackMessageAction[] v) where T : SlackMessageAttachment => o.Modify(b => b.AddCollection(() => o.Actions, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Actions))] + public static T AddActions(this T o, IEnumerable v) where T : SlackMessageAttachment => o.Modify(b => b.AddCollection(() => o.Actions, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Actions))] + public static T AddActions(this T o, Configure v) where T : SlackMessageAttachment => o.Modify(b => b.AddCollection(() => o.Actions, v.InvokeSafe(new()))); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Actions))] + public static T RemoveActions(this T o, params SlackMessageAction[] v) where T : SlackMessageAttachment => o.Modify(b => b.RemoveCollection(() => o.Actions, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Actions))] + public static T RemoveActions(this T o, IEnumerable v) where T : SlackMessageAttachment => o.Modify(b => b.RemoveCollection(() => o.Actions, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.Actions))] + public static T ClearActions(this T o) where T : SlackMessageAttachment => o.Modify(b => b.ClearCollection(() => o.Actions)); #endregion #region CallbackId - /// - ///

Sets

- ///

The callback id sent to the interactive message endpoint.

- ///
- [Pure] - public static T SetCallbackId(this T toolSettings, string callbackId) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.CallbackId = callbackId; - return toolSettings; - } - /// - ///

Resets

- ///

The callback id sent to the interactive message endpoint.

- ///
- [Pure] - public static T ResetCallbackId(this T toolSettings) where T : SlackMessageAttachment - { - toolSettings = toolSettings.NewInstance(); - toolSettings.CallbackId = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.CallbackId))] + public static T SetCallbackId(this T o, string v) where T : SlackMessageAttachment => o.Modify(b => b.Set(() => o.CallbackId, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAttachment), Property = nameof(SlackMessageAttachment.CallbackId))] + public static T ResetCallbackId(this T o) where T : SlackMessageAttachment => o.Modify(b => b.Remove(() => o.CallbackId)); #endregion } #endregion #region SlackMessageFieldExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class SlackMessageFieldExtensions { #region Title - /// - ///

Sets

- ///

Shown as a bold heading above the value text. It cannot contain markup and will be escaped for you.

- ///
- [Pure] - public static T SetTitle(this T toolSettings, string title) where T : SlackMessageField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Title = title; - return toolSettings; - } - /// - ///

Resets

- ///

Shown as a bold heading above the value text. It cannot contain markup and will be escaped for you.

- ///
- [Pure] - public static T ResetTitle(this T toolSettings) where T : SlackMessageField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Title = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageField), Property = nameof(SlackMessageField.Title))] + public static T SetTitle(this T o, string v) where T : SlackMessageField => o.Modify(b => b.Set(() => o.Title, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageField), Property = nameof(SlackMessageField.Title))] + public static T ResetTitle(this T o) where T : SlackMessageField => o.Modify(b => b.Remove(() => o.Title)); #endregion #region Value - /// - ///

Sets

- ///

The text value of the field. It may contain standard message markup and must be escaped as normal. May be multi-line.

- ///
- [Pure] - public static T SetValue(this T toolSettings, string value) where T : SlackMessageField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Value = value; - return toolSettings; - } - /// - ///

Resets

- ///

The text value of the field. It may contain standard message markup and must be escaped as normal. May be multi-line.

- ///
- [Pure] - public static T ResetValue(this T toolSettings) where T : SlackMessageField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Value = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageField), Property = nameof(SlackMessageField.Value))] + public static T SetValue(this T o, string v) where T : SlackMessageField => o.Modify(b => b.Set(() => o.Value, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageField), Property = nameof(SlackMessageField.Value))] + public static T ResetValue(this T o) where T : SlackMessageField => o.Modify(b => b.Remove(() => o.Value)); #endregion #region Short - /// - ///

Sets

- ///

An optional flag indicating whether the value is short enough to be displayed side-by-side with other values.

- ///
- [Pure] - public static T SetShort(this T toolSettings, bool? @short) where T : SlackMessageField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Short = @short; - return toolSettings; - } - /// - ///

Resets

- ///

An optional flag indicating whether the value is short enough to be displayed side-by-side with other values.

- ///
- [Pure] - public static T ResetShort(this T toolSettings) where T : SlackMessageField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Short = null; - return toolSettings; - } - /// - ///

Enables

- ///

An optional flag indicating whether the value is short enough to be displayed side-by-side with other values.

- ///
- [Pure] - public static T EnableShort(this T toolSettings) where T : SlackMessageField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Short = true; - return toolSettings; - } - /// - ///

Disables

- ///

An optional flag indicating whether the value is short enough to be displayed side-by-side with other values.

- ///
- [Pure] - public static T DisableShort(this T toolSettings) where T : SlackMessageField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Short = false; - return toolSettings; - } - /// - ///

Toggles

- ///

An optional flag indicating whether the value is short enough to be displayed side-by-side with other values.

- ///
- [Pure] - public static T ToggleShort(this T toolSettings) where T : SlackMessageField - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Short = !toolSettings.Short; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageField), Property = nameof(SlackMessageField.Short))] + public static T SetShort(this T o, bool? v) where T : SlackMessageField => o.Modify(b => b.Set(() => o.Short, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageField), Property = nameof(SlackMessageField.Short))] + public static T ResetShort(this T o) where T : SlackMessageField => o.Modify(b => b.Remove(() => o.Short)); + /// + [Pure] [Builder(Type = typeof(SlackMessageField), Property = nameof(SlackMessageField.Short))] + public static T EnableShort(this T o) where T : SlackMessageField => o.Modify(b => b.Set(() => o.Short, true)); + /// + [Pure] [Builder(Type = typeof(SlackMessageField), Property = nameof(SlackMessageField.Short))] + public static T DisableShort(this T o) where T : SlackMessageField => o.Modify(b => b.Set(() => o.Short, false)); + /// + [Pure] [Builder(Type = typeof(SlackMessageField), Property = nameof(SlackMessageField.Short))] + public static T ToggleShort(this T o) where T : SlackMessageField => o.Modify(b => b.Set(() => o.Short, !o.Short)); #endregion } #endregion #region SlackMessageActionExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class SlackMessageActionExtensions { #region Name - /// - ///

Sets

- ///

Name this specific action. The name will be returned to your Action URL along with the message's callback_id when this action is invoked. Use it to identify this particular response path.

- ///
- [Pure] - public static T SetName(this T toolSettings, string name) where T : SlackMessageAction - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Name = name; - return toolSettings; - } - /// - ///

Resets

- ///

Name this specific action. The name will be returned to your Action URL along with the message's callback_id when this action is invoked. Use it to identify this particular response path.

- ///
- [Pure] - public static T ResetName(this T toolSettings) where T : SlackMessageAction - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Name = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAction), Property = nameof(SlackMessageAction.Name))] + public static T SetName(this T o, string v) where T : SlackMessageAction => o.Modify(b => b.Set(() => o.Name, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAction), Property = nameof(SlackMessageAction.Name))] + public static T ResetName(this T o) where T : SlackMessageAction => o.Modify(b => b.Remove(() => o.Name)); #endregion #region Text - /// - ///

Sets

- ///

The user-facing label for the message button or menu representing this action. Cannot contain markup.

- ///
- [Pure] - public static T SetText(this T toolSettings, string text) where T : SlackMessageAction - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = text; - return toolSettings; - } - /// - ///

Resets

- ///

The user-facing label for the message button or menu representing this action. Cannot contain markup.

- ///
- [Pure] - public static T ResetText(this T toolSettings) where T : SlackMessageAction - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAction), Property = nameof(SlackMessageAction.Text))] + public static T SetText(this T o, string v) where T : SlackMessageAction => o.Modify(b => b.Set(() => o.Text, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAction), Property = nameof(SlackMessageAction.Text))] + public static T ResetText(this T o) where T : SlackMessageAction => o.Modify(b => b.Remove(() => o.Text)); #endregion #region Value - /// - ///

Sets

- ///

Provide a string identifying this specific action. It will be sent to your Action URL along with the name and attachment's callback_id . If providing multiple actions with the same name, value can be strategically used to differentiate intent. Cannot exceed 2000 characters.

- ///
- [Pure] - public static T SetValue(this T toolSettings, string value) where T : SlackMessageAction - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Value = value; - return toolSettings; - } - /// - ///

Resets

- ///

Provide a string identifying this specific action. It will be sent to your Action URL along with the name and attachment's callback_id . If providing multiple actions with the same name, value can be strategically used to differentiate intent. Cannot exceed 2000 characters.

- ///
- [Pure] - public static T ResetValue(this T toolSettings) where T : SlackMessageAction - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Value = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAction), Property = nameof(SlackMessageAction.Value))] + public static T SetValue(this T o, string v) where T : SlackMessageAction => o.Modify(b => b.Set(() => o.Value, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAction), Property = nameof(SlackMessageAction.Value))] + public static T ResetValue(this T o) where T : SlackMessageAction => o.Modify(b => b.Remove(() => o.Value)); #endregion #region Style - /// - ///

Sets

- ///

Leave blank to indicate that this is an ordinary button. Use primary or danger to mark important buttons.

- ///
- [Pure] - public static T SetStyle(this T toolSettings, SlackMessageActionStyle style) where T : SlackMessageAction - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Style = style; - return toolSettings; - } - /// - ///

Resets

- ///

Leave blank to indicate that this is an ordinary button. Use primary or danger to mark important buttons.

- ///
- [Pure] - public static T ResetStyle(this T toolSettings) where T : SlackMessageAction - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Style = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAction), Property = nameof(SlackMessageAction.Style))] + public static T SetStyle(this T o, SlackMessageActionStyle v) where T : SlackMessageAction => o.Modify(b => b.Set(() => o.Style, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAction), Property = nameof(SlackMessageAction.Style))] + public static T ResetStyle(this T o) where T : SlackMessageAction => o.Modify(b => b.Remove(() => o.Style)); #endregion #region Confirmation - /// - ///

Sets

- ///

Shows a confirmation dialog when the action is selected.

- ///
- [Pure] - public static T SetConfirmation(this T toolSettings, SlackMessageConfirmation confirmation) where T : SlackMessageAction - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Confirmation = confirmation; - return toolSettings; - } - /// - ///

Resets

- ///

Shows a confirmation dialog when the action is selected.

- ///
- [Pure] - public static T ResetConfirmation(this T toolSettings) where T : SlackMessageAction - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Confirmation = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageAction), Property = nameof(SlackMessageAction.Confirmation))] + public static T SetConfirmation(this T o, SlackMessageConfirmation v) where T : SlackMessageAction => o.Modify(b => b.Set(() => o.Confirmation, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageAction), Property = nameof(SlackMessageAction.Confirmation))] + public static T SetConfirmation(this T o, Configure v) where T : SlackMessageAction => o.Modify(b => b.Set(() => o.Confirmation, v.InvokeSafe(new()))); + /// + [Pure] [Builder(Type = typeof(SlackMessageAction), Property = nameof(SlackMessageAction.Confirmation))] + public static T ResetConfirmation(this T o) where T : SlackMessageAction => o.Modify(b => b.Remove(() => o.Confirmation)); #endregion } #endregion #region SlackMessageConfirmationExtensions -/// -/// Used within . -/// +/// Used within . [PublicAPI] [ExcludeFromCodeCoverage] public static partial class SlackMessageConfirmationExtensions { #region Title - /// - ///

Sets

- ///

Title of the confirmation dialog.

- ///
- [Pure] - public static T SetTitle(this T toolSettings, string title) where T : SlackMessageConfirmation - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Title = title; - return toolSettings; - } - /// - ///

Resets

- ///

Title of the confirmation dialog.

- ///
- [Pure] - public static T ResetTitle(this T toolSettings) where T : SlackMessageConfirmation - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Title = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageConfirmation), Property = nameof(SlackMessageConfirmation.Title))] + public static T SetTitle(this T o, string v) where T : SlackMessageConfirmation => o.Modify(b => b.Set(() => o.Title, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageConfirmation), Property = nameof(SlackMessageConfirmation.Title))] + public static T ResetTitle(this T o) where T : SlackMessageConfirmation => o.Modify(b => b.Remove(() => o.Title)); #endregion #region Text - /// - ///

Sets

- ///

Text of the confirmation dialog.

- ///
- [Pure] - public static T SetText(this T toolSettings, string text) where T : SlackMessageConfirmation - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = text; - return toolSettings; - } - /// - ///

Resets

- ///

Text of the confirmation dialog.

- ///
- [Pure] - public static T ResetText(this T toolSettings) where T : SlackMessageConfirmation - { - toolSettings = toolSettings.NewInstance(); - toolSettings.Text = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageConfirmation), Property = nameof(SlackMessageConfirmation.Text))] + public static T SetText(this T o, string v) where T : SlackMessageConfirmation => o.Modify(b => b.Set(() => o.Text, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageConfirmation), Property = nameof(SlackMessageConfirmation.Text))] + public static T ResetText(this T o) where T : SlackMessageConfirmation => o.Modify(b => b.Remove(() => o.Text)); #endregion #region OkText - /// - ///

Sets

- ///

Confirm button text of the confirmation dialog.

- ///
- [Pure] - public static T SetOkText(this T toolSettings, string okText) where T : SlackMessageConfirmation - { - toolSettings = toolSettings.NewInstance(); - toolSettings.OkText = okText; - return toolSettings; - } - /// - ///

Resets

- ///

Confirm button text of the confirmation dialog.

- ///
- [Pure] - public static T ResetOkText(this T toolSettings) where T : SlackMessageConfirmation - { - toolSettings = toolSettings.NewInstance(); - toolSettings.OkText = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageConfirmation), Property = nameof(SlackMessageConfirmation.OkText))] + public static T SetOkText(this T o, string v) where T : SlackMessageConfirmation => o.Modify(b => b.Set(() => o.OkText, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageConfirmation), Property = nameof(SlackMessageConfirmation.OkText))] + public static T ResetOkText(this T o) where T : SlackMessageConfirmation => o.Modify(b => b.Remove(() => o.OkText)); #endregion #region DismissText - /// - ///

Sets

- ///

Dismiss button text of the confirmation dialog.

- ///
- [Pure] - public static T SetDismissText(this T toolSettings, string dismissText) where T : SlackMessageConfirmation - { - toolSettings = toolSettings.NewInstance(); - toolSettings.DismissText = dismissText; - return toolSettings; - } - /// - ///

Resets

- ///

Dismiss button text of the confirmation dialog.

- ///
- [Pure] - public static T ResetDismissText(this T toolSettings) where T : SlackMessageConfirmation - { - toolSettings = toolSettings.NewInstance(); - toolSettings.DismissText = null; - return toolSettings; - } + /// + [Pure] [Builder(Type = typeof(SlackMessageConfirmation), Property = nameof(SlackMessageConfirmation.DismissText))] + public static T SetDismissText(this T o, string v) where T : SlackMessageConfirmation => o.Modify(b => b.Set(() => o.DismissText, v)); + /// + [Pure] [Builder(Type = typeof(SlackMessageConfirmation), Property = nameof(SlackMessageConfirmation.DismissText))] + public static T ResetDismissText(this T o) where T : SlackMessageConfirmation => o.Modify(b => b.Remove(() => o.DismissText)); #endregion } #endregion #region SlackMessageActionStyle -/// -/// Used within . -/// +/// Used within . [PublicAPI] [Serializable] [ExcludeFromCodeCoverage] diff --git a/source/Nuke.Common/Tools/SonarScanner/SonarScanner.Generated.cs b/source/Nuke.Common/Tools/SonarScanner/SonarScanner.Generated.cs index fc1f01630..d47c620b7 100644 --- a/source/Nuke.Common/Tools/SonarScanner/SonarScanner.Generated.cs +++ b/source/Nuke.Common/Tools/SonarScanner/SonarScanner.Generated.cs @@ -145,7 +145,7 @@ public partial class SonarScannerBeginSettings : ToolOptions /// Specifies the password for the client certificate used to access SonarQube. Required if a client certificate is used. [Argument(Format = "/d:sonar.clientcert.password={value}")] public string ClientCertificatePassword => Get(() => ClientCertificatePassword); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region SonarScannerEndSettings @@ -165,7 +165,7 @@ public partial class SonarScannerEndSettings : ToolOptions /// Specifies the password for the client certificate used to access SonarQube. Required if a client certificate is used. [Argument(Format = "/d:sonar.clientcert.password={value}")] public string ClientCertificatePassword => Get(() => ClientCertificatePassword); /// - [Argument()] public string Framework => Get(() => Framework); + public string Framework => Get(() => Framework); } #endregion #region SonarScannerBeginSettingsExtensions diff --git a/source/Nuke.Common/Tools/Teams/Teams.Generated.cs b/source/Nuke.Common/Tools/Teams/Teams.Generated.cs index 42eace214..2c428f56d 100644 --- a/source/Nuke.Common/Tools/Teams/Teams.Generated.cs +++ b/source/Nuke.Common/Tools/Teams/Teams.Generated.cs @@ -26,11 +26,11 @@ namespace Nuke.Common.Tools.Teams; public partial class TeamsMessage : Options { /// - [Argument()] public string Title => Get(() => Title); + [JsonProperty("title")] public string Title => Get(() => Title); /// - [Argument()] public string Text => Get(() => Text); + [JsonProperty("text")] public string Text => Get(() => Text); /// - [Argument()] public string ThemeColor => Get(() => ThemeColor); + [JsonProperty("themeColor")] public string ThemeColor => Get(() => ThemeColor); } #endregion #region TeamsMessageExtensions diff --git a/source/Nuke.Common/Tools/VSWhere/VSWhere.Generated.cs b/source/Nuke.Common/Tools/VSWhere/VSWhere.Generated.cs index 57eeac32d..75b8a4e85 100644 --- a/source/Nuke.Common/Tools/VSWhere/VSWhere.Generated.cs +++ b/source/Nuke.Common/Tools/VSWhere/VSWhere.Generated.cs @@ -82,39 +82,39 @@ public partial class VSWhereSettings : ToolOptions public partial class VSWhereCatalog : Options { /// - [Argument()] public string BuildBranch => Get(() => BuildBranch); + public string BuildBranch => Get(() => BuildBranch); /// - [Argument()] public string BuildVersion => Get(() => BuildVersion); + public string BuildVersion => Get(() => BuildVersion); /// - [Argument()] public string Id => Get(() => Id); + public string Id => Get(() => Id); /// - [Argument()] public string LocalBuild => Get(() => LocalBuild); + public string LocalBuild => Get(() => LocalBuild); /// - [Argument()] public string ManifestName => Get(() => ManifestName); + public string ManifestName => Get(() => ManifestName); /// - [Argument()] public string ManifestType => Get(() => ManifestType); + public string ManifestType => Get(() => ManifestType); /// - [Argument()] public string ProductDisplayVersion => Get(() => ProductDisplayVersion); + public string ProductDisplayVersion => Get(() => ProductDisplayVersion); /// - [Argument()] public string ProductLine => Get(() => ProductLine); + public string ProductLine => Get(() => ProductLine); /// - [Argument()] public string ProductLineVersion => Get(() => ProductLineVersion); + public string ProductLineVersion => Get(() => ProductLineVersion); /// - [Argument()] public string ProductMilestone => Get(() => ProductMilestone); + public string ProductMilestone => Get(() => ProductMilestone); /// - [Argument()] public string ProductMilestoneIsPreRelease => Get(() => ProductMilestoneIsPreRelease); + public string ProductMilestoneIsPreRelease => Get(() => ProductMilestoneIsPreRelease); /// - [Argument()] public string ProductName => Get(() => ProductName); + public string ProductName => Get(() => ProductName); /// - [Argument()] public string ProductPatchVersion => Get(() => ProductPatchVersion); + public string ProductPatchVersion => Get(() => ProductPatchVersion); /// - [Argument()] public string ProductPreReleaseMilestoneSuffix => Get(() => ProductPreReleaseMilestoneSuffix); + public string ProductPreReleaseMilestoneSuffix => Get(() => ProductPreReleaseMilestoneSuffix); /// - [Argument()] public string ProductRelease => Get(() => ProductRelease); + public string ProductRelease => Get(() => ProductRelease); /// - [Argument()] public string ProductSemanticVersion => Get(() => ProductSemanticVersion); + public string ProductSemanticVersion => Get(() => ProductSemanticVersion); /// - [Argument()] public string RequiredEngineVersion => Get(() => RequiredEngineVersion); + public string RequiredEngineVersion => Get(() => RequiredEngineVersion); } #endregion #region VSWhereResult @@ -125,41 +125,41 @@ public partial class VSWhereCatalog : Options public partial class VSWhereResult : Options { /// - [Argument()] public string InstanceId => Get(() => InstanceId); + public string InstanceId => Get(() => InstanceId); /// - [Argument()] public DateTime InstallDate => Get(() => InstallDate); + public DateTime InstallDate => Get(() => InstallDate); /// - [Argument()] public string InstallationName => Get(() => InstallationName); + public string InstallationName => Get(() => InstallationName); /// - [Argument()] public string InstallationPath => Get(() => InstallationPath); + public string InstallationPath => Get(() => InstallationPath); /// - [Argument()] public string InstallationVersion => Get(() => InstallationVersion); + public string InstallationVersion => Get(() => InstallationVersion); /// - [Argument()] public string ProductId => Get(() => ProductId); + public string ProductId => Get(() => ProductId); /// - [Argument()] public string ProductPath => Get(() => ProductPath); + public string ProductPath => Get(() => ProductPath); /// - [Argument()] public bool? IsPreRelease => Get(() => IsPreRelease); + public bool? IsPreRelease => Get(() => IsPreRelease); /// - [Argument()] public string DisplayName => Get(() => DisplayName); + public string DisplayName => Get(() => DisplayName); /// - [Argument()] public string Description => Get(() => Description); + public string Description => Get(() => Description); /// - [Argument()] public string ChannelId => Get(() => ChannelId); + public string ChannelId => Get(() => ChannelId); /// - [Argument()] public string ChannelUri => Get(() => ChannelUri); + public string ChannelUri => Get(() => ChannelUri); /// - [Argument()] public string EnginePath => Get(() => EnginePath); + public string EnginePath => Get(() => EnginePath); /// - [Argument()] public string ReleaseNotes => Get(() => ReleaseNotes); + public string ReleaseNotes => Get(() => ReleaseNotes); /// - [Argument()] public string ThirdPartyNotices => Get(() => ThirdPartyNotices); + public string ThirdPartyNotices => Get(() => ThirdPartyNotices); /// - [Argument()] public DateTime UpdateDate => Get(() => UpdateDate); + public DateTime UpdateDate => Get(() => UpdateDate); /// - [Argument()] public VSWhereCatalog Catalog => Get(() => Catalog); + public VSWhereCatalog Catalog => Get(() => Catalog); /// - [Argument()] public IReadOnlyDictionary Properties => Get>(() => Properties); + public IReadOnlyDictionary Properties => Get>(() => Properties); } #endregion #region VSWhereSettingsExtensions diff --git a/source/Nuke.Tooling.Generator/Generators/DataClassExtensionGenerator.cs b/source/Nuke.Tooling.Generator/Generators/DataClassExtensionGenerator.cs index d5be030c1..710a3cfc6 100644 --- a/source/Nuke.Tooling.Generator/Generators/DataClassExtensionGenerator.cs +++ b/source/Nuke.Tooling.Generator/Generators/DataClassExtensionGenerator.cs @@ -46,6 +46,12 @@ private static void WriteMethods(DataClassWriter writer, Property property) name: $"Set{property.Name}", additionalParameters: [$"{attributes}{property.GetNullableType()} v"], modification: $"Set(() => {access}, v)") + .When(property.IsCustomType(), _ => _ + .WriteMethod( + property, + name: $"Set{property.Name}", + additionalParameters: [$"Configure<{property.GetNullableType()}> v"], + modification: $"Set(() => {access}, v.InvokeSafe(new()))")) .WriteMethod( property, name: $"Reset{property.Name}", diff --git a/source/Nuke.Tooling.Generator/Generators/DataClassGenerator.cs b/source/Nuke.Tooling.Generator/Generators/DataClassGenerator.cs index ab5b65ca6..6c3904622 100644 --- a/source/Nuke.Tooling.Generator/Generators/DataClassGenerator.cs +++ b/source/Nuke.Tooling.Generator/Generators/DataClassGenerator.cs @@ -108,6 +108,9 @@ private static void WritePropertyDeclaration(DataClassWriter writer, Property pr string GetArgumentAttribute() { + if (property.Format.IsNullOrWhiteSpace()) + return null; + var arguments = new (string Name, string Value)[] { (nameof(ArgumentAttribute.Format), property.Format?.DoubleQuote()), diff --git a/source/Nuke.Tooling.Generator/Generators/ModelExtensions.cs b/source/Nuke.Tooling.Generator/Generators/ModelExtensions.cs index f80324e15..fd6bd164d 100644 --- a/source/Nuke.Tooling.Generator/Generators/ModelExtensions.cs +++ b/source/Nuke.Tooling.Generator/Generators/ModelExtensions.cs @@ -102,6 +102,11 @@ public static bool IsString(this Property property) return property.Type.EqualsOrdinalIgnoreCase("string"); } + public static bool IsCustomType(this Property property) + { + return property.DataClass.Tool.DataClasses.Any(x => x.Name == property.Type); + } + public static bool HasCustomListType(this Property property) { return property.DataClass.Tool.DataClasses.Any(x => x.Name == property.GetListValueType()); diff --git a/source/Nuke.Tooling.Generator/Writers/WriterExtensions.cs b/source/Nuke.Tooling.Generator/Writers/WriterExtensions.cs index 9fdcbcafd..0171026d0 100644 --- a/source/Nuke.Tooling.Generator/Writers/WriterExtensions.cs +++ b/source/Nuke.Tooling.Generator/Writers/WriterExtensions.cs @@ -49,7 +49,7 @@ public static T WriteLine(this T writerWrapper, [CanBeNull] string text) where T : IWriterWrapper { if (text != null) - writerWrapper.Writer.WriteLine(text); + writerWrapper.Writer.WriteLine(text.Trim()); return writerWrapper; }