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
postsIReadOnlyList<DraftPost>-
A list of posts for the draft. Maximum idunno.Bluesky.Maximum.DraftPosts.
deviceIdstring?-
Identifier of the device that created this draft.
deviceNamestring?-
The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
langsIReadOnlyList<string>?-
A collection of RFC5646 language codes for the draft. Maximum idunno.Bluesky.Maximum.DraftLangs.
postGateEmbeddingRulesIReadOnlyList<PostGateRule>?-
An collection of embedding rules for the draft posts. Maximum idunno.Bluesky.Maximum.DraftPostGateEmbeddingRules.
threadGateAllowRulesIReadOnlyList<ThreadGateRule>?-
A collection of thread gate rules for the draft. Maximum idunno.Bluesky.Maximum.DraftThreadGateAllowRules.
Exceptions
- ArgumentNullException
-
Thrown when
postsis 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
postDraftPost-
The draft post.
deviceIdstring?-
Identifier of the device that created this draft.
deviceNamestring?-
The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
Exceptions
- ArgumentNullException
-
Thrown when
postis null. - ArgumentOutOfRangeException
-
Thrown when
deviceNameis 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
textstring-
The text to create a draft post from.
deviceIdstring?-
Identifier of the device that created this draft.
Exceptions
- ArgumentException
-
Thrown when
textis 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
textstring-
The text to create a draft post from.
deviceIdstring?-
Identifier of the device that created this draft.
deviceNamestring?-
The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
Exceptions
- ArgumentException
-
Thrown when
textis null or whitespace. - ArgumentOutOfRangeException
-
Thrown when
deviceNameis specified and its length is greater than idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
Draft(Draft)
protected Draft(Draft original)Parameters
originalDraft
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
postsIReadOnlyList<DraftPost>-
A list of posts for the draft. Maximum idunno.Bluesky.Maximum.DraftPosts.
deviceIdstring?-
Identifier of the device that created this draft.
deviceNamestring?-
The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
langsIReadOnlyList<string>?-
A collection of RFC5646 language codes for the draft. Maximum idunno.Bluesky.Maximum.DraftLangs.
postGateEmbeddingRulesIReadOnlyList<PostGateRule>?-
An collection of embedding rules for the draft posts. Maximum idunno.Bluesky.Maximum.DraftPostGateEmbeddingRules.
threadGateAllowRulesIReadOnlyList<ThreadGateRule>?-
A collection of thread gate rules for the draft. Maximum idunno.Bluesky.Maximum.DraftThreadGateAllowRules.
Exceptions
- ArgumentNullException
-
Thrown when
postsis 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
postDraftPost-
The draft post.
deviceIdstring?-
Identifier of the device that created this draft.
deviceNamestring?-
The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
Exceptions
- ArgumentNullException
-
Thrown when
postis null. - ArgumentOutOfRangeException
-
Thrown when
deviceNameis 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
textstring-
The text to create a draft post from.
deviceIdstring?-
Identifier of the device that created this draft.
Exceptions
- ArgumentException
-
Thrown when
textis 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
textstring-
The text to create a draft post from.
deviceIdstring?-
Identifier of the device that created this draft.
deviceNamestring?-
The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
Exceptions
- ArgumentException
-
Thrown when
textis null or whitespace. - ArgumentOutOfRangeException
-
Thrown when
deviceNameis specified and its length is greater than idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
Draft(Draft)
protected Draft(Draft original)Parameters
originalDraft
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
postsIReadOnlyList<DraftPost>-
A list of posts for the draft. Maximum idunno.Bluesky.Maximum.DraftPosts.
deviceIdstring?-
Identifier of the device that created this draft.
deviceNamestring?-
The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
langsIReadOnlyList<string>?-
A collection of RFC5646 language codes for the draft. Maximum idunno.Bluesky.Maximum.DraftLangs.
postGateEmbeddingRulesIReadOnlyList<PostGateRule>?-
An collection of embedding rules for the draft posts. Maximum idunno.Bluesky.Maximum.DraftPostGateEmbeddingRules.
threadGateAllowRulesIReadOnlyList<ThreadGateRule>?-
A collection of thread gate rules for the draft. Maximum idunno.Bluesky.Maximum.DraftThreadGateAllowRules.
Exceptions
- ArgumentNullException
-
Thrown when
postsis 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
postDraftPost-
The draft post.
deviceIdstring?-
Identifier of the device that created this draft.
deviceNamestring?-
The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
Exceptions
- ArgumentNullException
-
Thrown when
postis null. - ArgumentOutOfRangeException
-
Thrown when
deviceNameis 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
textstring-
The text to create a draft post from.
deviceIdstring?-
Identifier of the device that created this draft.
Exceptions
- ArgumentException
-
Thrown when
textis 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
textstring-
The text to create a draft post from.
deviceIdstring?-
Identifier of the device that created this draft.
deviceNamestring?-
The device and/or platform on which the draft was created. Maximum idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
Exceptions
- ArgumentException
-
Thrown when
textis null or whitespace. - ArgumentOutOfRangeException
-
Thrown when
deviceNameis specified and its length is greater than idunno.Bluesky.Maximum.DraftDeviceNameLengthInBytes UTF-8 bytes.
Draft(Draft)
protected Draft(Draft original)Parameters
originalDraft
Properties
DeviceId
Gets the identifier of the device that created this draft.
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? DeviceId { get; }Property Value
DeviceId
Gets the identifier of the device that created this draft.
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? DeviceId { get; }Property Value
DeviceId
Gets the identifier of the device that created this draft.
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? DeviceId { get; }Property Value
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
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
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
EqualityContract
protected virtual Type EqualityContract { get; }Property Value
EqualityContract
protected virtual Type EqualityContract { get; }Property Value
EqualityContract
protected virtual Type EqualityContract { get; }Property Value
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
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
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
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
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
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
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
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
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
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
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
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
Remarks
A maximum of idunno.Bluesky.Maximum.DraftThreadGateAllowRules thread gates can be specified.
Methods
<Clone>$()
public virtual Draft <Clone>$()Returns
<Clone>$()
public virtual Draft <Clone>$()Returns
<Clone>$()
public virtual Draft <Clone>$()Returns
Equals(object?)
public override bool Equals(object? obj)Parameters
objobject?
Returns
Equals(Draft?)
public virtual bool Equals(Draft? other)Parameters
otherDraft?
Returns
Equals(object?)
public override bool Equals(object? obj)Parameters
objobject?
Returns
Equals(Draft?)
public virtual bool Equals(Draft? other)Parameters
otherDraft?
Returns
Equals(object?)
public override bool Equals(object? obj)Parameters
objobject?
Returns
Equals(Draft?)
public virtual bool Equals(Draft? other)Parameters
otherDraft?
Returns
GetHashCode()
public override int GetHashCode()Returns
GetHashCode()
public override int GetHashCode()Returns
GetHashCode()
public override int GetHashCode()Returns
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)Parameters
builderStringBuilder
Returns
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)Parameters
builderStringBuilder
Returns
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)Parameters
builderStringBuilder
Returns
ToString()
public override string ToString()Returns
ToString()
public override string ToString()Returns
ToString()
public override string ToString()Returns
Operators
operator ==(Draft?, Draft?)
public static bool operator ==(Draft? left, Draft? right)Parameters
Returns
operator ==(Draft?, Draft?)
public static bool operator ==(Draft? left, Draft? right)Parameters
Returns
operator ==(Draft?, Draft?)
public static bool operator ==(Draft? left, Draft? right)Parameters
Returns
operator !=(Draft?, Draft?)
public static bool operator !=(Draft? left, Draft? right)Parameters
Returns
operator !=(Draft?, Draft?)
public static bool operator !=(Draft? left, Draft? right)Parameters
Returns
operator !=(Draft?, Draft?)
public static bool operator !=(Draft? left, Draft? right)