-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodel__v2__target___identifier__attributes_post_request_data.go
More file actions
480 lines (402 loc) · 16 KB
/
model__v2__target___identifier__attributes_post_request_data.go
File metadata and controls
480 lines (402 loc) · 16 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
/*
Attio API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
API version: 2.0.0
Contact: support@attio.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package libattio
import (
"encoding/json"
"fmt"
)
// checks if the V2TargetIdentifierAttributesPostRequestData type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &V2TargetIdentifierAttributesPostRequestData{}
// V2TargetIdentifierAttributesPostRequestData struct for V2TargetIdentifierAttributesPostRequestData
type V2TargetIdentifierAttributesPostRequestData struct {
// The name of the attribute. The title will be visible across Attio's UI.
Title string `json:"title"`
// A text description for the attribute.
Description NullableString `json:"description"`
// A unique, human-readable slug to access the attribute through URLs and API calls. Formatted in snake case.
ApiSlug string `json:"api_slug"`
// The type of the attribute. This value affects the possible `config` values. Attributes of type \"status\" are not supported on objects.
Type string `json:"type"`
// When `is_required` is `true`, new records/entries must have a value for this attribute. If `false`, values may be `null`. This value does not affect existing data and you do not need to backfill `null` values if changing `is_required` from `false` to `true`.
IsRequired bool `json:"is_required"`
// Whether or not new values for this attribute must be unique. Uniqueness restrictions are only applied to new data and do not apply retroactively to previously created data.
IsUnique bool `json:"is_unique"`
// Whether or not this attribute can have multiple values. Multiselect is only available on some value types.
IsMultiselect bool `json:"is_multiselect"`
DefaultValue NullableV2TargetIdentifierAttributesPostRequestDataDefaultValue `json:"default_value,omitempty"`
Relationship *V2TargetIdentifierAttributesPostRequestDataRelationship `json:"relationship,omitempty"`
Config V2TargetIdentifierAttributesPostRequestDataConfig `json:"config"`
AdditionalProperties map[string]interface{}
}
type _V2TargetIdentifierAttributesPostRequestData V2TargetIdentifierAttributesPostRequestData
// NewV2TargetIdentifierAttributesPostRequestData instantiates a new V2TargetIdentifierAttributesPostRequestData object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewV2TargetIdentifierAttributesPostRequestData(title string, description NullableString, apiSlug string, type_ string, isRequired bool, isUnique bool, isMultiselect bool, config V2TargetIdentifierAttributesPostRequestDataConfig) *V2TargetIdentifierAttributesPostRequestData {
this := V2TargetIdentifierAttributesPostRequestData{}
this.Title = title
this.Description = description
this.ApiSlug = apiSlug
this.Type = type_
this.IsRequired = isRequired
this.IsUnique = isUnique
this.IsMultiselect = isMultiselect
this.Config = config
return &this
}
// NewV2TargetIdentifierAttributesPostRequestDataWithDefaults instantiates a new V2TargetIdentifierAttributesPostRequestData object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewV2TargetIdentifierAttributesPostRequestDataWithDefaults() *V2TargetIdentifierAttributesPostRequestData {
this := V2TargetIdentifierAttributesPostRequestData{}
return &this
}
// GetTitle returns the Title field value
func (o *V2TargetIdentifierAttributesPostRequestData) GetTitle() string {
if o == nil {
var ret string
return ret
}
return o.Title
}
// GetTitleOk returns a tuple with the Title field value
// and a boolean to check if the value has been set.
func (o *V2TargetIdentifierAttributesPostRequestData) GetTitleOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Title, true
}
// SetTitle sets field value
func (o *V2TargetIdentifierAttributesPostRequestData) SetTitle(v string) {
o.Title = v
}
// GetDescription returns the Description field value
// If the value is explicit nil, the zero value for string will be returned
func (o *V2TargetIdentifierAttributesPostRequestData) GetDescription() string {
if o == nil || o.Description.Get() == nil {
var ret string
return ret
}
return *o.Description.Get()
}
// GetDescriptionOk returns a tuple with the Description field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *V2TargetIdentifierAttributesPostRequestData) GetDescriptionOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Description.Get(), o.Description.IsSet()
}
// SetDescription sets field value
func (o *V2TargetIdentifierAttributesPostRequestData) SetDescription(v string) {
o.Description.Set(&v)
}
// GetApiSlug returns the ApiSlug field value
func (o *V2TargetIdentifierAttributesPostRequestData) GetApiSlug() string {
if o == nil {
var ret string
return ret
}
return o.ApiSlug
}
// GetApiSlugOk returns a tuple with the ApiSlug field value
// and a boolean to check if the value has been set.
func (o *V2TargetIdentifierAttributesPostRequestData) GetApiSlugOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.ApiSlug, true
}
// SetApiSlug sets field value
func (o *V2TargetIdentifierAttributesPostRequestData) SetApiSlug(v string) {
o.ApiSlug = v
}
// GetType returns the Type field value
func (o *V2TargetIdentifierAttributesPostRequestData) GetType() string {
if o == nil {
var ret string
return ret
}
return o.Type
}
// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *V2TargetIdentifierAttributesPostRequestData) GetTypeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}
// SetType sets field value
func (o *V2TargetIdentifierAttributesPostRequestData) SetType(v string) {
o.Type = v
}
// GetIsRequired returns the IsRequired field value
func (o *V2TargetIdentifierAttributesPostRequestData) GetIsRequired() bool {
if o == nil {
var ret bool
return ret
}
return o.IsRequired
}
// GetIsRequiredOk returns a tuple with the IsRequired field value
// and a boolean to check if the value has been set.
func (o *V2TargetIdentifierAttributesPostRequestData) GetIsRequiredOk() (*bool, bool) {
if o == nil {
return nil, false
}
return &o.IsRequired, true
}
// SetIsRequired sets field value
func (o *V2TargetIdentifierAttributesPostRequestData) SetIsRequired(v bool) {
o.IsRequired = v
}
// GetIsUnique returns the IsUnique field value
func (o *V2TargetIdentifierAttributesPostRequestData) GetIsUnique() bool {
if o == nil {
var ret bool
return ret
}
return o.IsUnique
}
// GetIsUniqueOk returns a tuple with the IsUnique field value
// and a boolean to check if the value has been set.
func (o *V2TargetIdentifierAttributesPostRequestData) GetIsUniqueOk() (*bool, bool) {
if o == nil {
return nil, false
}
return &o.IsUnique, true
}
// SetIsUnique sets field value
func (o *V2TargetIdentifierAttributesPostRequestData) SetIsUnique(v bool) {
o.IsUnique = v
}
// GetIsMultiselect returns the IsMultiselect field value
func (o *V2TargetIdentifierAttributesPostRequestData) GetIsMultiselect() bool {
if o == nil {
var ret bool
return ret
}
return o.IsMultiselect
}
// GetIsMultiselectOk returns a tuple with the IsMultiselect field value
// and a boolean to check if the value has been set.
func (o *V2TargetIdentifierAttributesPostRequestData) GetIsMultiselectOk() (*bool, bool) {
if o == nil {
return nil, false
}
return &o.IsMultiselect, true
}
// SetIsMultiselect sets field value
func (o *V2TargetIdentifierAttributesPostRequestData) SetIsMultiselect(v bool) {
o.IsMultiselect = v
}
// GetDefaultValue returns the DefaultValue field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *V2TargetIdentifierAttributesPostRequestData) GetDefaultValue() V2TargetIdentifierAttributesPostRequestDataDefaultValue {
if o == nil || IsNil(o.DefaultValue.Get()) {
var ret V2TargetIdentifierAttributesPostRequestDataDefaultValue
return ret
}
return *o.DefaultValue.Get()
}
// GetDefaultValueOk returns a tuple with the DefaultValue field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *V2TargetIdentifierAttributesPostRequestData) GetDefaultValueOk() (*V2TargetIdentifierAttributesPostRequestDataDefaultValue, bool) {
if o == nil {
return nil, false
}
return o.DefaultValue.Get(), o.DefaultValue.IsSet()
}
// HasDefaultValue returns a boolean if a field has been set.
func (o *V2TargetIdentifierAttributesPostRequestData) HasDefaultValue() bool {
if o != nil && o.DefaultValue.IsSet() {
return true
}
return false
}
// SetDefaultValue gets a reference to the given NullableV2TargetIdentifierAttributesPostRequestDataDefaultValue and assigns it to the DefaultValue field.
func (o *V2TargetIdentifierAttributesPostRequestData) SetDefaultValue(v V2TargetIdentifierAttributesPostRequestDataDefaultValue) {
o.DefaultValue.Set(&v)
}
// SetDefaultValueNil sets the value for DefaultValue to be an explicit nil
func (o *V2TargetIdentifierAttributesPostRequestData) SetDefaultValueNil() {
o.DefaultValue.Set(nil)
}
// UnsetDefaultValue ensures that no value is present for DefaultValue, not even an explicit nil
func (o *V2TargetIdentifierAttributesPostRequestData) UnsetDefaultValue() {
o.DefaultValue.Unset()
}
// GetRelationship returns the Relationship field value if set, zero value otherwise.
func (o *V2TargetIdentifierAttributesPostRequestData) GetRelationship() V2TargetIdentifierAttributesPostRequestDataRelationship {
if o == nil || IsNil(o.Relationship) {
var ret V2TargetIdentifierAttributesPostRequestDataRelationship
return ret
}
return *o.Relationship
}
// GetRelationshipOk returns a tuple with the Relationship field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *V2TargetIdentifierAttributesPostRequestData) GetRelationshipOk() (*V2TargetIdentifierAttributesPostRequestDataRelationship, bool) {
if o == nil || IsNil(o.Relationship) {
return nil, false
}
return o.Relationship, true
}
// HasRelationship returns a boolean if a field has been set.
func (o *V2TargetIdentifierAttributesPostRequestData) HasRelationship() bool {
if o != nil && !IsNil(o.Relationship) {
return true
}
return false
}
// SetRelationship gets a reference to the given V2TargetIdentifierAttributesPostRequestDataRelationship and assigns it to the Relationship field.
func (o *V2TargetIdentifierAttributesPostRequestData) SetRelationship(v V2TargetIdentifierAttributesPostRequestDataRelationship) {
o.Relationship = &v
}
// GetConfig returns the Config field value
func (o *V2TargetIdentifierAttributesPostRequestData) GetConfig() V2TargetIdentifierAttributesPostRequestDataConfig {
if o == nil {
var ret V2TargetIdentifierAttributesPostRequestDataConfig
return ret
}
return o.Config
}
// GetConfigOk returns a tuple with the Config field value
// and a boolean to check if the value has been set.
func (o *V2TargetIdentifierAttributesPostRequestData) GetConfigOk() (*V2TargetIdentifierAttributesPostRequestDataConfig, bool) {
if o == nil {
return nil, false
}
return &o.Config, true
}
// SetConfig sets field value
func (o *V2TargetIdentifierAttributesPostRequestData) SetConfig(v V2TargetIdentifierAttributesPostRequestDataConfig) {
o.Config = v
}
func (o V2TargetIdentifierAttributesPostRequestData) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o V2TargetIdentifierAttributesPostRequestData) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["title"] = o.Title
toSerialize["description"] = o.Description.Get()
toSerialize["api_slug"] = o.ApiSlug
toSerialize["type"] = o.Type
toSerialize["is_required"] = o.IsRequired
toSerialize["is_unique"] = o.IsUnique
toSerialize["is_multiselect"] = o.IsMultiselect
if o.DefaultValue.IsSet() {
toSerialize["default_value"] = o.DefaultValue.Get()
}
if !IsNil(o.Relationship) {
toSerialize["relationship"] = o.Relationship
}
toSerialize["config"] = o.Config
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *V2TargetIdentifierAttributesPostRequestData) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"title",
"description",
"api_slug",
"type",
"is_required",
"is_unique",
"is_multiselect",
"config",
}
// defaultValueFuncMap captures the default values for required properties.
// These values are used when required properties are missing from the payload.
defaultValueFuncMap := map[string]func() interface{}{}
var defaultValueApplied bool
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err
}
for _, requiredProperty := range requiredProperties {
if value, exists := allProperties[requiredProperty]; !exists || value == "" {
if _, ok := defaultValueFuncMap[requiredProperty]; ok {
allProperties[requiredProperty] = defaultValueFuncMap[requiredProperty]()
defaultValueApplied = true
}
}
if value, exists := allProperties[requiredProperty]; !exists || value == "" {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
if defaultValueApplied {
data, err = json.Marshal(allProperties)
if err != nil {
return err
}
}
varV2TargetIdentifierAttributesPostRequestData := _V2TargetIdentifierAttributesPostRequestData{}
err = json.Unmarshal(data, &varV2TargetIdentifierAttributesPostRequestData)
if err != nil {
return err
}
*o = V2TargetIdentifierAttributesPostRequestData(varV2TargetIdentifierAttributesPostRequestData)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "title")
delete(additionalProperties, "description")
delete(additionalProperties, "api_slug")
delete(additionalProperties, "type")
delete(additionalProperties, "is_required")
delete(additionalProperties, "is_unique")
delete(additionalProperties, "is_multiselect")
delete(additionalProperties, "default_value")
delete(additionalProperties, "relationship")
delete(additionalProperties, "config")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableV2TargetIdentifierAttributesPostRequestData struct {
value *V2TargetIdentifierAttributesPostRequestData
isSet bool
}
func (v NullableV2TargetIdentifierAttributesPostRequestData) Get() *V2TargetIdentifierAttributesPostRequestData {
return v.value
}
func (v *NullableV2TargetIdentifierAttributesPostRequestData) Set(val *V2TargetIdentifierAttributesPostRequestData) {
v.value = val
v.isSet = true
}
func (v NullableV2TargetIdentifierAttributesPostRequestData) IsSet() bool {
return v.isSet
}
func (v *NullableV2TargetIdentifierAttributesPostRequestData) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableV2TargetIdentifierAttributesPostRequestData(val *V2TargetIdentifierAttributesPostRequestData) *NullableV2TargetIdentifierAttributesPostRequestData {
return &NullableV2TargetIdentifierAttributesPostRequestData{value: val, isSet: true}
}
func (v NullableV2TargetIdentifierAttributesPostRequestData) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableV2TargetIdentifierAttributesPostRequestData) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}