add mirror_updated field to Repository struct (#565)

This PR resolves https://gitea.com/gitea/go-sdk/issues/566.

It ensures that the client-side SDK extracts the `mirror_updated` field introduced on the server by https://github.com/go-gitea/gitea/pull/18267 (issue: https://github.com/go-gitea/gitea/issues/18266).

Co-authored-by: Peter Gardfjäll <peter.gardfjall.work@gmail.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/565
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: Norwin <noerw@noreply.gitea.io>
Co-authored-by: petergardfjall <petergardfjall@noreply.gitea.io>
Co-committed-by: petergardfjall <petergardfjall@noreply.gitea.io>
This commit is contained in:
petergardfjall 2022-03-28 19:06:48 +08:00 committed by Andrew Thornton
parent 29e6eb37fe
commit f0663b3c13
2 changed files with 3 additions and 0 deletions

View file

@ -93,6 +93,7 @@ type Repository struct {
AvatarURL string `json:"avatar_url"` AvatarURL string `json:"avatar_url"`
Internal bool `json:"internal"` Internal bool `json:"internal"`
MirrorInterval string `json:"mirror_interval"` MirrorInterval string `json:"mirror_interval"`
MirrorUpdated time.Time `json:"mirror_updated,omitempty"`
DefaultMergeStyle MergeStyle `json:"default_merge_style"` DefaultMergeStyle MergeStyle `json:"default_merge_style"`
} }

View file

@ -61,6 +61,8 @@ func TestRepoMigrateAndLanguages(t *testing.T) {
assert.True(t, repoG.Mirror) assert.True(t, repoG.Mirror)
assert.False(t, repoG.Empty) assert.False(t, repoG.Empty)
assert.EqualValues(t, 1, repoG.Watchers) assert.EqualValues(t, 1, repoG.Watchers)
var zeroTime time.Time
assert.NotEqual(t, zeroTime, repoG.MirrorUpdated)
log.Println("== TestRepoLanguages ==") log.Println("== TestRepoLanguages ==")
time.Sleep(time.Second) time.Sleep(time.Second)