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