Table of Contents

Class AttachmentProperties

Namespace
NetCord.Rest
Assembly
NetCord.dll

Represents a message attachment, and its contained data.

public class AttachmentProperties : IHttpSerializable
Inheritance
AttachmentProperties
Implements
Derived
Inherited Members

Constructors

AttachmentProperties(string)

Creates an empty attachment with the given filename.

protected AttachmentProperties(string fileName)

Parameters

fileName string
Name of the attachment (max 1024 characters for attachments sent by message, 2-30 characters for attachments used for sticker creation).

AttachmentProperties(string, Stream)

Creates an attachment from the provided stream, with the given filename.

public AttachmentProperties(string fileName, Stream stream)

Parameters

fileName string
Name of the attachment (max 1024 characters for attachments sent by message, 2-30 characters for attachments used for sticker creation).
stream Stream

A stream containing the attachment's contents.

Properties

Description

Description for the attachment (max 1024 characters for attachments sent by message, max 200 characters for attachments used for sticker creation).

public string? Description { get; set; }

Property Value

string

FileName

Name of the attachment (max 1024 characters for attachments sent by message, 2-30 characters for attachments used for sticker creation).

public string FileName { get; set; }

Property Value

string

SupportsHttpSerialization

Whether the attachment supports HTTP serialization.

public virtual bool SupportsHttpSerialization { get; }

Property Value

bool

Title

The title of the attachment.

public string? Title { get; set; }

Property Value

string

Methods

GetStream()

protected Stream? GetStream()

Returns

Stream

Serialize()

Serializes the object or its part into HttpContent.

public virtual HttpContent Serialize()

Returns

HttpContent

WithDescription(string?)

Description for the attachment (max 1024 characters for attachments sent by message, max 200 characters for attachments used for sticker creation).

public AttachmentProperties WithDescription(string? description)

Parameters

description string

Returns

AttachmentProperties

WithFileName(string)

Name of the attachment (max 1024 characters for attachments sent by message, 2-30 characters for attachments used for sticker creation).

public AttachmentProperties WithFileName(string fileName)

Parameters

fileName string

Returns

AttachmentProperties

WithTitle(string?)

The title of the attachment.

public AttachmentProperties WithTitle(string? title)

Parameters

title string

Returns

AttachmentProperties

WriteTo(Utf8JsonWriter, int)

protected virtual void WriteTo(Utf8JsonWriter writer, int attachmentId)

Parameters

writer Utf8JsonWriter
attachmentId int