go.bigb.es/confluence-md-utilities

v0.1.0
Doc Versions Source

Types

T type Body

src
type Body struct {
	Storage StorageBody `json:"storage"`
}

Body holds page body content.

T type Client

src
type Client struct {
	BaseURL    string
	Token      string
	HTTPClient *http.Client
}

Client is a Confluence REST API client for Server/Data Center.

f func NewClient

src
func NewClient(baseURL, token string) *Client

NewClient creates a new Confluence API client.

m func (*Client) FindContent

src
func (c *Client) FindContent(spaceKey, title string) (*ContentResponse, error)

FindContent searches for a page by space key and title.

m func (*Client) GetContent

src
func (c *Client) GetContent(pageID string) (*ContentResponse, error)

GetContent fetches a page by ID with storage body and version info.

m func (*Client) GetPage

src
func (c *Client) GetPage(ref *PageRef) (*ContentResponse, error)

GetPage resolves a PageRef to a full ContentResponse.

m func (*Client) UpdateContent

src
func (c *Client) UpdateContent(pageID string, current *ContentResponse, newBody string, message string) error

UpdateContent updates a page's storage body, incrementing the version.

T type ContentResponse

src
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.

T type PageRef

src
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.

f func ParsePageURL

src
func ParsePageURL(rawURL string) (*PageRef, error)

T type StorageBody

src
type StorageBody struct {
	Value          string `json:"value"`
	Representation string `json:"representation"`
}

StorageBody holds the storage format representation.

T type Version

src
type Version struct {
	Number  int    `json:"number"`
	Message string `json:"message,omitempty"`
}

Version holds page version info.

Source Files