issue

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 8 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, error)

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(data *IssueData) (*Issue, error)

CreateIssue creates a new issue - delegates to Creator

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"`
	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 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

Jump to

Keyboard shortcuts

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