confluence

package module
v5.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README

PkgGoDev GoReportCard GitHub Actions CI Status GitHub Actions CodeQL Status Codebeat badge

InstallationUsage exampleBuild StatusLicense


go-confluence is a Go package for working with Confluence REST API.

Currently, this package support only getting data from API (i.e., you cannot create or modify data using this package).

Installation

Make sure you have a working Go 1.15+ workspace (instructions), then:

go get -d pkg.re/essentialkaos/go-confluence.v5

For update to latest stable release, do:

go get -d -u pkg.re/essentialkaos/go-confluence.v5

Usage example

package main

import (
  "fmt"
  cf "pkg.re/essentialkaos/go-confluence.v5"
)

func main() {
  api, err := cf.NewAPI("https://confluence.domain.com", "john", "MySuppaPAssWOrd")
  api.SetUserAgent("MyApp", "1.2.3")

  if err != nil {
    fmt.Printf("Error: %v\n", err)
    return
  }

  content, err := cf.GetContentByID(
    "18173522", cf.ContentIDParameters{
      Version: 4,
      Expand:  []string{"space", "body.view", "version"},
    },
  )

  if err != nil {
    fmt.Printf("Error: %v\n", err)
    return
  }

  fmt.Println("ID: %s\n", content.ID)
}

Build Status

Branch Status
master (Stable) CI
develop (Unstable) CI

License

Apache License, Version 2.0

Documentation

Index

Constants

View Source
const (
	CONTENT_TYPE_ATTACHMENT = "attachment"
	CONTENT_TYPE_BLOGPOST   = "blogpost"
	CONTENT_TYPE_COMMENT    = "comment"
	CONTENT_TYPE_PAGE       = "page"
)

Content type

View Source
const (
	SEARCH_EXCERPT_INDEXED   = "indexed"
	SEARCH_EXCERPT_HIGHLIGHT = "highlight"
	SEARCH_EXCERPT_NONE      = "none"
)

Excerpt values

View Source
const (
	SPACE_TYPE_PERSONAL = "personal"
	SPACE_TYPE_GLOBAL   = "global"
)

Space type

View Source
const (
	SPACE_STATUS_CURRENT  = "current"
	SPACE_STATUS_ARCHIVED = "archived"
)

Content status

View Source
const (
	CONTENT_STATUS_CURRENT = "current"
	CONTENT_STATUS_TRASHED = "trashed"
	CONTENT_STATUS_DRAFT   = "draft"
)

Space status

View Source
const (
	UNITS_MINUTES = "minutes"
	UNITS_HOURS   = "hours"
	UNITS_DAYS    = "days"
	UNITS_MONTHS  = "months"
	UNITS_YEARS   = "years"
)

Units

View Source
const (
	OPERATION_READ   = "read"
	OPERATION_UPDATE = "update"
)

Operations types

View Source
const (
	CALENDAR_CONTEXT_MY    = "myCalendars"
	CALENDAR_CONTEXT_SPACE = "spaceCalendars"
)

Calendar context

View Source
const (
	// NAME is package name
	NAME = "Go-Confluence"

	// VERSION is package version
	VERSION = "5.1.2"
)

Variables

View Source
var (
	ErrInitEmptyURL      = errors.New("URL can't be empty")
	ErrInitEmptyUser     = errors.New("User can't be empty")
	ErrInitEmptyPassword = errors.New("Password can't be empty")
	ErrNoPerms           = errors.New("User does not have permission to use confluence")
	ErrQueryError        = errors.New("Query cannot be parsed")
	ErrNoContent         = errors.New("There is no content with the given id, or if the calling user does not have permission to view the content")
	ErrNoSpace           = errors.New("There is no space with the given key, or if the calling user does not have permission to view the space")
	ErrNoUserPerms       = errors.New("User does not have permission to view users")
	ErrNoUserFound       = errors.New("User with the given username or userkey does not exist")
)

API errors

Functions

func IsValidCalendarID

func IsValidCalendarID(id string) bool

IsValidCalendarID validates calendar ID

Types

type API

type API struct {
	Client *fasthttp.Client // Client is client for http requests
	// contains filtered or unexported fields
}

API is Confluence API struct

func NewAPI

func NewAPI(url, username, password string) (*API, error)

NewAPI create new API struct

func (api *API) GenTinyLink(contentID string) string

GenTinyLink generates tiny link for content with given ID

func (*API) GetAnonymousUser

func (api *API) GetAnonymousUser() (*User, error)

GetAnonymousUser fetch information about the how anonymous is represented in confluence https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#user-getAnonymous

func (*API) GetAttachments

func (api *API) GetAttachments(contentID string, params AttachmentParameters) (*ContentCollection, error)

GetAttachments fetch list of attachment Content entities within a single container https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content/{id}/child/attachment-getAttachments

func (*API) GetAuditRecords

func (api *API) GetAuditRecords(params AuditParameters) (*AuditRecordCollection, error)

GetAuditRecords fetch a list of AuditRecord instances dating back to a certain time https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#audit-getAuditRecords

func (*API) GetAuditRecordsSince

func (api *API) GetAuditRecordsSince(params AuditSinceParameters) (*AuditRecordCollection, error)

GetAuditRecordsSince fetch a list of AuditRecord instances dating back to a certain time https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#audit-getAuditRecords

func (*API) GetAuditRetention

func (api *API) GetAuditRetention() (*AuditRetentionInfo, error)

GetAuditRetention fetch the current retention period https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#audit-getRetentionPeriod

func (*API) GetCalendarEvents

func (api *API) GetCalendarEvents(params CalendarEventsParameters) (*CalendarEventCollection, error)

GetCalendarEvents fetch events from given calendar

func (*API) GetCalendars

func (api *API) GetCalendars(params CalendarsParameters) (*CalendarCollection, error)

func (*API) GetContent

func (api *API) GetContent(params ContentParameters) (*ContentCollection, error)

GetContent fetch list of Content https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content-getContent

func (*API) GetContentByID

func (api *API) GetContentByID(contentID string, params ContentIDParameters) (*Content, error)

GetContentByID fetch a piece of Content https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content-getContentById

func (*API) GetContentChildren

func (api *API) GetContentChildren(contentID string, params ChildrenParameters) (*Contents, error)

GetContentChildren fetch a map of the direct children of a piece of Content https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content/{id}/child-children

func (*API) GetContentChildrenByType

func (api *API) GetContentChildrenByType(contentID, contentType string, params ChildrenParameters) (*ContentCollection, error)

GetContentChildrenByType the direct children of a piece of Content, limited to a single child type https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content/{id}/child-childrenOfType

func (*API) GetContentComments

func (api *API) GetContentComments(contentID string, params ChildrenParameters) (*ContentCollection, error)

GetContentComments fetch the comments of a content https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content/{id}/child-commentsOfContent

func (*API) GetContentHistory

func (api *API) GetContentHistory(contentID string, params ExpandParameters) (*History, error)

GetContentHistory fetch the history of a particular piece of content https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content-getHistory

func (*API) GetCurrentUser

func (api *API) GetCurrentUser(params ExpandParameters) (*User, error)

GetCurrentUser fetch information about the current logged in user https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#user-getCurrent

func (*API) GetDescendants

func (api *API) GetDescendants(contentID string, params ExpandParameters) (*Contents, error)

GetDescendants fetch a map of the descendants of a piece of Content https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content/{id}/descendant-descendants

func (*API) GetDescendantsOfType

func (api *API) GetDescendantsOfType(contentID, descType string, params ExpandParameters) (*ContentCollection, error)

GetDescendantsOfType fetch the direct descendants of a piece of Content, limited to a single descendant type https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content/{id}/descendant-descendantsOfType

func (*API) GetGroup

func (api *API) GetGroup(groupName string, params ExpandParameters) (*Group, error)

GetGroup fetch the user group with the group name https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#group-getGroup

func (*API) GetGroupMembers

func (api *API) GetGroupMembers(groupName string, params CollectionParameters) (*UserCollection, error)

GetGroupMembers fetch a collection of users in the given group https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#group-getMembers

func (*API) GetGroups

func (api *API) GetGroups(params CollectionParameters) (*GroupCollection, error)

GetGroups fetch collection of user groups https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#group-getGroups

func (*API) GetLabels

func (api *API) GetLabels(contentID string, params LabelParameters) (*LabelCollection, error)

GetLabels fetch the list of labels on a piece of Content https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content/{id}/label-labels

func (*API) GetRestrictions

func (api *API) GetRestrictions(contentID, parentPageId, spaceKey string) (*Restrictions, error)

GetRestrictions returns restrictions for the content with permissions inheritance. Confluence API doesn't provide such an API method, so we use private JSON API.

func (*API) GetRestrictionsByOperation

func (api *API) GetRestrictionsByOperation(contentID string, params ExpandParameters) (*Restrictions, error)

GetRestrictionsByOperation fetch info about all restrictions by operation https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content/{id}/restriction-byOperation

func (*API) GetRestrictionsForOperation

func (api *API) GetRestrictionsForOperation(contentID, operation string, params CollectionParameters) (*Restriction, error)

GetRestrictionsForOperation fetch info about all restrictions of given operation https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content/{id}/restriction-forOperation

func (*API) GetSpace

func (api *API) GetSpace(spaceKey string, params Parameters) (*Space, error)

GetSpace fetch information about a space https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#space-space

func (*API) GetSpaceContent

func (api *API) GetSpaceContent(spaceKey string, params SpaceParameters) (*Contents, error)

GetSpaceContent fetch the content in this given space https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#space-contents

func (*API) GetSpaceContentWithType

func (api *API) GetSpaceContentWithType(spaceKey, contentType string, params SpaceParameters) (*Contents, error)

GetSpaceContentWithType fetch the content in this given space with the given type https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#space-contentsWithType

func (*API) GetSpaces

func (api *API) GetSpaces(params SpaceParameters) (*SpaceCollection, error)

GetSpaces fetch information about a number of spaces https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#space-spaces

func (*API) GetUser

func (api *API) GetUser(params UserParameters) (*User, error)

GetUser fetch information about a user identified by either user key or username https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#user-getUser

func (*API) GetUserGroups

func (api *API) GetUserGroups(params UserParameters) (*GroupCollection, error)

GetUserGroups fetch collection of groups that the given user is a member of https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#user-getGroups

func (*API) IsWatchingContent

func (api *API) IsWatchingContent(contentID string, params WatchParameters) (*WatchStatus, error)

IsWatchingContent fetch information about whether a user is watching a specified content https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#user/watch-isWatchingContent

func (*API) IsWatchingSpace

func (api *API) IsWatchingSpace(spaceKey string, params WatchParameters) (*WatchStatus, error)

IsWatchingSpace fetch information about whether a user is watching a specified space https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#user/watch-isWatchingSpace

func (*API) ListWatchers

func (api *API) ListWatchers(params ListWatchersParameters) (*WatchInfo, error)

ListWatchers fetch information about all watcher of given page

func (*API) ProfileURL

func (api *API) ProfileURL(u *User) string

ProfileURL return link to profile

func (*API) Search

func (api *API) Search(params SearchParameters) (*SearchResult, error)

Search search for entities in Confluence using the Confluence Query Language (CQL) https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#search-search

func (*API) SearchContent

func (api *API) SearchContent(params ContentSearchParameters) (*ContentCollection, error)

SearchContent fetch a list of content using the Confluence Query Language (CQL) https://docs.atlassian.com/ConfluenceServer/rest/7.3.4/#content-search

func (*API) SetUserAgent

func (api *API) SetUserAgent(app, version string)

SetUserAgent set user-agent string based on app name and version

type AttachmentParameters

type AttachmentParameters struct {
	Filename  string   `query:"filename"`
	MediaType string   `query:"mediaType"`
	Expand    []string `query:"expand"`
	Start     int      `query:"start"`
	Limit     int      `query:"limit"`
}

AttachmentParameters is params for fetching attachments info

func (AttachmentParameters) ToQuery

func (p AttachmentParameters) ToQuery() string

ToQuery convert params to URL query

func (AttachmentParameters) Validate

func (p AttachmentParameters) Validate() error

Validate validates parameters

type AuditParameters

type AuditParameters struct {
	StartDate    time.Time `query:"startDate"`
	EndDate      time.Time `query:"endDate"`
	SearchString string    `query:"searchString"`
	Start        int       `query:"start"`
	Limit        int       `query:"limit"`
}

AuditParameters is params for fetching audit data

func (AuditParameters) ToQuery

func (p AuditParameters) ToQuery() string

ToQuery convert params to URL query

func (AuditParameters) Validate

func (p AuditParameters) Validate() error

Validate validates parameters

type AuditRecord

type AuditRecord struct {
	Author        *User      `json:"author"`
	RemoteAddress string     `json:"remoteAddress"`
	CreationDate  *Timestamp `json:"creationDate"`
	Summary       string     `json:"summary"`
	Description   string     `json:"description"`
	Category      string     `json:"category"`
	IsSysAdmin    bool       `json:"sysAdmin"`
}

AuditRecord represents audit record

type AuditRecordCollection

type AuditRecordCollection struct {
	Results []*AuditRecord `json:"results"`
	Start   int            `json:"start"`
	Limit   int            `json:"limit"`
	Size    int            `json:"size"`
}

AuditRecordCollection contains paginated list of audit record

type AuditRetentionInfo

type AuditRetentionInfo struct {
	Number int    `json:"number"`
	Units  string `json:"units"`
}

AuditRetentionInfo contains info about retention time

type AuditSinceParameters

type AuditSinceParameters struct {
	Number       int    `query:"number"`
	Units        string `query:"units"`
	SearchString string `query:"searchString"`
	Start        int    `query:"start"`
	Limit        int    `query:"limit"`
}

AuditSinceParameters is params for fetching audit data

func (AuditSinceParameters) ToQuery

func (p AuditSinceParameters) ToQuery() string

ToQuery convert params to URL query

func (AuditSinceParameters) Validate

func (p AuditSinceParameters) Validate() error

Validate validates parameters

type Body

type Body struct {
	View        *View `json:"view"`
	ExportView  *View `json:"export_view"`
	StyledView  *View `json:"styled_view"`
	StorageView *View `json:"storage"`
}

Body contains content data

type Calendar

type Calendar struct {
	UsersPermittedToView      []*PermsUser `json:"usersPermittedToView"`
	UsersPermittedToEdit      []*PermsUser `json:"usersPermittedToEdit"`
	GroupsPermittedToView     []string     `json:"groupsPermittedToView"`
	GroupsPermittedToEdit     []string     `json:"groupsPermittedToEdit"`
	Warnings                  []string     `json:"warnings"`
	ChildSubCalendars         []*Calendar  `json:"childSubCalendars"`
	SubscriberCount           int          `json:"subscriberCount"`
	SubCalendar               *SubCalendar `json:"subCalendar"`
	ReminderMe                bool         `json:"reminderMe"`
	IsHidden                  bool         `json:"hidden"`
	IsEditable                bool         `json:"editable"`
	IsReloadable              bool         `json:"reloadable"`
	IsDeletable               bool         `json:"deletable"`
	IsEventsHidden            bool         `json:"eventsHidden"`
	IsWatchedViaContent       bool         `json:"watchedViaContent"`
	IsAdministrable           bool         `json:"administrable"`
	IsWatched                 bool         `json:"watched"`
	IsEventsViewable          bool         `json:"eventsViewable"`
	IsEventsEditable          bool         `json:"eventsEditable"`
	IsSubscribedByCurrentUser bool         `json:"subscribedByCurrentUser"`
}

Calendar represents Team Calendars calendar

type CalendarCollection

type CalendarCollection struct {
	Calendars []*Calendar `json:"payload"`
	Success   bool        `json:"success"`
}

CalendarCollection contains slice with calendars

type CalendarEvent

type CalendarEvent struct {
	Invitees              []*CalendarUser `json:"invitees"`
	WorkingURL            string          `json:"workingUrl"`
	Description           string          `json:"description"`
	ClassName             string          `json:"className"`
	ShortTitle            string          `json:"shortTitle"`
	Title                 string          `json:"title"`
	EventType             string          `json:"eventType"`
	ID                    string          `json:"id"`
	CustomEventTypeID     string          `json:"customEventTypeId"`
	SubCalendarID         string          `json:"subCalendarId"`
	IconURL               string          `json:"iconUrl"`
	IconLink              string          `json:"iconLink"`
	MediumIconURL         string          `json:"mediumIconUrl"`
	BackgroundColor       string          `json:"backgroundColor"`
	BorderColor           string          `json:"borderColor"`
	TextColor             string          `json:"textColor"`
	ColorScheme           string          `json:"colorScheme"`
	Where                 string          `json:"where"`
	FormattedStartDate    string          `json:"confluenceFormattedStartDate"`
	Start                 *Date           `json:"start"`
	End                   *Date           `json:"end"`
	OriginalStartDateTime *Date           `json:"originalStartDateTime"`
	OriginalEndDateTime   *Date           `json:"originalEndDateTime"`
	IsExpandDates         bool            `json:"expandDates"`
	IsEditable            bool            `json:"editable"`
	IsAllDay              bool            `json:"allDay"`
}

CalendarEvent represents Team Calendars event

type CalendarEventCollection

type CalendarEventCollection struct {
	Events  []*CalendarEvent `json:"events"`
	Success bool             `json:"success"`
}

CalendarEventCollection contains slice with events

type CalendarEventsParameters

type CalendarEventsParameters struct {
	SubCalendarID  string    `query:"subCalendarId"`
	UserTimezoneID string    `query:"userTimeZoneId"`
	Start          time.Time `query:"start,timedate"`
	End            time.Time `query:"end,timedate"`
	// contains filtered or unexported fields
}

CalendarEventsParameters contains request params for events from Team Calendars API

func (CalendarEventsParameters) ToQuery

func (p CalendarEventsParameters) ToQuery() string

ToQuery convert params to URL query

func (CalendarEventsParameters) Validate

func (p CalendarEventsParameters) Validate() error

Validate validates parameters

type CalendarUser

type CalendarUser struct {
	DisplayName   string `json:"displayName"`
	Name          string `json:"name"`
	ID            string `json:"id"`
	Type          string `json:"type"`
	AvatarIconURL string `json:"avatarIconUrl"`
	Email         string `json:"email"`
}

CalendarUser represents Team Calendars user

type CalendarsParameters

type CalendarsParameters struct {
	IncludeSubCalendarID []string `query:"include,unwrap"`
	CalendarContext      string   `query:"calendarContext"`
	ViewingSpaceKey      string   `query:"viewingSpaceKey"`
	// contains filtered or unexported fields
}

CalendarsParameters contains request params for calendars from Team Calendars API

func (CalendarsParameters) ToQuery

func (p CalendarsParameters) ToQuery() string

ToQuery convert params to URL query

func (CalendarsParameters) Validate

func (p CalendarsParameters) Validate() error

Validate validates parameters

type ChildrenParameters

type ChildrenParameters struct {
	ParentVersion int      `query:"parentVersion"`
	Location      string   `query:"location"`
	Depth         string   `query:"depth"`
	Expand        []string `query:"expand"`
	Start         int      `query:"start"`
	Limit         int      `query:"limit"`
}

ChildrenParameters is params for fetching content child info

func (ChildrenParameters) ToQuery

func (p ChildrenParameters) ToQuery() string

ToQuery convert params to URL query

func (ChildrenParameters) Validate

func (p ChildrenParameters) Validate() error

Validate validates parameters

type CollectionParameters

type CollectionParameters struct {
	Expand []string `query:"expand"`
	Start  int      `query:"start"`
	Limit  int      `query:"limit"`
}

CollectionParameters is params with pagination info

func (CollectionParameters) ToQuery

func (p CollectionParameters) ToQuery() string

ToQuery convert params to URL query

func (CollectionParameters) Validate

func (p CollectionParameters) Validate() error

Validate validates parameters

type Container

type Container struct {
	ID    ContainerID `json:"id"`
	Key   string      `json:"key"`   // Space
	Name  string      `json:"name"`  // Space
	Title string      `json:"title"` // Page or blogpost
	Links *Links      `json:"_links"`
}

Container contains basic container info

func (*Container) IsPage

func (c *Container) IsPage() bool

IsPage return true if container is page

func (*Container) IsSpace

func (c *Container) IsSpace() bool

IsSpace return true if container is space

type ContainerID

type ContainerID string

ContainerID is container ID

func (*ContainerID) UnmarshalJSON

func (c *ContainerID) UnmarshalJSON(b []byte) error

UnmarshalJSON is custom container ID unmarshaler

type Content

type Content struct {
	ID          string       `json:"id"`
	Type        string       `json:"type"`
	Status      string       `json:"status"`
	Title       string       `json:"title"`
	Extensions  *Extensions  `json:"extensions"`
	Metadata    *Metadata    `json:"metadata"`
	Container   *Container   `json:"container"`
	Space       *Space       `json:"space"`
	Version     *Version     `json:"version"`
	Operations  []*Operation `json:"operations"`
	Children    *Contents    `json:"children"`
	Ancestors   []*Content   `json:"ancestors"`
	Descendants *Contents    `json:"descendants"`
	Body        *Body        `json:"body"`
	Links       *Links       `json:"_links"`
}

Content contains content info

func (*Content) IsAttachment

func (c *Content) IsAttachment() bool

IsAttachment return true if content is attachment

func (*Content) IsComment

func (c *Content) IsComment() bool

IsComment return true if content is comment

func (*Content) IsDraft

func (c *Content) IsDraft() bool

IsDraft return true if content is draft

func (*Content) IsPage

func (c *Content) IsPage() bool

IsPage return true if content is page

func (*Content) IsTrashed

func (c *Content) IsTrashed() bool

IsTrashed return true if content is trashed

type ContentCollection

type ContentCollection struct {
	Results []*Content `json:"results"`
	Start   int        `json:"start"`
	Limit   int        `json:"limit"`
	Size    int        `json:"size"`
}

ContentCollection represents paginated list of content

type ContentIDParameters

type ContentIDParameters struct {
	Status  string   `query:"status"`
	Version int      `query:"version"`
	Expand  []string `query:"expand"`
}

ContentIDParameters is params for fetching content info

func (ContentIDParameters) ToQuery

func (p ContentIDParameters) ToQuery() string

ToQuery convert params to URL query

func (ContentIDParameters) Validate

func (p ContentIDParameters) Validate() error

Validate validates parameters

type ContentParameters

type ContentParameters struct {
	Type       string    `query:"type"`
	SpaceKey   string    `query:"spaceKey"`
	Title      string    `query:"title"`
	Status     string    `query:"status"`
	PostingDay time.Time `query:"postingDay"`
	Expand     []string  `query:"expand"`
	Start      int       `query:"start"`
	Limit      int       `query:"limit"`
}

ContentParameters is params for fetching content info

func (ContentParameters) ToQuery

func (p ContentParameters) ToQuery() string

ToQuery convert params to URL query

func (ContentParameters) Validate

func (p ContentParameters) Validate() error

Validate validates parameters

type ContentSearchParameters

type ContentSearchParameters struct {
	CQL        string   `query:"cql"`
	CQLContext string   `query:"cqlcontext"`
	Expand     []string `query:"expand"`
	Start      int      `query:"start"`
	Limit      int      `query:"limit"`
}

ContentSearchParameters is params for searching content

func (ContentSearchParameters) ToQuery

func (p ContentSearchParameters) ToQuery() string

ToQuery convert params to URL query

func (ContentSearchParameters) Validate

func (p ContentSearchParameters) Validate() error

Validate validates parameters

type Contents

type Contents struct {
	Attachments *ContentCollection `json:"attachment"`
	Comments    *ContentCollection `json:"comment"`
	Pages       *ContentCollection `json:"page"`
	Blogposts   *ContentCollection `json:"blogposts"`
}

Contents contains all types of content

type Contributors

type Contributors struct {
	Publishers *Publishers `json:"publishers"`
}

Contributors contains contributors list

type CustomEventType

type CustomEventType struct {
	Created             string `json:"created"`
	Icon                string `json:"icon"`
	PeriodInMins        int    `json:"periodInMins"`
	CustomEventTypeID   string `json:"customEventTypeId"`
	Title               string `json:"title"`
	ParentSubCalendarID string `json:"parentSubCalendarId"`
}

CustomEventType contains info about custom event type

type Date

type Date struct {
	time.Time
}

Date is RFC3339 encoded date

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

UnmarshalJSON is custom Date format unmarshaler

type EmptyParameters

type EmptyParameters struct {
}

EmptyParameters is empty parameters

func (EmptyParameters) ToQuery

func (p EmptyParameters) ToQuery() string

ToQuery convert params to URL query

func (EmptyParameters) Validate

func (p EmptyParameters) Validate() error

Validate validates parameters

type EventTypeReminder

type EventTypeReminder struct {
	EventTypeID       string `json:"eventTypeId"`
	PeriodInMins      int    `json:"periodInMins"`
	IsCustomEventType bool   `json:"isCustomEventType"`
}

EventTypeReminder contains info about event reminder

type ExpandParameters

type ExpandParameters struct {
	Expand []string `query:"expand"`
}

ExpandParameters is params with field expand info

func (ExpandParameters) ToQuery

func (p ExpandParameters) ToQuery() string

ToQuery convert params to URL query

func (ExpandParameters) Validate

func (p ExpandParameters) Validate() error

Validate validates parameters

type ExtensionPosition

type ExtensionPosition int

ExtensionPosition is extension position

func (*ExtensionPosition) UnmarshalJSON

func (ep *ExtensionPosition) UnmarshalJSON(b []byte) error

UnmarshalJSON is custom position unmarshaler

type Extensions

type Extensions struct {
	Position   ExtensionPosition `json:"position"`   // Page
	MediaType  string            `json:"mediaType"`  // Attachment
	FileSize   int               `json:"fileSize"`   // Attachment
	Comment    string            `json:"comment"`    // Attachment
	Location   string            `json:"location"`   // Comment
	Resolution *Resolution       `json:"resolution"` // Comment
}

Extensions contains info about content extensions

type Group

type Group struct {
	Type string `json:"type"`
	Name string `json:"name"`
}

Group contains group info

type GroupCollection

type GroupCollection struct {
	Results []*Group `json:"results"`
	Start   int      `json:"start"`
	Limit   int      `json:"limit"`
	Size    int      `json:"size"`
}

GroupCollection contains paginated list of groups

type History

type History struct {
	CreatedBy       *User         `json:"createdBy"`
	CreatedDate     *Date         `json:"createdDate"`
	LastUpdated     *Version      `json:"lastUpdated"`
	PreviousVersion *Version      `json:"previousVersion"`
	NextVersion     *Version      `json:"nextVersion"`
	Contributors    *Contributors `json:"contributors"`
	IsLatest        bool          `json:"latest"`
}

History contains info about content history

type Icon

type Icon struct {
	Path      string `json:"path"`
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	IsDefault bool   `json:"isDefault"`
}

Icon contains icon info

type Label

type Label struct {
	Prefix string `json:"prefix"`
	Name   string `json:"name"`
	ID     string `json:"id"`
}

Label contains label info

type LabelCollection

type LabelCollection struct {
	Result []*Label `json:"results"`
	Start  int      `json:"start"`
	Limit  int      `json:"limit"`
	Size   int      `json:"size"`
}

LabelCollection contains paginated list of labels

type LabelParameters

type LabelParameters struct {
	Prefix string `query:"prefix"`
	Start  int    `query:"start"`
	Limit  int    `query:"limit"`
}

LabelParameters is params for fetching labels

func (LabelParameters) ToQuery

func (p LabelParameters) ToQuery() string

ToQuery convert params to URL query

func (LabelParameters) Validate

func (p LabelParameters) Validate() error

Validate validates parameters

type Links struct {
	WebUI  string `json:"webui"`
	TinyUI string `json:"tinyui"`
	Base   string `json:"base"`
}

Links contains links

type ListWatchersParameters

type ListWatchersParameters struct {
	PageID string `query:"pageId"`
}

ListWatchersParameters is params for fetching info about page watchers

func (ListWatchersParameters) ToQuery

func (p ListWatchersParameters) ToQuery() string

ToQuery convert params to URL query

func (ListWatchersParameters) Validate

func (p ListWatchersParameters) Validate() error

Validate validates parameters

type Metadata

type Metadata struct {
	Labels    *LabelCollection `json:"labels"`    // Page
	MediaType string           `json:"mediaType"` // Attachment
}

Metadata contains metadata records

type Operation

type Operation struct {
	Name       string `json:"operation"`
	TargetType string `json:"targetType"`
}

Operation contains operation info

type Parameters

type Parameters interface {
	ToQuery() string
	Validate() error
}

Parameters is interface for parameters structs

type PermsUser

type PermsUser struct {
	AvatarURL   string `json:"avatarUrl"`
	Name        string `json:"name"`
	DisplayName string `json:"fullName"`
	Key         string `json:"id"`
}

PermsUser represents Team Calendars permissions user

type Publishers

type Publishers struct {
	Users    []*User  `json:"users"`
	UserKeys []string `json:"userKeys"`
}

Publishers contains info about users

type Resolution

type Resolution struct {
	Status           string `json:"status"`
	LastModifier     *User  `json:"lastModifier"`
	LastModifiedDate *Date  `json:"lastModifiedDate"`
}

Resolution contains resolution info

type Restriction

type Restriction struct {
	Operation string           `json:"operation"`
	Data      *RestrictionData `json:"restrictions"`
}

Restriction contains restriction info for single operation

type RestrictionData

type RestrictionData struct {
	User  *UserCollection  `json:"user"`
	Group *GroupCollection `json:"group"`
}

RestrictionData contains restrictions data

type Restrictions

type Restrictions struct {
	Read   *Restriction `json:"read"`
	Update *Restriction `json:"update"`
}

Restrictions contains info about all restrictions

type SearchEntity

type SearchEntity struct {
	Content      *Content `json:"content"`
	Space        *Space   `json:"space"`
	User         *User    `json:"user"`
	Title        string   `json:"title"`
	Excerpt      string   `json:"excerpt"`
	URL          string   `json:"url"`
	EntityType   string   `json:"entityType"`
	LastModified *Date    `json:"lastModified"`
}

SearchEntity contains search result

type SearchParameters

type SearchParameters struct {
	Expand                []string `query:"expand"`
	CQL                   string   `query:"cql"`
	CQLContext            string   `query:"cqlcontext"`
	Excerpt               string   `query:"excerpt"`
	Start                 int      `query:"start"`
	Limit                 int      `query:"limit"`
	IncludeArchivedSpaces bool     `query:"includeArchivedSpaces"`
}

SearchParameters is params for fetching search results

func (SearchParameters) ToQuery

func (p SearchParameters) ToQuery() string

ToQuery convert params to URL query

func (SearchParameters) Validate

func (p SearchParameters) Validate() error

Validate validates parameters

type SearchResult

type SearchResult struct {
	Results        []*SearchEntity `json:"results"`
	Start          int             `json:"start"`
	Limit          int             `json:"limit"`
	Size           int             `json:"size"`
	TotalSize      int             `json:"totalSize"`
	CQLQuery       string          `json:"cqlQuery"`
	SearchDuration int             `json:"searchDuration"`
}

SearchResult contains contains paginated list of search results

type Space

type Space struct {
	ID    int    `json:"id"`
	Key   string `json:"key"`
	Name  string `json:"name"`
	Icon  *Icon  `json:"icon"`
	Type  string `json:"type"`
	Links *Links `json:"_links"`
}

Space contains info about space

func (*Space) IsArchived

func (s *Space) IsArchived() bool

IsArchived return true if space is archived

func (*Space) IsGlobal

func (s *Space) IsGlobal() bool

IsGlobal return true if space is global

func (*Space) IsPersonal

func (s *Space) IsPersonal() bool

IsPersonal return true if space is personal

type SpaceCollection

type SpaceCollection struct {
	Results []*Space `json:"results"`
	Start   int      `json:"start"`
	Limit   int      `json:"limit"`
	Size    int      `json:"size"`
}

SpaceCollection contains paginated list of spaces

type SpaceParameters

type SpaceParameters struct {
	SpaceKey  []string `query:"spaceKey,unwrap"`
	Expand    []string `query:"expand"`
	Type      string   `query:"type"`
	Status    string   `query:"status"`
	Label     string   `query:"label"`
	Depth     string   `query:"depth"`
	Start     int      `query:"start"`
	Limit     int      `query:"limit"`
	Favourite bool     `query:"favourite"`
}

SpaceParameters is params for fetching info about space

func (SpaceParameters) ToQuery

func (p SpaceParameters) ToQuery() string

ToQuery convert params to URL query

func (SpaceParameters) Validate

func (p SpaceParameters) Validate() error

Validate validates parameters

type SubCalendar

type SubCalendar struct {
	DisableEventTypes        []string             `json:"disableEventTypes"`
	CustomEventTypes         []*CustomEventType   `json:"customEventTypes"`
	SanboxEventTypeReminders []*EventTypeReminder `json:"sanboxEventTypeReminders"`
	Creator                  string               `json:"creator"`
	TypeKey                  string               `json:"typeKey"`
	Color                    string               `json:"color"`
	TimeZoneID               string               `json:"timeZoneId"`
	Description              string               `json:"description"`
	Type                     string               `json:"type"`
	SpaceKey                 string               `json:"spaceKey"`
	SpaceName                string               `json:"spaceName"`
	Name                     string               `json:"name"`
	ID                       string               `json:"id"`
	IsWatchable              bool                 `json:"watchable"`
	IsEventInviteesSupported bool                 `json:"eventInviteesSupported"`
	IsRestrictable           bool                 `json:"restrictable"`
}

SubCalendar represents Team Calendars sub-calendar

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp is UNIX timestamp in ms

func (*Timestamp) UnmarshalJSON

func (d *Timestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON is custom Timestamp format unmarshaler

type User

type User struct {
	Type           string `json:"type"`
	Name           string `json:"username"`
	Key            string `json:"userKey"`
	ProfilePicture *Icon  `json:"profilePicture"`
	DisplayName    string `json:"displayName"`
}

User contains user info

type UserCollection

type UserCollection struct {
	Results []*User `json:"results"`
	Start   int     `json:"start"`
	Limit   int     `json:"limit"`
	Size    int     `json:"size"`
}

UserCollection contains paginated list of users

type UserParameters

type UserParameters struct {
	Key      string   `query:"key"`
	Username string   `query:"username"`
	Expand   []string `query:"expand"`
	Start    int      `query:"start"`
	Limit    int      `query:"limit"`
}

UserParameters is params for fetching info about user

func (UserParameters) ToQuery

func (p UserParameters) ToQuery() string

ToQuery convert params to URL query

func (UserParameters) Validate

func (p UserParameters) Validate() error

Validate validates parameters

type Version

type Version struct {
	Message     string   `json:"message"`
	By          *User    `json:"by"`
	When        *Date    `json:"when"`
	Number      int      `json:"number"`
	Content     *Content `json:"content"`
	IsMinorEdit bool     `json:"minorEdit"`
	IsHidden    bool     `json:"hidden"`
}

Version contains info about content version

type View

type View struct {
	Representation string `json:"representation"`
	Value          string `json:"value"`
}

View is data view

type WatchInfo

type WatchInfo struct {
	PageWatchers  []*Watcher `json:"pageWatchers"`
	SpaceWatchers []*Watcher `json:"spaceWatchers"`
}

WatchInfo contains info about watchers

func (*WatchInfo) Combined

func (wi *WatchInfo) Combined() []*Watcher

Combined return united slice with all watchers

type WatchParameters

type WatchParameters struct {
	Key         string `query:"key"`
	Username    string `query:"username"`
	ContentType string `query:"contentType"`
}

WatchParameters is params for fetching info about watchers

func (WatchParameters) ToQuery

func (p WatchParameters) ToQuery() string

ToQuery convert params to URL query

func (WatchParameters) Validate

func (p WatchParameters) Validate() error

Validate validates parameters

type WatchStatus

type WatchStatus struct {
	IsWatching bool `json:"watching"`
}

WatchStatus contains watching status

type Watcher

type Watcher struct {
	AvatarURL   string `json:"avatarUrl"`
	Name        string `json:"name"`
	Key         string `json:"userKey"`
	DisplayName string `json:"fullName"`
	Type        string `json:"type"`
}

Watcher contains watcher info

Jump to

Keyboard shortcuts

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