bunnyshell.com/sdk@v0.16.0/utils.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 "reflect" 17 "time" 18 ) 19 20 // PtrBool is a helper routine that returns a pointer to given boolean value. 21 func PtrBool(v bool) *bool { return &v } 22 23 // PtrInt is a helper routine that returns a pointer to given integer value. 24 func PtrInt(v int) *int { return &v } 25 26 // PtrInt32 is a helper routine that returns a pointer to given integer value. 27 func PtrInt32(v int32) *int32 { return &v } 28 29 // PtrInt64 is a helper routine that returns a pointer to given integer value. 30 func PtrInt64(v int64) *int64 { return &v } 31 32 // PtrFloat32 is a helper routine that returns a pointer to given float value. 33 func PtrFloat32(v float32) *float32 { return &v } 34 35 // PtrFloat64 is a helper routine that returns a pointer to given float value. 36 func PtrFloat64(v float64) *float64 { return &v } 37 38 // PtrString is a helper routine that returns a pointer to given string value. 39 func PtrString(v string) *string { return &v } 40 41 // PtrTime is helper routine that returns a pointer to given Time value. 42 func PtrTime(v time.Time) *time.Time { return &v } 43 44 type NullableBool struct { 45 value *bool 46 isSet bool 47 } 48 49 func (v NullableBool) Get() *bool { 50 return v.value 51 } 52 53 func (v *NullableBool) Set(val *bool) { 54 v.value = val 55 v.isSet = true 56 } 57 58 func (v NullableBool) IsSet() bool { 59 return v.isSet 60 } 61 62 func (v *NullableBool) Unset() { 63 v.value = nil 64 v.isSet = false 65 } 66 67 func NewNullableBool(val *bool) *NullableBool { 68 return &NullableBool{value: val, isSet: true} 69 } 70 71 func (v NullableBool) MarshalJSON() ([]byte, error) { 72 return json.Marshal(v.value) 73 } 74 75 func (v *NullableBool) UnmarshalJSON(src []byte) error { 76 v.isSet = true 77 return json.Unmarshal(src, &v.value) 78 } 79 80 type NullableInt struct { 81 value *int 82 isSet bool 83 } 84 85 func (v NullableInt) Get() *int { 86 return v.value 87 } 88 89 func (v *NullableInt) Set(val *int) { 90 v.value = val 91 v.isSet = true 92 } 93 94 func (v NullableInt) IsSet() bool { 95 return v.isSet 96 } 97 98 func (v *NullableInt) Unset() { 99 v.value = nil 100 v.isSet = false 101 } 102 103 func NewNullableInt(val *int) *NullableInt { 104 return &NullableInt{value: val, isSet: true} 105 } 106 107 func (v NullableInt) MarshalJSON() ([]byte, error) { 108 return json.Marshal(v.value) 109 } 110 111 func (v *NullableInt) UnmarshalJSON(src []byte) error { 112 v.isSet = true 113 return json.Unmarshal(src, &v.value) 114 } 115 116 type NullableInt32 struct { 117 value *int32 118 isSet bool 119 } 120 121 func (v NullableInt32) Get() *int32 { 122 return v.value 123 } 124 125 func (v *NullableInt32) Set(val *int32) { 126 v.value = val 127 v.isSet = true 128 } 129 130 func (v NullableInt32) IsSet() bool { 131 return v.isSet 132 } 133 134 func (v *NullableInt32) Unset() { 135 v.value = nil 136 v.isSet = false 137 } 138 139 func NewNullableInt32(val *int32) *NullableInt32 { 140 return &NullableInt32{value: val, isSet: true} 141 } 142 143 func (v NullableInt32) MarshalJSON() ([]byte, error) { 144 return json.Marshal(v.value) 145 } 146 147 func (v *NullableInt32) UnmarshalJSON(src []byte) error { 148 v.isSet = true 149 return json.Unmarshal(src, &v.value) 150 } 151 152 type NullableInt64 struct { 153 value *int64 154 isSet bool 155 } 156 157 func (v NullableInt64) Get() *int64 { 158 return v.value 159 } 160 161 func (v *NullableInt64) Set(val *int64) { 162 v.value = val 163 v.isSet = true 164 } 165 166 func (v NullableInt64) IsSet() bool { 167 return v.isSet 168 } 169 170 func (v *NullableInt64) Unset() { 171 v.value = nil 172 v.isSet = false 173 } 174 175 func NewNullableInt64(val *int64) *NullableInt64 { 176 return &NullableInt64{value: val, isSet: true} 177 } 178 179 func (v NullableInt64) MarshalJSON() ([]byte, error) { 180 return json.Marshal(v.value) 181 } 182 183 func (v *NullableInt64) UnmarshalJSON(src []byte) error { 184 v.isSet = true 185 return json.Unmarshal(src, &v.value) 186 } 187 188 type NullableFloat32 struct { 189 value *float32 190 isSet bool 191 } 192 193 func (v NullableFloat32) Get() *float32 { 194 return v.value 195 } 196 197 func (v *NullableFloat32) Set(val *float32) { 198 v.value = val 199 v.isSet = true 200 } 201 202 func (v NullableFloat32) IsSet() bool { 203 return v.isSet 204 } 205 206 func (v *NullableFloat32) Unset() { 207 v.value = nil 208 v.isSet = false 209 } 210 211 func NewNullableFloat32(val *float32) *NullableFloat32 { 212 return &NullableFloat32{value: val, isSet: true} 213 } 214 215 func (v NullableFloat32) MarshalJSON() ([]byte, error) { 216 return json.Marshal(v.value) 217 } 218 219 func (v *NullableFloat32) UnmarshalJSON(src []byte) error { 220 v.isSet = true 221 return json.Unmarshal(src, &v.value) 222 } 223 224 type NullableFloat64 struct { 225 value *float64 226 isSet bool 227 } 228 229 func (v NullableFloat64) Get() *float64 { 230 return v.value 231 } 232 233 func (v *NullableFloat64) Set(val *float64) { 234 v.value = val 235 v.isSet = true 236 } 237 238 func (v NullableFloat64) IsSet() bool { 239 return v.isSet 240 } 241 242 func (v *NullableFloat64) Unset() { 243 v.value = nil 244 v.isSet = false 245 } 246 247 func NewNullableFloat64(val *float64) *NullableFloat64 { 248 return &NullableFloat64{value: val, isSet: true} 249 } 250 251 func (v NullableFloat64) MarshalJSON() ([]byte, error) { 252 return json.Marshal(v.value) 253 } 254 255 func (v *NullableFloat64) UnmarshalJSON(src []byte) error { 256 v.isSet = true 257 return json.Unmarshal(src, &v.value) 258 } 259 260 type NullableString struct { 261 value *string 262 isSet bool 263 } 264 265 func (v NullableString) Get() *string { 266 return v.value 267 } 268 269 func (v *NullableString) Set(val *string) { 270 v.value = val 271 v.isSet = true 272 } 273 274 func (v NullableString) IsSet() bool { 275 return v.isSet 276 } 277 278 func (v *NullableString) Unset() { 279 v.value = nil 280 v.isSet = false 281 } 282 283 func NewNullableString(val *string) *NullableString { 284 return &NullableString{value: val, isSet: true} 285 } 286 287 func (v NullableString) MarshalJSON() ([]byte, error) { 288 return json.Marshal(v.value) 289 } 290 291 func (v *NullableString) UnmarshalJSON(src []byte) error { 292 v.isSet = true 293 return json.Unmarshal(src, &v.value) 294 } 295 296 type NullableTime struct { 297 value *time.Time 298 isSet bool 299 } 300 301 func (v NullableTime) Get() *time.Time { 302 return v.value 303 } 304 305 func (v *NullableTime) Set(val *time.Time) { 306 v.value = val 307 v.isSet = true 308 } 309 310 func (v NullableTime) IsSet() bool { 311 return v.isSet 312 } 313 314 func (v *NullableTime) Unset() { 315 v.value = nil 316 v.isSet = false 317 } 318 319 func NewNullableTime(val *time.Time) *NullableTime { 320 return &NullableTime{value: val, isSet: true} 321 } 322 323 func (v NullableTime) MarshalJSON() ([]byte, error) { 324 return v.value.MarshalJSON() 325 } 326 327 func (v *NullableTime) UnmarshalJSON(src []byte) error { 328 v.isSet = true 329 return json.Unmarshal(src, &v.value) 330 } 331 332 // IsNil checks if an input is nil 333 func IsNil(i interface{}) bool { 334 if i == nil { 335 return true 336 } 337 switch reflect.TypeOf(i).Kind() { 338 case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: 339 return reflect.ValueOf(i).IsNil() 340 case reflect.Array: 341 return reflect.ValueOf(i).IsZero() 342 } 343 return false 344 } 345 346 type MappedNullable interface { 347 ToMap() (map[string]interface{}, error) 348 }