gitea源码

status.go 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package structs
  4. import (
  5. "time"
  6. "code.gitea.io/gitea/modules/commitstatus"
  7. )
  8. // CommitStatus holds a single status of a single Commit
  9. type CommitStatus struct {
  10. // ID is the unique identifier for the commit status
  11. ID int64 `json:"id"`
  12. // State represents the status state (pending, success, error, failure)
  13. State commitstatus.CommitStatusState `json:"status"`
  14. // TargetURL is the URL to link to for more details
  15. TargetURL string `json:"target_url"`
  16. // Description provides a brief description of the status
  17. Description string `json:"description"`
  18. // URL is the API URL for this status
  19. URL string `json:"url"`
  20. // Context is the unique context identifier for the status
  21. Context string `json:"context"`
  22. // Creator is the user who created the status
  23. Creator *User `json:"creator"`
  24. // swagger:strfmt date-time
  25. Created time.Time `json:"created_at"`
  26. // swagger:strfmt date-time
  27. Updated time.Time `json:"updated_at"`
  28. }
  29. // CombinedStatus holds the combined state of several statuses for a single commit
  30. type CombinedStatus struct {
  31. // State is the overall combined status state
  32. State commitstatus.CommitStatusState `json:"state"`
  33. // SHA is the commit SHA this status applies to
  34. SHA string `json:"sha"`
  35. // TotalCount is the total number of statuses
  36. TotalCount int `json:"total_count"`
  37. // Statuses contains all individual commit statuses
  38. Statuses []*CommitStatus `json:"statuses"`
  39. // Repository is the repository this status belongs to
  40. Repository *Repository `json:"repository"`
  41. // CommitURL is the API URL for the commit
  42. CommitURL string `json:"commit_url"`
  43. // URL is the API URL for this combined status
  44. URL string `json:"url"`
  45. }
  46. // CreateStatusOption holds the information needed to create a new CommitStatus for a Commit
  47. type CreateStatusOption struct {
  48. // State represents the status state to set (pending, success, error, failure)
  49. State commitstatus.CommitStatusState `json:"state"`
  50. // TargetURL is the URL to link to for more details
  51. TargetURL string `json:"target_url"`
  52. // Description provides a brief description of the status
  53. Description string `json:"description"`
  54. // Context is the unique context identifier for the status
  55. Context string `json:"context"`
  56. }