go.bigb.es/confluence-md-utilities
Index
- type Body
- type Client
- func NewClient(baseURL, token string) *Client
- func (*Client) FindContent(spaceKey, title string) (*ContentResponse, error)
- func (*Client) GetContent(pageID string) (*ContentResponse, error)
- func (*Client) GetPage(ref *PageRef) (*ContentResponse, error)
- func (*Client) UpdateContent(pageID string, current *ContentResponse, newBody string, message string) error
- type ContentResponse
- type PageRef
- type StorageBody
- type Version
Types
type Body struct { Storage StorageBody `json:"storage"` }
type Client struct { BaseURL string Token string HTTPClient *http.Client }
Client is a Confluence REST API client for Server/Data Center.
NewClient creates a new Confluence API client.
func (c *Client) FindContent(spaceKey, title string) (*ContentResponse, error)
FindContent searches for a page by space key and title.
func (c *Client) GetContent(pageID string) (*ContentResponse, error)
GetContent fetches a page by ID with storage body and version info.
func (c *Client) GetPage(ref *PageRef) (*ContentResponse, error)
GetPage resolves a PageRef to a full ContentResponse.
func (c *Client) UpdateContent(pageID string, current *ContentResponse, newBody string, message string) error
UpdateContent updates a page's storage body, incrementing the version.
type ContentResponse struct { ID string `json:"id"` Type string `json:"type"` Title string `json:"title"` Version Version `json:"version"` Body Body `json:"body"` }
ContentResponse represents a Confluence page from the REST API.
type PageRef struct { BaseURL string // e.g., "https://confluence.example.com" PageID string // numeric ID if available SpaceKey string // from /display/SPACE/... format Title string // URL-decoded page title }
PageRef holds parsed Confluence page reference from a URL.
func ParsePageURL(rawURL string) (*PageRef, error)
ParsePageURL parses a Confluence Server/Data Center page URL into a PageRef.
Supported formats:
type StorageBody struct { Value string `json:"value"` Representation string `json:"representation"` }
StorageBody holds the storage format representation.
Body holds page body content.