Files
sdk/model_code_span.go

497 lines
13 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the CodeSpan type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CodeSpan{}
// CodeSpan struct for CodeSpan
type CodeSpan struct {
// EndLine is the last line of the span, inclusive. It equals Line for a one-line span rather than being zero or absent.
EndLine *int64 `json:"endLine,omitempty"`
// File is the path inside the repo, relative to its root and never absolute.
File *string `json:"file,omitempty"`
// Kind is what the indexer decided this chunk IS — \"func\", \"method\", \"type\", \"struct\", \"interface\", \"var\", \"const\", or \"block\" for a run of code that declares nothing. Absent when the chunker could not classify it.
Kind *string `json:"kind,omitempty"`
// Line is where the span starts, 1-based, as an editor counts.
Line *int64 `json:"line,omitempty"`
// Repo is the indexed repository the span was found in, as it was indexed (\"owner/name\"). A search may be scoped to one repo or run across all of them, so this is how a caller tells the results apart.
Repo *string `json:"repo,omitempty"`
// context: match | definition | caller
Role *string `json:"role,omitempty"`
// Score ranks this span against the OTHERS IN THE SAME RESPONSE and means nothing across responses or between tiers: the hybrid tier's number is a reciprocal-rank fusion sum (Σ 1/(60+rank), so tenths at best), the symbol tier's is a descending position count, and the text and semantic tiers pass through bm25 and cosine. Compare within a list; never threshold on it.
Score *float64 `json:"score,omitempty"`
// Snippet is the code itself: a bounded excerpt on /search, the whole chunk on /context — which is why the same type serves both and why a /context span is the one an agent pastes into its window.
Snippet *string `json:"snippet,omitempty"`
// Symbol is the declared name, when the span declares one. Absent on a block.
Symbol *string `json:"symbol,omitempty"`
// Tier is which retrieval produced the span: \"hybrid\" (the default — all three fused), \"text\" (trigram/FTS), \"regex\", \"semantic\" (vector), or \"symbol\". It is what explains a Score, so the two travel together.
Tier *string `json:"tier,omitempty"`
AdditionalProperties map[string]interface{}
}
type _CodeSpan CodeSpan
// NewCodeSpan instantiates a new CodeSpan object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewCodeSpan() *CodeSpan {
this := CodeSpan{}
return &this
}
// NewCodeSpanWithDefaults instantiates a new CodeSpan object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewCodeSpanWithDefaults() *CodeSpan {
this := CodeSpan{}
return &this
}
// GetEndLine returns the EndLine field value if set, zero value otherwise.
func (o *CodeSpan) GetEndLine() int64 {
if o == nil || IsNil(o.EndLine) {
var ret int64
return ret
}
return *o.EndLine
}
// GetEndLineOk returns a tuple with the EndLine field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSpan) GetEndLineOk() (*int64, bool) {
if o == nil || IsNil(o.EndLine) {
return nil, false
}
return o.EndLine, true
}
// HasEndLine returns a boolean if a field has been set.
func (o *CodeSpan) HasEndLine() bool {
if o != nil && !IsNil(o.EndLine) {
return true
}
return false
}
// SetEndLine gets a reference to the given int64 and assigns it to the EndLine field.
func (o *CodeSpan) SetEndLine(v int64) {
o.EndLine = &v
}
// GetFile returns the File field value if set, zero value otherwise.
func (o *CodeSpan) GetFile() string {
if o == nil || IsNil(o.File) {
var ret string
return ret
}
return *o.File
}
// GetFileOk returns a tuple with the File field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSpan) GetFileOk() (*string, bool) {
if o == nil || IsNil(o.File) {
return nil, false
}
return o.File, true
}
// HasFile returns a boolean if a field has been set.
func (o *CodeSpan) HasFile() bool {
if o != nil && !IsNil(o.File) {
return true
}
return false
}
// SetFile gets a reference to the given string and assigns it to the File field.
func (o *CodeSpan) SetFile(v string) {
o.File = &v
}
// GetKind returns the Kind field value if set, zero value otherwise.
func (o *CodeSpan) GetKind() string {
if o == nil || IsNil(o.Kind) {
var ret string
return ret
}
return *o.Kind
}
// GetKindOk returns a tuple with the Kind field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSpan) GetKindOk() (*string, bool) {
if o == nil || IsNil(o.Kind) {
return nil, false
}
return o.Kind, true
}
// HasKind returns a boolean if a field has been set.
func (o *CodeSpan) HasKind() bool {
if o != nil && !IsNil(o.Kind) {
return true
}
return false
}
// SetKind gets a reference to the given string and assigns it to the Kind field.
func (o *CodeSpan) SetKind(v string) {
o.Kind = &v
}
// GetLine returns the Line field value if set, zero value otherwise.
func (o *CodeSpan) GetLine() int64 {
if o == nil || IsNil(o.Line) {
var ret int64
return ret
}
return *o.Line
}
// GetLineOk returns a tuple with the Line field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSpan) GetLineOk() (*int64, bool) {
if o == nil || IsNil(o.Line) {
return nil, false
}
return o.Line, true
}
// HasLine returns a boolean if a field has been set.
func (o *CodeSpan) HasLine() bool {
if o != nil && !IsNil(o.Line) {
return true
}
return false
}
// SetLine gets a reference to the given int64 and assigns it to the Line field.
func (o *CodeSpan) SetLine(v int64) {
o.Line = &v
}
// GetRepo returns the Repo field value if set, zero value otherwise.
func (o *CodeSpan) GetRepo() string {
if o == nil || IsNil(o.Repo) {
var ret string
return ret
}
return *o.Repo
}
// GetRepoOk returns a tuple with the Repo field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSpan) GetRepoOk() (*string, bool) {
if o == nil || IsNil(o.Repo) {
return nil, false
}
return o.Repo, true
}
// HasRepo returns a boolean if a field has been set.
func (o *CodeSpan) HasRepo() bool {
if o != nil && !IsNil(o.Repo) {
return true
}
return false
}
// SetRepo gets a reference to the given string and assigns it to the Repo field.
func (o *CodeSpan) SetRepo(v string) {
o.Repo = &v
}
// GetRole returns the Role field value if set, zero value otherwise.
func (o *CodeSpan) GetRole() string {
if o == nil || IsNil(o.Role) {
var ret string
return ret
}
return *o.Role
}
// GetRoleOk returns a tuple with the Role field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSpan) GetRoleOk() (*string, bool) {
if o == nil || IsNil(o.Role) {
return nil, false
}
return o.Role, true
}
// HasRole returns a boolean if a field has been set.
func (o *CodeSpan) HasRole() bool {
if o != nil && !IsNil(o.Role) {
return true
}
return false
}
// SetRole gets a reference to the given string and assigns it to the Role field.
func (o *CodeSpan) SetRole(v string) {
o.Role = &v
}
// GetScore returns the Score field value if set, zero value otherwise.
func (o *CodeSpan) GetScore() float64 {
if o == nil || IsNil(o.Score) {
var ret float64
return ret
}
return *o.Score
}
// GetScoreOk returns a tuple with the Score field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSpan) GetScoreOk() (*float64, bool) {
if o == nil || IsNil(o.Score) {
return nil, false
}
return o.Score, true
}
// HasScore returns a boolean if a field has been set.
func (o *CodeSpan) HasScore() bool {
if o != nil && !IsNil(o.Score) {
return true
}
return false
}
// SetScore gets a reference to the given float64 and assigns it to the Score field.
func (o *CodeSpan) SetScore(v float64) {
o.Score = &v
}
// GetSnippet returns the Snippet field value if set, zero value otherwise.
func (o *CodeSpan) GetSnippet() string {
if o == nil || IsNil(o.Snippet) {
var ret string
return ret
}
return *o.Snippet
}
// GetSnippetOk returns a tuple with the Snippet field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSpan) GetSnippetOk() (*string, bool) {
if o == nil || IsNil(o.Snippet) {
return nil, false
}
return o.Snippet, true
}
// HasSnippet returns a boolean if a field has been set.
func (o *CodeSpan) HasSnippet() bool {
if o != nil && !IsNil(o.Snippet) {
return true
}
return false
}
// SetSnippet gets a reference to the given string and assigns it to the Snippet field.
func (o *CodeSpan) SetSnippet(v string) {
o.Snippet = &v
}
// GetSymbol returns the Symbol field value if set, zero value otherwise.
func (o *CodeSpan) GetSymbol() string {
if o == nil || IsNil(o.Symbol) {
var ret string
return ret
}
return *o.Symbol
}
// GetSymbolOk returns a tuple with the Symbol field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSpan) GetSymbolOk() (*string, bool) {
if o == nil || IsNil(o.Symbol) {
return nil, false
}
return o.Symbol, true
}
// HasSymbol returns a boolean if a field has been set.
func (o *CodeSpan) HasSymbol() bool {
if o != nil && !IsNil(o.Symbol) {
return true
}
return false
}
// SetSymbol gets a reference to the given string and assigns it to the Symbol field.
func (o *CodeSpan) SetSymbol(v string) {
o.Symbol = &v
}
// GetTier returns the Tier field value if set, zero value otherwise.
func (o *CodeSpan) GetTier() string {
if o == nil || IsNil(o.Tier) {
var ret string
return ret
}
return *o.Tier
}
// GetTierOk returns a tuple with the Tier field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CodeSpan) GetTierOk() (*string, bool) {
if o == nil || IsNil(o.Tier) {
return nil, false
}
return o.Tier, true
}
// HasTier returns a boolean if a field has been set.
func (o *CodeSpan) HasTier() bool {
if o != nil && !IsNil(o.Tier) {
return true
}
return false
}
// SetTier gets a reference to the given string and assigns it to the Tier field.
func (o *CodeSpan) SetTier(v string) {
o.Tier = &v
}
func (o CodeSpan) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o CodeSpan) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.EndLine) {
toSerialize["endLine"] = o.EndLine
}
if !IsNil(o.File) {
toSerialize["file"] = o.File
}
if !IsNil(o.Kind) {
toSerialize["kind"] = o.Kind
}
if !IsNil(o.Line) {
toSerialize["line"] = o.Line
}
if !IsNil(o.Repo) {
toSerialize["repo"] = o.Repo
}
if !IsNil(o.Role) {
toSerialize["role"] = o.Role
}
if !IsNil(o.Score) {
toSerialize["score"] = o.Score
}
if !IsNil(o.Snippet) {
toSerialize["snippet"] = o.Snippet
}
if !IsNil(o.Symbol) {
toSerialize["symbol"] = o.Symbol
}
if !IsNil(o.Tier) {
toSerialize["tier"] = o.Tier
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *CodeSpan) UnmarshalJSON(data []byte) (err error) {
varCodeSpan := _CodeSpan{}
err = json.Unmarshal(data, &varCodeSpan)
if err != nil {
return err
}
*o = CodeSpan(varCodeSpan)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "endLine")
delete(additionalProperties, "file")
delete(additionalProperties, "kind")
delete(additionalProperties, "line")
delete(additionalProperties, "repo")
delete(additionalProperties, "role")
delete(additionalProperties, "score")
delete(additionalProperties, "snippet")
delete(additionalProperties, "symbol")
delete(additionalProperties, "tier")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableCodeSpan struct {
value *CodeSpan
isSet bool
}
func (v NullableCodeSpan) Get() *CodeSpan {
return v.value
}
func (v *NullableCodeSpan) Set(val *CodeSpan) {
v.value = val
v.isSet = true
}
func (v NullableCodeSpan) IsSet() bool {
return v.isSet
}
func (v *NullableCodeSpan) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCodeSpan(val *CodeSpan) *NullableCodeSpan {
return &NullableCodeSpan{value: val, isSet: true}
}
func (v NullableCodeSpan) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCodeSpan) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}