@@ -185,6 +185,29 @@ type MinimalIssueComment struct {
185185 UpdatedAt string `json:"updated_at,omitempty"`
186186}
187187
188+ // MinimalFileContentResponse is the trimmed output type for create/update/delete file responses.
189+ type MinimalFileContentResponse struct {
190+ Content * MinimalFileContent `json:"content,omitempty"`
191+ Commit * MinimalFileCommit `json:"commit,omitempty"`
192+ }
193+
194+ // MinimalFileContent is the trimmed content portion of a file operation response.
195+ type MinimalFileContent struct {
196+ Name string `json:"name"`
197+ Path string `json:"path"`
198+ SHA string `json:"sha"`
199+ Size int `json:"size,omitempty"`
200+ HTMLURL string `json:"html_url"`
201+ }
202+
203+ // MinimalFileCommit is the trimmed commit portion of a file operation response.
204+ type MinimalFileCommit struct {
205+ SHA string `json:"sha"`
206+ Message string `json:"message,omitempty"`
207+ HTMLURL string `json:"html_url,omitempty"`
208+ Author * MinimalCommitAuthor `json:"author,omitempty"`
209+ }
210+
188211// MinimalPullRequest is the trimmed output type for pull request objects to reduce verbosity.
189212type MinimalPullRequest struct {
190213 Number int `json:"number"`
@@ -338,6 +361,42 @@ func convertToMinimalIssueComment(comment *github.IssueComment) MinimalIssueComm
338361 return m
339362}
340363
364+ func convertToMinimalFileContentResponse (resp * github.RepositoryContentResponse ) MinimalFileContentResponse {
365+ m := MinimalFileContentResponse {}
366+
367+ if resp == nil {
368+ return m
369+ }
370+
371+ if c := resp .Content ; c != nil {
372+ m .Content = & MinimalFileContent {
373+ Name : c .GetName (),
374+ Path : c .GetPath (),
375+ SHA : c .GetSHA (),
376+ Size : c .GetSize (),
377+ HTMLURL : c .GetHTMLURL (),
378+ }
379+ }
380+
381+ m .Commit = & MinimalFileCommit {
382+ SHA : resp .Commit .GetSHA (),
383+ Message : resp .Commit .GetMessage (),
384+ HTMLURL : resp .Commit .GetHTMLURL (),
385+ }
386+
387+ if author := resp .Commit .Author ; author != nil {
388+ m .Commit .Author = & MinimalCommitAuthor {
389+ Name : author .GetName (),
390+ Email : author .GetEmail (),
391+ }
392+ if author .Date != nil {
393+ m .Commit .Author .Date = author .Date .Format (time .RFC3339 )
394+ }
395+ }
396+
397+ return m
398+ }
399+
341400func convertToMinimalPullRequest (pr * github.PullRequest ) MinimalPullRequest {
342401 m := MinimalPullRequest {
343402 Number : pr .GetNumber (),
@@ -480,7 +539,7 @@ func convertToMinimalCommit(commit *github.RepositoryCommit, includeDiffs bool)
480539 Email : commit .Commit .Author .GetEmail (),
481540 }
482541 if commit .Commit .Author .Date != nil {
483- minimalCommit .Commit .Author .Date = commit .Commit .Author .Date .Format ("2006-01-02T15:04:05Z" )
542+ minimalCommit .Commit .Author .Date = commit .Commit .Author .Date .Format (time . RFC3339 )
484543 }
485544 }
486545
@@ -490,7 +549,7 @@ func convertToMinimalCommit(commit *github.RepositoryCommit, includeDiffs bool)
490549 Email : commit .Commit .Committer .GetEmail (),
491550 }
492551 if commit .Commit .Committer .Date != nil {
493- minimalCommit .Commit .Committer .Date = commit .Commit .Committer .Date .Format ("2006-01-02T15:04:05Z" )
552+ minimalCommit .Commit .Committer .Date = commit .Commit .Committer .Date .Format (time . RFC3339 )
494553 }
495554 }
496555 }
0 commit comments