本站源代码
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

66 lines
2.0KB

  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. package structs
  5. import (
  6. "time"
  7. )
  8. // StatusState holds the state of a Status
  9. // It can be "pending", "success", "error", "failure", and "warning"
  10. type StatusState string
  11. const (
  12. // StatusPending is for when the Status is Pending
  13. StatusPending StatusState = "pending"
  14. // StatusSuccess is for when the Status is Success
  15. StatusSuccess StatusState = "success"
  16. // StatusError is for when the Status is Error
  17. StatusError StatusState = "error"
  18. // StatusFailure is for when the Status is Failure
  19. StatusFailure StatusState = "failure"
  20. // StatusWarning is for when the Status is Warning
  21. StatusWarning StatusState = "warning"
  22. )
  23. // Status holds a single Status of a single Commit
  24. type Status struct {
  25. ID int64 `json:"id"`
  26. State StatusState `json:"status"`
  27. TargetURL string `json:"target_url"`
  28. Description string `json:"description"`
  29. URL string `json:"url"`
  30. Context string `json:"context"`
  31. Creator *User `json:"creator"`
  32. // swagger:strfmt date-time
  33. Created time.Time `json:"created_at"`
  34. // swagger:strfmt date-time
  35. Updated time.Time `json:"updated_at"`
  36. }
  37. // CombinedStatus holds the combined state of several statuses for a single commit
  38. type CombinedStatus struct {
  39. State StatusState `json:"state"`
  40. SHA string `json:"sha"`
  41. TotalCount int `json:"total_count"`
  42. Statuses []*Status `json:"statuses"`
  43. Repository *Repository `json:"repository"`
  44. CommitURL string `json:"commit_url"`
  45. URL string `json:"url"`
  46. }
  47. // CreateStatusOption holds the information needed to create a new Status for a Commit
  48. type CreateStatusOption struct {
  49. State StatusState `json:"state"`
  50. TargetURL string `json:"target_url"`
  51. Description string `json:"description"`
  52. Context string `json:"context"`
  53. }
  54. // ListStatusesOption holds pagination information
  55. type ListStatusesOption struct {
  56. Page int
  57. }
上海开阖软件有限公司 沪ICP备12045867号-1