Table of Contents

Interface IUploadedFile

Namespace
Glitch9.AIDevKit

Represents a file object retrieved from an AI provider (e.g., /v1/files).

  • Provides common properties such as file size, MIME type, and timestamps.
  • Normalizes file information across providers like OpenAI and Google.
  • Used as the return type for file-related tasks (e.g., UploadFileTask, DownloadFileTask).
public interface IUploadedFile : IProviderData, IData
Inherited Members
Extension Methods

Properties

ByteSize

Gets the total size of the file in bytes.

  • Useful for validating upload/download sizes.
  • May differ depending on provider’s storage format.
int ByteSize { get; }

Property Value

int

CreatedAt

Gets the timestamp of when the file was created on the provider’s system.

  • Uses UnixTime for consistency across APIs.
  • Often represents the original upload time.
UnixTime CreatedAt { get; }

Property Value

UnixTime

ExpiresAt

Gets the timestamp when the file will expire (if applicable).

  • Some providers set expiration dates for temporary files.
  • May return null if the file does not expire.
UnixTime ExpiresAt { get; }

Property Value

UnixTime

MimeType

Gets the MIME type of the file as detected or declared during upload.

  • Examples: application/json, image/png, audio/wav.
  • Can be used to determine how to process or preview the file.
MimeType MimeType { get; }

Property Value

MimeType

Uri

Gets the URI where the file can be accessed, if provided by the API.

  • Default implementation returns null.
  • Some providers return a signed URL or permanent link.
string Uri { get; }

Property Value

string

Methods

GetMetadata()

Builds a serializable metadata object for this file.

  • Encapsulates file properties for persistence or logging.
  • Useful for caching file data locally or transmitting through APIs.
SerializableMetadata GetMetadata()

Returns

SerializableMetadata