Documentation
¶
Index ¶
- func FetchAll[T any](ctx context.Context, c *Client, path string, params url.Values, key string, ...) ([]T, int, error)
- func FetchAllFiltered[T any](ctx context.Context, c *Client, path string, params url.Values, key string, ...) ([]T, bool, error)
- type APIError
- type CategoryService
- type Client
- func (c *Client) DebugLog() *debug.Logger
- func (c *Client) Delete(ctx context.Context, path string) error
- func (c *Client) DoRaw(ctx context.Context, method, path string, params url.Values, body io.Reader) (*RawResponse, error)
- func (c *Client) Get(ctx context.Context, path string, params url.Values, out interface{}) error
- func (c *Client) Post(ctx context.Context, path string, body interface{}, out interface{}) error
- func (c *Client) Put(ctx context.Context, path string, body interface{}) error
- type EnumerationService
- type GroupService
- func (s *GroupService) AddUser(ctx context.Context, groupID, userID int) error
- func (s *GroupService) Create(ctx context.Context, group models.GroupCreate) (*models.Group, error)
- func (s *GroupService) Delete(ctx context.Context, id int) error
- func (s *GroupService) Get(ctx context.Context, id int, includes []string) (*models.Group, error)
- func (s *GroupService) List(ctx context.Context, filter models.GroupFilter) ([]models.Group, int, error)
- func (s *GroupService) RemoveUser(ctx context.Context, groupID, userID int) error
- func (s *GroupService) Update(ctx context.Context, id int, update models.GroupUpdate) error
- type IssueService
- func (s *IssueService) Create(ctx context.Context, issue models.IssueCreate) (*models.Issue, error)
- func (s *IssueService) Delete(ctx context.Context, id int) error
- func (s *IssueService) Get(ctx context.Context, id int, includes []string) (*models.Issue, error)
- func (s *IssueService) List(ctx context.Context, filter models.IssueFilter) ([]models.Issue, int, error)
- func (s *IssueService) Update(ctx context.Context, id int, update models.IssueUpdate) error
- type MembershipService
- func (s *MembershipService) Create(ctx context.Context, projectID string, membership models.MembershipCreate) (*models.Membership, error)
- func (s *MembershipService) Delete(ctx context.Context, id int) error
- func (s *MembershipService) Get(ctx context.Context, id int) (*models.Membership, error)
- func (s *MembershipService) List(ctx context.Context, projectID string, limit, offset int) ([]models.Membership, int, error)
- func (s *MembershipService) Update(ctx context.Context, id int, update models.MembershipUpdate) error
- type ProjectService
- func (s *ProjectService) Create(ctx context.Context, project models.ProjectCreate) (*models.Project, error)
- func (s *ProjectService) Delete(ctx context.Context, identifier string) error
- func (s *ProjectService) Get(ctx context.Context, identifier string, includes []string) (*models.Project, error)
- func (s *ProjectService) List(ctx context.Context, includes []string, limit, offset int) ([]models.Project, int, error)
- func (s *ProjectService) Members(ctx context.Context, identifier string, limit, offset int) ([]models.Membership, int, error)
- func (s *ProjectService) Update(ctx context.Context, identifier string, update models.ProjectUpdate) error
- type RawResponse
- type SearchParams
- type SearchService
- type StatusService
- type TimeEntryService
- func (s *TimeEntryService) Create(ctx context.Context, entry models.TimeEntryCreate) (*models.TimeEntry, error)
- func (s *TimeEntryService) Delete(ctx context.Context, id int) error
- func (s *TimeEntryService) Get(ctx context.Context, id int) (*models.TimeEntry, error)
- func (s *TimeEntryService) List(ctx context.Context, filter models.TimeEntryFilter) ([]models.TimeEntry, int, error)
- func (s *TimeEntryService) Update(ctx context.Context, id int, update models.TimeEntryUpdate) error
- type TrackerService
- type UserService
- func (s *UserService) Create(ctx context.Context, user models.UserCreate) (*models.User, error)
- func (s *UserService) Current(ctx context.Context) (*models.User, error)
- func (s *UserService) Delete(ctx context.Context, id int) error
- func (s *UserService) Get(ctx context.Context, id int) (*models.User, error)
- func (s *UserService) List(ctx context.Context, filter models.UserFilter) ([]models.User, int, error)
- func (s *UserService) Update(ctx context.Context, id int, update models.UserUpdate) error
- type VersionService
- func (s *VersionService) Get(ctx context.Context, id int) (*models.Version, error)
- func (s *VersionService) List(ctx context.Context, projectID string, limit, offset int) ([]models.Version, int, error)
- func (s *VersionService) ListFiltered(ctx context.Context, projectID string, need int, ...) ([]models.Version, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchAll ¶
func FetchAll[T any](ctx context.Context, c *Client, path string, params url.Values, key string, maxResults int) ([]T, int, error)
FetchAll retrieves all pages of a resource. The key parameter is the JSON wrapper key (e.g., "issues", "projects"). If maxResults is 0, all results are fetched.
func FetchAllFiltered ¶
func FetchAllFiltered[T any](ctx context.Context, c *Client, path string, params url.Values, key string, maxResults int, filter func(T) bool) ([]T, bool, error)
FetchAllFiltered retrieves pages of a resource, keeping only items that pass the filter. If maxResults is 0, all matching items are fetched. Returns the matched items and whether more matches may exist beyond what was collected.
Types ¶
type APIError ¶
APIError represents an error response from the Redmine API.
func (*APIError) IsAuthError ¶
IsAuthError returns true if the error is a 401.
func (*APIError) IsForbidden ¶
IsForbidden returns true if the error is a 403.
func (*APIError) IsNotFound ¶
IsNotFound returns true if the error is a 404.
func (*APIError) IsValidationError ¶
IsValidationError returns true if the error is a 422.
type CategoryService ¶
type CategoryService struct {
// contains filtered or unexported fields
}
CategoryService handles issue category-related API calls.
func (*CategoryService) List ¶
func (s *CategoryService) List(ctx context.Context, projectID string) ([]models.IssueCategory, int, error)
List retrieves issue categories for a project.
type Client ¶
type Client struct {
Issues *IssueService
Projects *ProjectService
TimeEntries *TimeEntryService
Users *UserService
Trackers *TrackerService
Statuses *StatusService
Enumerations *EnumerationService
Versions *VersionService
Categories *CategoryService
Groups *GroupService
Search *SearchService
Memberships *MembershipService
// contains filtered or unexported fields
}
Client is the Redmine API client.
func (*Client) DoRaw ¶ added in v1.10.0
func (c *Client) DoRaw(ctx context.Context, method, path string, params url.Values, body io.Reader) (*RawResponse, error)
DoRaw performs an HTTP request and returns the raw response without parsing.
type EnumerationService ¶
type EnumerationService struct {
// contains filtered or unexported fields
}
EnumerationService handles enumeration-related API calls.
func (*EnumerationService) IssuePriorities ¶
func (s *EnumerationService) IssuePriorities(ctx context.Context) ([]models.Enumeration, error)
IssuePriorities retrieves all issue priorities.
func (*EnumerationService) TimeEntryActivities ¶
func (s *EnumerationService) TimeEntryActivities(ctx context.Context) ([]models.Enumeration, error)
TimeEntryActivities retrieves all time entry activities.
type GroupService ¶
type GroupService struct {
// contains filtered or unexported fields
}
GroupService handles group-related API calls.
func (*GroupService) AddUser ¶
func (s *GroupService) AddUser(ctx context.Context, groupID, userID int) error
AddUser adds a user to a group.
func (*GroupService) Create ¶
func (s *GroupService) Create(ctx context.Context, group models.GroupCreate) (*models.Group, error)
Create creates a new group.
func (*GroupService) Delete ¶
func (s *GroupService) Delete(ctx context.Context, id int) error
Delete deletes a group.
func (*GroupService) Get ¶
Get retrieves a single group by ID. includes can contain "users" and/or "memberships".
func (*GroupService) List ¶
func (s *GroupService) List(ctx context.Context, filter models.GroupFilter) ([]models.Group, int, error)
List retrieves groups matching the given filter.
func (*GroupService) RemoveUser ¶
func (s *GroupService) RemoveUser(ctx context.Context, groupID, userID int) error
RemoveUser removes a user from a group.
func (*GroupService) Update ¶
func (s *GroupService) Update(ctx context.Context, id int, update models.GroupUpdate) error
Update updates an existing group.
type IssueService ¶
type IssueService struct {
// contains filtered or unexported fields
}
IssueService handles issue-related API calls.
func (*IssueService) Create ¶
func (s *IssueService) Create(ctx context.Context, issue models.IssueCreate) (*models.Issue, error)
Create creates a new issue.
func (*IssueService) Delete ¶
func (s *IssueService) Delete(ctx context.Context, id int) error
Delete deletes an issue.
func (*IssueService) List ¶
func (s *IssueService) List(ctx context.Context, filter models.IssueFilter) ([]models.Issue, int, error)
List retrieves issues matching the given filter.
func (*IssueService) Update ¶
func (s *IssueService) Update(ctx context.Context, id int, update models.IssueUpdate) error
Update updates an existing issue.
type MembershipService ¶ added in v1.11.0
type MembershipService struct {
// contains filtered or unexported fields
}
MembershipService handles membership-related API calls.
func (*MembershipService) Create ¶ added in v1.11.0
func (s *MembershipService) Create(ctx context.Context, projectID string, membership models.MembershipCreate) (*models.Membership, error)
Create creates a new membership in a project.
func (*MembershipService) Delete ¶ added in v1.11.0
func (s *MembershipService) Delete(ctx context.Context, id int) error
Delete deletes a membership.
func (*MembershipService) Get ¶ added in v1.11.0
func (s *MembershipService) Get(ctx context.Context, id int) (*models.Membership, error)
Get retrieves a single membership by ID.
func (*MembershipService) List ¶ added in v1.11.0
func (s *MembershipService) List(ctx context.Context, projectID string, limit, offset int) ([]models.Membership, int, error)
List retrieves memberships for a project.
func (*MembershipService) Update ¶ added in v1.11.0
func (s *MembershipService) Update(ctx context.Context, id int, update models.MembershipUpdate) error
Update updates an existing membership.
type ProjectService ¶
type ProjectService struct {
// contains filtered or unexported fields
}
ProjectService handles project-related API calls.
func (*ProjectService) Create ¶
func (s *ProjectService) Create(ctx context.Context, project models.ProjectCreate) (*models.Project, error)
Create creates a new project.
func (*ProjectService) Delete ¶
func (s *ProjectService) Delete(ctx context.Context, identifier string) error
Delete deletes a project.
func (*ProjectService) Get ¶
func (s *ProjectService) Get(ctx context.Context, identifier string, includes []string) (*models.Project, error)
Get retrieves a single project by identifier.
func (*ProjectService) List ¶
func (s *ProjectService) List(ctx context.Context, includes []string, limit, offset int) ([]models.Project, int, error)
List retrieves all projects.
func (*ProjectService) Members ¶
func (s *ProjectService) Members(ctx context.Context, identifier string, limit, offset int) ([]models.Membership, int, error)
Members retrieves project memberships.
func (*ProjectService) Update ¶
func (s *ProjectService) Update(ctx context.Context, identifier string, update models.ProjectUpdate) error
Update updates an existing project.
type RawResponse ¶ added in v1.10.0
RawResponse holds the unprocessed HTTP response from DoRaw.
type SearchParams ¶
type SearchParams struct {
Query string
ProjectID string
Scope string // "all", "my_projects", "subprojects"
AllWords bool
TitlesOnly bool
OpenIssues bool
Attachments string // "0", "1", "only"
// Resource type filters
Issues bool
News bool
Documents bool
Changesets bool
WikiPages bool
Messages bool
Projects bool
Limit int
Offset int
}
SearchParams holds parameters for the search API call.
type SearchService ¶
type SearchService struct {
// contains filtered or unexported fields
}
SearchService handles the Redmine search API.
func (*SearchService) Search ¶
func (s *SearchService) Search(ctx context.Context, params SearchParams) ([]models.SearchResult, int, error)
Search performs a search query against the Redmine search API.
type StatusService ¶
type StatusService struct {
// contains filtered or unexported fields
}
StatusService handles issue status API calls.
func (*StatusService) List ¶
func (s *StatusService) List(ctx context.Context) ([]models.IssueStatus, error)
List retrieves all issue statuses.
type TimeEntryService ¶
type TimeEntryService struct {
// contains filtered or unexported fields
}
TimeEntryService handles time entry API calls.
func (*TimeEntryService) Create ¶
func (s *TimeEntryService) Create(ctx context.Context, entry models.TimeEntryCreate) (*models.TimeEntry, error)
Create creates a new time entry.
func (*TimeEntryService) Delete ¶
func (s *TimeEntryService) Delete(ctx context.Context, id int) error
Delete deletes a time entry.
func (*TimeEntryService) List ¶
func (s *TimeEntryService) List(ctx context.Context, filter models.TimeEntryFilter) ([]models.TimeEntry, int, error)
List retrieves time entries matching the given filter.
func (*TimeEntryService) Update ¶
func (s *TimeEntryService) Update(ctx context.Context, id int, update models.TimeEntryUpdate) error
Update updates an existing time entry.
type TrackerService ¶
type TrackerService struct {
// contains filtered or unexported fields
}
TrackerService handles tracker-related API calls.
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService handles user-related API calls.
func (*UserService) Create ¶
func (s *UserService) Create(ctx context.Context, user models.UserCreate) (*models.User, error)
Create creates a new user.
func (*UserService) Delete ¶
func (s *UserService) Delete(ctx context.Context, id int) error
Delete deletes a user.
func (*UserService) List ¶
func (s *UserService) List(ctx context.Context, filter models.UserFilter) ([]models.User, int, error)
List retrieves users matching the given filter.
func (*UserService) Update ¶
func (s *UserService) Update(ctx context.Context, id int, update models.UserUpdate) error
Update updates an existing user.
type VersionService ¶
type VersionService struct {
// contains filtered or unexported fields
}
VersionService handles version-related API calls.
func (*VersionService) List ¶
func (s *VersionService) List(ctx context.Context, projectID string, limit, offset int) ([]models.Version, int, error)
List retrieves versions for a project. If limit is 0, all versions are fetched.
func (*VersionService) ListFiltered ¶
func (s *VersionService) ListFiltered(ctx context.Context, projectID string, need int, filter func(models.Version) bool) ([]models.Version, bool, error)
ListFiltered pages through versions for a project, keeping only those that match the filter function, and returns once need results have been collected (or there are no more pages). If need is 0, all matching versions are returned. The hasMore return indicates whether additional matches may exist beyond what was collected.