Documentation
¶
Index ¶
- Constants
- Variables
- func GetGitStartAndEndLine(gitInfo *GitInfo, localStartLine, localEndLine int) (int, int, error)
- func ParseConfluenceItemID(id string) (string, bool)
- type Channels
- type Component
- type ConfluenceClient
- type ConfluenceClientOption
- type ConfluencePlugin
- type DiffType
- type DiscordPlugin
- type Document
- type EmptyFolder
- type FileSystemPlugin
- type Folder
- type GitInfo
- type GitPlugin
- type IPlugin
- type ISlackClient
- type ISourceItem
- type ListFoldersResponse
- type Option
- type Page
- type PageBody
- type PageVersion
- type PaligoClient
- type PaligoItem
- type PaligoPlugin
- type Plugin
- type PluginChannels
- type SlackPlugin
- type Space
- type StringBuilderPool
Constants ¶
const ( PALIGO_RATE_LIMIT_CHECK_INTERVAL = 5 * time.Second PALIGO_DOCUMENT_SHOW_LIMIT = 50 PALIGO_FOLDER_SHOW_LIMIT = 50 )
https://paligo.net/docs/apidocs/en/index-en.html#UUID-a5b548af-9a37-d305-f5a8-11142d86fe20
Variables ¶
var ( // ErrBaseURLInvalidOrUnreachable is returned when the base URL/host/service is invalid or unreachable. ErrBaseURLInvalidOrUnreachable = errors.New("base url invalid or service unreachable") // ErrBadCredentials indicates token is invalid/expired or username does not match the token. ErrBadCredentials = errors.New("bad credentials") // ErrMissingScopes indicates the token is valid but missing required scopes. ErrMissingScopes = errors.New("token missing required scopes") // ErrUnexpectedHTTPStatus is used for other non-2xx statuses not classified above. ErrUnexpectedHTTPStatus = errors.New("unexpected http status") // ErrAPIResponseTooLarge is returned internally when a single API response exceeds // the configured per-request size limit. Callers treat this as a soft failure: // skip the current batch and move on when possible. ErrAPIResponseTooLarge = errors.New("confluence api response exceeded configured size limit") // ErrTotalScanVolumeExceeded is returned when the total downloaded bytes across // the scan exceed the configured global limit. Callers should stop scanning // gracefully and not treat this as a hard failure. ErrTotalScanVolumeExceeded = errors.New("confluence total scan volume exceeded configured limit") )
var ErrFileDiffSizeExceeded = errors.New("file diff size exceeded")
var (
ErrHTTPSRequired = errors.New("must use https")
)
Functions ¶
func GetGitStartAndEndLine ¶
GetGitStartAndEndLine walks the diff hunks and discover the actual start and end lines of the file
func ParseConfluenceItemID ¶
ParseConfluenceItemID extracts the Confluence page ID from an item ID produced by NewConfluenceItemID. It returns ("", false) if the ID does not conform to the expected pattern.
Types ¶
type Channels ¶
type Channels struct {
Items chan ISourceItem
Errors chan error
// contains filtered or unexported fields
}
func (*Channels) GetErrorsCh ¶
func (*Channels) GetItemsCh ¶
func (c *Channels) GetItemsCh() chan ISourceItem
type Component ¶
type Component struct {
PaligoItem
Subtype string `json:"subtype"`
Creator int `json:"creator"`
Owner int `json:"owner"`
Author int `json:"author"`
CreatedAt int `json:"created_at"`
ModifiedAt int `json:"modified_at"`
Checkout bool `json:"checkout"`
CheckoutUser string `json:"checkout_user"`
ParentResource int `json:"parent_resource"`
Taxonomies []interface{} `json:"taxonomies"`
ReleaseStatus string `json:"release_status"`
Content string `json:"content"`
Languages []string `json:"languages"`
External []interface{} `json:"external"`
CustomAttributes []interface{} `json:"custom_attributes"`
}
type ConfluenceClient ¶
type ConfluenceClient interface {
WalkAllPages(ctx context.Context, limit int, visit func(*Page) error) error
WalkPagesByIDs(ctx context.Context, pageIDs []string, limit int, visit func(*Page) error) error
WalkPagesBySpaceIDs(ctx context.Context, spaceIDs []string, limit int, visit func(*Page) error) error
WalkPageVersions(ctx context.Context, pageID string, limit int, visit func(int) error) error
FetchPageAtVersion(ctx context.Context, pageID string, version int) (*Page, error)
WalkSpacesByKeys(ctx context.Context, spaceKeys []string, limit int, visit func(*Space) error) error
WikiBaseURL() string
APIResponseLimitHit() bool
}
ConfluenceClient defines the operations required by the Confluence plugin. Methods stream results via visitor callbacks and handle pagination internally.
func NewConfluenceClient ¶
func NewConfluenceClient(inputBaseURL, username, token string, opts ...ConfluenceClientOption) (ConfluenceClient, error)
NewConfluenceClient constructs a ConfluenceClient for the given base input URL. Behavior:
- Normalizes base wiki URL to "https://{host}/wiki".
- Discovers cloudId and always uses platform v2: "https://api.atlassian.com/ex/confluence/{cloudId}/wiki/api/v2".
- Applies any provided ConfluenceClientOption values (for example, response/scan size limits) before issuing API requests.
type ConfluenceClientOption ¶
type ConfluenceClientOption func(*httpConfluenceClient)
func WithMaxAPIResponseBytes ¶
func WithMaxAPIResponseBytes(n int64) ConfluenceClientOption
WithMaxAPIResponseBytes sets an optional per-request API response size limit in bytes. A value of 0 disables the limit. Negative values are treated as 0.
func WithMaxTotalScanBytes ¶
func WithMaxTotalScanBytes(n int64) ConfluenceClientOption
WithMaxTotalScanBytes sets an optional total downloaded-bytes limit in bytes for the entire Confluence scan. A value of 0 disables the limit. Negative values are treated as 0.
type ConfluencePlugin ¶
type ConfluencePlugin struct {
Plugin
SpaceIDs []string
SpaceKeys []string
PageIDs []string
History bool
// contains filtered or unexported fields
}
func (*ConfluencePlugin) DefineCommand ¶
func (p *ConfluencePlugin) DefineCommand(items chan ISourceItem, errs chan error) (*cobra.Command, error)
DefineCommand wires the Cobra command, flags, and pre-run initialization.
func (*ConfluencePlugin) GetName ¶
func (p *ConfluencePlugin) GetName() string
GetName returns the CLI subcommand name for this plugin.
func (*ConfluencePlugin) NewConfluenceItemID ¶
func (p *ConfluencePlugin) NewConfluenceItemID(pageID string, version int) string
NewConfluenceItemID builds the item ID for a Confluence page.
type DiscordPlugin ¶
type DiscordPlugin struct {
Token string
Guilds []string
Channels []string
Count int
BackwardDuration time.Duration
Session *discordgo.Session
// contains filtered or unexported fields
}
func (*DiscordPlugin) DefineCommand ¶
func (p *DiscordPlugin) DefineCommand(items chan ISourceItem, errors chan error) (*cobra.Command, error)
func (*DiscordPlugin) GetName ¶
func (p *DiscordPlugin) GetName() string
type Document ¶
type Document struct {
PaligoItem
Content string `json:"content"`
Languages []string `json:"languages"`
}
type EmptyFolder ¶
type EmptyFolder struct {
PaligoItem
Children string `json:"children"`
}
type FileSystemPlugin ¶
func (*FileSystemPlugin) DefineCommand ¶
func (p *FileSystemPlugin) DefineCommand(items chan ISourceItem, errors chan error) (*cobra.Command, error)
func (*FileSystemPlugin) GetName ¶
func (p *FileSystemPlugin) GetName() string
type Folder ¶
type Folder struct {
PaligoItem
Children []PaligoItem `json:"children"`
}
type GitInfo ¶
type GitInfo struct {
Hunks []*gitdiff.TextFragment
ContentType DiffType
}
type GitPlugin ¶
func (*GitPlugin) DefineCommand ¶
type IPlugin ¶
type IPlugin interface {
GetName() string
DefineCommand(items chan ISourceItem, errors chan error) (*cobra.Command, error)
}
func NewConfluencePlugin ¶
func NewConfluencePlugin() IPlugin
NewConfluencePlugin constructs a new Confluence plugin with a default chunker.
func NewGitPlugin ¶
func NewGitPlugin() IPlugin
type ISlackClient ¶
type ISourceItem ¶
type ListFoldersResponse ¶
type ListFoldersResponse struct {
Page int `json:"page"`
NextPage string `json:"next_page"`
TotalPages int `json:"total_pages"`
Folders []EmptyFolder `json:"folders"`
}
type Page ¶
type Page struct {
ID string `json:"id"`
Status string `json:"status"`
Title string `json:"title"`
SpaceID string `json:"spaceId"`
Type string `json:"type"`
Body PageBody `json:"body"`
Links map[string]string `json:"_links"`
Version PageVersion `json:"version"`
}
Page represents a Confluence page.
type PageBody ¶
type PageBody struct {
Storage *struct {
Value string `json:"value"`
} `json:"storage,omitempty"`
}
PageBody contains the Storage-Format body of a page.
type PageVersion ¶
type PageVersion struct {
Number int `json:"number"`
}
PageVersion models the "version" object returned by Confluence.
type PaligoClient ¶
type PaligoClient struct {
Instance string
// contains filtered or unexported fields
}
type PaligoItem ¶
type PaligoPlugin ¶
func (*PaligoPlugin) DefineCommand ¶
func (p *PaligoPlugin) DefineCommand(items chan ISourceItem, errors chan error) (*cobra.Command, error)
func (*PaligoPlugin) GetAuthorizationHeader ¶
func (p *PaligoPlugin) GetAuthorizationHeader() string
func (*PaligoPlugin) GetCredentials ¶
func (p *PaligoPlugin) GetCredentials() (string, string)
func (*PaligoPlugin) GetName ¶
func (p *PaligoPlugin) GetName() string
type PluginChannels ¶
type PluginChannels interface {
GetItemsCh() chan ISourceItem
GetErrorsCh() chan error
}
func NewChannels ¶
func NewChannels(opts ...Option) PluginChannels
type SlackPlugin ¶
func (*SlackPlugin) DefineCommand ¶
func (p *SlackPlugin) DefineCommand(items chan ISourceItem, errors chan error) (*cobra.Command, error)
func (*SlackPlugin) GetName ¶
func (p *SlackPlugin) GetName() string
type Space ¶
type Space struct {
ID string `json:"id"`
Key string `json:"key"`
Name string `json:"name"`
Links map[string]string `json:"_links"`
}
Space represents a Confluence space.
type StringBuilderPool ¶
type StringBuilderPool struct {
// contains filtered or unexported fields
}
StringBuilderPool provides thread-safe object pooling for string builders
func (*StringBuilderPool) Get ¶
func (p *StringBuilderPool) Get() *strings.Builder
Get retrieves a string builder from the pool
func (*StringBuilderPool) Put ¶
func (p *StringBuilderPool) Put(sb *strings.Builder)
Put returns a string builder to the pool with size limits
func (*StringBuilderPool) Stats ¶
func (p *StringBuilderPool) Stats() (gets, puts, discards, news int64, efficiency float64)
Stats returns pool efficiency statistics