// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
package org_tangled
// schema: org.tangled.temp.search.searchCode
import (
"context"
"github.com/bluesky-social/indigo/lex/util"
)
const (
TempSearchSearchCodeNSID = "org.tangled.temp.search.searchCode"
)
// TempSearchSearchCode_Chunk is a "chunk" in the org.tangled.temp.search.searchCode schema.
type TempSearchSearchCode_Chunk struct {
// content: Source lines for this match chunk.
Content string `json:"content" cborgen:"content"`
// highlights: Byte-offset ranges within content that match the query.
Highlights []*TempSearchSearchCode_Highlight `json:"highlights,omitempty" cborgen:"highlights,omitempty"`
// lineStart: 1-based line number of the first line in content.
LineStart int64 `json:"lineStart" cborgen:"lineStart"`
}
// TempSearchSearchCode_FileResult is a "fileResult" in the org.tangled.temp.search.searchCode schema.
type TempSearchSearchCode_FileResult struct {
Branches []string `json:"branches,omitempty" cborgen:"branches,omitempty"`
// chunks: set for content matches
Chunks []*TempSearchSearchCode_Chunk `json:"chunks,omitempty" cborgen:"chunks,omitempty"`
Commit string `json:"commit" cborgen:"commit"`
// language: Detected programming language.
Language *string `json:"language,omitempty" cborgen:"language,omitempty"`
// path: File path relative to repository root.
Path string `json:"path" cborgen:"path"`
// ranges: set for a filename match
Ranges []*TempSearchSearchCode_Highlight `json:"ranges,omitempty" cborgen:"ranges,omitempty"`
Repo *RepoDefs_RepoViewBasic `json:"repo" cborgen:"repo"`
}
// TempSearchSearchCode_Highlight is a "highlight" in the org.tangled.temp.search.searchCode schema.
type TempSearchSearchCode_Highlight struct {
// end: End byte offset (exclusive) within the chunk content string.
End int64 `json:"end" cborgen:"end"`
// start: Start byte offset within the chunk content string.
Start int64 `json:"start" cborgen:"start"`
}
// TempSearchSearchCode_Output is the output of a org.tangled.temp.search.searchCode call.
type TempSearchSearchCode_Output struct {
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
Results []*TempSearchSearchCode_FileResult `json:"results" cborgen:"results"`
}
// TempSearchSearchCode calls the XRPC method "org.tangled.temp.search.searchCode".
//
// q: Search query string.
// repo: Restrict search to a specific repository, by its DID.
func TempSearchSearchCode(ctx context.Context, c util.LexClient, cursor string, limit int64, q string, repo string) (*TempSearchSearchCode_Output, error) {
var out TempSearchSearchCode_Output
params := map[string]interface{}{}
if cursor != "" {
params["cursor"] = cursor
}
if limit != 0 {
params["limit"] = limit
}
params["q"] = q
if repo != "" {
params["repo"] = repo
}
if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.search.searchCode", params, nil, &out); err != nil {
return nil, err
}
return &out, nil
}