Skip to content

Commit c465010

Browse files
feat(api): api update
1 parent ece2072 commit c465010

File tree

4 files changed

+73
-84
lines changed

4 files changed

+73
-84
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1791
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-869343a7f8f6161983e953e472dac9ffd4a77f36de4162e24bff29f8ba0c97fc.yml
3-
openapi_spec_hash: 9f841b7944f821416e8cae8d9d567381
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-b7df96efd8d427e2ca69c857b4b8bf37744c239d4182abaf7fbee43404e09e2e.yml
3+
openapi_spec_hash: 2d764ef74dc75d1d989e0e83cfd96b34
44
config_hash: de4c81cee29cd7dd907279e8916b334f

api.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -987,11 +987,6 @@ Methods:
987987

988988
# DNS
989989

990-
Response Types:
991-
992-
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/dns#DNSAnalyticsNominalMetric">DNSAnalyticsNominalMetric</a>
993-
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v5/dns#DNSAnalyticsQuery">DNSAnalyticsQuery</a>
994-
995990
## DNSSEC
996991

997992
Response Types:

dns/analyticsreportbytime.go

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ type ByTime struct {
6868
Max interface{} `json:"max,required"`
6969
// Minimum results for each metric (object mapping metric names to values).
7070
// Currently always an empty object.
71-
Min interface{} `json:"min,required"`
72-
Query DNSAnalyticsQuery `json:"query,required"`
71+
Min interface{} `json:"min,required"`
72+
Query ByTimeQuery `json:"query,required"`
7373
// Total number of rows in the result.
7474
Rows float64 `json:"rows,required"`
7575
// Array of time intervals in the response data. Each interval is represented as an
@@ -109,8 +109,8 @@ type ByTimeData struct {
109109
Dimensions []string `json:"dimensions,required"`
110110
// Array with one item per requested metric. Each item is an array of values,
111111
// broken down by time interval.
112-
Metrics []DNSAnalyticsNominalMetric `json:"metrics,required"`
113-
JSON byTimeDataJSON `json:"-"`
112+
Metrics [][]float64 `json:"metrics,required"`
113+
JSON byTimeDataJSON `json:"-"`
114114
}
115115

116116
// byTimeDataJSON contains the JSON metadata for the struct [ByTimeData]
@@ -129,6 +129,73 @@ func (r byTimeDataJSON) RawJSON() string {
129129
return r.raw
130130
}
131131

132+
type ByTimeQuery struct {
133+
// Array of dimension names.
134+
Dimensions []string `json:"dimensions,required"`
135+
// Limit number of returned metrics.
136+
Limit int64 `json:"limit,required"`
137+
// Array of metric names.
138+
Metrics []string `json:"metrics,required"`
139+
// Start date and time of requesting data period in ISO 8601 format.
140+
Since time.Time `json:"since,required" format:"date-time"`
141+
// Unit of time to group data by.
142+
TimeDelta ByTimeQueryTimeDelta `json:"time_delta,required"`
143+
// End date and time of requesting data period in ISO 8601 format.
144+
Until time.Time `json:"until,required" format:"date-time"`
145+
// Segmentation filter in 'attribute operator value' format.
146+
Filters string `json:"filters"`
147+
// Array of dimensions to sort by, where each dimension may be prefixed by -
148+
// (descending) or + (ascending).
149+
Sort []string `json:"sort"`
150+
JSON byTimeQueryJSON `json:"-"`
151+
}
152+
153+
// byTimeQueryJSON contains the JSON metadata for the struct [ByTimeQuery]
154+
type byTimeQueryJSON struct {
155+
Dimensions apijson.Field
156+
Limit apijson.Field
157+
Metrics apijson.Field
158+
Since apijson.Field
159+
TimeDelta apijson.Field
160+
Until apijson.Field
161+
Filters apijson.Field
162+
Sort apijson.Field
163+
raw string
164+
ExtraFields map[string]apijson.Field
165+
}
166+
167+
func (r *ByTimeQuery) UnmarshalJSON(data []byte) (err error) {
168+
return apijson.UnmarshalRoot(data, r)
169+
}
170+
171+
func (r byTimeQueryJSON) RawJSON() string {
172+
return r.raw
173+
}
174+
175+
// Unit of time to group data by.
176+
type ByTimeQueryTimeDelta string
177+
178+
const (
179+
ByTimeQueryTimeDeltaAll ByTimeQueryTimeDelta = "all"
180+
ByTimeQueryTimeDeltaAuto ByTimeQueryTimeDelta = "auto"
181+
ByTimeQueryTimeDeltaYear ByTimeQueryTimeDelta = "year"
182+
ByTimeQueryTimeDeltaQuarter ByTimeQueryTimeDelta = "quarter"
183+
ByTimeQueryTimeDeltaMonth ByTimeQueryTimeDelta = "month"
184+
ByTimeQueryTimeDeltaWeek ByTimeQueryTimeDelta = "week"
185+
ByTimeQueryTimeDeltaDay ByTimeQueryTimeDelta = "day"
186+
ByTimeQueryTimeDeltaHour ByTimeQueryTimeDelta = "hour"
187+
ByTimeQueryTimeDeltaDekaminute ByTimeQueryTimeDelta = "dekaminute"
188+
ByTimeQueryTimeDeltaMinute ByTimeQueryTimeDelta = "minute"
189+
)
190+
191+
func (r ByTimeQueryTimeDelta) IsKnown() bool {
192+
switch r {
193+
case ByTimeQueryTimeDeltaAll, ByTimeQueryTimeDeltaAuto, ByTimeQueryTimeDeltaYear, ByTimeQueryTimeDeltaQuarter, ByTimeQueryTimeDeltaMonth, ByTimeQueryTimeDeltaWeek, ByTimeQueryTimeDeltaDay, ByTimeQueryTimeDeltaHour, ByTimeQueryTimeDeltaDekaminute, ByTimeQueryTimeDeltaMinute:
194+
return true
195+
}
196+
return false
197+
}
198+
132199
type AnalyticsReportBytimeGetParams struct {
133200
// Identifier.
134201
ZoneID param.Field[string] `path:"zone_id,required"`

dns/dns.go

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
package dns
44

55
import (
6-
"time"
7-
8-
"github.com/cloudflare/cloudflare-go/v5/internal/apijson"
96
"github.com/cloudflare/cloudflare-go/v5/option"
107
)
118

@@ -37,73 +34,3 @@ func NewDNSService(opts ...option.RequestOption) (r *DNSService) {
3734
r.ZoneTransfers = NewZoneTransferService(opts...)
3835
return
3936
}
40-
41-
type DNSAnalyticsNominalMetric []float64
42-
43-
type DNSAnalyticsQuery struct {
44-
// Array of dimension names.
45-
Dimensions []string `json:"dimensions,required"`
46-
// Limit number of returned metrics.
47-
Limit int64 `json:"limit,required"`
48-
// Array of metric names.
49-
Metrics []string `json:"metrics,required"`
50-
// Start date and time of requesting data period in ISO 8601 format.
51-
Since time.Time `json:"since,required" format:"date-time"`
52-
// Unit of time to group data by.
53-
TimeDelta DNSAnalyticsQueryTimeDelta `json:"time_delta,required"`
54-
// End date and time of requesting data period in ISO 8601 format.
55-
Until time.Time `json:"until,required" format:"date-time"`
56-
// Segmentation filter in 'attribute operator value' format.
57-
Filters string `json:"filters"`
58-
// Array of dimensions to sort by, where each dimension may be prefixed by -
59-
// (descending) or + (ascending).
60-
Sort []string `json:"sort"`
61-
JSON dnsAnalyticsQueryJSON `json:"-"`
62-
}
63-
64-
// dnsAnalyticsQueryJSON contains the JSON metadata for the struct
65-
// [DNSAnalyticsQuery]
66-
type dnsAnalyticsQueryJSON struct {
67-
Dimensions apijson.Field
68-
Limit apijson.Field
69-
Metrics apijson.Field
70-
Since apijson.Field
71-
TimeDelta apijson.Field
72-
Until apijson.Field
73-
Filters apijson.Field
74-
Sort apijson.Field
75-
raw string
76-
ExtraFields map[string]apijson.Field
77-
}
78-
79-
func (r *DNSAnalyticsQuery) UnmarshalJSON(data []byte) (err error) {
80-
return apijson.UnmarshalRoot(data, r)
81-
}
82-
83-
func (r dnsAnalyticsQueryJSON) RawJSON() string {
84-
return r.raw
85-
}
86-
87-
// Unit of time to group data by.
88-
type DNSAnalyticsQueryTimeDelta string
89-
90-
const (
91-
DNSAnalyticsQueryTimeDeltaAll DNSAnalyticsQueryTimeDelta = "all"
92-
DNSAnalyticsQueryTimeDeltaAuto DNSAnalyticsQueryTimeDelta = "auto"
93-
DNSAnalyticsQueryTimeDeltaYear DNSAnalyticsQueryTimeDelta = "year"
94-
DNSAnalyticsQueryTimeDeltaQuarter DNSAnalyticsQueryTimeDelta = "quarter"
95-
DNSAnalyticsQueryTimeDeltaMonth DNSAnalyticsQueryTimeDelta = "month"
96-
DNSAnalyticsQueryTimeDeltaWeek DNSAnalyticsQueryTimeDelta = "week"
97-
DNSAnalyticsQueryTimeDeltaDay DNSAnalyticsQueryTimeDelta = "day"
98-
DNSAnalyticsQueryTimeDeltaHour DNSAnalyticsQueryTimeDelta = "hour"
99-
DNSAnalyticsQueryTimeDeltaDekaminute DNSAnalyticsQueryTimeDelta = "dekaminute"
100-
DNSAnalyticsQueryTimeDeltaMinute DNSAnalyticsQueryTimeDelta = "minute"
101-
)
102-
103-
func (r DNSAnalyticsQueryTimeDelta) IsKnown() bool {
104-
switch r {
105-
case DNSAnalyticsQueryTimeDeltaAll, DNSAnalyticsQueryTimeDeltaAuto, DNSAnalyticsQueryTimeDeltaYear, DNSAnalyticsQueryTimeDeltaQuarter, DNSAnalyticsQueryTimeDeltaMonth, DNSAnalyticsQueryTimeDeltaWeek, DNSAnalyticsQueryTimeDeltaDay, DNSAnalyticsQueryTimeDeltaHour, DNSAnalyticsQueryTimeDeltaDekaminute, DNSAnalyticsQueryTimeDeltaMinute:
106-
return true
107-
}
108-
return false
109-
}

0 commit comments

Comments
 (0)