MCPcopy Create free account
hub / github.com/gogs/gogs / APIFormat

Method APIFormat

internal/database/issue.go:185–220  ·  view source on GitHub ↗

This method assumes some fields assigned with values: Required - Poster, Labels, Optional - Milestone, Assignee, PullRequest

()

Source from the content-addressed store, hash-verified

183// Required - Poster, Labels,
184// Optional - Milestone, Assignee, PullRequest
185func (issue *Issue) APIFormat() *api.Issue {
186 apiLabels := make([]*api.Label, len(issue.Labels))
187 for i := range issue.Labels {
188 apiLabels[i] = issue.Labels[i].APIFormat()
189 }
190
191 apiIssue := &api.Issue{
192 ID: issue.ID,
193 Index: issue.Index,
194 Poster: issue.Poster.APIFormat(),
195 Title: issue.Title,
196 Body: issue.Content,
197 Labels: apiLabels,
198 State: issue.State(),
199 Comments: issue.NumComments,
200 Created: issue.Created,
201 Updated: issue.Updated,
202 }
203
204 if issue.Milestone != nil {
205 apiIssue.Milestone = issue.Milestone.APIFormat()
206 }
207 if issue.Assignee != nil {
208 apiIssue.Assignee = issue.Assignee.APIFormat()
209 }
210 if issue.IsPull {
211 apiIssue.PullRequest = &api.PullRequestMeta{
212 HasMerged: issue.PullRequest.HasMerged,
213 }
214 if issue.PullRequest.HasMerged {
215 apiIssue.PullRequest.Merged = &issue.PullRequest.Merged
216 }
217 }
218
219 return apiIssue
220}
221
222// HashTag returns unique hash tag for issue.
223func (issue *Issue) HashTag() string {

Callers 8

ClearLabelsMethod · 0.95
ChangeStatusMethod · 0.95
ChangeTitleMethod · 0.95
ChangeContentMethod · 0.95
ChangeAssigneeMethod · 0.95
CreateIssueFunction · 0.95
NewIssueFunction · 0.45

Implementers 1

mailerIssueinternal/database/issue_mail.go

Calls 1

StateMethod · 0.95

Tested by

no test coverage detected