From 6798779270f57a207ea6abffccfaf8bf66a7d655 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 04:41:53 +0000 Subject: [PATCH] feat(api): rename reserved `model_type` keyword (#3034) --- .stats.yml | 2 +- api.md | 22 -- radar/radar.go | 2 - radar/robotstxt.go | 190 ------------------ radar/robotstxt_test.go | 44 ---- radar/robotstxttop.go | 28 --- radar/robotstxttopdirective.go | 300 ---------------------------- radar/robotstxttopdirective_test.go | 48 ----- 8 files changed, 1 insertion(+), 635 deletions(-) delete mode 100644 radar/robotstxt.go delete mode 100644 radar/robotstxt_test.go delete mode 100644 radar/robotstxttop.go delete mode 100644 radar/robotstxttopdirective.go delete mode 100644 radar/robotstxttopdirective_test.go diff --git a/.stats.yml b/.stats.yml index de988b6e99d..5642cfdad39 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1332 +configured_endpoints: 1330 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-60169622cdb93defdefea93ffc7d048f623611bd2220fbd0274f79e3e7bda5f0.yml diff --git a/api.md b/api.md index 05cecd6c194..47b1c3a7299 100644 --- a/api.md +++ b/api.md @@ -6746,28 +6746,6 @@ Methods: - client.Radar.TCPResetsTimeouts.Summary(ctx context.Context, query radar.TCPResetsTimeoutSummaryParams) (radar.TCPResetsTimeoutSummaryResponse, error) - client.Radar.TCPResetsTimeouts.TimeseriesGroups(ctx context.Context, query radar.TCPResetsTimeoutTimeseriesGroupsParams) (radar.TCPResetsTimeoutTimeseriesGroupsResponse, error) -## RobotsTXT - -Response Types: - -- radar.RobotsTXTDomainsResponse - -Methods: - -- client.Radar.RobotsTXT.Domains(ctx context.Context, query radar.RobotsTXTDomainsParams) (radar.RobotsTXTDomainsResponse, error) - -### Top - -#### Directive - -Response Types: - -- radar.RobotsTXTTopDirectiveGetResponse - -Methods: - -- client.Radar.RobotsTXT.Top.Directive.Get(ctx context.Context, directive radar.RobotsTXTTopDirectiveGetParamsDirective, query radar.RobotsTXTTopDirectiveGetParams) (radar.RobotsTXTTopDirectiveGetResponse, error) - # BotManagement Params Types: diff --git a/radar/radar.go b/radar/radar.go index f120105cec1..730acb0b58a 100644 --- a/radar/radar.go +++ b/radar/radar.go @@ -31,7 +31,6 @@ type RadarService struct { Ranking *RankingService TrafficAnomalies *TrafficAnomalyService TCPResetsTimeouts *TCPResetsTimeoutService - RobotsTXT *RobotsTXTService } // NewRadarService generates a new service that applies the given options to each @@ -57,6 +56,5 @@ func NewRadarService(opts ...option.RequestOption) (r *RadarService) { r.Ranking = NewRankingService(opts...) r.TrafficAnomalies = NewTrafficAnomalyService(opts...) r.TCPResetsTimeouts = NewTCPResetsTimeoutService(opts...) - r.RobotsTXT = NewRobotsTXTService(opts...) return } diff --git a/radar/robotstxt.go b/radar/robotstxt.go deleted file mode 100644 index ed2819174d9..00000000000 --- a/radar/robotstxt.go +++ /dev/null @@ -1,190 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package radar - -import ( - "context" - "net/http" - "net/url" - - "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" -) - -// RobotsTXTService contains methods and other services that help with interacting -// with the cloudflare API. -// -// Note, unlike clients, this service does not read variables from the environment -// automatically. You should not instantiate this service directly, and instead use -// the [NewRobotsTXTService] method instead. -type RobotsTXTService struct { - Options []option.RequestOption - Top *RobotsTXTTopService -} - -// NewRobotsTXTService generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewRobotsTXTService(opts ...option.RequestOption) (r *RobotsTXTService) { - r = &RobotsTXTService{} - r.Options = opts - r.Top = NewRobotsTXTTopService(opts...) - return -} - -// Get the top User-Agents on robots.txt files by domain. -func (r *RobotsTXTService) Domains(ctx context.Context, query RobotsTXTDomainsParams, opts ...option.RequestOption) (res *RobotsTXTDomainsResponse, err error) { - var env RobotsTXTDomainsResponseEnvelope - opts = append(r.Options[:], opts...) - path := "radar/robots_txt/domains" - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type RobotsTXTDomainsResponse struct { - Date string `json:"date,required"` - Domains []RobotsTXTDomainsResponseDomain `json:"domains,required"` - UserAgents []string `json:"userAgents,required"` - JSON robotsTXTDomainsResponseJSON `json:"-"` -} - -// robotsTXTDomainsResponseJSON contains the JSON metadata for the struct -// [RobotsTXTDomainsResponse] -type robotsTXTDomainsResponseJSON struct { - Date apijson.Field - Domains apijson.Field - UserAgents apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RobotsTXTDomainsResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r robotsTXTDomainsResponseJSON) RawJSON() string { - return r.raw -} - -type RobotsTXTDomainsResponseDomain struct { - string `json:"*,required"` - Amazonbot string `json:"amazonbot,required"` - CategoriesParent string `json:"categories_parent,required"` - CategoriesSub string `json:"categories_sub,required"` - Domain string `json:"domain,required"` - JSON robotsTXTDomainsResponseDomainJSON `json:"-"` -} - -// robotsTXTDomainsResponseDomainJSON contains the JSON metadata for the struct -// [RobotsTXTDomainsResponseDomain] -type robotsTXTDomainsResponseDomainJSON struct { - apijson.Field - Amazonbot apijson.Field - CategoriesParent apijson.Field - CategoriesSub apijson.Field - Domain apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RobotsTXTDomainsResponseDomain) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r robotsTXTDomainsResponseDomainJSON) RawJSON() string { - return r.raw -} - -type RobotsTXTDomainsParams struct { - // Filter domains by category - DomainCategory param.Field[string] `query:"domainCategory"` - // Filter domains by name - DomainName param.Field[string] `query:"domainName"` - // Format results are returned in. - Format param.Field[RobotsTXTDomainsParamsFormat] `query:"format"` - // Limit the number of objects in the response. - Limit param.Field[int64] `query:"limit"` - // Number of objects to skip before grabbing results. - Offset param.Field[int64] `query:"offset"` -} - -// URLQuery serializes [RobotsTXTDomainsParams]'s query parameters as `url.Values`. -func (r RobotsTXTDomainsParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatRepeat, - NestedFormat: apiquery.NestedQueryFormatDots, - }) -} - -// Format results are returned in. -type RobotsTXTDomainsParamsFormat string - -const ( - RobotsTXTDomainsParamsFormatJson RobotsTXTDomainsParamsFormat = "JSON" - RobotsTXTDomainsParamsFormatCsv RobotsTXTDomainsParamsFormat = "CSV" -) - -func (r RobotsTXTDomainsParamsFormat) IsKnown() bool { - switch r { - case RobotsTXTDomainsParamsFormatJson, RobotsTXTDomainsParamsFormatCsv: - return true - } - return false -} - -type RobotsTXTDomainsResponseEnvelope struct { - Result RobotsTXTDomainsResponse `json:"result,required"` - ResultInfo RobotsTXTDomainsResponseEnvelopeResultInfo `json:"resultInfo,required"` - Success bool `json:"success,required"` - JSON robotsTXTDomainsResponseEnvelopeJSON `json:"-"` -} - -// robotsTXTDomainsResponseEnvelopeJSON contains the JSON metadata for the struct -// [RobotsTXTDomainsResponseEnvelope] -type robotsTXTDomainsResponseEnvelopeJSON struct { - Result apijson.Field - ResultInfo apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RobotsTXTDomainsResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r robotsTXTDomainsResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -type RobotsTXTDomainsResponseEnvelopeResultInfo struct { - Limit int64 `json:"limit,required"` - Offset int64 `json:"offset,required"` - Total int64 `json:"total,required"` - JSON robotsTXTDomainsResponseEnvelopeResultInfoJSON `json:"-"` -} - -// robotsTXTDomainsResponseEnvelopeResultInfoJSON contains the JSON metadata for -// the struct [RobotsTXTDomainsResponseEnvelopeResultInfo] -type robotsTXTDomainsResponseEnvelopeResultInfoJSON struct { - Limit apijson.Field - Offset apijson.Field - Total apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RobotsTXTDomainsResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r robotsTXTDomainsResponseEnvelopeResultInfoJSON) RawJSON() string { - return r.raw -} diff --git a/radar/robotstxt_test.go b/radar/robotstxt_test.go deleted file mode 100644 index 0dd2d81644d..00000000000 --- a/radar/robotstxt_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package radar_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/testutil" - "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/cloudflare/cloudflare-go/v2/radar" -) - -func TestRobotsTXTDomainsWithOptionalParams(t *testing.T) { - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.Radar.RobotsTXT.Domains(context.TODO(), radar.RobotsTXTDomainsParams{ - DomainCategory: cloudflare.F("domainCategory"), - DomainName: cloudflare.F("domainName"), - Format: cloudflare.F(radar.RobotsTXTDomainsParamsFormatJson), - Limit: cloudflare.F(int64(5)), - Offset: cloudflare.F(int64(0)), - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/radar/robotstxttop.go b/radar/robotstxttop.go deleted file mode 100644 index a14c8138864..00000000000 --- a/radar/robotstxttop.go +++ /dev/null @@ -1,28 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package radar - -import ( - "github.com/cloudflare/cloudflare-go/v2/option" -) - -// RobotsTXTTopService contains methods and other services that help with -// interacting with the cloudflare API. -// -// Note, unlike clients, this service does not read variables from the environment -// automatically. You should not instantiate this service directly, and instead use -// the [NewRobotsTXTTopService] method instead. -type RobotsTXTTopService struct { - Options []option.RequestOption - Directive *RobotsTXTTopDirectiveService -} - -// NewRobotsTXTTopService generates a new service that applies the given options to -// each request. These options are applied after the parent client's options (if -// there is one), and before any request-specific options. -func NewRobotsTXTTopService(opts ...option.RequestOption) (r *RobotsTXTTopService) { - r = &RobotsTXTTopService{} - r.Options = opts - r.Directive = NewRobotsTXTTopDirectiveService(opts...) - return -} diff --git a/radar/robotstxttopdirective.go b/radar/robotstxttopdirective.go deleted file mode 100644 index b0e80771cac..00000000000 --- a/radar/robotstxttopdirective.go +++ /dev/null @@ -1,300 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package radar - -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" -) - -// RobotsTXTTopDirectiveService contains methods and other services that help with -// interacting with the cloudflare API. -// -// Note, unlike clients, this service does not read variables from the environment -// automatically. You should not instantiate this service directly, and instead use -// the [NewRobotsTXTTopDirectiveService] method instead. -type RobotsTXTTopDirectiveService struct { - Options []option.RequestOption -} - -// NewRobotsTXTTopDirectiveService generates a new service that applies the given -// options to each request. These options are applied after the parent client's -// options (if there is one), and before any request-specific options. -func NewRobotsTXTTopDirectiveService(opts ...option.RequestOption) (r *RobotsTXTTopDirectiveService) { - r = &RobotsTXTTopDirectiveService{} - r.Options = opts - return -} - -// Get the top User-Agents on robots.txt files by directive. -func (r *RobotsTXTTopDirectiveService) Get(ctx context.Context, directive RobotsTXTTopDirectiveGetParamsDirective, query RobotsTXTTopDirectiveGetParams, opts ...option.RequestOption) (res *RobotsTXTTopDirectiveGetResponse, err error) { - var env RobotsTXTTopDirectiveGetResponseEnvelope - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("radar/robots_txt/top/%v", directive) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type RobotsTXTTopDirectiveGetResponse struct { - Meta RobotsTXTTopDirectiveGetResponseMeta `json:"meta,required"` - Top0 []RobotsTXTTopDirectiveGetResponseTop0 `json:"top_0,required"` - JSON robotsTXTTopDirectiveGetResponseJSON `json:"-"` -} - -// robotsTXTTopDirectiveGetResponseJSON contains the JSON metadata for the struct -// [RobotsTXTTopDirectiveGetResponse] -type robotsTXTTopDirectiveGetResponseJSON struct { - Meta apijson.Field - Top0 apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RobotsTXTTopDirectiveGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r robotsTXTTopDirectiveGetResponseJSON) RawJSON() string { - return r.raw -} - -type RobotsTXTTopDirectiveGetResponseMeta struct { - DateRange []RobotsTXTTopDirectiveGetResponseMetaDateRange `json:"dateRange,required"` - LastUpdated string `json:"lastUpdated,required"` - ConfidenceInfo RobotsTXTTopDirectiveGetResponseMetaConfidenceInfo `json:"confidenceInfo"` - JSON robotsTXTTopDirectiveGetResponseMetaJSON `json:"-"` -} - -// robotsTXTTopDirectiveGetResponseMetaJSON contains the JSON metadata for the -// struct [RobotsTXTTopDirectiveGetResponseMeta] -type robotsTXTTopDirectiveGetResponseMetaJSON struct { - DateRange apijson.Field - LastUpdated apijson.Field - ConfidenceInfo apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RobotsTXTTopDirectiveGetResponseMeta) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r robotsTXTTopDirectiveGetResponseMetaJSON) RawJSON() string { - return r.raw -} - -type RobotsTXTTopDirectiveGetResponseMetaDateRange struct { - // Adjusted end of date range. - EndTime time.Time `json:"endTime,required" format:"date-time"` - // Adjusted start of date range. - StartTime time.Time `json:"startTime,required" format:"date-time"` - JSON robotsTXTTopDirectiveGetResponseMetaDateRangeJSON `json:"-"` -} - -// robotsTXTTopDirectiveGetResponseMetaDateRangeJSON contains the JSON metadata for -// the struct [RobotsTXTTopDirectiveGetResponseMetaDateRange] -type robotsTXTTopDirectiveGetResponseMetaDateRangeJSON struct { - EndTime apijson.Field - StartTime apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RobotsTXTTopDirectiveGetResponseMetaDateRange) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r robotsTXTTopDirectiveGetResponseMetaDateRangeJSON) RawJSON() string { - return r.raw -} - -type RobotsTXTTopDirectiveGetResponseMetaConfidenceInfo struct { - Annotations []RobotsTXTTopDirectiveGetResponseMetaConfidenceInfoAnnotation `json:"annotations"` - Level int64 `json:"level"` - JSON robotsTXTTopDirectiveGetResponseMetaConfidenceInfoJSON `json:"-"` -} - -// robotsTXTTopDirectiveGetResponseMetaConfidenceInfoJSON contains the JSON -// metadata for the struct [RobotsTXTTopDirectiveGetResponseMetaConfidenceInfo] -type robotsTXTTopDirectiveGetResponseMetaConfidenceInfoJSON struct { - Annotations apijson.Field - Level apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RobotsTXTTopDirectiveGetResponseMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r robotsTXTTopDirectiveGetResponseMetaConfidenceInfoJSON) RawJSON() string { - return r.raw -} - -type RobotsTXTTopDirectiveGetResponseMetaConfidenceInfoAnnotation struct { - DataSource string `json:"dataSource,required"` - Description string `json:"description,required"` - EventType string `json:"eventType,required"` - IsInstantaneous bool `json:"isInstantaneous,required"` - EndTime time.Time `json:"endTime" format:"date-time"` - LinkedURL string `json:"linkedUrl"` - StartTime time.Time `json:"startTime" format:"date-time"` - JSON robotsTXTTopDirectiveGetResponseMetaConfidenceInfoAnnotationJSON `json:"-"` -} - -// robotsTXTTopDirectiveGetResponseMetaConfidenceInfoAnnotationJSON contains the -// JSON metadata for the struct -// [RobotsTXTTopDirectiveGetResponseMetaConfidenceInfoAnnotation] -type robotsTXTTopDirectiveGetResponseMetaConfidenceInfoAnnotationJSON struct { - DataSource apijson.Field - Description apijson.Field - EventType apijson.Field - IsInstantaneous apijson.Field - EndTime apijson.Field - LinkedURL apijson.Field - StartTime apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RobotsTXTTopDirectiveGetResponseMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r robotsTXTTopDirectiveGetResponseMetaConfidenceInfoAnnotationJSON) RawJSON() string { - return r.raw -} - -type RobotsTXTTopDirectiveGetResponseTop0 struct { - Date string `json:"date,required"` - Fully int64 `json:"fully,required"` - Partially int64 `json:"partially,required"` - Total int64 `json:"total,required"` - UserAgent string `json:"userAgent,required"` - JSON robotsTXTTopDirectiveGetResponseTop0JSON `json:"-"` -} - -// robotsTXTTopDirectiveGetResponseTop0JSON contains the JSON metadata for the -// struct [RobotsTXTTopDirectiveGetResponseTop0] -type robotsTXTTopDirectiveGetResponseTop0JSON struct { - Date apijson.Field - Fully apijson.Field - Partially apijson.Field - Total apijson.Field - UserAgent apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RobotsTXTTopDirectiveGetResponseTop0) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r robotsTXTTopDirectiveGetResponseTop0JSON) RawJSON() string { - return r.raw -} - -type RobotsTXTTopDirectiveGetParams struct { - // Filter by user agent category. - AgentCategory param.Field[RobotsTXTTopDirectiveGetParamsAgentCategory] `query:"agentCategory"` - // Date to filter the ranking. - Date param.Field[string] `query:"date"` - // Format results are returned in. - Format param.Field[RobotsTXTTopDirectiveGetParamsFormat] `query:"format"` - // Limit the number of objects in the response. - Limit param.Field[int64] `query:"limit"` - // Array of names that will be used to name the series in responses. - Name param.Field[[]string] `query:"name"` -} - -// URLQuery serializes [RobotsTXTTopDirectiveGetParams]'s query parameters as -// `url.Values`. -func (r RobotsTXTTopDirectiveGetParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatRepeat, - NestedFormat: apiquery.NestedQueryFormatDots, - }) -} - -// Robots.txt directive. -type RobotsTXTTopDirectiveGetParamsDirective string - -const ( - RobotsTXTTopDirectiveGetParamsDirectiveAllow RobotsTXTTopDirectiveGetParamsDirective = "ALLOW" - RobotsTXTTopDirectiveGetParamsDirectiveDisallow RobotsTXTTopDirectiveGetParamsDirective = "DISALLOW" -) - -func (r RobotsTXTTopDirectiveGetParamsDirective) IsKnown() bool { - switch r { - case RobotsTXTTopDirectiveGetParamsDirectiveAllow, RobotsTXTTopDirectiveGetParamsDirectiveDisallow: - return true - } - return false -} - -// Filter by user agent category. -type RobotsTXTTopDirectiveGetParamsAgentCategory string - -const ( - RobotsTXTTopDirectiveGetParamsAgentCategoryAI RobotsTXTTopDirectiveGetParamsAgentCategory = "AI" -) - -func (r RobotsTXTTopDirectiveGetParamsAgentCategory) IsKnown() bool { - switch r { - case RobotsTXTTopDirectiveGetParamsAgentCategoryAI: - return true - } - return false -} - -// Format results are returned in. -type RobotsTXTTopDirectiveGetParamsFormat string - -const ( - RobotsTXTTopDirectiveGetParamsFormatJson RobotsTXTTopDirectiveGetParamsFormat = "JSON" - RobotsTXTTopDirectiveGetParamsFormatCsv RobotsTXTTopDirectiveGetParamsFormat = "CSV" -) - -func (r RobotsTXTTopDirectiveGetParamsFormat) IsKnown() bool { - switch r { - case RobotsTXTTopDirectiveGetParamsFormatJson, RobotsTXTTopDirectiveGetParamsFormatCsv: - return true - } - return false -} - -type RobotsTXTTopDirectiveGetResponseEnvelope struct { - Result RobotsTXTTopDirectiveGetResponse `json:"result,required"` - Success bool `json:"success,required"` - JSON robotsTXTTopDirectiveGetResponseEnvelopeJSON `json:"-"` -} - -// robotsTXTTopDirectiveGetResponseEnvelopeJSON contains the JSON metadata for the -// struct [RobotsTXTTopDirectiveGetResponseEnvelope] -type robotsTXTTopDirectiveGetResponseEnvelopeJSON struct { - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RobotsTXTTopDirectiveGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r robotsTXTTopDirectiveGetResponseEnvelopeJSON) RawJSON() string { - return r.raw -} diff --git a/radar/robotstxttopdirective_test.go b/radar/robotstxttopdirective_test.go deleted file mode 100644 index 9ad4649ea2b..00000000000 --- a/radar/robotstxttopdirective_test.go +++ /dev/null @@ -1,48 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package radar_test - -import ( - "context" - "errors" - "os" - "testing" - - "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/testutil" - "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/cloudflare/cloudflare-go/v2/radar" -) - -func TestRobotsTXTTopDirectiveGetWithOptionalParams(t *testing.T) { - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.Radar.RobotsTXT.Top.Directive.Get( - context.TODO(), - radar.RobotsTXTTopDirectiveGetParamsDirectiveAllow, - radar.RobotsTXTTopDirectiveGetParams{ - AgentCategory: cloudflare.F(radar.RobotsTXTTopDirectiveGetParamsAgentCategoryAI), - Date: cloudflare.F("2024-09-19"), - Format: cloudflare.F(radar.RobotsTXTTopDirectiveGetParamsFormatJson), - Limit: cloudflare.F(int64(5)), - Name: cloudflare.F([]string{"string", "string", "string"}), - }, - ) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -}