Table of Contents

Class Draft

Namespace
idunno.Bluesky.Drafts
Assembly
idunno.Bluesky.dll

Encapsulates a draft containing an array of draft posts

[JsonPolymorphic(UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToNearestAncestor)]
[JsonDerivedType(typeof(Draft), "app.bsky.draft.defs#draft")]
public record Draft : IEquatable<Draft>

Inheritance

Implements

Inherited Members

Constructors

Draft(IReadOnlyList<DraftPost>, string?, string?, IReadOnlyList<string>?, IReadOnlyList<PostGateRule>?, IReadOnlyList<ThreadGateRule>?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

[JsonConstructor]
public Draft(IReadOnlyList<DraftPost> posts, string? deviceId, string? deviceName = null, IReadOnlyList<string>? langs = null, IReadOnlyList<PostGateRule>? postGateEmbeddingRules = null, IReadOnlyList<ThreadGateRule>? threadGateAllowRules = null)

Parameters

posts IReadOnlyList<DraftPost>

A list of posts for the draft. Maximum idunno.Bluesky.Maximum.DraftPosts.

deviceId string?

Identifier of the device that created this draft.

deviceName string?

The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

langs IReadOnlyList<string>?

A collection of RFC5646 language codes for the draft. Maximum idunno.Bluesky.Maximum.DraftLangs.

postGateEmbeddingRules IReadOnlyList<PostGateRule>?

An collection of embedding rules for the draft posts. Maximum idunno.Bluesky.Maximum.DraftPostGateEmbeddingRules.

threadGateAllowRules IReadOnlyList<ThreadGateRule>?

A collection of thread gate rules for the draft. Maximum idunno.Bluesky.Maximum.DraftThreadGateAllowRules.

Exceptions

ArgumentNullException

Thrown when posts is null.

ArgumentOutOfRangeException

Thrown when any of the collections, or idunno.Bluesky.Drafts.Draft.DeviceName exceed their maximum allowed size.

Draft(DraftPost, string?, string?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

public Draft(DraftPost post, string? deviceId, string? deviceName)

Parameters

post DraftPost

The draft post.

deviceId string?

Identifier of the device that created this draft.

deviceName string?

The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Exceptions

ArgumentNullException

Thrown when post is null.

ArgumentOutOfRangeException

Thrown when deviceName is specified and its length is greater than idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Draft(string, string?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

public Draft(string text, string? deviceId)

Parameters

text string

The text to create a draft post from.

deviceId string?

Identifier of the device that created this draft.

Exceptions

ArgumentException

Thrown when text is null or whitespace.

Draft(string, string?, string?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

public Draft(string text, string? deviceId, string? deviceName)

Parameters

text string

The text to create a draft post from.

deviceId string?

Identifier of the device that created this draft.

deviceName string?

The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Exceptions

ArgumentException

Thrown when text is null or whitespace.

ArgumentOutOfRangeException

Thrown when deviceName is specified and its length is greater than idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Draft(Draft)

protected Draft(Draft original)

Parameters

original Draft

Draft(IReadOnlyList<DraftPost>, string?, string?, IReadOnlyList<string>?, IReadOnlyList<PostGateRule>?, IReadOnlyList<ThreadGateRule>?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

[JsonConstructor]
public Draft(IReadOnlyList<DraftPost> posts, string? deviceId, string? deviceName = null, IReadOnlyList<string>? langs = null, IReadOnlyList<PostGateRule>? postGateEmbeddingRules = null, IReadOnlyList<ThreadGateRule>? threadGateAllowRules = null)

Parameters

posts IReadOnlyList<DraftPost>

A list of posts for the draft. Maximum idunno.Bluesky.Maximum.DraftPosts.

deviceId string?

Identifier of the device that created this draft.

deviceName string?

The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

langs IReadOnlyList<string>?

A collection of RFC5646 language codes for the draft. Maximum idunno.Bluesky.Maximum.DraftLangs.

postGateEmbeddingRules IReadOnlyList<PostGateRule>?

An collection of embedding rules for the draft posts. Maximum idunno.Bluesky.Maximum.DraftPostGateEmbeddingRules.

threadGateAllowRules IReadOnlyList<ThreadGateRule>?

A collection of thread gate rules for the draft. Maximum idunno.Bluesky.Maximum.DraftThreadGateAllowRules.

Exceptions

ArgumentNullException

Thrown when posts is null.

ArgumentOutOfRangeException

Thrown when any of the collections, or idunno.Bluesky.Drafts.Draft.DeviceName exceed their maximum allowed size.

Draft(DraftPost, string?, string?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

public Draft(DraftPost post, string? deviceId, string? deviceName)

Parameters

post DraftPost

The draft post.

deviceId string?

Identifier of the device that created this draft.

deviceName string?

The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Exceptions

ArgumentNullException

Thrown when post is null.

ArgumentOutOfRangeException

Thrown when deviceName is specified and its length is greater than idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Draft(string, string?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

public Draft(string text, string? deviceId)

Parameters

text string

The text to create a draft post from.

deviceId string?

Identifier of the device that created this draft.

Exceptions

ArgumentException

Thrown when text is null or whitespace.

Draft(string, string?, string?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

public Draft(string text, string? deviceId, string? deviceName)

Parameters

text string

The text to create a draft post from.

deviceId string?

Identifier of the device that created this draft.

deviceName string?

The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Exceptions

ArgumentException

Thrown when text is null or whitespace.

ArgumentOutOfRangeException

Thrown when deviceName is specified and its length is greater than idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Draft(Draft)

protected Draft(Draft original)

Parameters

original Draft

Draft(IReadOnlyList<DraftPost>, string?, string?, IReadOnlyList<string>?, IReadOnlyList<PostGateRule>?, IReadOnlyList<ThreadGateRule>?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

[JsonConstructor]
public Draft(IReadOnlyList<DraftPost> posts, string? deviceId, string? deviceName = null, IReadOnlyList<string>? langs = null, IReadOnlyList<PostGateRule>? postGateEmbeddingRules = null, IReadOnlyList<ThreadGateRule>? threadGateAllowRules = null)

Parameters

posts IReadOnlyList<DraftPost>

A list of posts for the draft. Maximum idunno.Bluesky.Maximum.DraftPosts.

deviceId string?

Identifier of the device that created this draft.

deviceName string?

The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

langs IReadOnlyList<string>?

A collection of RFC5646 language codes for the draft. Maximum idunno.Bluesky.Maximum.DraftLangs.

postGateEmbeddingRules IReadOnlyList<PostGateRule>?

An collection of embedding rules for the draft posts. Maximum idunno.Bluesky.Maximum.DraftPostGateEmbeddingRules.

threadGateAllowRules IReadOnlyList<ThreadGateRule>?

A collection of thread gate rules for the draft. Maximum idunno.Bluesky.Maximum.DraftThreadGateAllowRules.

Exceptions

ArgumentNullException

Thrown when posts is null.

ArgumentOutOfRangeException

Thrown when any of the collections, or idunno.Bluesky.Drafts.Draft.DeviceName exceed their maximum allowed size.

Draft(DraftPost, string?, string?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

public Draft(DraftPost post, string? deviceId, string? deviceName)

Parameters

post DraftPost

The draft post.

deviceId string?

Identifier of the device that created this draft.

deviceName string?

The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Exceptions

ArgumentNullException

Thrown when post is null.

ArgumentOutOfRangeException

Thrown when deviceName is specified and its length is greater than idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Draft(string, string?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

public Draft(string text, string? deviceId)

Parameters

text string

The text to create a draft post from.

deviceId string?

Identifier of the device that created this draft.

Exceptions

ArgumentException

Thrown when text is null or whitespace.

Draft(string, string?, string?)

Creates a new instance of idunno.Bluesky.Drafts.Draft with the specified properties.

public Draft(string text, string? deviceId, string? deviceName)

Parameters

text string

The text to create a draft post from.

deviceId string?

Identifier of the device that created this draft.

deviceName string?

The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Exceptions

ArgumentException

Thrown when text is null or whitespace.

ArgumentOutOfRangeException

Thrown when deviceName is specified and its length is greater than idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

Draft(Draft)

protected Draft(Draft original)

Parameters

original Draft

Properties

DeviceId

Gets the identifier of the device that created this draft.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? DeviceId { get; }

Property Value

string?

DeviceId

Gets the identifier of the device that created this draft.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? DeviceId { get; }

Property Value

string?

DeviceId

Gets the identifier of the device that created this draft.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? DeviceId { get; }

Property Value

string?

DeviceName

Gets the device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? DeviceName { get; }

Property Value

string?

DeviceName

Gets the device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? DeviceName { get; }

Property Value

string?

DeviceName

Gets the device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? DeviceName { get; }

Property Value

string?

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

Langs

Gets the collection of language strings, if any, that the post is written in.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<string>? Langs { get; }

Property Value

IReadOnlyList<string>?

Remarks

A maximum of idunno.Bluesky.Maximum.DraftLangs languages can be specified. Languages should be specified in RFC5646 format.

Langs

Gets the collection of language strings, if any, that the post is written in.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<string>? Langs { get; }

Property Value

IReadOnlyList<string>?

Remarks

A maximum of idunno.Bluesky.Maximum.DraftLangs languages can be specified. Languages should be specified in RFC5646 format.

Langs

Gets the collection of language strings, if any, that the post is written in.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<string>? Langs { get; }

Property Value

IReadOnlyList<string>?

Remarks

A maximum of idunno.Bluesky.Maximum.DraftLangs languages can be specified. Languages should be specified in RFC5646 format.

PostGateEmbeddingRules

Gets the rules for the post gate to be created when this draft is published.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("postgateEmbeddingRules")]
public IReadOnlyList<PostGateRule>? PostGateEmbeddingRules { get; }

Property Value

IReadOnlyList<PostGateRule>?

Remarks

A maximum of idunno.Bluesky.Maximum.DraftPostGateEmbeddingRules post gates can be specified.

PostGateEmbeddingRules

Gets the rules for the post gate to be created when this draft is published.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("postgateEmbeddingRules")]
public IReadOnlyList<PostGateRule>? PostGateEmbeddingRules { get; }

Property Value

IReadOnlyList<PostGateRule>?

Remarks

A maximum of idunno.Bluesky.Maximum.DraftPostGateEmbeddingRules post gates can be specified.

PostGateEmbeddingRules

Gets the rules for the post gate to be created when this draft is published.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("postgateEmbeddingRules")]
public IReadOnlyList<PostGateRule>? PostGateEmbeddingRules { get; }

Property Value

IReadOnlyList<PostGateRule>?

Remarks

A maximum of idunno.Bluesky.Maximum.DraftPostGateEmbeddingRules post gates can be specified.

Posts

Gets the array of draft posts that compose this draft.

[JsonRequired]
public IReadOnlyList<DraftPost> Posts { get; init; }

Property Value

IReadOnlyList<DraftPost>

Exceptions

ArgumentNullException

Thrown when setting to null.

ArgumentOutOfRangeException

Thrown when setting to an empty collection or one larger than idunno.Bluesky.Maximum.DraftPosts.

Posts

Gets the array of draft posts that compose this draft.

[JsonRequired]
public IReadOnlyList<DraftPost> Posts { get; init; }

Property Value

IReadOnlyList<DraftPost>

Exceptions

ArgumentNullException

Thrown when setting to null.

ArgumentOutOfRangeException

Thrown when setting to an empty collection or one larger than idunno.Bluesky.Maximum.DraftPosts.

Posts

Gets the array of draft posts that compose this draft.

[JsonRequired]
public IReadOnlyList<DraftPost> Posts { get; init; }

Property Value

IReadOnlyList<DraftPost>

Exceptions

ArgumentNullException

Thrown when setting to null.

ArgumentOutOfRangeException

Thrown when setting to an empty collection or one larger than idunno.Bluesky.Maximum.DraftPosts.

ThreadGateAllowRules

Gets the rules for the thread gates to be created when this draft is published.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("threadgateAllow")]
public IReadOnlyList<ThreadGateRule>? ThreadGateAllowRules { get; }

Property Value

IReadOnlyList<ThreadGateRule>?

Remarks

A maximum of idunno.Bluesky.Maximum.DraftThreadGateAllowRules thread gates can be specified.

ThreadGateAllowRules

Gets the rules for the thread gates to be created when this draft is published.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("threadgateAllow")]
public IReadOnlyList<ThreadGateRule>? ThreadGateAllowRules { get; }

Property Value

IReadOnlyList<ThreadGateRule>?

Remarks

A maximum of idunno.Bluesky.Maximum.DraftThreadGateAllowRules thread gates can be specified.

ThreadGateAllowRules

Gets the rules for the thread gates to be created when this draft is published.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("threadgateAllow")]
public IReadOnlyList<ThreadGateRule>? ThreadGateAllowRules { get; }

Property Value

IReadOnlyList<ThreadGateRule>?

Remarks

A maximum of idunno.Bluesky.Maximum.DraftThreadGateAllowRules thread gates can be specified.

Methods

<Clone>$()

public virtual Draft <Clone>$()

Returns

Draft

<Clone>$()

public virtual Draft <Clone>$()

Returns

Draft

<Clone>$()

public virtual Draft <Clone>$()

Returns

Draft

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

Equals(Draft?)

public virtual bool Equals(Draft? other)

Parameters

other Draft?

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

Equals(Draft?)

public virtual bool Equals(Draft? other)

Parameters

other Draft?

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

Equals(Draft?)

public virtual bool Equals(Draft? other)

Parameters

other Draft?

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

GetHashCode()

public override int GetHashCode()

Returns

int

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

public override string ToString()

Returns

string

ToString()

public override string ToString()

Returns

string

ToString()

public override string ToString()

Returns

string

Operators

operator ==(Draft?, Draft?)

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

Parameters

left Draft?
right Draft?

Returns

bool

operator ==(Draft?, Draft?)

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

Parameters

left Draft?
right Draft?

Returns

bool

operator ==(Draft?, Draft?)

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

Parameters

left Draft?
right Draft?

Returns

bool

operator !=(Draft?, Draft?)

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

Parameters

left Draft?
right Draft?

Returns

bool

operator !=(Draft?, Draft?)

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

Parameters

left Draft?
right Draft?

Returns

bool

operator !=(Draft?, Draft?)

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

Parameters

left Draft?
right Draft?

Returns

bool