forked from parallelum/fipe-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel_vehicles_type.go
More file actions
114 lines (92 loc) · 3.23 KB
/
model_vehicles_type.go
File metadata and controls
114 lines (92 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
Fipe API
API de Consulta Tabela FIPE fornece preços médios de veículos no mercado nacional. Atualizada mensalmente com dados extraidos da tabela FIPE. Essa API Fipe utiliza banco de dados próprio, onde todas as requisições acontecem internamente, sem sobrecarregar o Web Service da Fipe, evitando assim bloqueios por múltiplos acessos. A API está online desde 2015 e totalmente gratuíta. Gostaria que ele continuasse gratuíta? O que acha de me pagar uma cerveja? 🍺 [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUPMYWH6XAC5G) ### Fipe API SDKs - [Fipe Go SDK](https://pkg.go.dev/github.com/parallelum/fipe-go) - [Fipe .NetCore Nuget SDK](https://www.nuget.org/packages/Br.Com.Parallelum.Fipe/) - [Fipe Javascript SDK](https://github.com/deividfortuna/fipe-promise)
API version: 2.0.0
Contact: deividfortuna@gmail.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package fipe
import (
"encoding/json"
"fmt"
)
// VehiclesType the model 'VehiclesType'
type VehiclesType string
// List of VehiclesType
const (
CARS VehiclesType = "cars"
MOTORCYCLES VehiclesType = "motorcycles"
TRUCKS VehiclesType = "trucks"
)
// All allowed values of VehiclesType enum
var AllowedVehiclesTypeEnumValues = []VehiclesType{
"cars",
"motorcycles",
"trucks",
}
func (v *VehiclesType) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := VehiclesType(value)
for _, existing := range AllowedVehiclesTypeEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid VehiclesType", value)
}
// NewVehiclesTypeFromValue returns a pointer to a valid VehiclesType
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewVehiclesTypeFromValue(v string) (*VehiclesType, error) {
ev := VehiclesType(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for VehiclesType: valid values are %v", v, AllowedVehiclesTypeEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v VehiclesType) IsValid() bool {
for _, existing := range AllowedVehiclesTypeEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to VehiclesType value
func (v VehiclesType) Ptr() *VehiclesType {
return &v
}
type NullableVehiclesType struct {
value *VehiclesType
isSet bool
}
func (v NullableVehiclesType) Get() *VehiclesType {
return v.value
}
func (v *NullableVehiclesType) Set(val *VehiclesType) {
v.value = val
v.isSet = true
}
func (v NullableVehiclesType) IsSet() bool {
return v.isSet
}
func (v *NullableVehiclesType) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableVehiclesType(val *VehiclesType) *NullableVehiclesType {
return &NullableVehiclesType{value: val, isSet: true}
}
func (v NullableVehiclesType) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableVehiclesType) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}