confluence

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package confluence is a minimal Confluence Cloud client scoped to what whodar ingests: pages and the people who wrote them. Credentials are held only in memory, never serialized, and never logged.

Index

Constants

This section is empty.

Variables

View Source
var ErrRateLimited = errors.New("confluence: rate limited")

ErrRateLimited indicates the API rate limit was exhausted.

View Source
var ErrStatus = errors.New("confluence: unexpected status")

ErrStatus indicates an unexpected HTTP status.

Functions

This section is empty.

Types

type Client

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

Client calls the Confluence Cloud REST API.

func New

func New(siteURL, email, token string, opts ...Option) *Client

New returns a Client for the site, authenticating with an email and API token. It panics if any argument is empty.

func (*Client) Pages

func (c *Client) Pages(ctx context.Context, cql string, max int) ([]Page, error)

Pages returns up to max pages matching cql, paginating in pages of 100. A non-positive max returns all matches.

type Doer

type Doer interface {
	// Do performs the request and returns the response.
	Do(req *http.Request) (*http.Response, error)
}

Doer performs an HTTP request. *http.Client satisfies it; tests inject a stub.

type Option

type Option func(*Client)

Option configures a Client.

func WithHTTPClient

func WithHTTPClient(d Doer) Option

WithHTTPClient sets the HTTP doer.

type Page

type Page struct {
	// Title is the page title.
	Title string `json:"title"`
	// Space is the page's space.
	Space struct {
		// Key is the space key.
		Key string `json:"key"`
		// Name is the space name.
		Name string `json:"name"`
	} `json:"space"`
	// Metadata holds the page labels.
	Metadata struct {
		// Labels are the page labels.
		Labels struct {
			// Results is the label list.
			Results []label `json:"results"`
		} `json:"labels"`
	} `json:"metadata"`
	// History holds the page creator.
	History struct {
		// CreatedBy is the page's creator.
		CreatedBy *User `json:"createdBy"`
	} `json:"history"`
	// Version holds the last editor and edit time.
	Version struct {
		// By is the last editor.
		By *User `json:"by"`
		// When is the last edit time.
		When time.Time `json:"when"`
	} `json:"version"`
}

Page is the subset of a content page whodar reads.

func (Page) Authors

func (p Page) Authors() []*User

Authors returns the distinct creator and last editor of the page.

func (Page) LabelNames

func (p Page) LabelNames() []string

LabelNames returns the page's label names.

type User

type User struct {
	// AccountID is the stable account identifier.
	AccountID string `json:"accountId"`
	// DisplayName is the user's display name.
	DisplayName string `json:"displayName"`
	// Email is the user's email, present when visible to the token.
	Email string `json:"email"`
}

User is the subset of a Confluence user whodar reads.

Jump to

Keyboard shortcuts

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