Documentation
¶
Overview ¶
Package confluence implements the Atlassian Confluence Cloud API provider.
Index ¶
- Constants
- func GetDefaultSpaceKey() string
- func GetWebhookToken() string
- type Body
- type Confluence
- func (c *Confluence) CreatePage(ctx context.Context, spaceKey, title, content string) (*Page, error)
- func (c *Confluence) DeletePage(ctx context.Context, pageID string) error
- func (c *Confluence) GetCurrentUser(ctx context.Context) (map[string]any, error)
- func (c *Confluence) GetPage(ctx context.Context, pageID string, expandBody bool) (*Page, error)
- func (c *Confluence) GetPageContent(ctx context.Context, pageID string) (string, error)
- func (c *Confluence) ListPages(ctx context.Context, spaceKey string, start, limit int) (*PageListResponse, error)
- func (c *Confluence) ListSpaces(ctx context.Context, start, limit int) (*SpaceListResponse, error)
- func (c *Confluence) SearchPages(ctx context.Context, cql string, start, limit int) (*SearchResponse, error)
- func (c *Confluence) UpdatePage(ctx context.Context, pageID, title, content string) (*Page, error)
- type ContentLinks
- type CreatePageRequest
- type Page
- type PageListResponse
- type SearchResponse
- type SearchResult
- type Space
- type SpaceListResponse
- type SpaceRef
- type StorageBody
- type UpdatePageRequest
- type Version
- type WebhookPageRef
- type WebhookPayload
Constants ¶
const ( ID = "confluence" SiteURLKey = "site_url" EmailKey = "email" APITokenKey = "api_token" WebhookTokenKey = "webhook_token" DefaultSpaceKeyKey = "default_space_key" )
Variables ¶
This section is empty.
Functions ¶
func GetDefaultSpaceKey ¶
func GetDefaultSpaceKey() string
GetDefaultSpaceKey reads the optional default space key from config.
func GetWebhookToken ¶
func GetWebhookToken() string
GetWebhookToken reads the inbound webhook query token from config.
Types ¶
type Body ¶
type Body struct {
Storage *StorageBody `json:"storage,omitempty"`
}
Body holds page body representations.
type Confluence ¶
type Confluence struct {
// contains filtered or unexported fields
}
Confluence is an HTTP client for the Confluence Cloud REST API.
func GetClient ¶
func GetClient() *Confluence
GetClient builds a Confluence client from vendors.confluence config. Returns nil when site_url, email, or api_token is not configured.
func NewConfluence ¶
func NewConfluence(siteURL, email, apiToken string) *Confluence
NewConfluence creates a Confluence API client.
func (*Confluence) CreatePage ¶
func (c *Confluence) CreatePage(ctx context.Context, spaceKey, title, content string) (*Page, error)
CreatePage creates a page in a space with storage-format content.
func (*Confluence) DeletePage ¶
func (c *Confluence) DeletePage(ctx context.Context, pageID string) error
DeletePage deletes a page by id.
func (*Confluence) GetCurrentUser ¶
GetCurrentUser returns the authenticated user (health check).
func (*Confluence) GetPageContent ¶
GetPageContent returns the storage-format body of a page.
func (*Confluence) ListPages ¶
func (c *Confluence) ListPages(ctx context.Context, spaceKey string, start, limit int) (*PageListResponse, error)
ListPages returns pages in a space.
func (*Confluence) ListSpaces ¶
func (c *Confluence) ListSpaces(ctx context.Context, start, limit int) (*SpaceListResponse, error)
ListSpaces returns spaces with pagination.
func (*Confluence) SearchPages ¶
func (c *Confluence) SearchPages(ctx context.Context, cql string, start, limit int) (*SearchResponse, error)
SearchPages runs a CQL search for pages.
func (*Confluence) UpdatePage ¶
UpdatePage updates page title and/or storage-format content.
type ContentLinks ¶
type ContentLinks struct {
WebUI string `json:"webui,omitempty"`
}
ContentLinks holds API links for content.
type CreatePageRequest ¶
type CreatePageRequest struct {
Type string `json:"type"`
Title string `json:"title"`
Space map[string]string `json:"space"`
Body map[string]StorageBody `json:"body"`
Ancestors []map[string]string `json:"ancestors,omitempty"`
}
CreatePageRequest is the API body for creating a page.
type Page ¶
type Page struct {
ID string `json:"id"`
Type string `json:"type"`
Status string `json:"status,omitempty"`
Title string `json:"title"`
Space *SpaceRef `json:"space,omitempty"`
Body *Body `json:"body,omitempty"`
Version *Version `json:"version,omitempty"`
Links *ContentLinks `json:"_links,omitempty"`
}
Page is a Confluence content page.
type PageListResponse ¶
type PageListResponse struct {
Results []Page `json:"results"`
Start int `json:"start"`
Limit int `json:"limit"`
Size int `json:"size"`
}
PageListResponse is the paginated content list response.
type SearchResponse ¶
type SearchResponse struct {
Results []SearchResult `json:"results"`
Start int `json:"start"`
Limit int `json:"limit"`
Size int `json:"size"`
}
SearchResponse is the CQL search response.
type SearchResult ¶
type SearchResult struct {
Content Page `json:"content"`
}
SearchResult is one search hit.
type Space ¶
type Space struct {
ID int `json:"id"`
Key string `json:"key"`
Name string `json:"name"`
Type string `json:"type,omitempty"`
}
Space is a Confluence space resource.
type SpaceListResponse ¶
type SpaceListResponse struct {
Results []Space `json:"results"`
Start int `json:"start"`
Limit int `json:"limit"`
Size int `json:"size"`
}
SpaceListResponse is the paginated space list response.
type StorageBody ¶
type StorageBody struct {
Value string `json:"value"`
Representation string `json:"representation"`
}
StorageBody is Confluence storage-format content.
type UpdatePageRequest ¶
type UpdatePageRequest struct {
ID string `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
Body map[string]StorageBody `json:"body,omitempty"`
Version Version `json:"version"`
}
UpdatePageRequest is the API body for updating a page.
type Version ¶
type Version struct {
Number int `json:"number"`
}
Version is content version metadata.
type WebhookPageRef ¶
WebhookPageRef identifies a page in webhook payloads.
type WebhookPayload ¶
type WebhookPayload struct {
ID string `json:"id,omitempty"`
Event string `json:"event"`
Page *WebhookPageRef `json:"page"`
Space *SpaceRef `json:"space"`
}
WebhookPayload is a normalized inbound automation webhook body.