~james/core

core/api/org_tangled/gitgetEntry.go -rw-r--r-- 1.4 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 14 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
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.

package org_tangled

// schema: org.tangled.git.getEntry

import (
	"context"

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

const (
	GitGetEntryNSID = "org.tangled.git.getEntry"
)

// GitGetEntry_Output is the output of a org.tangled.git.getEntry call.
type GitGetEntry_Output struct {
	LastCommit *GitDefs_Commit `json:"lastCommit,omitempty" cborgen:"lastCommit,omitempty"`
	Mode       string          `json:"mode" cborgen:"mode"`
	// name: The file name
	Name string `json:"name" cborgen:"name"`
	Oid  string `json:"oid" cborgen:"oid"`
	// size: Blob size
	Size int64 `json:"size" cborgen:"size"`
	// submodule: Submodule information if path is a submodule
	Submodule *GitDefs_Submodule `json:"submodule,omitempty" cborgen:"submodule,omitempty"`
}

// GitGetEntry calls the XRPC method "org.tangled.git.getEntry".
//
// path: path of the entity
// ref: Git revision (branch, tag, or commit Object ID)
// repo: DID of the repository
func GitGetEntry(ctx context.Context, c util.LexClient, path string, ref string, repo string) (*GitGetEntry_Output, error) {
	var out GitGetEntry_Output

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

	return &out, nil
}