remote

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectRemoteType

func DetectRemoteType(remoteURL, authToken string) (string, error)

DetectRemoteType detects whether a remote server is Forgejo or Gitea by calling the /api/v1/version endpoint and parsing the response

Types

type ClientInterface

ClientInterface combines IssueLister, IssueCommenter, IssueCommentLister, IssueCommentEditor, IssueCreator, IssueAttachmentCreator, IssueEditor, PullRequestLister, PullRequestCommentLister, PullRequestCommenter, PullRequestCommentEditor, PullRequestEditor, PullRequestCreator, PullRequestGetter, and FileContentFetcher for complete Git operations

type Comment

type Comment struct {
	ID      int    `json:"id"`
	Content string `json:"body"`
	Author  string `json:"user"`
	Created string `json:"created"`
	Updated string `json:"updated"`
}

Comment represents a comment on a Git repository issue or pull request

type CreateIssueArgs

type CreateIssueArgs struct {
	Repository string `json:"repository"`
	Title      string `json:"title"`
	Body       string `json:"body"`
}

CreateIssueArgs represents arguments for creating a new issue

type CreateIssueWithAttachmentsArgs

type CreateIssueWithAttachmentsArgs struct {
	CreateIssueArgs
	Attachments []ProcessedAttachment
}

CreateIssueWithAttachmentsArgs represents arguments for creating a new issue with attachments

type CreatePullRequestArgs

type CreatePullRequestArgs struct {
	Repository string `json:"repository"`
	Head       string `json:"head"` // Source branch
	Base       string `json:"base"` // Target branch
	Title      string `json:"title"`
	Body       string `json:"body"`
	Draft      bool   `json:"draft"`
	Assignee   string `json:"assignee"` // Single reviewer
}

CreatePullRequestArgs represents arguments for creating a new pull request

type CreatePullRequestCommentArgs

type CreatePullRequestCommentArgs struct {
	Repository        string `json:"repository"`
	PullRequestNumber int    `json:"pull_request_number"`
	Comment           string `json:"comment"`
}

CreatePullRequestCommentArgs represents the arguments for creating a pull request comment

type EditIssueArgs

type EditIssueArgs struct {
	Repository  string `json:"repository"`
	Directory   string `json:"directory"`
	IssueNumber int    `json:"issue_number"`
	Title       string `json:"title"`
	Body        string `json:"body"`
	State       string `json:"state"`
}

EditIssueArgs represents the arguments for editing an issue

type EditIssueCommentArgs

type EditIssueCommentArgs struct {
	Repository  string `json:"repository"`
	IssueNumber int    `json:"issue_number"`
	CommentID   int    `json:"comment_id"`
	NewContent  string `json:"new_content"`
}

EditIssueCommentArgs represents the arguments for editing an issue comment

type EditPullRequestArgs

type EditPullRequestArgs struct {
	Repository        string `json:"repository"`
	Directory         string `json:"directory"`
	PullRequestNumber int    `json:"pull_request_number"`
	Title             string `json:"title"`
	Body              string `json:"body"`
	State             string `json:"state"`
	BaseBranch        string `json:"base_branch"`
}

EditPullRequestArgs represents the arguments for editing a pull request

type EditPullRequestCommentArgs

type EditPullRequestCommentArgs struct {
	Repository        string `json:"repository"`
	PullRequestNumber int    `json:"pull_request_number"`
	CommentID         int    `json:"comment_id"`
	NewContent        string `json:"new_content"`
}

EditPullRequestCommentArgs represents the arguments for editing a pull request comment

type FileContentFetcher

type FileContentFetcher interface {
	GetFileContent(ctx context.Context, owner, repo, ref, filepath string) ([]byte, error)
}

FileContentFetcher defines interface for fetching repository file contents

type Issue

type Issue struct {
	ID      int    `json:"id"`
	Number  int    `json:"number"`
	Title   string `json:"title"`
	State   string `json:"state"`
	Body    string `json:"body,omitempty"`
	User    string `json:"user"`
	Updated string `json:"updated,omitempty"`
	Created string `json:"created,omitempty"`
}

Issue represents a Git repository issue

type IssueAttachmentCreator

type IssueAttachmentCreator interface {
	CreateIssueWithAttachments(ctx context.Context, args CreateIssueWithAttachmentsArgs) (*Issue, error)
}

IssueAttachmentCreator defines the interface for creating issues with attachments

type IssueCommentEditor

type IssueCommentEditor interface {
	EditIssueComment(ctx context.Context, args EditIssueCommentArgs) (*Comment, error)
}

IssueCommentEditor defines the interface for editing comments on Git repository issues

type IssueCommentList

type IssueCommentList struct {
	Comments []Comment `json:"comments"`
	Total    int       `json:"total"`
	Limit    int       `json:"limit"`
	Offset   int       `json:"offset"`
}

IssueCommentList represents a collection of comments with pagination metadata

type IssueCommentLister

type IssueCommentLister interface {
	ListIssueComments(ctx context.Context, repo string, issueNumber int, limit, offset int) (*IssueCommentList, error)
}

IssueCommentLister defines the interface for listing comments from Git repository issues

type IssueCommenter

type IssueCommenter interface {
	CreateIssueComment(ctx context.Context, repo string, issueNumber int, comment string) (*Comment, error)
}

IssueCommenter defines the interface for creating comments on Git repository issues

type IssueCreator

type IssueCreator interface {
	CreateIssue(ctx context.Context, args CreateIssueArgs) (*Issue, error)
}

IssueCreator defines the interface for creating issues

type IssueEditor

type IssueEditor interface {
	EditIssue(ctx context.Context, args EditIssueArgs) (*Issue, error)
}

IssueEditor defines the interface for editing issues in Git repositories

type IssueLister

type IssueLister interface {
	ListIssues(ctx context.Context, repo string, limit, offset int) ([]Issue, error)
}

IssueLister defines the interface for listing issues from a Git repository

type Label added in v0.1.1

type Label struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Color       string `json:"color"`
	Description string `json:"description,omitempty"`
}

Label represents a repository label

type ListIssueCommentsArgs

type ListIssueCommentsArgs struct {
	Repository  string `json:"repository"`
	IssueNumber int    `json:"issue_number"`
	Limit       int    `json:"limit"`
	Offset      int    `json:"offset"`
}

ListIssueCommentsArgs represents the arguments for listing issue comments

type ListPullRequestCommentsArgs

type ListPullRequestCommentsArgs struct {
	Repository        string `json:"repository"`
	PullRequestNumber int    `json:"pull_request_number"`
	Limit             int    `json:"limit"`
	Offset            int    `json:"offset"`
}

ListPullRequestCommentsArgs represents the arguments for listing pull request comments

type ListPullRequestsOptions

type ListPullRequestsOptions struct {
	State  string `json:"state"`
	Limit  int    `json:"limit"`
	Offset int    `json:"offset"`
}

ListPullRequestsOptions represents the options for listing pull requests

type Milestone added in v0.1.1

type Milestone struct {
	ID           int    `json:"id"`
	Title        string `json:"title"`
	Description  string `json:"description,omitempty"`
	State        string `json:"state"`
	OpenIssues   int    `json:"open_issues"`
	ClosedIssues int    `json:"closed_issues"`
}

Milestone represents a repository milestone

type ProcessedAttachment

type ProcessedAttachment struct {
	Data     []byte
	Filename string
	MIMEType string
}

ProcessedAttachment represents a processed file attachment

type PullRequest

type PullRequest struct {
	ID        int               `json:"id"`
	Number    int               `json:"number"`
	Title     string            `json:"title"`
	Body      string            `json:"body"`
	State     string            `json:"state"`
	User      string            `json:"user"`
	CreatedAt string            `json:"created"`
	UpdatedAt string            `json:"updated"`
	Head      PullRequestBranch `json:"head"`
	Base      PullRequestBranch `json:"base"`
}

PullRequest represents a Git repository pull request

type PullRequestBranch

type PullRequestBranch struct {
	Ref string `json:"ref"`
	Sha string `json:"sha"`
}

PullRequestBranch represents a branch reference in a pull request

type PullRequestCommentEditor

type PullRequestCommentEditor interface {
	EditPullRequestComment(ctx context.Context, args EditPullRequestCommentArgs) (*Comment, error)
}

PullRequestCommentEditor defines the interface for editing comments on Git repository pull requests

type PullRequestCommentList

type PullRequestCommentList struct {
	Comments []Comment `json:"comments"`
	Total    int       `json:"total"`
	Limit    int       `json:"limit"`
	Offset   int       `json:"offset"`
}

PullRequestCommentList represents a collection of pull request comments with pagination metadata

type PullRequestCommentLister

type PullRequestCommentLister interface {
	ListPullRequestComments(ctx context.Context, repo string, pullRequestNumber int, limit, offset int) (*PullRequestCommentList, error)
}

PullRequestCommentLister defines the interface for listing comments from Git repository pull requests

type PullRequestCommenter

type PullRequestCommenter interface {
	CreatePullRequestComment(ctx context.Context, repo string, pullRequestNumber int, comment string) (*Comment, error)
}

PullRequestCommenter defines the interface for creating comments on Git repository pull requests

type PullRequestCreator

type PullRequestCreator interface {
	CreatePullRequest(ctx context.Context, args CreatePullRequestArgs) (*PullRequest, error)
}

PullRequestCreator defines the interface for creating pull requests

type PullRequestDetails added in v0.1.1

type PullRequestDetails struct {
	// Basic fields (matching PullRequest for compatibility)
	ID        int               `json:"id"`
	Number    int               `json:"number"`
	Title     string            `json:"title"`
	Body      string            `json:"body"`
	State     string            `json:"state"`
	User      string            `json:"user"`
	CreatedAt string            `json:"created"`
	UpdatedAt string            `json:"updated"`
	Head      PullRequestBranch `json:"head"`
	Base      PullRequestBranch `json:"base"`

	// Additional metadata fields
	HTMLURL             string     `json:"html_url"`
	DiffURL             string     `json:"diff_url"`
	PatchURL            string     `json:"patch_url"`
	Labels              []Label    `json:"labels,omitempty"`
	Milestone           *Milestone `json:"milestone,omitempty"`
	Assignee            string     `json:"assignee,omitempty"`
	Assignees           []string   `json:"assignees,omitempty"`
	Comments            int        `json:"comments"`
	IsLocked            bool       `json:"is_locked"`
	Mergeable           bool       `json:"mergeable"`
	HasMerged           bool       `json:"has_merged"`
	MergedAt            string     `json:"merged_at,omitempty"`
	MergeCommitSHA      string     `json:"merge_commit_sha,omitempty"`
	MergedBy            string     `json:"merged_by,omitempty"`
	AllowMaintainerEdit bool       `json:"allow_maintainer_edit"`
	ClosedAt            string     `json:"closed_at,omitempty"`
	Deadline            string     `json:"deadline,omitempty"`
}

PullRequestDetails represents comprehensive pull request information

type PullRequestEditor

type PullRequestEditor interface {
	EditPullRequest(ctx context.Context, args EditPullRequestArgs) (*PullRequest, error)
}

PullRequestEditor defines the interface for editing pull requests in Git repositories

type PullRequestGetter added in v0.1.1

type PullRequestGetter interface {
	GetPullRequest(ctx context.Context, repo string, number int) (*PullRequestDetails, error)
}

PullRequestGetter defines the interface for fetching a single pull request

type PullRequestLister

type PullRequestLister interface {
	ListPullRequests(ctx context.Context, repo string, options ListPullRequestsOptions) ([]PullRequest, error)
}

PullRequestLister defines the interface for listing pull requests from a Git repository

type VersionResponse

type VersionResponse struct {
	Version string `json:"version"`
}

VersionResponse represents the response from the /api/v1/version endpoint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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