MCPcopy
hub / github.com/cli/cli / mapDiscussionFromListNode

Function mapDiscussionFromListNode

pkg/cmd/discussion/client/client.go:143–179  ·  view source on GitHub ↗

mapDiscussionFromListNode converts a discussionListNode into the domain Discussion type.

(n discussionListNode)

Source from the content-addressed store, hash-verified

141
142// mapDiscussionFromListNode converts a discussionListNode into the domain Discussion type.
143func 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
181func (c *discussionClient) List(repo ghrepo.Interface, filters ListFilters, after string, limit int) (*DiscussionListResult, error) {
182 if limit <= 0 {

Callers 7

ListMethod · 0.85
SearchMethod · 0.85
GetByNumberMethod · 0.85
GetWithCommentsMethod · 0.85
GetCommentRepliesMethod · 0.85
CreateMethod · 0.85
UpdateMethod · 0.85

Calls 1

mapActorFromListNodeFunction · 0.85

Tested by

no test coverage detected