Documentation
¶
Overview ¶
Package confluence provides wrapper for the Confluence API https://developer.atlassian.com/cloud/confluence/rest
Index ¶
- type APIResponse
- type Client
- func (client Client) CreateContent(bp *CreateContentBodyParameters, qp *QueryParameters) (Content, error)
- func (client Client) Delete(class interface{}) error
- func (client Client) DeleteContent(content Content) error
- func (client Client) GetContent(qp *GetContentQueryParameters) ([]Content, error)
- func (client Client) Search(qp *SearchQueryParameters) ([]SearchResult, error)
- func (client Client) UpdateContent(content *Content, qp *QueryParameters) (Content, error)
- type Content
- type ContentResponse
- type CreateContentBodyParameters
- type GetContentQueryParameters
- type Label
- type QueryParameters
- type SearchQueryParameters
- type SearchResponse
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse struct {
StatusCode int `json:"statusCode,omitempty"`
Data struct {
Authorized bool `json:"authorized,omitempty"`
Valid bool `json:"valid,omitempty"`
Errors []struct {
Message struct {
Key string `json:"key,omitempty"`
Args []interface{} `json:"args,omitempty"`
} `json:"message,omitempty"`
} `json:"errors,omitempty"`
Successful bool `json:"successful,omitempty"`
} `json:"data,omitempty"`
Message string `json:"message,omitempty"`
}
APIResponse provides default response from API
type Client ¶
Client for the Confluence API
func (Client) CreateContent ¶
func (client Client) CreateContent(bp *CreateContentBodyParameters, qp *QueryParameters) (Content, error)
CreateContent creates a new piece of content or publishes an existing draft. https://developer.atlassian.com/cloud/confluence/rest/#api-content-post
func (Client) DeleteContent ¶
DeleteContent oves a piece of content to the space’s trash or purges it from the trash, depending on the content’s type and status:
- If the content’s type is `page` or `blogpost` and its status is `current`, it will be trashed.
- If the content’s type is `page` or `blogpost` and its status is `trashed`, the content will be purged from the trash and deleted permanently. Note, you must also set the `status` query parameter to `trashed` in your request.
- If the content’s type is `comment` or `attachment`, it will be deleted permanently without being trashed.
https://developer.atlassian.com/cloud/confluence/rest/#api-content-id-delete
func (Client) GetContent ¶
func (client Client) GetContent(qp *GetContentQueryParameters) ([]Content, error)
GetContent Returns all content in a Confluence instance. https://developer.atlassian.com/cloud/confluence/rest/#api-content-get
func (Client) Search ¶
func (client Client) Search(qp *SearchQueryParameters) ([]SearchResult, error)
Search searches for content using the Confluence Query Language (CQL) https://developer.atlassian.com/cloud/confluence/rest/#api-search-get
Example:
searchResults, err := client.Search(&confluence.SearchQueryParameters{
CQL: "space = PE",
Limit: 1,
})
if err != nil {
errorAndExit(err)
}
for _, searchResult := range searchResults {
fmt.Println(searchResult.Title)
}
func (Client) UpdateContent ¶
func (client Client) UpdateContent(content *Content, qp *QueryParameters) (Content, error)
UpdateContent updates a piece of content. Use this method to update the title or body of a piece of content, change the status, change the parent page, and more. https://developer.atlassian.com/cloud/confluence/rest/#api-content-id-put
type Content ¶
type Content struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Status string `json:"status,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
Version struct {
Number int `json:"number,omitempty"`
} `json:"version,omitempty"`
Body struct {
Storage struct {
Value string `json:"value,omitempty"`
Representation string `json:"representation,omitempty"`
EmbeddedContent []interface{} `json:"embeddedContent,omitempty"`
Expandable struct {
Content string `json:"content,omitempty"`
} `json:"_expandable,omitempty"`
} `json:"storage,omitempty"`
} `json:"body,omitempty"`
Metadata struct {
Labels []Label `json:"labels,omitempty"`
} `json:"metadata,omitempty"`
Links struct {
Self string `json:"self,omitempty"`
Tinyui string `json:"tinyui,omitempty"`
Editui string `json:"editui,omitempty"`
Webui string `json:"webui,omitempty"`
} `json:"_links,omitempty"`
}
Content represents the data returned from the Confluence API
type ContentResponse ¶
type ContentResponse struct {
Results []Content `json:"results"`
}
ContentResponse represents the data returned from the Confluence API
type CreateContentBodyParameters ¶
type CreateContentBodyParameters struct {
Content
Ancestors []struct {
ID string `json:"id,omitempty"`
} `json:"ancestors,omitempty"`
Space struct {
Key string `json:"key,omitempty"`
} `json:"space,omitempty"`
}
CreateContentBodyParameters query parameters for CreateContent
type GetContentQueryParameters ¶
type GetContentQueryParameters struct {
QueryParameters
Expand []string `url:"-"`
ExpandString string `url:"expand,omitempty"`
Limit int `url:"limit,omitempty"`
Orderby string `url:"orderby,omitempty"`
PostingDay string `url:"postingDay,omitempty"`
Spacekey string `url:"spaceKey,omitempty"`
Start int `url:"start,omitempty"`
Title string `url:"title,omitempty"`
Trigger string `url:"trigger,omitempty"`
Type string `url:"type,omitempty"`
}
GetContentQueryParameters query parameters for GetContent
type QueryParameters ¶
type QueryParameters struct {
Expand []string `url:"expand,omitempty"`
Status string `url:"status,omitempty"`
}
QueryParameters provides default query parameters for client
type SearchQueryParameters ¶
type SearchQueryParameters struct {
CQL string `url:"cql"`
CQLContext string `url:"cqlcontext,omitempty"`
IncludeArchivedSpaces bool `url:"includeArchivedSpaces,omitempty"`
Limit int `url:"limit,omitempty"`
Start int `url:"start,omitempty"`
}
SearchQueryParameters query parameters for Search
type SearchResponse ¶
type SearchResponse struct {
APIResponse
Results []SearchResult `json:"results,omitempty"`
Start int `json:"start,omitempty"`
Limit int `json:"limit,omitempty"`
Size int `json:"size,omitempty"`
TotalSize int `json:"totalSize,omitempty"`
CqlQuery string `json:"cqlQuery,omitempty"`
SearchDuration int `json:"searchDuration,omitempty"`
Links struct {
Base string `json:"base,omitempty"`
Context string `json:"context,omitempty"`
} `json:"_links,omitempty"`
}
SearchResponse represents the data returned from the Confluence API
type SearchResult ¶
type SearchResult struct {
Space struct {
Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Metadata struct {
} `json:"metadata,omitempty"`
Status string `json:"status,omitempty"`
Expandable struct {
Operations string `json:"operations,omitempty"`
Permissions string `json:"permissions,omitempty"`
Description string `json:"description,omitempty"`
} `json:"_expandable,omitempty"`
Links struct {
Self string `json:"self,omitempty"`
} `json:"_links,omitempty"`
} `json:"space,omitempty"`
Title string `json:"title,omitempty"`
Excerpt string `json:"excerpt,omitempty"`
URL string `json:"url,omitempty"`
ResultGlobalContainer struct {
Title string `json:"title"`
DisplayURL string `json:"displayUrl"`
} `json:"resultGlobalContainer"`
Breadcrumbs []interface{} `json:"breadcrumbs,omitempty"`
EntityType string `json:"entityType,omitempty"`
IconCSSClass string `json:"iconCssClass,omitempty"`
LastModified time.Time `json:"lastModified,omitempty"`
FriendlyLastModified string `json:"friendlyLastModified,omitempty"`
Score float64 `json:"score,omitempty"`
Content `json:"content,omitempty"`
}
SearchResult results from Search