bunnyshell.com/sdk@v0.16.0/model_git_info.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 GitInfo type satisfies the MappedNullable interface at compile time
    19  var _ MappedNullable = &GitInfo{}
    20  
    21  // GitInfo struct for GitInfo
    22  type GitInfo struct {
    23  	Repository NullableString `json:"repository,omitempty"`
    24  	Branch     NullableString `json:"branch,omitempty"`
    25  }
    26  
    27  // NewGitInfo instantiates a new GitInfo object
    28  // This constructor will assign default values to properties that have it defined,
    29  // and makes sure properties required by API are set, but the set of arguments
    30  // will change when the set of required properties is changed
    31  func NewGitInfo() *GitInfo {
    32  	this := GitInfo{}
    33  	return &this
    34  }
    35  
    36  // NewGitInfoWithDefaults instantiates a new GitInfo object
    37  // This constructor will only assign default values to properties that have it defined,
    38  // but it doesn't guarantee that properties required by API are set
    39  func NewGitInfoWithDefaults() *GitInfo {
    40  	this := GitInfo{}
    41  	return &this
    42  }
    43  
    44  // GetRepository returns the Repository field value if set, zero value otherwise (both if not set or set to explicit null).
    45  func (o *GitInfo) GetRepository() string {
    46  	if o == nil || IsNil(o.Repository.Get()) {
    47  		var ret string
    48  		return ret
    49  	}
    50  	return *o.Repository.Get()
    51  }
    52  
    53  // GetRepositoryOk returns a tuple with the Repository field value if set, nil otherwise
    54  // and a boolean to check if the value has been set.
    55  // NOTE: If the value is an explicit nil, `nil, true` will be returned
    56  func (o *GitInfo) GetRepositoryOk() (*string, bool) {
    57  	if o == nil {
    58  		return nil, false
    59  	}
    60  	return o.Repository.Get(), o.Repository.IsSet()
    61  }
    62  
    63  // HasRepository returns a boolean if a field has been set.
    64  func (o *GitInfo) HasRepository() bool {
    65  	if o != nil && o.Repository.IsSet() {
    66  		return true
    67  	}
    68  
    69  	return false
    70  }
    71  
    72  // SetRepository gets a reference to the given NullableString and assigns it to the Repository field.
    73  func (o *GitInfo) SetRepository(v string) {
    74  	o.Repository.Set(&v)
    75  }
    76  
    77  // SetRepositoryNil sets the value for Repository to be an explicit nil
    78  func (o *GitInfo) SetRepositoryNil() {
    79  	o.Repository.Set(nil)
    80  }
    81  
    82  // UnsetRepository ensures that no value is present for Repository, not even an explicit nil
    83  func (o *GitInfo) UnsetRepository() {
    84  	o.Repository.Unset()
    85  }
    86  
    87  // GetBranch returns the Branch field value if set, zero value otherwise (both if not set or set to explicit null).
    88  func (o *GitInfo) GetBranch() string {
    89  	if o == nil || IsNil(o.Branch.Get()) {
    90  		var ret string
    91  		return ret
    92  	}
    93  	return *o.Branch.Get()
    94  }
    95  
    96  // GetBranchOk returns a tuple with the Branch field value if set, nil otherwise
    97  // and a boolean to check if the value has been set.
    98  // NOTE: If the value is an explicit nil, `nil, true` will be returned
    99  func (o *GitInfo) GetBranchOk() (*string, bool) {
   100  	if o == nil {
   101  		return nil, false
   102  	}
   103  	return o.Branch.Get(), o.Branch.IsSet()
   104  }
   105  
   106  // HasBranch returns a boolean if a field has been set.
   107  func (o *GitInfo) HasBranch() bool {
   108  	if o != nil && o.Branch.IsSet() {
   109  		return true
   110  	}
   111  
   112  	return false
   113  }
   114  
   115  // SetBranch gets a reference to the given NullableString and assigns it to the Branch field.
   116  func (o *GitInfo) SetBranch(v string) {
   117  	o.Branch.Set(&v)
   118  }
   119  
   120  // SetBranchNil sets the value for Branch to be an explicit nil
   121  func (o *GitInfo) SetBranchNil() {
   122  	o.Branch.Set(nil)
   123  }
   124  
   125  // UnsetBranch ensures that no value is present for Branch, not even an explicit nil
   126  func (o *GitInfo) UnsetBranch() {
   127  	o.Branch.Unset()
   128  }
   129  
   130  func (o GitInfo) MarshalJSON() ([]byte, error) {
   131  	toSerialize, err := o.ToMap()
   132  	if err != nil {
   133  		return []byte{}, err
   134  	}
   135  	return json.Marshal(toSerialize)
   136  }
   137  
   138  func (o GitInfo) ToMap() (map[string]interface{}, error) {
   139  	toSerialize := map[string]interface{}{}
   140  	if o.Repository.IsSet() {
   141  		toSerialize["repository"] = o.Repository.Get()
   142  	}
   143  	if o.Branch.IsSet() {
   144  		toSerialize["branch"] = o.Branch.Get()
   145  	}
   146  	return toSerialize, nil
   147  }
   148  
   149  type NullableGitInfo struct {
   150  	value *GitInfo
   151  	isSet bool
   152  }
   153  
   154  func (v NullableGitInfo) Get() *GitInfo {
   155  	return v.value
   156  }
   157  
   158  func (v *NullableGitInfo) Set(val *GitInfo) {
   159  	v.value = val
   160  	v.isSet = true
   161  }
   162  
   163  func (v NullableGitInfo) IsSet() bool {
   164  	return v.isSet
   165  }
   166  
   167  func (v *NullableGitInfo) Unset() {
   168  	v.value = nil
   169  	v.isSet = false
   170  }
   171  
   172  func NewNullableGitInfo(val *GitInfo) *NullableGitInfo {
   173  	return &NullableGitInfo{value: val, isSet: true}
   174  }
   175  
   176  func (v NullableGitInfo) MarshalJSON() ([]byte, error) {
   177  	return json.Marshal(v.value)
   178  }
   179  
   180  func (v *NullableGitInfo) UnmarshalJSON(src []byte) error {
   181  	v.isSet = true
   182  	return json.Unmarshal(src, &v.value)
   183  }