forked from
tangled.org/core
Monorepo for Tangled
1package types
2
3import (
4 "github.com/bluekeyes/go-gitdiff/gitdiff"
5 "github.com/go-git/go-git/v5/plumbing/object"
6)
7
8type RepoIndexResponse struct {
9 IsEmpty bool `json:"is_empty"`
10 Ref string `json:"ref,omitempty"`
11 Readme string `json:"readme,omitempty"`
12 ReadmeFileName string `json:"readme_file_name,omitempty"`
13 Commits []Commit `json:"commits,omitempty"`
14 Description string `json:"description,omitempty"`
15 Files []NiceTree `json:"files,omitempty"`
16 Branches []Branch `json:"branches,omitempty"`
17 Tags []*TagReference `json:"tags,omitempty"`
18 TotalCommits int `json:"total_commits,omitempty"`
19}
20
21type RepoLogResponse struct {
22 Commits []Commit `json:"commits,omitempty"`
23 Ref string `json:"ref,omitempty"`
24 Description string `json:"description,omitempty"`
25 Log bool `json:"log,omitempty"`
26 Total int `json:"total,omitempty"`
27 Page int `json:"page,omitempty"`
28 PerPage int `json:"per_page,omitempty"`
29}
30
31type RepoCommitResponse struct {
32 Ref string `json:"ref,omitempty"`
33 Diff *NiceDiff `json:"diff,omitempty"`
34}
35
36type RepoFormatPatchResponse struct {
37 Rev1 string `json:"rev1,omitempty"`
38 Rev2 string `json:"rev2,omitempty"`
39 FormatPatch []FormatPatch `json:"format_patch,omitempty"`
40 FormatPatchRaw string `json:"patch,omitempty"`
41 CombinedPatch []*gitdiff.File `json:"combined_patch,omitempty"`
42 CombinedPatchRaw string `json:"combined_patch_raw,omitempty"`
43}
44
45type RepoTreeResponse struct {
46 Ref string `json:"ref,omitempty"`
47 Parent string `json:"parent,omitempty"`
48 Description string `json:"description,omitempty"`
49 DotDot string `json:"dotdot,omitempty"`
50 Files []NiceTree `json:"files,omitempty"`
51 ReadmeFileName string `json:"readme_filename,omitempty"`
52 Readme string `json:"readme_contents,omitempty"`
53}
54
55type TagReference struct {
56 Reference
57 Tag *object.Tag `json:"tag,omitempty"`
58 Message string `json:"message,omitempty"`
59}
60
61type Reference struct {
62 Name string `json:"name"`
63 Hash string `json:"hash"`
64}
65
66type Branch struct {
67 Reference `json:"reference"`
68 Commit *object.Commit `json:"commit,omitempty"`
69 IsDefault bool `json:"is_default,omitempty"`
70}
71
72type RepoTagsResponse struct {
73 Tags []*TagReference `json:"tags,omitempty"`
74}
75
76type RepoTagResponse struct {
77 Tag *TagReference `json:"tag,omitempty"`
78}
79
80type RepoBranchesResponse struct {
81 Branches []Branch `json:"branches,omitempty"`
82}
83
84type RepoBranchResponse struct {
85 Branch Branch
86}
87
88type RepoDefaultBranchResponse struct {
89 Branch string `json:"branch,omitempty"`
90}
91
92type ForkStatus int
93
94const (
95 UpToDate ForkStatus = 0
96 FastForwardable = 1
97 Conflict = 2
98 MissingBranch = 3
99)
100
101type ForkInfo struct {
102 IsFork bool
103 Status ForkStatus
104}
105
106type AncestorCheckResponse struct {
107 Status ForkStatus `json:"status"`
108}
109
110type RepoLanguageDetails struct {
111 Name string
112 Percentage float32
113 Color string
114}
115
116type RepoLanguageResponse struct {
117 // Language: File count
118 Languages map[string]int64 `json:"languages"`
119}