gitea源码

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package structs
  4. import (
  5. "time"
  6. )
  7. // LFSLock represent a lock
  8. // for use with the locks API.
  9. type LFSLock struct {
  10. // The unique identifier of the lock
  11. ID string `json:"id"`
  12. // The file path that is locked
  13. Path string `json:"path"`
  14. // The timestamp when the lock was created
  15. LockedAt time.Time `json:"locked_at"`
  16. // The owner of the lock
  17. Owner *LFSLockOwner `json:"owner"`
  18. }
  19. // LFSLockOwner represent a lock owner
  20. // for use with the locks API.
  21. type LFSLockOwner struct {
  22. // The name of the lock owner
  23. Name string `json:"name"`
  24. }
  25. // LFSLockRequest contains the path of the lock to create
  26. // https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#create-lock
  27. type LFSLockRequest struct {
  28. // The file path to lock
  29. Path string `json:"path"`
  30. }
  31. // LFSLockResponse represent a lock created
  32. // https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#create-lock
  33. type LFSLockResponse struct {
  34. // The created lock
  35. Lock *LFSLock `json:"lock"`
  36. }
  37. // LFSLockList represent a list of lock requested
  38. // https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#list-locks
  39. type LFSLockList struct {
  40. // The list of locks
  41. Locks []*LFSLock `json:"locks"`
  42. // The cursor for pagination to the next set of results
  43. Next string `json:"next_cursor,omitempty"`
  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. // Locks owned by the requesting user
  49. Ours []*LFSLock `json:"ours"`
  50. // Locks owned by other users
  51. Theirs []*LFSLock `json:"theirs"`
  52. // The cursor for pagination to the next set of results
  53. Next string `json:"next_cursor,omitempty"`
  54. }
  55. // LFSLockError contains information on the error that occurs
  56. type LFSLockError struct {
  57. // The error message
  58. Message string `json:"message"`
  59. // The lock related to the error, if any
  60. Lock *LFSLock `json:"lock,omitempty"`
  61. // URL to documentation about the error
  62. Documentation string `json:"documentation_url,omitempty"`
  63. // The request ID for debugging purposes
  64. RequestID string `json:"request_id,omitempty"`
  65. }
  66. // LFSLockDeleteRequest contains params of a delete request
  67. // https://github.com/git-lfs/git-lfs/blob/master/docs/api/locking.md#delete-lock
  68. type LFSLockDeleteRequest struct {
  69. // Whether to force delete the lock even if not owned by the requester
  70. Force bool `json:"force"`
  71. }