// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
package org_tangled
// schema: org.tangled.temp.git.listCommits
import (
"context"
"encoding/json"
"fmt"
"github.com/bluesky-social/indigo/lex/util"
)
const (
TempGitListCommitsNSID = "org.tangled.temp.git.listCommits"
)
// TempGitListCommits_Commit is a "commit" in the org.tangled.temp.git.listCommits schema.
type TempGitListCommits_Commit struct {
Author *GitDefs_Signature `json:"author" cborgen:"author"`
Committer *GitDefs_Signature `json:"committer" cborgen:"committer"`
ExtraHeaders []*TempGitListCommits_Header `json:"extraHeaders" cborgen:"extraHeaders"`
Message string `json:"message" cborgen:"message"`
Oid string `json:"oid" cborgen:"oid"`
Parents []string `json:"parents" cborgen:"parents"`
// signature: Set only when the commit's signature verifies against the key embedded in it. Says nothing about who owns that key.
Signature *TempGitListCommits_Commit_Signature `json:"signature,omitempty" cborgen:"signature,omitempty"`
Stat *GitDefs_DiffStat `json:"stat,omitempty" cborgen:"stat,omitempty"`
Tree string `json:"tree" cborgen:"tree"`
}
// Set only when the commit's signature verifies against the key embedded in it. Says nothing about who owns that key.
type TempGitListCommits_Commit_Signature struct {
TempGitListCommits_SshSignature *TempGitListCommits_SshSignature
}
func (t *TempGitListCommits_Commit_Signature) MarshalJSON() ([]byte, error) {
if t.TempGitListCommits_SshSignature != nil {
t.TempGitListCommits_SshSignature.LexiconTypeID = "org.tangled.temp.git.listCommits#sshSignature"
return json.Marshal(t.TempGitListCommits_SshSignature)
}
return nil, fmt.Errorf("cannot marshal empty enum")
}
func (t *TempGitListCommits_Commit_Signature) UnmarshalJSON(b []byte) error {
typ, err := util.TypeExtract(b)
if err != nil {
return err
}
switch typ {
case "org.tangled.temp.git.listCommits#sshSignature":
t.TempGitListCommits_SshSignature = new(TempGitListCommits_SshSignature)
return json.Unmarshal(b, t.TempGitListCommits_SshSignature)
default:
return nil
}
}
// TempGitListCommits_Header is a "header" in the org.tangled.temp.git.listCommits schema.
type TempGitListCommits_Header struct {
Key string `json:"key" cborgen:"key"`
Value string `json:"value" cborgen:"value"`
}
// TempGitListCommits_Output is the output of a org.tangled.temp.git.listCommits call.
type TempGitListCommits_Output struct {
Commits []*TempGitListCommits_Commit `json:"commits" cborgen:"commits"`
}
// TempGitListCommits_SshSignature is a "sshSignature" in the org.tangled.temp.git.listCommits schema.
//
// RECORDTYPE: TempGitListCommits_SshSignature
type TempGitListCommits_SshSignature struct {
LexiconTypeID string `json:"$type,const=org.tangled.temp.git.listCommits#sshSignature" cborgen:"$type,const=org.tangled.temp.git.listCommits#sshSignature"`
// fingerprint: SHA256 fingerprint of the signing key, `SHA256:...`
Fingerprint string `json:"fingerprint" cborgen:"fingerprint"`
}
// TempGitListCommits calls the XRPC method "org.tangled.temp.git.listCommits".
//
// includeStats: Diff each commit against its first parent and include a line stat
// limit: Maximum number of commits to return
// ranges: Commit ids or `<commit>..<commit>` ranges
// repos: DIDs of the repositories to read objects from
// skip: Number of matching commits to skip. A poor man's pagination.
func TempGitListCommits(ctx context.Context, c util.LexClient, includeStats bool, limit int64, ranges []string, repos []string, skip int64) (*TempGitListCommits_Output, error) {
var out TempGitListCommits_Output
params := map[string]interface{}{}
if includeStats {
params["includeStats"] = includeStats
}
if limit != 0 {
params["limit"] = limit
}
if len(ranges) != 0 {
params["ranges"] = ranges
}
params["repos"] = repos
if skip != 0 {
params["skip"] = skip
}
if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.git.listCommits", params, nil, &out); err != nil {
return nil, err
}
return &out, nil
}