~james/core

core/api/org_tangled/gitgetBlame.go -rw-r--r-- 2.3 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 15 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.

package org_tangled

// schema: org.tangled.git.getBlame

import (
	"context"

	"github.com/bluesky-social/indigo/lex/util"
)

const (
	GitGetBlameNSID = "org.tangled.git.getBlame"
)

// GitGetBlame_Author is a "author" in the org.tangled.git.getBlame schema.
type GitGetBlame_Author struct {
	Email string `json:"email" cborgen:"email"`
	Name  string `json:"name" cborgen:"name"`
}

// GitGetBlame_Commit is a "commit" in the org.tangled.git.getBlame schema.
type GitGetBlame_Commit struct {
	Author *GitGetBlame_Author `json:"author" cborgen:"author"`
	// authoredAt: When the change was authored
	AuthoredAt string `json:"authoredAt" cborgen:"authoredAt"`
	// sha: Commit Object ID
	Sha string `json:"sha" cborgen:"sha"`
	// subject: First line of the commit message
	Subject string `json:"subject" cborgen:"subject"`
}

// GitGetBlame_Output is the output of a org.tangled.git.getBlame call.
type GitGetBlame_Output struct {
	// commit: The resolved commit Object ID
	Commit string `json:"commit" cborgen:"commit"`
	// commits: Unique commits referenced by blame runs
	Commits []*GitGetBlame_Commit `json:"commits" cborgen:"commits"`
	// runs: Complete, gap-free one-based line ranges sorted by start
	Runs []*GitGetBlame_Run `json:"runs" cborgen:"runs"`
}

// GitGetBlame_Run is a "run" in the org.tangled.git.getBlame schema.
type GitGetBlame_Run struct {
	// commit: The commit Object ID of the entry in commits this run is attributed to
	Commit string `json:"commit" cborgen:"commit"`
	// count: Number of lines in the run
	Count int64 `json:"count" cborgen:"count"`
	// start: First line of the run, one-based
	Start int64 `json:"start" cborgen:"start"`
}

// GitGetBlame calls the XRPC method "org.tangled.git.getBlame".
//
// path: Path of the file to blame
// ref: Git revision (branch, tag, or commit Object ID)
// repo: DID of the repository
func GitGetBlame(ctx context.Context, c util.LexClient, path string, ref string, repo string) (*GitGetBlame_Output, error) {
	var out GitGetBlame_Output

	params := map[string]interface{}{}
	params["path"] = path
	params["ref"] = ref
	params["repo"] = repo
	if err := c.LexDo(ctx, util.Query, "", "org.tangled.git.getBlame", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}