types

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package types defines custom Go types that wrap or extend forgejo-sdk types.

These types are primarily used to format Forgejo API responses into human-readable Markdown for consumption by MCP tools and AI assistants.

Index

Constants

View Source
const VERSION = "dev-test"

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionTaskList

type ActionTaskList struct {
	*MyActionTaskResponse
}

ActionTaskList represents a list of action tasks response Used by endpoints: - GET /repos/{owner}/{repo}/actions/tasks

func (ActionTaskList) ToMarkdown

func (atl ActionTaskList) ToMarkdown() string

ToMarkdown renders action tasks as a numbered list with status Example: 1. **Build and Test** `success` Run ID: 123 | Job ID: 456 Started: 2024-01-15 14:30 | Duration: 2m15s Steps:

  • Setup Go `success`
  • Run Tests `success`

2. **Deploy** `running` Run ID: 124 | Job ID: 457 Started: 2024-01-15 14:35

type Attachment

type Attachment struct {
	*forgejo.Attachment
}

Attachment represents an attachment response with embedded SDK attachment Used by endpoints: - GET /repos/{owner}/{repo}/releases/{id}/assets (list release attachments) - POST /repos/{owner}/{repo}/releases/{id}/assets (create release attachment) - PATCH /repos/{owner}/{repo}/releases/assets/{id} (edit release attachment) - GET /repos/{owner}/{repo}/issues/{index}/attachments (list issue attachments) - POST /repos/{owner}/{repo}/issues/{index}/attachments (create issue attachment) - PATCH /repos/{owner}/{repo}/issues/{index}/attachments/{attachment_id} (edit issue attachment)

func (*Attachment) ToMarkdown

func (a *Attachment) ToMarkdown() string

ToMarkdown renders attachment with name, size and download link Example: **document.pdf** (1024 bytes) [Download](https://git.example.com/attachments/123)

type AttachmentList

type AttachmentList []*Attachment

AttachmentList represents a list of attachments response Used by endpoints: - GET /repos/{owner}/{repo}/releases/{id}/assets - GET /repos/{owner}/{repo}/issues/{index}/attachments

func (AttachmentList) ToMarkdown

func (al AttachmentList) ToMarkdown() string

ToMarkdown renders attachments as a bullet list with download info Example: - **document.pdf** (1024 bytes) [Download](https://git.example.com/attachments/123) - **screenshot.png** (2048 bytes) [Download](https://git.example.com/attachments/124)

type Comment

type Comment struct {
	*forgejo.Comment
}

Comment represents a comment response with embedded SDK comment Used by endpoints: - POST /repos/{owner}/{repo}/issues/{index}/comments (create)

func (*Comment) ToMarkdown

func (c *Comment) ToMarkdown() string

ToMarkdown renders comment with author, timestamp and content Example: **alice** (2024-01-15 14:30) I think the issue is in the authentication module...

type EmptyResponse

type EmptyResponse struct{}

EmptyResponse represents an empty response for endpoints that don't return data Used by endpoints that only return status codes: - DELETE /repos/{owner}/{repo}/labels/{id} - DELETE /repos/{owner}/{repo}/milestones/{id} - DELETE /repos/{owner}/{repo}/releases/{id} - DELETE /repos/{owner}/{repo}/releases/assets/{id} - DELETE /repos/{owner}/{repo}/issues/{index}/labels/{id} - DELETE /repos/{owner}/{repo}/issues/{index}/attachments/{attachment_id} - DELETE /repos/{owner}/{repo}/wiki/page/{pageName}

func (EmptyResponse) ToMarkdown

func (er EmptyResponse) ToMarkdown() string

ToMarkdown renders simple success message for empty responses Example: *Operation completed successfully*

type Issue

type Issue struct {
	*forgejo.Issue
}

Issue represents an issue response with embedded SDK issue Used by endpoints: - POST /repos/{owner}/{repo}/issues (create) - PATCH /repos/{owner}/{repo}/issues/{index} (edit)

func (*Issue) ToMarkdown

func (i *Issue) ToMarkdown() string

ToMarkdown renders issue with title, state, assignees, labels and basic info Example: **#123 Fix login bug** (open) Author: johndoe Assignees: [alice bob] Labels: [bug priority-high] Milestone: v1.0.0 Due: 2024-12-31

The login page crashes when...

type IssueBlockingList added in v0.0.3

type IssueBlockingList []*forgejo.Issue

IssueBlockingList represents a list of issues that are blocked by the current issue. According to Forgejo API definition, these are issues that cannot be closed until the current issue is closed. Used by list_issue_blocking endpoint.

func (IssueBlockingList) ToMarkdown added in v0.0.3

func (ibl IssueBlockingList) ToMarkdown() string

ToMarkdown renders issue blocking list with essential information for quick scanning Shows: #Index **Title** (state) Example per issue: #123 **Fix authentication bug** (open) #45 **Update user model** (closed)

type IssueDependencyList

type IssueDependencyList []*forgejo.Issue

IssueDependencyList represents a list of issues that block the current issue. According to Forgejo API definition, these are issues that must be closed before the current issue can be closed. Used by list_issue_dependencies endpoint.

func (IssueDependencyList) ToMarkdown

func (idl IssueDependencyList) ToMarkdown() string

ToMarkdown renders issue dependencies with essential information for quick scanning Shows: #Index **Title** (state) Example per issue: #123 **Fix authentication bug** (open) #45 **Update user model** (closed)

type IssueList added in v0.0.3

type IssueList []*forgejo.Issue

IssueList represents a list of issues optimized for list display Used by list_repo_issues endpoint to show essential information only

func (IssueList) ToMarkdown added in v0.0.3

func (il IssueList) ToMarkdown() string

ToMarkdown renders issues with essential information for quick scanning Shows: Index, Title, State, Assignees, Labels, Updated time, Comments count Example per issue: #123 Fix login bug (open) | [testuser] | [bug priority-high] | 2024-01-15 | 5 comments

type Label

type Label struct {
	*forgejo.Label
}

Label represents a label response with embedded SDK label Used by endpoints: - GET /repos/{owner}/{repo}/labels (list) - POST /repos/{owner}/{repo}/labels (create) - PATCH /repos/{owner}/{repo}/labels/{id} (edit) - POST /repos/{owner}/{repo}/issues/{index}/labels (add to issue) - PUT /repos/{owner}/{repo}/issues/{index}/labels (replace issue labels) - DELETE /repos/{owner}/{repo}/issues/{index}/labels/{id} (remove from issue)

func (*Label) ToMarkdown

func (l *Label) ToMarkdown() string

ToMarkdown renders a label as a colored badge with name and description Example: **bug** `#ff0000` - Something isn't working

type LabelList

type LabelList []*Label

LabelList represents a list of labels response Used by endpoints: - GET /repos/{owner}/{repo}/labels - POST /repos/{owner}/{repo}/issues/{index}/labels - PUT /repos/{owner}/{repo}/issues/{index}/labels

func (LabelList) ToMarkdown

func (ll LabelList) ToMarkdown() string

ToMarkdown renders labels as a bullet list of colored badges Example: - **bug** `#ff0000` - Something isn't working - **enhancement** `#a2eeef` - New feature or request

type Milestone

type Milestone struct {
	*forgejo.Milestone
}

Milestone represents a milestone response with embedded SDK milestone Used by endpoints: - GET /repos/{owner}/{repo}/milestones (list) - POST /repos/{owner}/{repo}/milestones (create) - PATCH /repos/{owner}/{repo}/milestones/{id} (edit)

func (*Milestone) ToMarkdown

func (m *Milestone) ToMarkdown() string

ToMarkdown renders milestone with title, state, due date and progress Example: **v1.0.0** (open) - Due: 2024-12-31 - Progress: 5/10 Fix critical bugs before release

type MilestoneList

type MilestoneList []*Milestone

MilestoneList represents a list of milestones response Used by endpoints: - GET /repos/{owner}/{repo}/milestones

func (MilestoneList) ToMarkdown

func (ml MilestoneList) ToMarkdown() string

ToMarkdown renders milestones as a numbered list with essential details only Description is omitted to reduce memory usage for AI assistants Example: 1. **v1.0.0** (open) - Due: 2024-12-31 - Progress: 5/10 2. **v0.9.0** (closed) - Progress: 10/10

type MyActionTask added in v0.0.3

type MyActionTask struct {
	ID           int64     `json:"id"`
	Name         string    `json:"name"`
	DisplayTitle string    `json:"display_title"` // title of last commit
	Status       string    `json:"status"`
	Event        string    `json:"event"`       //push, pull_request, etc.
	WorkflowID   string    `json:"workflow_id"` // filename of yaml
	HeadBranch   string    `json:"head_branch"`
	HeadSHA      string    `json:"head_sha"`
	RunNumber    int64     `json:"run_number"` // run#N
	URL          string    `json:"url"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
	RunStartedAt time.Time `json:"run_started_at"`
}

MyActionTask represents a Forgejo Actions task.

func (*MyActionTask) ToMarkdown added in v0.0.3

func (at *MyActionTask) ToMarkdown() string

ToMarkdown renders action task with name, status, execution info and timing

type MyActionTaskResponse added in v0.0.3

type MyActionTaskResponse struct {
	TotalCount   int64           `json:"total_count"`
	WorkflowRuns []*MyActionTask `json:"workflow_runs"`
}

MyActionTaskResponse represents the response for listing action tasks.

type MyCreateWikiPageOptions added in v0.0.3

type MyCreateWikiPageOptions struct {
	Title         string `json:"title"`
	ContentBase64 string `json:"content_base64"`
	Message       string `json:"message,omitempty"`
}

MyCreateWikiPageOptions represents options for creating a wiki page.

type MyIssueMeta added in v0.0.3

type MyIssueMeta struct {
	Index int64  `json:"index"`
	Owner string `json:"owner,omitempty"`
	Name  string `json:"repo,omitempty"`
}

MyIssueMeta represents basic issue information for dependency operations. This type is not available in the Forgejo SDK.

type MyWikiCommit added in v0.0.3

type MyWikiCommit struct {
	ID        string              `json:"sha"`
	Author    *forgejo.CommitUser `json:"author"`
	Committer *forgejo.CommitUser `json:"commiter"` // Note: API has typo "commiter"
	Message   string              `json:"message"`
}

MyWikiCommit represents wiki page commit/revision information.

type MyWikiPage added in v0.0.3

type MyWikiPage struct {
	Title         string        `json:"title"`
	HTMLURL       string        `json:"html_url"`
	SubURL        string        `json:"sub_url"`
	LastCommit    *MyWikiCommit `json:"last_commit"`
	ContentBase64 string        `json:"content_base64"`
	CommitCount   int64         `json:"commit_count"`
	Sidebar       string        `json:"sidebar"`
	Footer        string        `json:"footer"`
}

MyWikiPage represents a complete wiki page with content.

type MyWikiPageMetaData added in v0.0.3

type MyWikiPageMetaData struct {
	Title      string        `json:"title"`
	HTMLURL    string        `json:"html_url"`
	SubURL     string        `json:"sub_url"`
	LastCommit *MyWikiCommit `json:"last_commit"`
}

MyWikiPageMetaData represents wiki page meta information.

type PullRequest

type PullRequest struct {
	*forgejo.PullRequest
}

PullRequest represents a pull request response with embedded SDK pull request Used by endpoints: - GET /repos/{owner}/{repo}/pulls (list) - GET /repos/{owner}/{repo}/pulls/{index} (get)

func (*PullRequest) ToMarkdown

func (pr *PullRequest) ToMarkdown() string

ToMarkdown renders pull request with title, state, author and branch info Example: **#42 Add user authentication** (open) Author: johndoe Branch: feature/auth → main

This PR implements OAuth2 authentication...

type PullRequestList

type PullRequestList []*PullRequest

PullRequestList represents a list of pull requests response Used by endpoints: - GET /repos/{owner}/{repo}/pulls

func (PullRequestList) ToMarkdown

func (prl PullRequestList) ToMarkdown() string

ToMarkdown renders pull requests as a numbered list with basic info Example: 1. **#42 Add user authentication** (open) Author: johndoe Branch: feature/auth → main

This PR implements OAuth2 authentication... 2. **#41 Fix database connection** (merged) Author: alice Branch: bugfix/db → main

type Release

type Release struct {
	*forgejo.Release
}

Release represents a release response with embedded SDK release Used by endpoints: - GET /repos/{owner}/{repo}/releases (list) - POST /repos/{owner}/{repo}/releases (create) - PATCH /repos/{owner}/{repo}/releases/{id} (edit)

func (*Release) ToMarkdown

func (r *Release) ToMarkdown() string

ToMarkdown renders release with tag, name, draft/prerelease status and description Example: **v1.0.0** - Major Release `PRERELEASE` (2024-01-15) This release includes new authentication system and bug fixes...

type ReleaseList

type ReleaseList []*Release

ReleaseList represents a list of releases response Used by endpoints: - GET /repos/{owner}/{repo}/releases

func (ReleaseList) ToMarkdown

func (rl ReleaseList) ToMarkdown() string

ToMarkdown renders releases as a numbered list with details Example: 1. **v1.0.0** - Major Release `PRERELEASE` (2024-01-15) This release includes new authentication system... 2. **v0.9.0** - Beta Release (2024-01-01) Initial beta version with core features

type Repository

type Repository struct {
	*forgejo.Repository
}

Repository represents a repository response with embedded SDK repository Used by endpoints: - GET /repos/search - GET /user/repos - GET /orgs/{org}/repos

func (*Repository) ToMarkdown

func (r *Repository) ToMarkdown() string

ToMarkdown renders repository with name, description, stats and key info Example: **owner/repo-name** `PRIVATE` `FORK` A sample repository for testing purposes Stars: 42 | Forks: 7 | Issues: 3 | PRs: 1 [View Repository](https://git.example.com/owner/repo-name)

type RepositoryList

type RepositoryList []*Repository

RepositoryList represents a list of repositories response Used by endpoints: - GET /repos/search - GET /user/repos - GET /orgs/{org}/repos

func (RepositoryList) ToMarkdown

func (rl RepositoryList) ToMarkdown() string

ToMarkdown renders repositories as a numbered list with basic stats Example: 1. **owner/repo-name** `PRIVATE` `FORK` A sample repository for testing purposes Stars: 42 | Forks: 7 | Issues: 3 | PRs: 1 [View Repository](https://git.example.com/owner/repo-name) 2. **owner/another-repo** Another repository Stars: 15 | Forks: 2 | Issues: 0 | PRs: 0

type WikiPage

type WikiPage struct {
	*MyWikiPage
}

WikiPage represents a wiki page response (custom implementation as SDK doesn't support) Used by endpoints: - GET /repos/{owner}/{repo}/wiki/page/{pageName} - POST /repos/{owner}/{repo}/wiki/new - PATCH /repos/{owner}/{repo}/wiki/page/{pageName}

func (*WikiPage) ToMarkdown

func (w *WikiPage) ToMarkdown() string

ToMarkdown renders wiki page with title, last modified date and content Example: # Getting Started *Last modified: 2024-01-15 14:30*

Welcome to our project wiki...

type WikiPageList

type WikiPageList []*MyWikiPageMetaData

WikiPageList represents a list of wiki pages response Used by endpoints: - GET /repos/{owner}/{repo}/wiki/pages

func (WikiPageList) ToMarkdown

func (wl WikiPageList) ToMarkdown() string

ToMarkdown renders wiki pages as a table of contents with links Example: ## Wiki Pages - **Getting Started** (2024-01-15) - **API Documentation** (2024-01-10) - **Contributing Guide** (2024-01-05)

Jump to

Keyboard shortcuts

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