bunnyshell.com/sdk@v0.16.0/model_filter_git.go (about)

     1  /*
     2  API Bunnyshell Environments
     3  
     4  Interact with Bunnyshell Platform
     5  
     6  API version: 1.1.0
     7  Contact: osi+support@bunnyshell.com
     8  */
     9  
    10  // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
    11  
    12  package sdk
    13  
    14  import (
    15  	"encoding/json"
    16  )
    17  
    18  // checks if the FilterGit type satisfies the MappedNullable interface at compile time
    19  var _ MappedNullable = &FilterGit{}
    20  
    21  // FilterGit struct for FilterGit
    22  type FilterGit struct {
    23  	Type       *string        `json:"type,omitempty"`
    24  	Repository NullableString `json:"repository,omitempty"`
    25  	Branch     NullableString `json:"branch,omitempty"`
    26  }
    27  
    28  // NewFilterGit instantiates a new FilterGit object
    29  // This constructor will assign default values to properties that have it defined,
    30  // and makes sure properties required by API are set, but the set of arguments
    31  // will change when the set of required properties is changed
    32  func NewFilterGit() *FilterGit {
    33  	this := FilterGit{}
    34  	var type_ string = "git"
    35  	this.Type = &type_
    36  	return &this
    37  }
    38  
    39  // NewFilterGitWithDefaults instantiates a new FilterGit object
    40  // This constructor will only assign default values to properties that have it defined,
    41  // but it doesn't guarantee that properties required by API are set
    42  func NewFilterGitWithDefaults() *FilterGit {
    43  	this := FilterGit{}
    44  	var type_ string = "git"
    45  	this.Type = &type_
    46  	return &this
    47  }
    48  
    49  // GetType returns the Type field value if set, zero value otherwise.
    50  func (o *FilterGit) GetType() string {
    51  	if o == nil || IsNil(o.Type) {
    52  		var ret string
    53  		return ret
    54  	}
    55  	return *o.Type
    56  }
    57  
    58  // GetTypeOk returns a tuple with the Type field value if set, nil otherwise
    59  // and a boolean to check if the value has been set.
    60  func (o *FilterGit) GetTypeOk() (*string, bool) {
    61  	if o == nil || IsNil(o.Type) {
    62  		return nil, false
    63  	}
    64  	return o.Type, true
    65  }
    66  
    67  // HasType returns a boolean if a field has been set.
    68  func (o *FilterGit) HasType() bool {
    69  	if o != nil && !IsNil(o.Type) {
    70  		return true
    71  	}
    72  
    73  	return false
    74  }
    75  
    76  // SetType gets a reference to the given string and assigns it to the Type field.
    77  func (o *FilterGit) SetType(v string) {
    78  	o.Type = &v
    79  }
    80  
    81  // GetRepository returns the Repository field value if set, zero value otherwise (both if not set or set to explicit null).
    82  func (o *FilterGit) GetRepository() string {
    83  	if o == nil || IsNil(o.Repository.Get()) {
    84  		var ret string
    85  		return ret
    86  	}
    87  	return *o.Repository.Get()
    88  }
    89  
    90  // GetRepositoryOk returns a tuple with the Repository field value if set, nil otherwise
    91  // and a boolean to check if the value has been set.
    92  // NOTE: If the value is an explicit nil, `nil, true` will be returned
    93  func (o *FilterGit) GetRepositoryOk() (*string, bool) {
    94  	if o == nil {
    95  		return nil, false
    96  	}
    97  	return o.Repository.Get(), o.Repository.IsSet()
    98  }
    99  
   100  // HasRepository returns a boolean if a field has been set.
   101  func (o *FilterGit) HasRepository() bool {
   102  	if o != nil && o.Repository.IsSet() {
   103  		return true
   104  	}
   105  
   106  	return false
   107  }
   108  
   109  // SetRepository gets a reference to the given NullableString and assigns it to the Repository field.
   110  func (o *FilterGit) SetRepository(v string) {
   111  	o.Repository.Set(&v)
   112  }
   113  
   114  // SetRepositoryNil sets the value for Repository to be an explicit nil
   115  func (o *FilterGit) SetRepositoryNil() {
   116  	o.Repository.Set(nil)
   117  }
   118  
   119  // UnsetRepository ensures that no value is present for Repository, not even an explicit nil
   120  func (o *FilterGit) UnsetRepository() {
   121  	o.Repository.Unset()
   122  }
   123  
   124  // GetBranch returns the Branch field value if set, zero value otherwise (both if not set or set to explicit null).
   125  func (o *FilterGit) GetBranch() string {
   126  	if o == nil || IsNil(o.Branch.Get()) {
   127  		var ret string
   128  		return ret
   129  	}
   130  	return *o.Branch.Get()
   131  }
   132  
   133  // GetBranchOk returns a tuple with the Branch field value if set, nil otherwise
   134  // and a boolean to check if the value has been set.
   135  // NOTE: If the value is an explicit nil, `nil, true` will be returned
   136  func (o *FilterGit) GetBranchOk() (*string, bool) {
   137  	if o == nil {
   138  		return nil, false
   139  	}
   140  	return o.Branch.Get(), o.Branch.IsSet()
   141  }
   142  
   143  // HasBranch returns a boolean if a field has been set.
   144  func (o *FilterGit) HasBranch() bool {
   145  	if o != nil && o.Branch.IsSet() {
   146  		return true
   147  	}
   148  
   149  	return false
   150  }
   151  
   152  // SetBranch gets a reference to the given NullableString and assigns it to the Branch field.
   153  func (o *FilterGit) SetBranch(v string) {
   154  	o.Branch.Set(&v)
   155  }
   156  
   157  // SetBranchNil sets the value for Branch to be an explicit nil
   158  func (o *FilterGit) SetBranchNil() {
   159  	o.Branch.Set(nil)
   160  }
   161  
   162  // UnsetBranch ensures that no value is present for Branch, not even an explicit nil
   163  func (o *FilterGit) UnsetBranch() {
   164  	o.Branch.Unset()
   165  }
   166  
   167  func (o FilterGit) MarshalJSON() ([]byte, error) {
   168  	toSerialize, err := o.ToMap()
   169  	if err != nil {
   170  		return []byte{}, err
   171  	}
   172  	return json.Marshal(toSerialize)
   173  }
   174  
   175  func (o FilterGit) ToMap() (map[string]interface{}, error) {
   176  	toSerialize := map[string]interface{}{}
   177  	if !IsNil(o.Type) {
   178  		toSerialize["type"] = o.Type
   179  	}
   180  	if o.Repository.IsSet() {
   181  		toSerialize["repository"] = o.Repository.Get()
   182  	}
   183  	if o.Branch.IsSet() {
   184  		toSerialize["branch"] = o.Branch.Get()
   185  	}
   186  	return toSerialize, nil
   187  }
   188  
   189  type NullableFilterGit struct {
   190  	value *FilterGit
   191  	isSet bool
   192  }
   193  
   194  func (v NullableFilterGit) Get() *FilterGit {
   195  	return v.value
   196  }
   197  
   198  func (v *NullableFilterGit) Set(val *FilterGit) {
   199  	v.value = val
   200  	v.isSet = true
   201  }
   202  
   203  func (v NullableFilterGit) IsSet() bool {
   204  	return v.isSet
   205  }
   206  
   207  func (v *NullableFilterGit) Unset() {
   208  	v.value = nil
   209  	v.isSet = false
   210  }
   211  
   212  func NewNullableFilterGit(val *FilterGit) *NullableFilterGit {
   213  	return &NullableFilterGit{value: val, isSet: true}
   214  }
   215  
   216  func (v NullableFilterGit) MarshalJSON() ([]byte, error) {
   217  	return json.Marshal(v.value)
   218  }
   219  
   220  func (v *NullableFilterGit) UnmarshalJSON(src []byte) error {
   221  	v.isSet = true
   222  	return json.Unmarshal(src, &v.value)
   223  }