809e9d2bf3
New tables: custom_field_definition, custom_field_value
Supports field types: text, number, date, dropdown, checkbox
Endpoints:
- GET/POST /repos/{owner}/{repo}/custom-fields
- GET/PATCH/DELETE /repos/{owner}/{repo}/custom-fields/{fieldId}
- GET /repos/{owner}/{repo}/issues/{index}/custom-fields
- PUT /repos/{owner}/{repo}/issues/{index}/custom-fields/{fieldId}
- DELETE /repos/{owner}/{repo}/issues/{index}/custom-fields/{fieldId}
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
66 lines
2.0 KiB
Go
66 lines
2.0 KiB
Go
// Copyright 2026 Moko Consulting. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package structs
|
|
|
|
import "time"
|
|
|
|
// CustomFieldDefinition represents a custom field definition for a repository
|
|
// swagger:model
|
|
type CustomFieldDefinition struct {
|
|
ID int64 `json:"id"`
|
|
RepoID int64 `json:"repo_id"`
|
|
Name string `json:"name"`
|
|
FieldType string `json:"field_type"`
|
|
Description string `json:"description"`
|
|
Required bool `json:"required"`
|
|
Position int `json:"position"`
|
|
Options string `json:"options"`
|
|
DefaultValue string `json:"default_value"`
|
|
// swagger:strfmt date-time
|
|
Created time.Time `json:"created_at"`
|
|
// swagger:strfmt date-time
|
|
Updated time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// CreateCustomFieldOption options for creating a custom field
|
|
// swagger:model
|
|
type CreateCustomFieldOption struct {
|
|
// required: true
|
|
Name string `json:"name" binding:"Required"`
|
|
// required: true
|
|
FieldType string `json:"field_type" binding:"Required"` // text, number, date, dropdown, checkbox
|
|
Description string `json:"description"`
|
|
Required bool `json:"required"`
|
|
Position int `json:"position"`
|
|
Options string `json:"options"` // JSON array for dropdown
|
|
DefaultValue string `json:"default_value"`
|
|
}
|
|
|
|
// EditCustomFieldOption options for editing a custom field
|
|
// swagger:model
|
|
type EditCustomFieldOption struct {
|
|
Name *string `json:"name"`
|
|
Description *string `json:"description"`
|
|
Required *bool `json:"required"`
|
|
Position *int `json:"position"`
|
|
Options *string `json:"options"`
|
|
DefaultValue *string `json:"default_value"`
|
|
}
|
|
|
|
// CustomFieldValue represents a custom field value for an issue
|
|
// swagger:model
|
|
type CustomFieldValue struct {
|
|
ID int64 `json:"id"`
|
|
IssueID int64 `json:"issue_id"`
|
|
FieldID int64 `json:"field_id"`
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
// SetCustomFieldValueOption options for setting a custom field value
|
|
// swagger:model
|
|
type SetCustomFieldValueOption struct {
|
|
// required: true
|
|
Value string `json:"value" binding:"Required"`
|
|
}
|