(nextCursor string, newest bool)
| 1125 | } |
| 1126 | |
| 1127 | func exampleDiscussionWithReplies(nextCursor string, newest bool) *client.Discussion { |
| 1128 | firstReply := client.DiscussionComment{ |
| 1129 | ID: "R1", |
| 1130 | URL: "https://github.com/OWNER/REPO/discussions/123#discussioncomment-2", |
| 1131 | Author: client.DiscussionActor{Login: "hubot"}, |
| 1132 | Body: "First reply", |
| 1133 | CreatedAt: time.Date(2025, 3, 1, 0, 20, 0, 0, time.UTC), |
| 1134 | } |
| 1135 | secondReply := client.DiscussionComment{ |
| 1136 | ID: "R2", |
| 1137 | URL: "https://github.com/OWNER/REPO/discussions/123#discussioncomment-3", |
| 1138 | Author: client.DiscussionActor{Login: "monalisa"}, |
| 1139 | Body: "Second reply", |
| 1140 | CreatedAt: time.Date(2025, 3, 1, 0, 40, 0, 0, time.UTC), |
| 1141 | } |
| 1142 | |
| 1143 | direction := client.DiscussionCommentListDirectionForward |
| 1144 | replies := []client.DiscussionComment{firstReply, secondReply} |
| 1145 | if newest { |
| 1146 | direction = client.DiscussionCommentListDirectionBackward |
| 1147 | replies = []client.DiscussionComment{secondReply, firstReply} |
| 1148 | } |
| 1149 | |
| 1150 | d := exampleAnswerableDiscussion() |
| 1151 | d.Comments = client.DiscussionCommentList{ |
| 1152 | TotalCount: 1, |
| 1153 | Comments: []client.DiscussionComment{ |
| 1154 | { |
| 1155 | ID: "DC_abc", |
| 1156 | URL: "https://github.com/OWNER/REPO/discussions/123#discussioncomment-1", |
| 1157 | Author: client.DiscussionActor{Login: "octocat"}, |
| 1158 | Body: "This is the parent comment", |
| 1159 | CreatedAt: time.Date(2025, 3, 1, 0, 0, 0, 0, time.UTC), |
| 1160 | IsAnswer: true, |
| 1161 | ReactionGroups: []client.ReactionGroup{ |
| 1162 | {Content: "THUMBS_UP", TotalCount: 3}, |
| 1163 | }, |
| 1164 | Replies: client.DiscussionCommentList{ |
| 1165 | TotalCount: 2, |
| 1166 | NextCursor: nextCursor, |
| 1167 | Direction: direction, |
| 1168 | Comments: replies, |
| 1169 | }, |
| 1170 | }, |
| 1171 | }, |
| 1172 | } |
| 1173 | return d |
| 1174 | } |
| 1175 | |
| 1176 | func exampleAnswerableDiscussion() *client.Discussion { |
| 1177 | return &client.Discussion{ |
no test coverage detected