github.com/khulnasoft/codebase@v0.0.0-20231214144635-a707781cbb24/go-bitbucket/model_error.go (about)

     1  /*
     2   * Bitbucket API
     3   *
     4   * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework.
     5   *
     6   * API version: 2.0
     7   * Contact: support@bitbucket.org
     8   */
     9  
    10  // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
    11  
    12  package bitbucket
    13  
    14  import (
    15  	"encoding/json"
    16  )
    17  
    18  // ModelError Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.
    19  type ModelError struct {
    20  	Type  string      `json:"type"`
    21  	Error *ErrorError `json:"error,omitempty"`
    22  }
    23  
    24  // NewModelError instantiates a new ModelError object
    25  // This constructor will assign default values to properties that have it defined,
    26  // and makes sure properties required by API are set, but the set of arguments
    27  // will change when the set of required properties is changed
    28  func NewModelError(type_ string) *ModelError {
    29  	this := ModelError{}
    30  	this.Type = type_
    31  	return &this
    32  }
    33  
    34  // NewModelErrorWithDefaults instantiates a new ModelError object
    35  // This constructor will only assign default values to properties that have it defined,
    36  // but it doesn't guarantee that properties required by API are set
    37  func NewModelErrorWithDefaults() *ModelError {
    38  	this := ModelError{}
    39  	return &this
    40  }
    41  
    42  // GetType returns the Type field value
    43  func (o *ModelError) GetType() string {
    44  	if o == nil {
    45  		var ret string
    46  		return ret
    47  	}
    48  
    49  	return o.Type
    50  }
    51  
    52  // GetTypeOk returns a tuple with the Type field value
    53  // and a boolean to check if the value has been set.
    54  func (o *ModelError) GetTypeOk() (*string, bool) {
    55  	if o == nil {
    56  		return nil, false
    57  	}
    58  	return &o.Type, true
    59  }
    60  
    61  // SetType sets field value
    62  func (o *ModelError) SetType(v string) {
    63  	o.Type = v
    64  }
    65  
    66  // GetError returns the Error field value if set, zero value otherwise.
    67  func (o *ModelError) GetError() ErrorError {
    68  	if o == nil || o.Error == nil {
    69  		var ret ErrorError
    70  		return ret
    71  	}
    72  	return *o.Error
    73  }
    74  
    75  // GetErrorOk returns a tuple with the Error field value if set, nil otherwise
    76  // and a boolean to check if the value has been set.
    77  func (o *ModelError) GetErrorOk() (*ErrorError, bool) {
    78  	if o == nil || o.Error == nil {
    79  		return nil, false
    80  	}
    81  	return o.Error, true
    82  }
    83  
    84  // HasError returns a boolean if a field has been set.
    85  func (o *ModelError) HasError() bool {
    86  	if o != nil && o.Error != nil {
    87  		return true
    88  	}
    89  
    90  	return false
    91  }
    92  
    93  // SetError gets a reference to the given ErrorError and assigns it to the Error field.
    94  func (o *ModelError) SetError(v ErrorError) {
    95  	o.Error = &v
    96  }
    97  
    98  func (o ModelError) MarshalJSON() ([]byte, error) {
    99  	toSerialize := map[string]interface{}{}
   100  	if true {
   101  		toSerialize["type"] = o.Type
   102  	}
   103  	if o.Error != nil {
   104  		toSerialize["error"] = o.Error
   105  	}
   106  	return json.Marshal(toSerialize)
   107  }
   108  
   109  type NullableModelError struct {
   110  	value *ModelError
   111  	isSet bool
   112  }
   113  
   114  func (v NullableModelError) Get() *ModelError {
   115  	return v.value
   116  }
   117  
   118  func (v *NullableModelError) Set(val *ModelError) {
   119  	v.value = val
   120  	v.isSet = true
   121  }
   122  
   123  func (v NullableModelError) IsSet() bool {
   124  	return v.isSet
   125  }
   126  
   127  func (v *NullableModelError) Unset() {
   128  	v.value = nil
   129  	v.isSet = false
   130  }
   131  
   132  func NewNullableModelError(val *ModelError) *NullableModelError {
   133  	return &NullableModelError{value: val, isSet: true}
   134  }
   135  
   136  func (v NullableModelError) MarshalJSON() ([]byte, error) {
   137  	return json.Marshal(v.value)
   138  }
   139  
   140  func (v *NullableModelError) UnmarshalJSON(src []byte) error {
   141  	v.isSet = true
   142  	return json.Unmarshal(src, &v.value)
   143  }