From 6ad4990a65462af770e15330da4777ea59bcc5ad Mon Sep 17 00:00:00 2001 From: Vlad Temian Date: Tue, 28 Nov 2017 17:21:39 +0200 Subject: [PATCH] Add fingerprint to ssh key endpoints. (#3009) * Add fingerprint to ssh key endpoints. * Update gitea sdk vendor --- public/swagger.v1.json | 6 +- routers/api/v1/convert/convert.go | 11 ++-- vendor/code.gitea.io/sdk/gitea/lfs_lock.go | 65 ++++++++++++++++++++++ vendor/code.gitea.io/sdk/gitea/user_key.go | 9 +-- vendor/vendor.json | 6 +- 5 files changed, 84 insertions(+), 13 deletions(-) create mode 100644 vendor/code.gitea.io/sdk/gitea/lfs_lock.go diff --git a/public/swagger.v1.json b/public/swagger.v1.json index 730079c81..4a7402766 100644 --- a/public/swagger.v1.json +++ b/public/swagger.v1.json @@ -6281,6 +6281,10 @@ "type": "string", "x-go-name": "Title" }, + "fingerprint": { + "type": "string", + "x-go-name": "Fingerprint" + }, "url": { "type": "string", "x-go-name": "URL" @@ -7178,4 +7182,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/routers/api/v1/convert/convert.go b/routers/api/v1/convert/convert.go index 0a0ab364b..b5aad95a9 100644 --- a/routers/api/v1/convert/convert.go +++ b/routers/api/v1/convert/convert.go @@ -77,11 +77,12 @@ func ToCommit(c *git.Commit) *api.PayloadCommit { // ToPublicKey convert models.PublicKey to api.PublicKey func ToPublicKey(apiLink string, key *models.PublicKey) *api.PublicKey { return &api.PublicKey{ - ID: key.ID, - Key: key.Content, - URL: apiLink + com.ToStr(key.ID), - Title: key.Name, - Created: key.Created, + ID: key.ID, + Key: key.Content, + URL: apiLink + com.ToStr(key.ID), + Title: key.Name, + Fingerprint: key.Fingerprint, + Created: key.Created, } } diff --git a/vendor/code.gitea.io/sdk/gitea/lfs_lock.go b/vendor/code.gitea.io/sdk/gitea/lfs_lock.go new file mode 100644 index 000000000..356636a3a --- /dev/null +++ b/vendor/code.gitea.io/sdk/gitea/lfs_lock.go @@ -0,0 +1,65 @@ +// Copyright 2017 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package gitea + +import ( + "time" +) + +// LFSLock represent a lock +// for use with the locks API. +type LFSLock struct { + ID string `json:"id"` + Path string `json:"path"` + LockedAt time.Time `json:"locked_at"` + Owner *LFSLockOwner `json:"owner"` +} + +// LFSLockOwner represent a lock owner +// for use with the locks API. +type LFSLockOwner struct { + Name string `json:"name"` +} + +// LFSLockRequest contains the path of the lock to create +// https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#create-lock +type LFSLockRequest struct { + Path string `json:"path"` +} + +// LFSLockResponse represent a lock created +// https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#create-lock +type LFSLockResponse struct { + Lock *LFSLock `json:"lock"` +} + +// LFSLockList represent a list of lock requested +// https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#list-locks +type LFSLockList struct { + Locks []*LFSLock `json:"locks"` + Next string `json:"next_cursor,omitempty"` +} + +// LFSLockListVerify represent a list of lock verification requested +// https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#list-locks-for-verification +type LFSLockListVerify struct { + Ours []*LFSLock `json:"ours"` + Theirs []*LFSLock `json:"theirs"` + Next string `json:"next_cursor,omitempty"` +} + +// LFSLockError contains information on the error that occurs +type LFSLockError struct { + Message string `json:"message"` + Lock *LFSLock `json:"lock,omitempty"` + Documentation string `json:"documentation_url,omitempty"` + RequestID string `json:"request_id,omitempty"` +} + +// LFSLockDeleteRequest contains params of a delete request +// https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#delete-lock +type LFSLockDeleteRequest struct { + Force bool `json:"force"` +} diff --git a/vendor/code.gitea.io/sdk/gitea/user_key.go b/vendor/code.gitea.io/sdk/gitea/user_key.go index 419c0a56d..4488c033f 100644 --- a/vendor/code.gitea.io/sdk/gitea/user_key.go +++ b/vendor/code.gitea.io/sdk/gitea/user_key.go @@ -13,10 +13,11 @@ import ( // PublicKey publickey is a user key to push code to repository type PublicKey struct { - ID int64 `json:"id"` - Key string `json:"key"` - URL string `json:"url,omitempty"` - Title string `json:"title,omitempty"` + ID int64 `json:"id"` + Key string `json:"key"` + URL string `json:"url,omitempty"` + Title string `json:"title,omitempty"` + Fingerprint string `json:"fingerprint,omitempty"` // swagger:strfmt date-time Created time.Time `json:"created_at,omitempty"` } diff --git a/vendor/vendor.json b/vendor/vendor.json index e33d3aa28..54cbbf330 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -9,10 +9,10 @@ "revisionTime": "2017-10-23T00:52:09Z" }, { - "checksumSHA1": "OICEgmUefW4L4l/FK/NVFnl/aOM=", + "checksumSHA1": "QQ7g7B9+EIzGjO14KCGEs9TNEzM=", "path": "code.gitea.io/sdk/gitea", - "revision": "1da52cf95ff3e7953227cfa0469e1c05a7d02557", - "revisionTime": "2017-11-12T09:10:33Z" + "revision": "ec7d3af43b598c1a3f2cb12f633b9625649d8e54", + "revisionTime": "2017-11-28T12:30:39Z" }, { "checksumSHA1": "bOODD4Gbw3GfcuQPU2dI40crxxk=",