Skip to content

Commit 69b5527

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add Product Analytics widget definitions (#3949)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 59f803f commit 69b5527

66 files changed

Lines changed: 10417 additions & 219 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.generator/schemas/v1/openapi.yaml

Lines changed: 1193 additions & 165 deletions
Large diffs are not rendered by default.
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV1
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// CalendarInterval Calendar interval definition.
14+
type CalendarInterval struct {
15+
// Alignment of the interval. Valid values depend on the interval type. For `day`, use hours (for example, `1am`, `2pm`, or `14`). For `week`, use day names (for example, `monday`). For `month`, use day-of-month ordinals (for example, `1st`, `15th`). For `year` or `quarter`, use month names (for example, `january`).
16+
Alignment *string `json:"alignment,omitempty"`
17+
// Quantity of the interval.
18+
Quantity *int64 `json:"quantity,omitempty"`
19+
// Timezone for the interval.
20+
Timezone *string `json:"timezone,omitempty"`
21+
// Type of calendar interval.
22+
Type CalendarIntervalType `json:"type"`
23+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
24+
UnparsedObject map[string]interface{} `json:"-"`
25+
}
26+
27+
// NewCalendarInterval instantiates a new CalendarInterval 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 NewCalendarInterval(typeVar CalendarIntervalType) *CalendarInterval {
32+
this := CalendarInterval{}
33+
this.Type = typeVar
34+
return &this
35+
}
36+
37+
// NewCalendarIntervalWithDefaults instantiates a new CalendarInterval object.
38+
// This constructor will only assign default values to properties that have it defined,
39+
// but it doesn't guarantee that properties required by API are set.
40+
func NewCalendarIntervalWithDefaults() *CalendarInterval {
41+
this := CalendarInterval{}
42+
return &this
43+
}
44+
45+
// GetAlignment returns the Alignment field value if set, zero value otherwise.
46+
func (o *CalendarInterval) GetAlignment() string {
47+
if o == nil || o.Alignment == nil {
48+
var ret string
49+
return ret
50+
}
51+
return *o.Alignment
52+
}
53+
54+
// GetAlignmentOk returns a tuple with the Alignment field value if set, nil otherwise
55+
// and a boolean to check if the value has been set.
56+
func (o *CalendarInterval) GetAlignmentOk() (*string, bool) {
57+
if o == nil || o.Alignment == nil {
58+
return nil, false
59+
}
60+
return o.Alignment, true
61+
}
62+
63+
// HasAlignment returns a boolean if a field has been set.
64+
func (o *CalendarInterval) HasAlignment() bool {
65+
return o != nil && o.Alignment != nil
66+
}
67+
68+
// SetAlignment gets a reference to the given string and assigns it to the Alignment field.
69+
func (o *CalendarInterval) SetAlignment(v string) {
70+
o.Alignment = &v
71+
}
72+
73+
// GetQuantity returns the Quantity field value if set, zero value otherwise.
74+
func (o *CalendarInterval) GetQuantity() int64 {
75+
if o == nil || o.Quantity == nil {
76+
var ret int64
77+
return ret
78+
}
79+
return *o.Quantity
80+
}
81+
82+
// GetQuantityOk returns a tuple with the Quantity field value if set, nil otherwise
83+
// and a boolean to check if the value has been set.
84+
func (o *CalendarInterval) GetQuantityOk() (*int64, bool) {
85+
if o == nil || o.Quantity == nil {
86+
return nil, false
87+
}
88+
return o.Quantity, true
89+
}
90+
91+
// HasQuantity returns a boolean if a field has been set.
92+
func (o *CalendarInterval) HasQuantity() bool {
93+
return o != nil && o.Quantity != nil
94+
}
95+
96+
// SetQuantity gets a reference to the given int64 and assigns it to the Quantity field.
97+
func (o *CalendarInterval) SetQuantity(v int64) {
98+
o.Quantity = &v
99+
}
100+
101+
// GetTimezone returns the Timezone field value if set, zero value otherwise.
102+
func (o *CalendarInterval) GetTimezone() string {
103+
if o == nil || o.Timezone == nil {
104+
var ret string
105+
return ret
106+
}
107+
return *o.Timezone
108+
}
109+
110+
// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise
111+
// and a boolean to check if the value has been set.
112+
func (o *CalendarInterval) GetTimezoneOk() (*string, bool) {
113+
if o == nil || o.Timezone == nil {
114+
return nil, false
115+
}
116+
return o.Timezone, true
117+
}
118+
119+
// HasTimezone returns a boolean if a field has been set.
120+
func (o *CalendarInterval) HasTimezone() bool {
121+
return o != nil && o.Timezone != nil
122+
}
123+
124+
// SetTimezone gets a reference to the given string and assigns it to the Timezone field.
125+
func (o *CalendarInterval) SetTimezone(v string) {
126+
o.Timezone = &v
127+
}
128+
129+
// GetType returns the Type field value.
130+
func (o *CalendarInterval) GetType() CalendarIntervalType {
131+
if o == nil {
132+
var ret CalendarIntervalType
133+
return ret
134+
}
135+
return o.Type
136+
}
137+
138+
// GetTypeOk returns a tuple with the Type field value
139+
// and a boolean to check if the value has been set.
140+
func (o *CalendarInterval) GetTypeOk() (*CalendarIntervalType, bool) {
141+
if o == nil {
142+
return nil, false
143+
}
144+
return &o.Type, true
145+
}
146+
147+
// SetType sets field value.
148+
func (o *CalendarInterval) SetType(v CalendarIntervalType) {
149+
o.Type = v
150+
}
151+
152+
// MarshalJSON serializes the struct using spec logic.
153+
func (o CalendarInterval) MarshalJSON() ([]byte, error) {
154+
toSerialize := map[string]interface{}{}
155+
if o.UnparsedObject != nil {
156+
return datadog.Marshal(o.UnparsedObject)
157+
}
158+
if o.Alignment != nil {
159+
toSerialize["alignment"] = o.Alignment
160+
}
161+
if o.Quantity != nil {
162+
toSerialize["quantity"] = o.Quantity
163+
}
164+
if o.Timezone != nil {
165+
toSerialize["timezone"] = o.Timezone
166+
}
167+
toSerialize["type"] = o.Type
168+
return datadog.Marshal(toSerialize)
169+
}
170+
171+
// UnmarshalJSON deserializes the given payload.
172+
func (o *CalendarInterval) UnmarshalJSON(bytes []byte) (err error) {
173+
all := struct {
174+
Alignment *string `json:"alignment,omitempty"`
175+
Quantity *int64 `json:"quantity,omitempty"`
176+
Timezone *string `json:"timezone,omitempty"`
177+
Type *CalendarIntervalType `json:"type"`
178+
}{}
179+
if err = datadog.Unmarshal(bytes, &all); err != nil {
180+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
181+
}
182+
if all.Type == nil {
183+
return fmt.Errorf("required field type missing")
184+
}
185+
186+
hasInvalidField := false
187+
o.Alignment = all.Alignment
188+
o.Quantity = all.Quantity
189+
o.Timezone = all.Timezone
190+
if !all.Type.IsValid() {
191+
hasInvalidField = true
192+
} else {
193+
o.Type = *all.Type
194+
}
195+
196+
if hasInvalidField {
197+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
198+
}
199+
200+
return nil
201+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV1
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// CalendarIntervalType Type of calendar interval.
14+
type CalendarIntervalType string
15+
16+
// List of CalendarIntervalType.
17+
const (
18+
CALENDARINTERVALTYPE_DAY CalendarIntervalType = "day"
19+
CALENDARINTERVALTYPE_WEEK CalendarIntervalType = "week"
20+
CALENDARINTERVALTYPE_MONTH CalendarIntervalType = "month"
21+
CALENDARINTERVALTYPE_YEAR CalendarIntervalType = "year"
22+
CALENDARINTERVALTYPE_QUARTER CalendarIntervalType = "quarter"
23+
CALENDARINTERVALTYPE_MINUTE CalendarIntervalType = "minute"
24+
CALENDARINTERVALTYPE_HOUR CalendarIntervalType = "hour"
25+
)
26+
27+
var allowedCalendarIntervalTypeEnumValues = []CalendarIntervalType{
28+
CALENDARINTERVALTYPE_DAY,
29+
CALENDARINTERVALTYPE_WEEK,
30+
CALENDARINTERVALTYPE_MONTH,
31+
CALENDARINTERVALTYPE_YEAR,
32+
CALENDARINTERVALTYPE_QUARTER,
33+
CALENDARINTERVALTYPE_MINUTE,
34+
CALENDARINTERVALTYPE_HOUR,
35+
}
36+
37+
// GetAllowedValues reeturns the list of possible values.
38+
func (v *CalendarIntervalType) GetAllowedValues() []CalendarIntervalType {
39+
return allowedCalendarIntervalTypeEnumValues
40+
}
41+
42+
// UnmarshalJSON deserializes the given payload.
43+
func (v *CalendarIntervalType) UnmarshalJSON(src []byte) error {
44+
var value string
45+
err := datadog.Unmarshal(src, &value)
46+
if err != nil {
47+
return err
48+
}
49+
*v = CalendarIntervalType(value)
50+
return nil
51+
}
52+
53+
// NewCalendarIntervalTypeFromValue returns a pointer to a valid CalendarIntervalType
54+
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
55+
func NewCalendarIntervalTypeFromValue(v string) (*CalendarIntervalType, error) {
56+
ev := CalendarIntervalType(v)
57+
if ev.IsValid() {
58+
return &ev, nil
59+
}
60+
return nil, fmt.Errorf("invalid value '%v' for CalendarIntervalType: valid values are %v", v, allowedCalendarIntervalTypeEnumValues)
61+
}
62+
63+
// IsValid return true if the value is valid for the enum, false otherwise.
64+
func (v CalendarIntervalType) IsValid() bool {
65+
for _, existing := range allowedCalendarIntervalTypeEnumValues {
66+
if existing == v {
67+
return true
68+
}
69+
}
70+
return false
71+
}
72+
73+
// Ptr returns reference to CalendarIntervalType value.
74+
func (v CalendarIntervalType) Ptr() *CalendarIntervalType {
75+
return &v
76+
}

0 commit comments

Comments
 (0)