mapDiscussionFromListNode converts a discussionListNode into the domain Discussion type.
(n discussionListNode)
| 141 | |
| 142 | // mapDiscussionFromListNode converts a discussionListNode into the domain Discussion type. |
| 143 | func mapDiscussionFromListNode(n discussionListNode) Discussion { |
| 144 | d := Discussion{ |
| 145 | ID: n.ID, |
| 146 | Number: n.Number, |
| 147 | Title: n.Title, |
| 148 | Body: n.Body, |
| 149 | URL: n.URL, |
| 150 | Closed: n.Closed, |
| 151 | StateReason: n.StateReason, |
| 152 | Author: mapActorFromListNode(n.Author), |
| 153 | Category: DiscussionCategory{ |
| 154 | ID: n.Category.ID, |
| 155 | Name: n.Category.Name, |
| 156 | Slug: n.Category.Slug, |
| 157 | Emoji: n.Category.Emoji, |
| 158 | IsAnswerable: n.Category.IsAnswerable, |
| 159 | }, |
| 160 | Answered: n.IsAnswered, |
| 161 | AnswerChosenAt: n.AnswerChosenAt, |
| 162 | CreatedAt: n.CreatedAt, |
| 163 | UpdatedAt: n.UpdatedAt, |
| 164 | ClosedAt: n.ClosedAt, |
| 165 | Locked: n.Locked, |
| 166 | } |
| 167 | |
| 168 | if n.AnswerChosenBy != nil { |
| 169 | a := mapActorFromListNode(*n.AnswerChosenBy) |
| 170 | d.AnswerChosenBy = &a |
| 171 | } |
| 172 | |
| 173 | d.Labels = make([]DiscussionLabel, len(n.Labels.Nodes)) |
| 174 | for i, l := range n.Labels.Nodes { |
| 175 | d.Labels[i] = DiscussionLabel{ID: l.ID, Name: l.Name, Color: l.Color} |
| 176 | } |
| 177 | |
| 178 | return d |
| 179 | } |
| 180 | |
| 181 | func (c *discussionClient) List(repo ghrepo.Interface, filters ListFilters, after string, limit int) (*DiscussionListResult, error) { |
| 182 | if limit <= 0 { |
no test coverage detected