Files
Jonathan Miller 6f49a9efbe feat(api): bulk issue operations — labels, state, milestone, assignees (#21)
Add four new API endpoints under /repos/{owner}/{repo}/issues/bulk/ for
performing batch operations across multiple issues in a single request.
Each endpoint returns a partial-failure result with per-issue success/failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-21 21:40:25 -05:00

59 lines
1.9 KiB
Go

// Copyright 2026 The MokoGitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs
// IssueBulkLabelsOption options for bulk label operations on issues
type IssueBulkLabelsOption struct {
// issue indexes to operate on
// required: true
Issues []int64 `json:"issues" binding:"Required"`
// Labels can be a list of integers representing label IDs
// or a list of strings representing label names
// required: true
Labels []any `json:"labels" binding:"Required"`
// action to perform: "add" (default), "remove", or "replace"
Action string `json:"action"`
}
// IssueBulkStateOption options for bulk state changes on issues
type IssueBulkStateOption struct {
// issue indexes to operate on
// required: true
Issues []int64 `json:"issues" binding:"Required"`
// new state for the issues, "open" or "closed"
// required: true
State string `json:"state" binding:"Required"`
}
// IssueBulkMilestoneOption options for bulk milestone assignment on issues
type IssueBulkMilestoneOption struct {
// issue indexes to operate on
// required: true
Issues []int64 `json:"issues" binding:"Required"`
// milestone id to assign, 0 to remove milestone
// required: true
MilestoneID int64 `json:"milestone_id"`
}
// IssueBulkAssigneesOption options for bulk assignee operations on issues
type IssueBulkAssigneesOption struct {
// issue indexes to operate on
// required: true
Issues []int64 `json:"issues" binding:"Required"`
// list of assignee usernames to add or set
// required: true
Assignees []string `json:"assignees" binding:"Required"`
}
// IssueBulkResult represents the result of a bulk issue operation
// swagger:model
type IssueBulkResult struct {
// count of successfully updated issues
SuccessCount int `json:"success_count"`
// count of issues that failed to update
FailureCount int `json:"failure_count"`
// details of failures, keyed by issue index
Failures map[int64]string `json:"failures,omitempty"`
}