Skip to content

Attachment

Class  ·  Sharkord\Models\Attachment

Class Attachment

Represents a file or media asset stored on the Sharkord server.

Returned as nested objects in payloads such as server logos and user avatars. This is a read-only data model — attachments are managed through dedicated storage endpoints, not through this class.

$sharkord->servers->getSettings()->then(function (\Sharkord\Models\ServerSettings $settings) {
if ($settings->logo) {
echo "Logo: {$settings->logo->originalName}\n";
echo "Type: {$settings->logo->mimeType}\n";
echo "Size: {$settings->logo->size} bytes\n";
}
});
PropertyTypeDescription
$id (read-only)intUnique attachment ID.
$name (read-only)stringStored filename on the server.
$originalName (read-only)stringThe original filename as uploaded by the user.
$md5 (read-only)stringMD5 hash of the file contents.
$userId (read-only)intID of the user who uploaded the file.
$size (read-only)intFile size in bytes.
$mimeType (read-only)stringMIME type (e.g. ‘image/gif’).
$extension (read-only)stringFile extension including the leading dot (e.g. ‘.gif’).
$createdAt (read-only)intUpload timestamp in milliseconds.
$updatedAt (read-only)`intnull`

Attachment constructor.

Parameters

ParameterTypeDescription
$rawDataarrayRaw attachment data from the API.

Factory method to create an Attachment from a raw API data array.

Parameters

ParameterTypeDescription
$rawarrayThe raw attachment payload.

Returns self


Returns the attachment data as a plain array.

Returns array<string,mixed>


Magic getter for attachment properties.

Parameters

ParameterTypeDescription
$namestringProperty name.

Returns mixed


Magic isset check.

Parameters

ParameterTypeDescription
$namestringProperty name.

Returns bool