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"`
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}
50
51type TagReference struct {
52 Reference
53 Tag *object.Tag `json:"tag,omitempty"`
54 Message string `json:"message,omitempty"`
55}
56
57type Reference struct {
58 Name string `json:"name"`
59 Hash string `json:"hash"`
60}
61
62type Branch struct {
63 Reference `json:"reference"`
64 Commit *object.Commit `json:"commit,omitempty"`
65 IsDefault bool `json:"is_deafult,omitempty"`
66}
67
68type RepoTagsResponse struct {
69 Tags []*TagReference `json:"tags,omitempty"`
70}
71
72type RepoBranchesResponse struct {
73 Branches []Branch `json:"branches,omitempty"`
74}
75
76type RepoBranchResponse struct {
77 Branch Branch
78}
79
80type RepoDefaultBranchResponse struct {
81 Branch string `json:"branch,omitempty"`
82}
83
84type RepoBlobResponse struct {
85 Contents string `json:"contents,omitempty"`
86 Ref string `json:"ref,omitempty"`
87 Path string `json:"path,omitempty"`
88 IsBinary bool `json:"is_binary,omitempty"`
89
90 Lines int `json:"lines,omitempty"`
91 SizeHint uint64 `json:"size_hint,omitempty"`
92}
93
94type ForkStatus int
95
96const (
97 UpToDate ForkStatus = 0
98 FastForwardable = 1
99 Conflict = 2
100 MissingBranch = 3
101)
102
103type ForkInfo struct {
104 IsFork bool
105 Status ForkStatus
106}
107
108type AncestorCheckResponse struct {
109 Status ForkStatus `json:"status"`
110}
111
112type RepoLanguageResponse struct {
113 // Language: Percentage
114 Languages map[string]int `json:"languages"`
115}