confluence

package
v0.99.12 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package confluence implements the Atlassian Confluence Cloud API provider.

Index

Constants

View Source
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

func (c *Confluence) GetCurrentUser(ctx context.Context) (map[string]any, error)

GetCurrentUser returns the authenticated user (health check).

func (*Confluence) GetPage

func (c *Confluence) GetPage(ctx context.Context, pageID string, expandBody bool) (*Page, error)

GetPage returns a page by id with optional body expansion.

func (*Confluence) GetPageContent

func (c *Confluence) GetPageContent(ctx context.Context, pageID string) (string, error)

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

func (c *Confluence) UpdatePage(ctx context.Context, pageID, title, content string) (*Page, error)

UpdatePage updates page title and/or storage-format content.

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 SpaceRef

type SpaceRef struct {
	Key  string `json:"key"`
	Name string `json:"name,omitempty"`
}

SpaceRef is a minimal space reference on content.

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

type WebhookPageRef struct {
	ID    string `json:"id"`
	Title string `json:"title,omitempty"`
}

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.

Jump to

Keyboard shortcuts

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