issue

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchError

type BatchError struct {
	Index int    `json:"index"`
	Title string `json:"title"`
	Error string `json:"error"`
}

BatchError represents an error during batch processing

type BatchResult

type BatchResult struct {
	Total     int          `json:"total"`
	Succeeded int          `json:"succeeded"`
	Failed    int          `json:"failed"`
	Issues    []*Issue     `json:"issues"`
	Errors    []BatchError `json:"errors,omitempty"`
}

BatchResult represents the result of batch issue creation

type Client

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

Client is a wrapper around GitHub API client for issue operations

func NewClient

func NewClient() *Client

NewClient creates a new issue client

func (*Client) AddToProject

func (c *Client) AddToProject(issueID, projectID string) (string, error)

AddToProject adds an issue to a project and returns the project item ID

func (*Client) AddToProjectWithDatabaseID added in v0.0.3

func (c *Client) AddToProjectWithDatabaseID(issueID, projectID string) (string, int, error)

AddToProjectWithDatabaseID adds an issue to a project and returns both IDs

func (*Client) CreateIssue

func (c *Client) CreateIssue(req IssueRequest) (Issue, error)

CreateIssueFromRequest creates a new issue from IssueRequest

func (*Client) CreateIssueWithData added in v0.6.0

func (c *Client) CreateIssueWithData(data *IssueData) (*Issue, error)

CreateIssueWithData creates a new issue - delegates to Creator

func (*Client) CreateIssueWithRepo added in v0.6.0

func (c *Client) CreateIssueWithRepo(req IssueRequest, repo string) (Issue, error)

CreateIssueWithRepo creates a new issue in a specific repo

func (*Client) GetGraphQLClient added in v0.5.0

func (c *Client) GetGraphQLClient() *api.GraphQLClient

GetGraphQLClient returns the GraphQL client for direct use

func (*Client) GetIssue added in v0.6.0

func (c *Client) GetIssue(number int) (Issue, error)

GetIssue fetches an issue by number

func (*Client) GetIssueWithRepo added in v0.6.0

func (c *Client) GetIssueWithRepo(number int, repo string) (Issue, error)

GetIssueWithRepo fetches an issue by number from a specific repo

func (*Client) GetProjectItemID added in v0.3.0

func (c *Client) GetProjectItemID(issueID, projectID string) (string, int, error)

GetProjectItemID gets the project item ID for an issue if it exists in the project

func (*Client) UpdateIssue added in v0.6.0

func (c *Client) UpdateIssue(number int, req IssueRequest) error

UpdateIssue updates an existing issue

func (*Client) UpdateIssueWithRepo added in v0.6.0

func (c *Client) UpdateIssueWithRepo(number int, req IssueRequest, repo string) error

UpdateIssueWithRepo updates an existing issue in a specific repo

func (*Client) UpdateProjectItemField

func (c *Client) UpdateProjectItemField(projectID, itemID, fieldID, optionID string) error

UpdateProjectItemField updates a single field value for a project item

type Comment added in v0.0.5

type Comment struct {
	ID        string    `json:"id"`
	Author    string    `json:"author"`
	Body      string    `json:"body"`
	CreatedAt time.Time `json:"created_at"`
}

Comment represents a comment on an issue

type Creator

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

Creator handles issue creation and project management

func NewCreator

func NewCreator(client *Client) *Creator

NewCreator creates a new issue creator

func (*Creator) AddToProject

func (c *Creator) AddToProject(issueID, projectID string) error

AddToProject adds an issue to a GitHub Project v2

func (*Creator) CreateIssue

func (c *Creator) CreateIssue(data *IssueData) (*Issue, error)

CreateIssue creates a new GitHub issue

func (*Creator) GetProjectItemID

func (c *Creator) GetProjectItemID(issueID, projectID string) (string, error)

GetProjectItemID retrieves the project item ID for an issue

func (*Creator) UpdateFields

func (c *Creator) UpdateFields(itemID string, fields map[string]interface{}) error

UpdateFields updates project field values for an issue

type ErrorType

type ErrorType int

ErrorType represents the type of error that occurred

const (
	// ErrorTypeValidation indicates a validation error
	ErrorTypeValidation ErrorType = iota
	// ErrorTypeConfiguration indicates a configuration error
	ErrorTypeConfiguration
	// ErrorTypePermission indicates a permission/authorization error
	ErrorTypePermission
	// ErrorTypeNetwork indicates a network connectivity error
	ErrorTypeNetwork
	// ErrorTypeRateLimit indicates GitHub API rate limit error
	ErrorTypeRateLimit
	// ErrorTypeNotFound indicates a resource was not found
	ErrorTypeNotFound
	// ErrorTypeAPI indicates a general API error
	ErrorTypeAPI
)

type Issue

type Issue struct {
	ID          string       `json:"id"`
	Number      int          `json:"number"`
	Title       string       `json:"title"`
	Body        string       `json:"body,omitempty"`
	URL         string       `json:"url"`
	State       string       `json:"state"`
	Repository  string       `json:"repository"`
	Labels      []Label      `json:"labels"`
	Assignees   []string     `json:"assignees,omitempty"`
	Milestone   string       `json:"milestone,omitempty"`
	ProjectItem *ProjectItem `json:"project_item,omitempty"`
	ProjectURL  string       `json:"project_url,omitempty"`
	Comments    []Comment    `json:"comments,omitempty"`
	CreatedAt   time.Time    `json:"created_at"`
	UpdatedAt   time.Time    `json:"updated_at"`
}

Issue represents a created GitHub issue with project metadata

func GetIssueDetails added in v0.0.5

func GetIssueDetails(number int, repo string) (*Issue, error)

GetIssueDetails fetches issue details using gh issue view command

type IssueData

type IssueData struct {
	Title        string            `yaml:"title" json:"title"`
	Body         string            `yaml:"body" json:"body"`
	Labels       []string          `yaml:"labels" json:"labels"`
	Repository   string            `yaml:"repository" json:"repository"`
	Priority     string            `yaml:"priority" json:"priority"`
	Status       string            `yaml:"status" json:"status"`
	CustomFields map[string]string `yaml:"custom_fields" json:"custom_fields"`

	// Pass-through fields for gh issue create compatibility
	Assignee  string `yaml:"assignee" json:"assignee"`
	Milestone string `yaml:"milestone" json:"milestone"`
}

IssueData represents the data needed to create an issue

func (*IssueData) GetFieldUpdates

func (d *IssueData) GetFieldUpdates() map[string]interface{}

GetFieldUpdates returns project field updates

func (*IssueData) GetOwner

func (d *IssueData) GetOwner() string

GetOwner returns the repository owner

func (*IssueData) GetRepo

func (d *IssueData) GetRepo() string

GetRepo returns the repository name

func (*IssueData) ToCreateRequest

func (d *IssueData) ToCreateRequest() map[string]interface{}

ToCreateRequest converts IssueData to a format suitable for GitHub API

func (*IssueData) Validate

func (d *IssueData) Validate() error

Validate checks if the issue data is valid

type IssueError

type IssueError struct {
	Type       ErrorType
	Message    string
	Cause      error
	Suggestion string
}

IssueError represents a structured error with type and suggestion

func NewAPIError

func NewAPIError(message string, cause error) *IssueError

NewAPIError creates a new general API error

func NewConfigurationError

func NewConfigurationError(message string, cause error) *IssueError

NewConfigurationError creates a new configuration error

func NewNetworkError

func NewNetworkError(message string, cause error) *IssueError

NewNetworkError creates a new network error

func NewNotFoundError

func NewNotFoundError(resource string) *IssueError

NewNotFoundError creates a new not found error

func NewPermissionError

func NewPermissionError(message string, cause error) *IssueError

NewPermissionError creates a new permission error

func NewRateLimitError

func NewRateLimitError(resetTime string) *IssueError

NewRateLimitError creates a new rate limit error with reset time

func NewValidationError

func NewValidationError(message string, cause error) *IssueError

NewValidationError creates a new validation error

func WrapError

func WrapError(err error, message string) *IssueError

WrapError wraps an existing error with additional context

func (*IssueError) Error

func (e *IssueError) Error() string

Error implements the error interface

func (*IssueError) Is

func (e *IssueError) Is(target error) bool

Is checks if the error is of a specific type

func (*IssueError) Unwrap

func (e *IssueError) Unwrap() error

Unwrap returns the underlying error

type IssueRequest added in v0.6.0

type IssueRequest struct {
	Title     string   `json:"title"`
	Body      string   `json:"body"`
	Labels    []string `json:"labels"`
	Assignees []string `json:"assignees"`
	Milestone string   `json:"milestone"`
}

IssueRequest represents the data for creating/updating an issue

type Label

type Label struct {
	Name  string `json:"name"`
	Color string `json:"color"`
}

Label represents a GitHub issue label

type ProjectItem

type ProjectItem struct {
	ID         string                 `json:"id"`
	DatabaseID int                    `json:"database_id"`
	ProjectID  string                 `json:"project_id"`
	Fields     map[string]interface{} `json:"fields"`
}

ProjectItem represents an issue's connection to a project

type SearchClient added in v0.6.6

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

SearchClient handles issue searching and filtering operations

func NewSearchClient added in v0.6.6

func NewSearchClient(cfg *config.Config) (*SearchClient, error)

NewSearchClient creates a new SearchClient

func (*SearchClient) FetchProjectIssues added in v0.6.6

func (s *SearchClient) FetchProjectIssues(projectID string, limit int) ([]filter.ProjectIssue, error)

FetchProjectIssues fetches project issues with field values and applies filtering

func (*SearchClient) FilterProjectIssues added in v0.6.6

func (s *SearchClient) FilterProjectIssues(issues []filter.ProjectIssue, filters *filter.IssueFilters) []filter.ProjectIssue

FilterProjectIssues applies local filtering to project issues

func (*SearchClient) GetProjectIssues added in v0.6.6

func (s *SearchClient) GetProjectIssues(projectID string) ([]filter.GitHubIssue, error)

GetProjectIssues fetches all issues in the specified project

func (*SearchClient) SearchIssues added in v0.6.6

func (s *SearchClient) SearchIssues(filters *filter.IssueFilters) ([]filter.GitHubIssue, error)

SearchIssues searches for issues using GitHub API with the provided filters

Jump to

Keyboard shortcuts

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