contents

package
v2.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the Contents API client for downloading file attachments. Webex file attachment URLs (returned in Message.Files) point to GET /v1/contents/{contentId} which requires Bearer token auth.

func New

func New(webexClient *webexsdk.Client, config *Config) *Client

New creates a new Contents plugin.

func (*Client) Download

func (c *Client) Download(contentID string) (*FileInfo, error)

Download fetches a file attachment by its content ID. The contentID is the Webex content identifier (the base64-encoded ID found at the end of URLs like https://webexapis.com/v1/contents/{contentId}).

func (*Client) DownloadFromURL

func (c *Client) DownloadFromURL(contentURL string) (*FileInfo, error)

DownloadFromURL fetches a file attachment from a full Webex content URL. This accepts the URLs directly from Message.Files (e.g., "https://webexapis.com/v1/contents/Y2lzY29...").

type Config

type Config struct{}

Config holds the configuration for the Contents plugin.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration.

type FileInfo

type FileInfo struct {
	// ContentType is the MIME type of the file (e.g., "image/png", "application/pdf").
	ContentType string
	// ContentDisposition contains the original filename from the server (e.g., "attachment; filename=\"report.pdf\"").
	ContentDisposition string
	// ContentLength is the size in bytes (-1 if unknown).
	ContentLength int64
	// Data is the raw file content.
	Data []byte
}

FileInfo holds metadata about a downloaded file attachment.

Jump to

Keyboard shortcuts

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