go-mcm/model/ticketnote.go

34 lines
717 B
Go

package model
import (
"encoding/json"
"go.etztech.xyz/go-mcm/model/django"
)
type TicketNote struct {
ID int64 `json:"id"`
AuthorID int64 `json:"author_id"`
TicketID int64 `json:"ticket_id"`
Message string `json:"message"`
LastUpdate string `json:"last_update"`
Date string `json:"date"`
Link string `json:"link"`
}
func (q *Query) TicketNote(builder *django.Builder) ([]*TicketNote, error) {
endpoint := q.endpoint("ticketnote", builder.QueryString())
ticketNotes := make([]*TicketNote, 0)
resp, err := response(endpoint)
if err != nil {
return nil, err
}
err = json.Unmarshal(resp, &ticketNotes)
if err != nil {
return nil, err
}
return ticketNotes, nil
}