Table of Contents

Class HeaderModuleBuilder

Namespace
Kook
Assembly
Kook.Net.Core.dll

Represents a header module builder for creating a HeaderModule.

public class HeaderModuleBuilder : IModuleBuilder, IEquatable<HeaderModuleBuilder>, IEquatable<IModuleBuilder>
Inheritance
HeaderModuleBuilder
Implements
Inherited Members

Constructors

HeaderModuleBuilder()

Initializes a new instance of the HeaderModuleBuilder class.

public HeaderModuleBuilder()

HeaderModuleBuilder(PlainTextElementBuilder)

Initializes a new instance of the HeaderModuleBuilder class.

public HeaderModuleBuilder(PlainTextElementBuilder text)

Parameters

text PlainTextElementBuilder

The text to be set for the header.

HeaderModuleBuilder(string)

Initializes a new instance of the HeaderModuleBuilder class.

public HeaderModuleBuilder(string text)

Parameters

text string

The text to be set for the header.

Fields

MaxTitleContentLength

Gets the maximum content length for header allowed by Kook.

public const int MaxTitleContentLength = 100

Field Value

int

Properties

Text

Gets or sets the text of the header.

public PlainTextElementBuilder? Text { get; set; }

Property Value

PlainTextElementBuilder

A PlainTextElementBuilder representing the text of the header.

Type

Specifies the module type of the IModule this builder creates.

public ModuleType Type { get; }

Property Value

ModuleType

A ModuleType representing the module type of the IModule this builder creates.

Methods

Build()

Builds this builder into a HeaderModule.

public HeaderModule Build()

Returns

HeaderModule

A HeaderModule representing the built header module object.

Exceptions

ArgumentNullException

The Text is null.

ArgumentException

The Text is null.

ArgumentException

The Text content is longer than MaxTitleContentLength.

Equals(HeaderModuleBuilder?)

Determines whether the specified HeaderModuleBuilder is equal to the current HeaderModuleBuilder.

public bool Equals(HeaderModuleBuilder? headerModuleBuilder)

Parameters

headerModuleBuilder HeaderModuleBuilder

The HeaderModuleBuilder to compare with the current HeaderModuleBuilder.

Returns

bool

true if the specified HeaderModuleBuilder is equal to the current HeaderModuleBuilder; otherwise, false.

Equals(object?)

Determines whether the specified HeaderModuleBuilder is equal to the current HeaderModuleBuilder.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current HeaderModule.

Returns

bool

true if the specified HeaderModuleBuilder is equal to the current HeaderModuleBuilder; otherwise, false.

Remarks

If the object passes is an HeaderModuleBuilder, Equals(HeaderModuleBuilder?) will be called to compare the 2 instances.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

WithText(PlainTextElementBuilder)

Sets the text of the header.

public HeaderModuleBuilder WithText(PlainTextElementBuilder text)

Parameters

text PlainTextElementBuilder

The text to be set for the header.

Returns

HeaderModuleBuilder

The current builder.

WithText(Action<PlainTextElementBuilder>?)

Sets the text of the header.

public HeaderModuleBuilder WithText(Action<PlainTextElementBuilder>? action = null)

Parameters

action Action<PlainTextElementBuilder>

The action to set the text of the header.

Returns

HeaderModuleBuilder

The current builder.

WithText(string)

Sets the text of the header.

public HeaderModuleBuilder WithText(string text)

Parameters

text string

The text to be set for the header.

Returns

HeaderModuleBuilder

The current builder.

Operators

operator ==(HeaderModuleBuilder?, HeaderModuleBuilder?)

Determines whether the specified HeaderModuleBuilder is equal to the current HeaderModuleBuilder.

public static bool operator ==(HeaderModuleBuilder? left, HeaderModuleBuilder? right)

Parameters

left HeaderModuleBuilder
right HeaderModuleBuilder

Returns

bool

true if the specified HeaderModuleBuilder is equal to the current HeaderModuleBuilder; otherwise, false.

implicit operator HeaderModuleBuilder(string)

Initialized a new instance of the HeaderModuleBuilder class with the specified text.

public static implicit operator HeaderModuleBuilder(string text)

Parameters

text string

The text to be set for the header.

Returns

HeaderModuleBuilder

An HeaderModuleBuilder object that is initialized with the specified text.

operator !=(HeaderModuleBuilder?, HeaderModuleBuilder?)

Determines whether the specified HeaderModuleBuilder is not equal to the current HeaderModuleBuilder.

public static bool operator !=(HeaderModuleBuilder? left, HeaderModuleBuilder? right)

Parameters

left HeaderModuleBuilder
right HeaderModuleBuilder

Returns

bool

true if the specified HeaderModuleBuilder is not equal to the current HeaderModuleBuilder; otherwise, false.