Files
sdk/model_lsp_diagnostic.go

307 lines
8.0 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 LspDiagnostic type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &LspDiagnostic{}
// LspDiagnostic struct for LspDiagnostic
type LspDiagnostic struct {
Code interface{} `json:"code,omitempty"`
// Message is the problem in the server's own words, meant to be shown.
Message *string `json:"message,omitempty"`
// Range is the span the problem is about.
Range *LspRange `json:"range,omitempty"`
// Severity is the LSP's: 1 error, 2 warning, 3 information, 4 hint. A file with only 3s and 4s still compiles.
Severity *int64 `json:"severity,omitempty"`
// Source is which checker reported it (\"compiler\", \"go vet\", a linter's name), which is what separates a build error from a style opinion.
Source *string `json:"source,omitempty"`
AdditionalProperties map[string]interface{}
}
type _LspDiagnostic LspDiagnostic
// NewLspDiagnostic instantiates a new LspDiagnostic 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 NewLspDiagnostic() *LspDiagnostic {
this := LspDiagnostic{}
return &this
}
// NewLspDiagnosticWithDefaults instantiates a new LspDiagnostic 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 NewLspDiagnosticWithDefaults() *LspDiagnostic {
this := LspDiagnostic{}
return &this
}
// GetCode returns the Code field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *LspDiagnostic) GetCode() interface{} {
if o == nil {
var ret interface{}
return ret
}
return o.Code
}
// GetCodeOk returns a tuple with the Code field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *LspDiagnostic) GetCodeOk() (*interface{}, bool) {
if o == nil || IsNil(o.Code) {
return nil, false
}
return &o.Code, true
}
// HasCode returns a boolean if a field has been set.
func (o *LspDiagnostic) HasCode() bool {
if o != nil && !IsNil(o.Code) {
return true
}
return false
}
// SetCode gets a reference to the given interface{} and assigns it to the Code field.
func (o *LspDiagnostic) SetCode(v interface{}) {
o.Code = v
}
// GetMessage returns the Message field value if set, zero value otherwise.
func (o *LspDiagnostic) GetMessage() string {
if o == nil || IsNil(o.Message) {
var ret string
return ret
}
return *o.Message
}
// GetMessageOk returns a tuple with the Message field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LspDiagnostic) GetMessageOk() (*string, bool) {
if o == nil || IsNil(o.Message) {
return nil, false
}
return o.Message, true
}
// HasMessage returns a boolean if a field has been set.
func (o *LspDiagnostic) HasMessage() bool {
if o != nil && !IsNil(o.Message) {
return true
}
return false
}
// SetMessage gets a reference to the given string and assigns it to the Message field.
func (o *LspDiagnostic) SetMessage(v string) {
o.Message = &v
}
// GetRange returns the Range field value if set, zero value otherwise.
func (o *LspDiagnostic) GetRange() LspRange {
if o == nil || IsNil(o.Range) {
var ret LspRange
return ret
}
return *o.Range
}
// GetRangeOk returns a tuple with the Range field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LspDiagnostic) GetRangeOk() (*LspRange, bool) {
if o == nil || IsNil(o.Range) {
return nil, false
}
return o.Range, true
}
// HasRange returns a boolean if a field has been set.
func (o *LspDiagnostic) HasRange() bool {
if o != nil && !IsNil(o.Range) {
return true
}
return false
}
// SetRange gets a reference to the given LspRange and assigns it to the Range field.
func (o *LspDiagnostic) SetRange(v LspRange) {
o.Range = &v
}
// GetSeverity returns the Severity field value if set, zero value otherwise.
func (o *LspDiagnostic) GetSeverity() int64 {
if o == nil || IsNil(o.Severity) {
var ret int64
return ret
}
return *o.Severity
}
// GetSeverityOk returns a tuple with the Severity field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LspDiagnostic) GetSeverityOk() (*int64, bool) {
if o == nil || IsNil(o.Severity) {
return nil, false
}
return o.Severity, true
}
// HasSeverity returns a boolean if a field has been set.
func (o *LspDiagnostic) HasSeverity() bool {
if o != nil && !IsNil(o.Severity) {
return true
}
return false
}
// SetSeverity gets a reference to the given int64 and assigns it to the Severity field.
func (o *LspDiagnostic) SetSeverity(v int64) {
o.Severity = &v
}
// GetSource returns the Source field value if set, zero value otherwise.
func (o *LspDiagnostic) GetSource() string {
if o == nil || IsNil(o.Source) {
var ret string
return ret
}
return *o.Source
}
// GetSourceOk returns a tuple with the Source field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LspDiagnostic) GetSourceOk() (*string, bool) {
if o == nil || IsNil(o.Source) {
return nil, false
}
return o.Source, true
}
// HasSource returns a boolean if a field has been set.
func (o *LspDiagnostic) HasSource() bool {
if o != nil && !IsNil(o.Source) {
return true
}
return false
}
// SetSource gets a reference to the given string and assigns it to the Source field.
func (o *LspDiagnostic) SetSource(v string) {
o.Source = &v
}
func (o LspDiagnostic) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o LspDiagnostic) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if o.Code != nil {
toSerialize["code"] = o.Code
}
if !IsNil(o.Message) {
toSerialize["message"] = o.Message
}
if !IsNil(o.Range) {
toSerialize["range"] = o.Range
}
if !IsNil(o.Severity) {
toSerialize["severity"] = o.Severity
}
if !IsNil(o.Source) {
toSerialize["source"] = o.Source
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *LspDiagnostic) UnmarshalJSON(data []byte) (err error) {
varLspDiagnostic := _LspDiagnostic{}
err = json.Unmarshal(data, &varLspDiagnostic)
if err != nil {
return err
}
*o = LspDiagnostic(varLspDiagnostic)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "code")
delete(additionalProperties, "message")
delete(additionalProperties, "range")
delete(additionalProperties, "severity")
delete(additionalProperties, "source")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableLspDiagnostic struct {
value *LspDiagnostic
isSet bool
}
func (v NullableLspDiagnostic) Get() *LspDiagnostic {
return v.value
}
func (v *NullableLspDiagnostic) Set(val *LspDiagnostic) {
v.value = val
v.isSet = true
}
func (v NullableLspDiagnostic) IsSet() bool {
return v.isSet
}
func (v *NullableLspDiagnostic) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLspDiagnostic(val *LspDiagnostic) *NullableLspDiagnostic {
return &NullableLspDiagnostic{value: val, isSet: true}
}
func (v NullableLspDiagnostic) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLspDiagnostic) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}