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 AttachmentCreateInput
- type AttachmentFormat
- type AttachmentResponse
- type AttachmentUpdateInput
- type CacheEntry
- type Client
- func (ac *Client) CreateAttachment(input *AttachmentCreateInput) (*core.Attachment, error)
- func (ac *Client) DeleteAttachment(id string) error
- func (ac *Client) DownloadToTempFile(url string) (string, error)
- func (ac *Client) GetAttachment(attachmentURL string, format AttachmentFormat) (*AttachmentResponse, error)
- func (ac *Client) ListAttachments(issueID string) ([]core.Attachment, error)
- func (ac *Client) UpdateAttachment(id string, input *AttachmentUpdateInput) (*core.Attachment, error)
- func (ac *Client) UploadFile(filename string, content []byte, contentType string) (string, error)
- func (ac *Client) UploadFileFromPath(filepath string) (string, error)
- 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. Expired entries are left for the background cleanup goroutine to remove.
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 AttachmentCreateInput ¶ added in v1.5.0
type AttachmentCreateInput struct {
IssueID string // Required — UUID of the issue
URL string // Required — attachment URL (also unique key per issue)
Title string // Required — display title
Subtitle string // Optional — display subtitle
}
AttachmentCreateInput holds parameters for creating a Linear attachment object.
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 AttachmentUpdateInput ¶ added in v1.5.0
AttachmentUpdateInput holds parameters for updating an attachment.
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) CreateAttachment ¶ added in v1.5.0
func (ac *Client) CreateAttachment(input *AttachmentCreateInput) (*core.Attachment, error)
CreateAttachment creates a new Linear attachment object on an issue.
func (*Client) DeleteAttachment ¶ added in v1.5.0
DeleteAttachment deletes an attachment by UUID.
func (*Client) DownloadToTempFile ¶ added in v1.6.0
DownloadToTempFile downloads a private Linear URL with auth (adds Bearer header automatically for uploads.linear.app URLs), saves content to /tmp/linear-img-<sha256-of-url>.<ext>, and returns the file path.
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) ListAttachments ¶ added in v1.5.0
func (ac *Client) ListAttachments(issueID string) ([]core.Attachment, error)
ListAttachments queries all attachments for an issue. issueID must be a UUID (resolve identifiers like "TEC-123" before calling).
func (*Client) UpdateAttachment ¶ added in v1.5.0
func (ac *Client) UpdateAttachment(id string, input *AttachmentUpdateInput) (*core.Attachment, error)
UpdateAttachment updates an existing attachment's title and subtitle.
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