Documentation
¶
Index ¶
- Constants
- func FilterImageAttachments(attachments []core.Attachment) []core.Attachment
- func GetImageDimensions(imageData []byte) (width, height int, err error)
- func IsImageAttachment(attachment core.Attachment) bool
- type AttachmentCache
- type AttachmentFormat
- type AttachmentResponse
- type CacheEntry
- type Client
- type FileUploadResponse
Constants ¶
const MCPSizeLimit = 1024 * 1024 // 1MB
MCPSizeLimit is the 1MB limit for MCP content (Claude Desktop constraint)
Variables ¶
This section is empty.
Functions ¶
func FilterImageAttachments ¶
func FilterImageAttachments(attachments []core.Attachment) []core.Attachment
FilterImageAttachments returns only image attachments from a slice
func GetImageDimensions ¶
GetImageDimensions returns dimensions of image data
func IsImageAttachment ¶
func IsImageAttachment(attachment core.Attachment) bool
IsImageAttachment checks if an attachment is an image based on content type
Types ¶
type AttachmentCache ¶
type AttachmentCache struct {
// contains filtered or unexported fields
}
AttachmentCache provides in-memory caching for processed attachments
func NewAttachmentCache ¶
func NewAttachmentCache(ttl time.Duration) *AttachmentCache
NewAttachmentCache creates a new attachment cache with specified TTL
func (*AttachmentCache) Clear ¶
func (cache *AttachmentCache) Clear()
Clear removes all entries from the cache
func (*AttachmentCache) Get ¶
func (cache *AttachmentCache) Get(key string) *CacheEntry
Get retrieves a cache entry if it exists and hasn't expired
func (*AttachmentCache) Set ¶
func (cache *AttachmentCache) Set(key string, entry *CacheEntry)
Set stores a cache entry
func (*AttachmentCache) Size ¶
func (cache *AttachmentCache) Size() int
Size returns the current number of cached entries
type AttachmentFormat ¶
type AttachmentFormat string
AttachmentFormat defines the supported return formats for attachments
const ( FormatBase64 AttachmentFormat = "base64" // Base64 encoded content (default for MCP) FormatURL AttachmentFormat = "url" // Direct URL (for large files) FormatMetadata AttachmentFormat = "metadata" // Metadata only, no download )
type AttachmentResponse ¶
type AttachmentResponse struct {
Format AttachmentFormat `json:"format"`
Content string `json:"content,omitempty"` // Base64 content or URL
URL string `json:"url,omitempty"` // Original URL
ContentType string `json:"contentType,omitempty"` // MIME type
Size int64 `json:"size,omitempty"` // Content size in bytes
Width int `json:"width,omitempty"` // Image width (if image)
Height int `json:"height,omitempty"` // Image height (if image)
Resized bool `json:"resized,omitempty"` // True if image was resized for MCP limits
Error string `json:"error,omitempty"` // Error message if download failed
}
AttachmentResponse represents the response from GetAttachment
type CacheEntry ¶
type CacheEntry struct {
Content []byte
ContentType string
Size int64
Width int
Height int
Resized bool
ExpiresAt time.Time
}
CacheEntry represents a cached attachment with expiration
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
AttachmentClient handles attachment download and processing operations
func NewClient ¶
func NewClient(base *core.BaseClient) *Client
NewAttachmentClient creates a new attachment client
func (*Client) GetAttachment ¶
func (ac *Client) GetAttachment(attachmentURL string, format AttachmentFormat) (*AttachmentResponse, error)
GetAttachment downloads and processes an attachment with the specified format Note: This is a simplified implementation that expects the full attachment URL to be passed as attachmentID In practice, this would be enhanced to properly resolve attachment IDs to URLs
func (*Client) UploadFile ¶
UploadFile uploads a file to Linear and returns the asset URL This implements the full upload flow: 1. Call fileUpload mutation to get upload URL and headers 2. PUT the file content to the upload URL 3. Return the asset URL for use in markdown