confluence

package module
v0.0.0-...-a8c8845 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2018 License: MIT Imports: 11 Imported by: 0

README

go-confluence

Go library wrapping the confluence REST API.

Currently implemented

  • Authentication:
    • Basic Authentication
    • Token Key authentication
  • Manipulating existing wiki content, i.e:
    • DeleteContent
    • GetContent
    • UpdateContent

This is everything I needed for my project. I might add some more functionality when I find the time. Feel free to send pull requests.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	ID    string `json:"id,omitempty"`
	Title string `json:"title,omitempty"`
	Links struct {
		Download string `json:"download,omitempty"`
	} `json:"_links,omitempty"`
}

NOTE: The `_links.download` key is not documented in the Confluence REST API Reference. However,

it is referenced here: https://community.atlassian.com/t5/Answers-Developer-Questions/confluence-pages-get-attached-files-via-REST-API/qaq-p/529873#M67529

type AttachmentResults

type AttachmentResults struct {
	ResultPagination
	Results []Attachment `json:"results"`
}

type AuthMethod

type AuthMethod interface {
	// contains filtered or unexported methods
}

func BasicAuth

func BasicAuth(username, password string) AuthMethod

func TokenAuth

func TokenAuth(tokenkey string) AuthMethod

type ChildResults

type ChildResults struct {
	ResultPagination
	Results []Content `json:"results"`
}

type Content

type Content struct {
	ID     string `json:"id,omitempty"`
	Type   string `json:"type"`
	Status string `json:"status,omitempty"`
	Title  string `json:"title"`
	Body   struct {
		Storage struct {
			Value          string `json:"value"`
			Representation string `json:"representation"`
		} `json:"storage"`
	} `json:"body"`
	Version struct {
		Number    int  `json:"number"`
		MinorEdit bool `json:"minorEdit"`
	} `json:"version"`
	Space struct {
		Key string `json:"key"`
	} `json:"space,omitempty"`
	Ancestors []ContentAncestor `json:"ancestors,omitempty"`
}

type ContentAncestor

type ContentAncestor struct {
	ID string `json:"id"`
}

type ContentResult

type ContentResult struct {
	Content               Content `json:"content"`
	Title                 string  `json:"title"`
	Excerpt               string  `json:"excerpt"`
	URL                   string  `json:"url"`
	ResultGlobalContainer struct {
		Title      string `json:"title"`
		DisplayURL string `json:"displayUrl"`
	}
	// breadcrumbs is ignored
	EntityType           string `json:"entityType"`
	IconCSSClass         string `json:"iconCssClass"`
	LastModified         string `json:"lastModified"`
	FriendlyLastModified string `json:"friendlyLastModified"`
}

type ResultPagination

type ResultPagination struct {
	Start int `json:"size"`
	Limit int `json:"limit"`
	Size  int `json:"size"`
}

type SearchResults

type SearchResults struct {
	ResultPagination
	Results        []ContentResult `json:"results"`
	TotalSize      int             `json:"totalSize"`
	CqlQuery       string          `json:"cqlQuery"`
	SearchDuration int             `json:"SearchDuration"`
}

type Wiki

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

func NewWiki

func NewWiki(location string, authMethod AuthMethod) (*Wiki, error)

func (*Wiki) CreateAttachment

func (w *Wiki) CreateAttachment(contentID string, path string) (*AttachmentResults, error)

func (*Wiki) CreateContent

func (w *Wiki) CreateContent(content *Content) (*Content, error)

func (*Wiki) DeleteContent

func (w *Wiki) DeleteContent(contentID string) error

func (*Wiki) GetAttachment

func (w *Wiki) GetAttachment(contentID string, filename string) (*AttachmentResults, error)

func (*Wiki) GetAttachmentData

func (w *Wiki) GetAttachmentData(contentID string, filename string) ([]byte, error)

func (*Wiki) GetContent

func (w *Wiki) GetContent(contentID string, expand []string) (*Content, error)

func (*Wiki) GetContentChildPages

func (w *Wiki) GetContentChildPages(contentID string, expand []string) (*ChildResults, error)

func (*Wiki) Search

func (w *Wiki) Search(cql, cqlContext string, expand []string, limit int) (*SearchResults, error)

func (*Wiki) SetClient

func (w *Wiki) SetClient(c *http.Client)

func (*Wiki) UpdateAttachment

func (w *Wiki) UpdateAttachment(contentID string, path string, attachmentID string) (*AttachmentResults, error)

func (*Wiki) UpdateContent

func (w *Wiki) UpdateContent(content *Content) (*Content, error)

Jump to

Keyboard shortcuts

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