mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
345 lines
9.8 KiB
Go
345 lines
9.8 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 CodeContextBundle type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &CodeContextBundle{}
|
|
|
|
// CodeContextBundle struct for CodeContextBundle
|
|
type CodeContextBundle struct {
|
|
// BudgetTokens is the ceiling the caller asked for. Packing stops under it, so this is a bound and not a target.
|
|
BudgetTokens *int64 `json:"budgetTokens,omitempty"`
|
|
// Capped is true when the semantic tier stopped at its scan cap — it compares a query with at most 50000 stored vectors — with more left unread, so code past the cap could not be picked by meaning. The lexical and symbol tiers read the whole index either way. Absent otherwise.
|
|
Capped *bool `json:"capped,omitempty"`
|
|
// Query is the ask this bundle was packed for, echoed back so a cached or forwarded bundle still says what it answers.
|
|
Query *string `json:"query,omitempty"`
|
|
// Repo narrows the retrieval to one repository. Absent means every indexed repo was searched.
|
|
Repo *string `json:"repo,omitempty"`
|
|
// Spans are the packed chunks, most relevant first, each expanded with the definitions it calls and its notable callers. The top match is always present even if it had to be truncated to fit, so a matched query never comes back with nothing.
|
|
Spans []CodeSpan `json:"spans,omitempty"`
|
|
// UsedTokens is what the returned spans actually cost, by the same estimate the packer used (roughly one token per four characters — an estimate, not a tokenizer's count, so size a real window with headroom).
|
|
UsedTokens *int64 `json:"usedTokens,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _CodeContextBundle CodeContextBundle
|
|
|
|
// NewCodeContextBundle instantiates a new CodeContextBundle 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 NewCodeContextBundle() *CodeContextBundle {
|
|
this := CodeContextBundle{}
|
|
return &this
|
|
}
|
|
|
|
// NewCodeContextBundleWithDefaults instantiates a new CodeContextBundle 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 NewCodeContextBundleWithDefaults() *CodeContextBundle {
|
|
this := CodeContextBundle{}
|
|
return &this
|
|
}
|
|
|
|
// GetBudgetTokens returns the BudgetTokens field value if set, zero value otherwise.
|
|
func (o *CodeContextBundle) GetBudgetTokens() int64 {
|
|
if o == nil || IsNil(o.BudgetTokens) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.BudgetTokens
|
|
}
|
|
|
|
// GetBudgetTokensOk returns a tuple with the BudgetTokens field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CodeContextBundle) GetBudgetTokensOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.BudgetTokens) {
|
|
return nil, false
|
|
}
|
|
return o.BudgetTokens, true
|
|
}
|
|
|
|
// HasBudgetTokens returns a boolean if a field has been set.
|
|
func (o *CodeContextBundle) HasBudgetTokens() bool {
|
|
if o != nil && !IsNil(o.BudgetTokens) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetBudgetTokens gets a reference to the given int64 and assigns it to the BudgetTokens field.
|
|
func (o *CodeContextBundle) SetBudgetTokens(v int64) {
|
|
o.BudgetTokens = &v
|
|
}
|
|
|
|
// GetCapped returns the Capped field value if set, zero value otherwise.
|
|
func (o *CodeContextBundle) GetCapped() bool {
|
|
if o == nil || IsNil(o.Capped) {
|
|
var ret bool
|
|
return ret
|
|
}
|
|
return *o.Capped
|
|
}
|
|
|
|
// GetCappedOk returns a tuple with the Capped field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CodeContextBundle) GetCappedOk() (*bool, bool) {
|
|
if o == nil || IsNil(o.Capped) {
|
|
return nil, false
|
|
}
|
|
return o.Capped, true
|
|
}
|
|
|
|
// HasCapped returns a boolean if a field has been set.
|
|
func (o *CodeContextBundle) HasCapped() bool {
|
|
if o != nil && !IsNil(o.Capped) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCapped gets a reference to the given bool and assigns it to the Capped field.
|
|
func (o *CodeContextBundle) SetCapped(v bool) {
|
|
o.Capped = &v
|
|
}
|
|
|
|
// GetQuery returns the Query field value if set, zero value otherwise.
|
|
func (o *CodeContextBundle) GetQuery() string {
|
|
if o == nil || IsNil(o.Query) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Query
|
|
}
|
|
|
|
// GetQueryOk returns a tuple with the Query field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CodeContextBundle) GetQueryOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Query) {
|
|
return nil, false
|
|
}
|
|
return o.Query, true
|
|
}
|
|
|
|
// HasQuery returns a boolean if a field has been set.
|
|
func (o *CodeContextBundle) HasQuery() bool {
|
|
if o != nil && !IsNil(o.Query) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetQuery gets a reference to the given string and assigns it to the Query field.
|
|
func (o *CodeContextBundle) SetQuery(v string) {
|
|
o.Query = &v
|
|
}
|
|
|
|
// GetRepo returns the Repo field value if set, zero value otherwise.
|
|
func (o *CodeContextBundle) 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 *CodeContextBundle) 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 *CodeContextBundle) 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 *CodeContextBundle) SetRepo(v string) {
|
|
o.Repo = &v
|
|
}
|
|
|
|
// GetSpans returns the Spans field value if set, zero value otherwise.
|
|
func (o *CodeContextBundle) GetSpans() []CodeSpan {
|
|
if o == nil || IsNil(o.Spans) {
|
|
var ret []CodeSpan
|
|
return ret
|
|
}
|
|
return o.Spans
|
|
}
|
|
|
|
// GetSpansOk returns a tuple with the Spans field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CodeContextBundle) GetSpansOk() ([]CodeSpan, bool) {
|
|
if o == nil || IsNil(o.Spans) {
|
|
return nil, false
|
|
}
|
|
return o.Spans, true
|
|
}
|
|
|
|
// HasSpans returns a boolean if a field has been set.
|
|
func (o *CodeContextBundle) HasSpans() bool {
|
|
if o != nil && !IsNil(o.Spans) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetSpans gets a reference to the given []CodeSpan and assigns it to the Spans field.
|
|
func (o *CodeContextBundle) SetSpans(v []CodeSpan) {
|
|
o.Spans = v
|
|
}
|
|
|
|
// GetUsedTokens returns the UsedTokens field value if set, zero value otherwise.
|
|
func (o *CodeContextBundle) GetUsedTokens() int64 {
|
|
if o == nil || IsNil(o.UsedTokens) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.UsedTokens
|
|
}
|
|
|
|
// GetUsedTokensOk returns a tuple with the UsedTokens field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CodeContextBundle) GetUsedTokensOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.UsedTokens) {
|
|
return nil, false
|
|
}
|
|
return o.UsedTokens, true
|
|
}
|
|
|
|
// HasUsedTokens returns a boolean if a field has been set.
|
|
func (o *CodeContextBundle) HasUsedTokens() bool {
|
|
if o != nil && !IsNil(o.UsedTokens) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetUsedTokens gets a reference to the given int64 and assigns it to the UsedTokens field.
|
|
func (o *CodeContextBundle) SetUsedTokens(v int64) {
|
|
o.UsedTokens = &v
|
|
}
|
|
|
|
func (o CodeContextBundle) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o CodeContextBundle) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.BudgetTokens) {
|
|
toSerialize["budgetTokens"] = o.BudgetTokens
|
|
}
|
|
if !IsNil(o.Capped) {
|
|
toSerialize["capped"] = o.Capped
|
|
}
|
|
if !IsNil(o.Query) {
|
|
toSerialize["query"] = o.Query
|
|
}
|
|
if !IsNil(o.Repo) {
|
|
toSerialize["repo"] = o.Repo
|
|
}
|
|
if !IsNil(o.Spans) {
|
|
toSerialize["spans"] = o.Spans
|
|
}
|
|
if !IsNil(o.UsedTokens) {
|
|
toSerialize["usedTokens"] = o.UsedTokens
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *CodeContextBundle) UnmarshalJSON(data []byte) (err error) {
|
|
varCodeContextBundle := _CodeContextBundle{}
|
|
|
|
err = json.Unmarshal(data, &varCodeContextBundle)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = CodeContextBundle(varCodeContextBundle)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "budgetTokens")
|
|
delete(additionalProperties, "capped")
|
|
delete(additionalProperties, "query")
|
|
delete(additionalProperties, "repo")
|
|
delete(additionalProperties, "spans")
|
|
delete(additionalProperties, "usedTokens")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableCodeContextBundle struct {
|
|
value *CodeContextBundle
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableCodeContextBundle) Get() *CodeContextBundle {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableCodeContextBundle) Set(val *CodeContextBundle) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableCodeContextBundle) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableCodeContextBundle) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableCodeContextBundle(val *CodeContextBundle) *NullableCodeContextBundle {
|
|
return &NullableCodeContextBundle{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableCodeContextBundle) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableCodeContextBundle) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|