v0.18.0 0cea275

dto.go RawHistoryFolder

1// SPDX-License-Identifier: AGPL-3.0-or-later
2
3package ports
4
5import (
6	"time"
7
8	"bnema.dev/ermite/internal/domain"
9)
10
11// The parameters and results of the use case interfaces (services.go). They
12// live here so that the adapters that call the use cases and the use cases
13// themselves share them without importing each other.
14
15// RepoPage is a page of repositories ordered by name.
16type RepoPage struct {
17	Repos []domain.Repo
18	// NextPageToken is empty on the last page.
19	NextPageToken string
20}
21
22// RepoView is a repository with the Git state that belongs in its summary.
23type RepoView struct {
24	domain.Repo
25	// DefaultBranch is the branch HEAD points to, even when it does not exist
26	// yet; empty when HEAD is detached or the directory is missing.
27	DefaultBranch string
28}
29
30// CreateRepoParams are the settings of a new repository.
31type CreateRepoParams struct {
32	Name        domain.RepoName
33	Description string
34	// Visibility defaults to private when empty.
35	Visibility domain.Visibility
36}
37
38// UpdateRepoParams are the changes of Update; a nil field is left alone.
39type UpdateRepoParams struct {
40	Description   *string
41	Visibility    *domain.Visibility
42	DefaultBranch *string
43	// AllowedMergeModes replaces the allowed merge modes; it must hold at
44	// least one known mode.
45	AllowedMergeModes *[]domain.MergeMode
46	// FailingChecksBlock replaces the setting of that name.
47	FailingChecksBlock *bool
48}
49
50// TokenPage is a page of stored tokens, newest first.
51type TokenPage struct {
52	Tokens []domain.Token
53	// NextPageToken is empty on the last page.
54	NextPageToken string
55}
56
57// CreateTokenParams are the settings of a new token.
58type CreateTokenParams struct {
59	Label string
60	// Scopes must not be empty.
61	Scopes []domain.Scope
62	// Repos limits the token to these repositories; empty means every one.
63	Repos []domain.RepoName
64	// BranchPrefixes limits the token to the branches under these prefixes
65	// (see domain.ParseBranchPrefix); empty means every branch.
66	BranchPrefixes []string
67	// ExpiresAt is the zero time for a token that never expires.
68	ExpiresAt time.Time
69}
70
71// CreatedToken is a new token with its secret, which is shown once and never
72// stored.
73type CreatedToken struct {
74	Token  domain.Token
75	Secret string
76}
77
78// ListRefsParams selects the refs to list.
79type ListRefsParams struct {
80	// Kinds restricts the result; empty means every kind.
81	Kinds []domain.RefKind
82	// PageSize is 0 for the default, and lowered to MaxRefPageSize.
83	PageSize int
84	// PageToken is the NextPageToken of the previous page, or empty.
85	PageToken string
86}
87
88// RefPage is a page of refs.
89type RefPage struct {
90	Refs []domain.Ref
91	// NextPageToken is empty on the last page.
92	NextPageToken string
93}
94
95// ListCommitsParams selects a page of history.
96type ListCommitsParams struct {
97	// Revision is where the history starts; the zero value is HEAD. Ignored
98	// when PageToken is set: the token pins the commit the first page started
99	// from, so every page walks the same history even if a branch moves.
100	Revision domain.Revision
101	// Path limits the history to the commits that changed it. It must be the
102	// same on every page of a listing.
103	Path domain.TreePath
104	// PageSize is 0 for the default, and lowered to MaxPageSize.
105	PageSize int
106	// PageToken is the NextPageToken of the previous page, or empty.
107	PageToken string
108}
109
110// HistoryPage is a page of history, newest first.
111type HistoryPage struct {
112	Commits []domain.Commit
113	// NextPageToken is empty on the last page.
114	NextPageToken string
115}
116
117// WatchParams select the events of a watch.
118type WatchParams struct {
119	// Topics are TopicHome or "repo:<name>"; empty means TopicHome.
120	Topics []string
121	// ResumeAfter is the id of the last event the caller saw; empty to
122	// receive only new events.
123	ResumeAfter string
124	// Client identifies where the watch comes from, for the limit per client
125	// (MaxWatchersPerClient): an opaque key such as a normalized address; the
126	// web passes its visitor's. Empty only for callers with no client, which
127	// count against MaxWatchers alone.
128	Client string
129	// Ready, when not nil, is called once the topics are valid and the watch
130	// is registered: events published from then on are not missed. Nothing is
131	// sent before it returns.
132	Ready func()
133}
134
135// WatchEvent is one item of a watch.
136type WatchEvent struct {
137	// ID identifies the event, for resuming. Empty on a gap.
138	ID string
139	// Gap tells that events were lost: the caller must reload what it shows.
140	// Event is nil then.
141	Gap bool
142	// Event is a domain.RepoCreated, RepoUpdated, RepoDeleted, PushEvent,
143	// MergeRequestOpened, MergeRequestMerged, MergeRequestClosed,
144	// MergeRequestReady, CommentAdded, RunUpdated or JobUpdated.
145	Event domain.Event
146	// Repo is the state of the repository at delivery, for RepoCreated and
147	// RepoUpdated.
148	Repo *RepoView
149}
150
151// CreateMergeRequestParams describes the merge request to open.
152type CreateMergeRequestParams struct {
153	Title       string
154	Description string
155	// Source is required; Target defaults to the default branch.
156	Source, Target string
157}
158
159// ListMergeRequestsParams selects a page of merge requests.
160type ListMergeRequestsParams struct {
161	// State restricts the result; empty means every state.
162	State domain.MRState
163	// PageSize is 0 for the default, and lowered to MaxPageSize.
164	PageSize int
165	// PageToken is the NextPageToken of the previous page, or empty.
166	PageToken string
167}
168
169// MergeRequestPage is a page of merge requests, highest number first.
170type MergeRequestPage struct {
171	MergeRequests []domain.MergeRequest
172	// NextPageToken is empty on the last page.
173	NextPageToken string
174}
175
176// MergeRequestDetail is a merge request with its review data.
177type MergeRequestDetail struct {
178	MergeRequest domain.MergeRequest
179	// Commits are the commits of the head that the target lacks, newest
180	// first, at most MaxMergeRequestCommits.
181	Commits          []domain.Commit
182	CommitsTruncated bool
183	// DiffBaseID is the commit the diff compares from; zero when the source
184	// branch is gone, then the diff is empty.
185	DiffBaseID domain.ObjectID
186	Stats      domain.DiffStats
187	Diff       domain.Diff
188	// Comments are the comments, oldest first.
189	Comments []domain.Comment
190	// LastReadID is the head recorded by MarkRead; zero when none.
191	LastReadID domain.ObjectID
192	// LastReadLost tells that since-last-read was asked for, a head was
193	// recorded, but that commit is gone: the diff is against the target.
194	LastReadLost bool
195}
196
197// AddCommentParams describes the comment to add.
198type AddCommentParams struct {
199	// Path, Line and Side designate a line of the diff; all empty for a
200	// general comment.
201	Path string
202	Line int
203	Side domain.DiffSide
204	Text string
205}
206
207// MergeParams describes the merge to perform.
208type MergeParams struct {
209	// Mode defaults to fast-forward.
210	Mode domain.MergeMode
211	// HeadID is the commit the caller reviewed; the source branch must still
212	// point to it.
213	HeadID domain.ObjectID
214	// DeleteSource deletes the source branch after the merge.
215	DeleteSource bool
216}
217
218// MergeResult is a merged request and what happened to its source branch.
219type MergeResult struct {
220	domain.MergeRequest
221	// SourceDeleted is true when DeleteSource was asked and the branch is
222	// gone.
223	SourceDeleted bool
224}
225
226// LoginLink is a login link as the owner receives it.
227type LoginLink struct {
228	// URL holds the secret: show it once, never log it.
229	URL       string
230	ExpiresAt time.Time
231}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 3

Tags 43

↑↓ moveenter openesc close