vegapokerbot/internal/integration/redmine/api/dto.go
2024-05-07 21:49:09 +03:00

60 lines
1.7 KiB
Go

package api
import (
"strings"
"time"
)
type ErrorResponse struct {
Errors []string `json:"errors"`
}
func (e ErrorResponse) Error() string {
return strings.Join(e.Errors, "; ")
}
func (e ErrorResponse) IsError() bool {
return len(e.Errors) > 0
}
type IssueResponse struct {
ErrorResponse
Issue *Issue `json:"issue"`
}
type NameWithID struct {
ID int `json:"id"`
Name string `json:"name,omitempty"`
}
type CustomField struct {
ID int `json:"id"`
Name string `json:"name"`
Value string `json:"value"`
}
type Issue struct {
ID int `json:"id"`
Project NameWithID `json:"project"`
Tracker NameWithID `json:"tracker"`
Status NameWithID `json:"status"`
Priority NameWithID `json:"priority"`
Author NameWithID `json:"author"`
AssignedTo NameWithID `json:"assigned_to"`
Parent NameWithID `json:"parent"`
Subject string `json:"subject"`
Description string `json:"description"`
StartDate interface{} `json:"start_date"`
DueDate interface{} `json:"due_date"`
DoneRatio int `json:"done_ratio"`
IsPrivate bool `json:"is_private"`
EstimatedHours interface{} `json:"estimated_hours"`
TotalEstimatedHours interface{} `json:"total_estimated_hours"`
SpentHours float64 `json:"spent_hours"`
TotalSpentHours float64 `json:"total_spent_hours"`
CustomFields []CustomField `json:"custom_fields"`
CreatedOn time.Time `json:"created_on"`
UpdatedOn time.Time `json:"updated_on"`
ClosedOn interface{} `json:"closed_on"`
}