Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Commit 4319a1e

Browse files
sapklunny
authored andcommitted
Add api lfs locks struct (#78)
* Add locks struct * Add missing delete request
1 parent 1da52cf commit 4319a1e

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

gitea/lfs_lock.go

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright 2017 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package gitea
6+
7+
import (
8+
"time"
9+
)
10+
11+
// LFSLock represent a lock
12+
// for use with the locks API.
13+
type LFSLock struct {
14+
ID string `json:"id"`
15+
Path string `json:"path"`
16+
LockedAt time.Time `json:"locked_at"`
17+
Owner *LFSLockOwner `json:"owner"`
18+
}
19+
20+
// LFSLockOwner represent a lock owner
21+
// for use with the locks API.
22+
type LFSLockOwner struct {
23+
Name string `json:"name"`
24+
}
25+
26+
// LFSLockRequest contains the path of the lock to create
27+
// https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#create-lock
28+
type LFSLockRequest struct {
29+
Path string `json:"path"`
30+
}
31+
32+
// LFSLockResponse represent a lock created
33+
// https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#create-lock
34+
type LFSLockResponse struct {
35+
Lock *LFSLock `json:"lock"`
36+
}
37+
38+
// LFSLockList represent a list of lock requested
39+
// https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#list-locks
40+
type LFSLockList struct {
41+
Locks []*LFSLock `json:"locks"`
42+
Next string `json:"next_cursor,omitempty"`
43+
}
44+
45+
// LFSLockListVerify represent a list of lock verification requested
46+
// https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#list-locks-for-verification
47+
type LFSLockListVerify struct {
48+
Ours []*LFSLock `json:"ours"`
49+
Theirs []*LFSLock `json:"theirs"`
50+
Next string `json:"next_cursor,omitempty"`
51+
}
52+
53+
// LFSLockError contains information on the error that occurs
54+
type LFSLockError struct {
55+
Message string `json:"message"`
56+
Lock *LFSLock `json:"lock,omitempty"`
57+
Documentation string `json:"documentation_url,omitempty"`
58+
RequestID string `json:"request_id,omitempty"`
59+
}
60+
61+
// LFSLockDeleteRequest contains params of a delete request
62+
// https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#delete-lock
63+
type LFSLockDeleteRequest struct {
64+
Force bool `json:"force"`
65+
}

0 commit comments

Comments
 (0)