Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#1582)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Mar 19, 2024
1 parent c5ecc09 commit 3f69595
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 1,058 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1288
configured_endpoints: 1284
24 changes: 0 additions & 24 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1620,24 +1620,8 @@ Methods:

### Reports

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#DNSDNSAnalyticsAPIReport">DNSDNSAnalyticsAPIReport</a>

Methods:

- <code title="get /zones/{identifier}/dns_analytics/report">client.DNS.Analytics.Reports.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#AnalyticsReportService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, identifier <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#AnalyticsReportGetParams">AnalyticsReportGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#DNSDNSAnalyticsAPIReport">DNSDNSAnalyticsAPIReport</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

#### Bytimes

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#DNSDNSAnalyticsAPIReportBytime">DNSDNSAnalyticsAPIReportBytime</a>

Methods:

- <code title="get /zones/{identifier}/dns_analytics/report/bytime">client.DNS.Analytics.Reports.Bytimes.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#AnalyticsReportBytimeService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, identifier <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#AnalyticsReportBytimeGetParams">AnalyticsReportBytimeGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#DNSDNSAnalyticsAPIReportBytime">DNSDNSAnalyticsAPIReportBytime</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

## Firewall

Response Types:
Expand All @@ -1657,16 +1641,8 @@ Methods:

#### Reports

Methods:

- <code title="get /accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report">client.DNS.Firewall.Analytics.Reports.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#FirewallAnalyticsReportService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, accountIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>, identifier <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#FirewallAnalyticsReportGetParams">FirewallAnalyticsReportGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#DNSDNSAnalyticsAPIReport">DNSDNSAnalyticsAPIReport</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

##### Bytimes

Methods:

- <code title="get /accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report/bytime">client.DNS.Firewall.Analytics.Reports.Bytimes.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#FirewallAnalyticsReportBytimeService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, accountIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>, identifier <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#FirewallAnalyticsReportBytimeGetParams">FirewallAnalyticsReportBytimeGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns">dns</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/dns#DNSDNSAnalyticsAPIReportBytime">DNSDNSAnalyticsAPIReportBytime</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# DNSSEC

Response Types:
Expand Down
245 changes: 0 additions & 245 deletions dns/analyticsreport.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
package dns

import (
"context"
"fmt"
"net/http"
"net/url"
"time"

"github.com/cloudflare/cloudflare-go/v2/internal/apijson"
"github.com/cloudflare/cloudflare-go/v2/internal/apiquery"
"github.com/cloudflare/cloudflare-go/v2/internal/param"
"github.com/cloudflare/cloudflare-go/v2/internal/requestconfig"
"github.com/cloudflare/cloudflare-go/v2/option"
)

Expand All @@ -35,238 +25,3 @@ func NewAnalyticsReportService(opts ...option.RequestOption) (r *AnalyticsReport
r.Bytimes = NewAnalyticsReportBytimeService(opts...)
return
}

// Retrieves a list of summarised aggregate metrics over a given time period.
//
// See
// [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/)
// for detailed information about the available query parameters.
func (r *AnalyticsReportService) Get(ctx context.Context, identifier string, query AnalyticsReportGetParams, opts ...option.RequestOption) (res *DNSDNSAnalyticsAPIReport, err error) {
opts = append(r.Options[:], opts...)
var env AnalyticsReportGetResponseEnvelope
path := fmt.Sprintf("zones/%s/dns_analytics/report", identifier)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}

type DNSDNSAnalyticsAPIReport struct {
// Array with one row per combination of dimension values.
Data []DNSDNSAnalyticsAPIReportData `json:"data,required"`
// Number of seconds between current time and last processed event, in another
// words how many seconds of data could be missing.
DataLag float64 `json:"data_lag,required"`
// Maximum results for each metric (object mapping metric names to values).
// Currently always an empty object.
Max interface{} `json:"max,required"`
// Minimum results for each metric (object mapping metric names to values).
// Currently always an empty object.
Min interface{} `json:"min,required"`
Query DNSDNSAnalyticsAPIReportQuery `json:"query,required"`
// Total number of rows in the result.
Rows float64 `json:"rows,required"`
// Total results for metrics across all data (object mapping metric names to
// values).
Totals interface{} `json:"totals,required"`
JSON dnsdnsAnalyticsAPIReportJSON `json:"-"`
}

// dnsdnsAnalyticsAPIReportJSON contains the JSON metadata for the struct
// [DNSDNSAnalyticsAPIReport]
type dnsdnsAnalyticsAPIReportJSON struct {
Data apijson.Field
DataLag apijson.Field
Max apijson.Field
Min apijson.Field
Query apijson.Field
Rows apijson.Field
Totals apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *DNSDNSAnalyticsAPIReport) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r dnsdnsAnalyticsAPIReportJSON) RawJSON() string {
return r.raw
}

type DNSDNSAnalyticsAPIReportData struct {
// Array of dimension values, representing the combination of dimension values
// corresponding to this row.
Dimensions []string `json:"dimensions,required"`
// Array with one item per requested metric. Each item is a single value.
Metrics []float64 `json:"metrics,required"`
JSON dnsdnsAnalyticsAPIReportDataJSON `json:"-"`
}

// dnsdnsAnalyticsAPIReportDataJSON contains the JSON metadata for the struct
// [DNSDNSAnalyticsAPIReportData]
type dnsdnsAnalyticsAPIReportDataJSON struct {
Dimensions apijson.Field
Metrics apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *DNSDNSAnalyticsAPIReportData) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r dnsdnsAnalyticsAPIReportDataJSON) RawJSON() string {
return r.raw
}

type DNSDNSAnalyticsAPIReportQuery struct {
// Array of dimension names.
Dimensions []string `json:"dimensions,required"`
// Limit number of returned metrics.
Limit int64 `json:"limit,required"`
// Array of metric names.
Metrics []string `json:"metrics,required"`
// Start date and time of requesting data period in ISO 8601 format.
Since time.Time `json:"since,required" format:"date-time"`
// End date and time of requesting data period in ISO 8601 format.
Until time.Time `json:"until,required" format:"date-time"`
// Segmentation filter in 'attribute operator value' format.
Filters string `json:"filters"`
// Array of dimensions to sort by, where each dimension may be prefixed by -
// (descending) or + (ascending).
Sort []string `json:"sort"`
JSON dnsdnsAnalyticsAPIReportQueryJSON `json:"-"`
}

// dnsdnsAnalyticsAPIReportQueryJSON contains the JSON metadata for the struct
// [DNSDNSAnalyticsAPIReportQuery]
type dnsdnsAnalyticsAPIReportQueryJSON struct {
Dimensions apijson.Field
Limit apijson.Field
Metrics apijson.Field
Since apijson.Field
Until apijson.Field
Filters apijson.Field
Sort apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *DNSDNSAnalyticsAPIReportQuery) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r dnsdnsAnalyticsAPIReportQueryJSON) RawJSON() string {
return r.raw
}

type AnalyticsReportGetParams struct {
// A comma-separated list of dimensions to group results by.
Dimensions param.Field[string] `query:"dimensions"`
// Segmentation filter in 'attribute operator value' format.
Filters param.Field[string] `query:"filters"`
// Limit number of returned metrics.
Limit param.Field[int64] `query:"limit"`
// A comma-separated list of metrics to query.
Metrics param.Field[string] `query:"metrics"`
// Start date and time of requesting data period in ISO 8601 format.
Since param.Field[time.Time] `query:"since" format:"date-time"`
// A comma-separated list of dimensions to sort by, where each dimension may be
// prefixed by - (descending) or + (ascending).
Sort param.Field[string] `query:"sort"`
// End date and time of requesting data period in ISO 8601 format.
Until param.Field[time.Time] `query:"until" format:"date-time"`
}

// URLQuery serializes [AnalyticsReportGetParams]'s query parameters as
// `url.Values`.
func (r AnalyticsReportGetParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}

type AnalyticsReportGetResponseEnvelope struct {
Errors []AnalyticsReportGetResponseEnvelopeErrors `json:"errors,required"`
Messages []AnalyticsReportGetResponseEnvelopeMessages `json:"messages,required"`
Result DNSDNSAnalyticsAPIReport `json:"result,required"`
// Whether the API call was successful
Success AnalyticsReportGetResponseEnvelopeSuccess `json:"success,required"`
JSON analyticsReportGetResponseEnvelopeJSON `json:"-"`
}

// analyticsReportGetResponseEnvelopeJSON contains the JSON metadata for the struct
// [AnalyticsReportGetResponseEnvelope]
type analyticsReportGetResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Result apijson.Field
Success apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AnalyticsReportGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r analyticsReportGetResponseEnvelopeJSON) RawJSON() string {
return r.raw
}

type AnalyticsReportGetResponseEnvelopeErrors struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON analyticsReportGetResponseEnvelopeErrorsJSON `json:"-"`
}

// analyticsReportGetResponseEnvelopeErrorsJSON contains the JSON metadata for the
// struct [AnalyticsReportGetResponseEnvelopeErrors]
type analyticsReportGetResponseEnvelopeErrorsJSON struct {
Code apijson.Field
Message apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AnalyticsReportGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r analyticsReportGetResponseEnvelopeErrorsJSON) RawJSON() string {
return r.raw
}

type AnalyticsReportGetResponseEnvelopeMessages struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON analyticsReportGetResponseEnvelopeMessagesJSON `json:"-"`
}

// analyticsReportGetResponseEnvelopeMessagesJSON contains the JSON metadata for
// the struct [AnalyticsReportGetResponseEnvelopeMessages]
type analyticsReportGetResponseEnvelopeMessagesJSON struct {
Code apijson.Field
Message apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AnalyticsReportGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r analyticsReportGetResponseEnvelopeMessagesJSON) RawJSON() string {
return r.raw
}

// Whether the API call was successful
type AnalyticsReportGetResponseEnvelopeSuccess bool

const (
AnalyticsReportGetResponseEnvelopeSuccessTrue AnalyticsReportGetResponseEnvelopeSuccess = true
)
52 changes: 0 additions & 52 deletions dns/analyticsreport_test.go

This file was deleted.

Loading

0 comments on commit 3f69595

Please sign in to comment.