github

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AchievementInfo

type AchievementInfo struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	EarnedAt    time.Time `json:"earned_at"`
	IsCompleted bool      `json:"is_completed"`
}

AchievementInfo represents achievement information for sharing

type ActionsManager

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

ActionsManager handles GitHub Actions integration

func NewActionsManager

func NewActionsManager(repoOwner, repoName string) *ActionsManager

NewActionsManager creates a new GitHub Actions manager

func (*ActionsManager) GenerateBadgeEndpointJSON

func (am *ActionsManager) GenerateBadgeEndpointJSON(label, message, color string) string

GenerateBadgeEndpointJSON generates JSON for Shields.io endpoint

func (*ActionsManager) GenerateWorkflowFile

func (am *ActionsManager) GenerateWorkflowFile(templateName string, params map[string]interface{}) (string, error)

GenerateWorkflowFile generates a workflow file for a given template

func (*ActionsManager) GetBadgeEndpoints

func (am *ActionsManager) GetBadgeEndpoints() []BadgeEndpoint

GetBadgeEndpoints returns available badge endpoints

func (*ActionsManager) GetWorkflowFilePath

func (am *ActionsManager) GetWorkflowFilePath(templateName string) string

GetWorkflowFilePath returns the file path for a workflow

func (*ActionsManager) GetWorkflowTemplates

func (am *ActionsManager) GetWorkflowTemplates() []WorkflowTemplate

GetWorkflowTemplates returns available workflow templates

type BadgeConfig

type BadgeConfig struct {
	Style     string // flat, flat-square, plastic, for-the-badge, social
	Color     string // Color for the badge
	LogoColor string // Logo color
}

BadgeConfig represents configuration for generating badges

func DefaultBadgeConfig

func DefaultBadgeConfig() BadgeConfig

DefaultBadgeConfig returns the default badge configuration

type BadgeEndpoint

type BadgeEndpoint struct {
	Path        string
	Label       string
	Description string
}

Badge endpoint configuration

type BadgeGenerator

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

BadgeGenerator handles generation of various GitHub badges

func NewBadgeGenerator

func NewBadgeGenerator(statsCalculator *stats.StatsCalculator, config BadgeConfig) *BadgeGenerator

NewBadgeGenerator creates a new badge generator

func (*BadgeGenerator) GenerateAchievementsBadge

func (bg *BadgeGenerator) GenerateAchievementsBadge(completed, total int) string

GenerateAchievementsBadge generates an achievements progress badge

func (*BadgeGenerator) GenerateCommandsBadge

func (bg *BadgeGenerator) GenerateCommandsBadge(totalCommands int) string

GenerateCommandsBadge generates a total commands badge

func (*BadgeGenerator) GenerateCustomBadge

func (bg *BadgeGenerator) GenerateCustomBadge(label, message, color string) string

GenerateCustomBadge generates a custom badge with provided label and message

func (*BadgeGenerator) GenerateLastActiveBadge

func (bg *BadgeGenerator) GenerateLastActiveBadge(lastActive time.Time) string

GenerateLastActiveBadge generates a last active badge

func (*BadgeGenerator) GenerateProductivityBadge

func (bg *BadgeGenerator) GenerateProductivityBadge(score float64) string

GenerateProductivityBadge generates a productivity score badge

func (*BadgeGenerator) GenerateStreakBadge

func (bg *BadgeGenerator) GenerateStreakBadge(streakDays int) string

GenerateStreakBadge generates a streak badge

func (*BadgeGenerator) GenerateXPBadge

func (bg *BadgeGenerator) GenerateXPBadge(userProgress *models.UserProgress) string

GenerateXPBadge generates an XP progress badge

func (*BadgeGenerator) GetAchievementColor

func (bg *BadgeGenerator) GetAchievementColor(percentage float64) string

func (*BadgeGenerator) GetActivityColor

func (bg *BadgeGenerator) GetActivityColor(lastActiveDiff time.Duration) string

func (*BadgeGenerator) GetCommandsColor

func (bg *BadgeGenerator) GetCommandsColor(commands int) string

func (*BadgeGenerator) GetProductivityColor

func (bg *BadgeGenerator) GetProductivityColor(score float64) string

func (*BadgeGenerator) GetStreakColor

func (bg *BadgeGenerator) GetStreakColor(days int) string

func (*BadgeGenerator) GetXPColor

func (bg *BadgeGenerator) GetXPColor(level int) string

Color determination methods

type DayActivity

type DayActivity struct {
	Date         time.Time `json:"date"`
	CommandCount int       `json:"command_count"`
	XPEarned     int       `json:"xp_earned"`
	Level        int       `json:"level"`
}

DayActivity represents activity data for a single day

type HeatmapData

type HeatmapData struct {
	Year       int           `json:"year"`
	StartDate  time.Time     `json:"start_date"`
	EndDate    time.Time     `json:"end_date"`
	Days       []DayActivity `json:"days"`
	TotalDays  int           `json:"total_days"`
	ActiveDays int           `json:"active_days"`
	MaxDaily   int           `json:"max_daily"`
	MinDaily   int           `json:"min_daily"`
	AvgDaily   float64       `json:"avg_daily"`
}

HeatmapData represents a year's worth of activity data

type HeatmapGenerator

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

HeatmapGenerator generates GitHub-style activity heatmaps

func NewHeatmapGenerator

func NewHeatmapGenerator(statsCalculator *stats.StatsCalculator) *HeatmapGenerator

NewHeatmapGenerator creates a new heatmap generator

func (*HeatmapGenerator) GenerateHTMLHeatmap

func (hg *HeatmapGenerator) GenerateHTMLHeatmap(data *HeatmapData) string

GenerateHTMLHeatmap creates an HTML representation of the heatmap

func (*HeatmapGenerator) GenerateMarkdownHeatmap

func (hg *HeatmapGenerator) GenerateMarkdownHeatmap(data *HeatmapData) string

GenerateMarkdownHeatmap creates a markdown representation

func (*HeatmapGenerator) GenerateSVGHeatmap

func (hg *HeatmapGenerator) GenerateSVGHeatmap(data *HeatmapData) string

GenerateSVGHeatmap creates an SVG representation of the heatmap

func (*HeatmapGenerator) GenerateYearHeatmap

func (hg *HeatmapGenerator) GenerateYearHeatmap(year int) (*HeatmapData, error)

GenerateYearHeatmap generates heatmap data for a specific year

type MonthlyStats

type MonthlyStats struct {
	TotalCommands int
	ActiveDays    int
	BestDay       int
}

type ProfileData

type ProfileData struct {
	UserProgress    *models.UserProgress `json:"user_progress"`
	BasicStats      *stats.BasicStats    `json:"basic_stats"`
	Achievements    []AchievementInfo    `json:"achievements"`
	BadgeURLs       map[string]string    `json:"badge_urls"`
	ProfileMarkdown string               `json:"profile_markdown"`
	LastUpdated     time.Time            `json:"last_updated"`
	AvatarURL       string               `json:"avatar_url,omitempty"`
	AvatarASCII     string               `json:"avatar_ascii,omitempty"`
}

ProfileData represents a user's complete profile data

type ProfileGenerator

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

ProfileGenerator handles generation of shareable profiles and summaries

func NewProfileGenerator

func NewProfileGenerator(statsCalculator *stats.StatsCalculator, badgeGenerator *BadgeGenerator) *ProfileGenerator

NewProfileGenerator creates a new profile generator

func (*ProfileGenerator) ExportProfile

func (pg *ProfileGenerator) ExportProfile(profileData *ProfileData, format string) ([]byte, error)

ExportProfile exports profile data in various formats

func (*ProfileGenerator) GenerateProfile

func (pg *ProfileGenerator) GenerateProfile(userProgress *models.UserProgress) (*ProfileData, error)

GenerateProfile generates a complete shareable profile

func (*ProfileGenerator) GenerateProfileWithAvatar added in v0.9.2

func (pg *ProfileGenerator) GenerateProfileWithAvatar(userProgress *models.UserProgress, avatarURL, avatarASCII string) (*ProfileData, error)

GenerateProfileWithAvatar generates a complete shareable profile with avatar

func (*ProfileGenerator) GenerateSocialSnippets

func (pg *ProfileGenerator) GenerateSocialSnippets(profileData *ProfileData) []SocialSnippet

GenerateSocialSnippets creates social media snippets for sharing

func (*ProfileGenerator) GenerateStatsSummary

func (pg *ProfileGenerator) GenerateStatsSummary(userProgress *models.UserProgress, basicStats *stats.BasicStats) string

GenerateStatsSummary creates a brief stats summary for sharing

type SocialSnippet

type SocialSnippet struct {
	Platform string `json:"platform"`
	Content  string `json:"content"`
	Tags     string `json:"tags"`
}

SocialSnippet represents a shareable social media snippet

type SyncManager

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

SyncManager handles GitHub synchronization

func NewSyncManager

func NewSyncManager(cfg *config.Config, statsCalculator *stats.StatsCalculator) *SyncManager

NewSyncManager creates a new sync manager

func (*SyncManager) ScheduleSync

func (sm *SyncManager) ScheduleSync(userProgress *models.UserProgress) error

ScheduleSync schedules automatic sync based on configuration

func (*SyncManager) SyncToRepository

func (sm *SyncManager) SyncToRepository(userProgress *models.UserProgress) (*SyncResult, error)

SyncToRepository syncs current stats to the configured GitHub repository

func (*SyncManager) TriggerGitHubAction

func (sm *SyncManager) TriggerGitHubAction(workflowName string) error

TriggerGitHubAction triggers a GitHub Action workflow

type SyncResult

type SyncResult struct {
	Success       bool      `json:"success"`
	Timestamp     time.Time `json:"timestamp"`
	FilesUpdated  []string  `json:"files_updated"`
	CommitHash    string    `json:"commit_hash,omitempty"`
	ErrorMessage  string    `json:"error_message,omitempty"`
	SyncDuration  string    `json:"sync_duration"`
	BadgesUpdated int       `json:"badges_updated"`
	ProfileSize   int       `json:"profile_size"`
}

SyncResult represents the result of a sync operation

type WorkflowTemplate

type WorkflowTemplate struct {
	Name        string
	Description string
	Template    string
}

WorkflowTemplate represents a GitHub Actions workflow template

Jump to

Keyboard shortcuts

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