attachments

package
v0.15.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTag added in v0.10.0

func BuildTag(sgid string) string

BuildTag returns a bc-attachment tag for an sgid.

func ExtractBucketID added in v0.15.0

func ExtractBucketID(url string) (string, error)

ExtractBucketID extracts the bucket ID from a Basecamp URL

func ExtractUploadIDFromURL added in v0.15.0

func ExtractUploadIDFromURL(url string) (int64, error)

ExtractUploadIDFromURL extracts the upload ID from a download or app URL

func IsBlobURL added in v0.15.3

func IsBlobURL(url string) bool

IsBlobURL returns true if the URL is a blob/preview URL that cannot be downloaded via OAuth. Blob URLs use Google Cloud Storage with session cookie authentication instead of OAuth tokens. These URLs typically contain "/blobs/" or use the "preview.3.basecamp.com" subdomain.

Types

type Attachment

type Attachment struct {
	SGID        string
	ContentType string
	Filename    string
	URL         string
	Href        string
	Width       string
	Height      string
	Caption     string
}

Attachment represents a Basecamp attachment with metadata

func ParseAttachments

func ParseAttachments(htmlContent string) []Attachment

ParseAttachments extracts all bc-attachment elements from HTML content

func (*Attachment) GetDisplayName

func (a *Attachment) GetDisplayName() string

GetDisplayName returns the best display name for the attachment

func (*Attachment) IsImage

func (a *Attachment) IsImage() bool

IsImage returns true if the attachment is an image based on its content type

type DownloadResult added in v0.15.3

type DownloadResult struct {
	UploadID  int64
	SourceURL string // The URL that worked (either URL or Href)
	IsBlobURL bool   // True if this is a blob URL that can't be downloaded via API
	BlobURL   string // The blob URL for user reference (if IsBlobURL is true)
}

DownloadResult contains the result of attempting to extract download information

func TryExtractUploadID added in v0.15.3

func TryExtractUploadID(att *Attachment) (*DownloadResult, error)

TryExtractUploadID attempts to extract an upload ID from an attachment. It first tries the URL field, then falls back to the Href field if available. If both fail and the URL is a blob URL, it returns a result indicating the blob URL so callers can provide appropriate user guidance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL