Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3eef78c
codegen metadata
stainless-app[bot] Aug 14, 2025
8fbbc09
chore(api): upload stainless config from cloudflare-config
stainless-app[bot] Aug 14, 2025
7a87e8b
codegen metadata
stainless-app[bot] Aug 19, 2025
bc6d589
feat(api): api update
stainless-app[bot] Aug 20, 2025
751b34f
codegen metadata
stainless-app[bot] Aug 20, 2025
52ae5ee
codegen metadata
stainless-app[bot] Aug 20, 2025
4deaea0
codegen metadata
stainless-app[bot] Aug 20, 2025
878943e
feat(api): api update
stainless-app[bot] Aug 20, 2025
a34c220
chore(api): upload stainless config from cloudflare-config
stainless-app[bot] Aug 20, 2025
bde7ebc
feat(api): api update
stainless-app[bot] Aug 20, 2025
c8e584a
codegen metadata
stainless-app[bot] Aug 20, 2025
dfb9bc8
codegen metadata
stainless-app[bot] Aug 20, 2025
383a8a8
codegen metadata
stainless-app[bot] Aug 20, 2025
0f33a4a
codegen metadata
stainless-app[bot] Aug 20, 2025
9be9438
feat(api): api update
stainless-app[bot] Aug 20, 2025
91d55da
codegen metadata
stainless-app[bot] Aug 20, 2025
254759d
codegen metadata
stainless-app[bot] Aug 20, 2025
140264f
codegen metadata
stainless-app[bot] Aug 20, 2025
d9b0980
codegen metadata
stainless-app[bot] Aug 20, 2025
6f4d25f
codegen metadata
stainless-app[bot] Aug 20, 2025
6730034
codegen metadata
stainless-app[bot] Aug 20, 2025
1b242b2
codegen metadata
stainless-app[bot] Aug 20, 2025
479a6c9
chore(api): upload stainless config from cloudflare-config
stainless-app[bot] Aug 21, 2025
1cccd12
release: 5.2.0
stainless-app[bot] Aug 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "5.1.0"
".": "5.2.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 1793
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-bf6dcd562e592c1c6d992e04b39d5b372e2a7cb4d3fdcad23e483e21389bd3aa.yml
openapi_spec_hash: 8b8da2355d909906fe7af3bc6f507487
config_hash: 6a474fd6a3d6ab37e33c490fcce3f791
configured_endpoints: 1798
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-c972b67141d4322a331c3f8191fd859e88c23d0528b1e8daac86c49521cd3510.yml
openapi_spec_hash: 55643b37c147c204b6b0d70c3e99a6b6
config_hash: a1304617cd14c003fb430a6827269eba
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 5.2.0 (2025-08-21)

Full Changelog: [v5.1.0...v5.2.0](https://github.com/cloudflare/cloudflare-go/compare/v5.1.0...v5.2.0)

### Features

* **api:** api update ([9be9438](https://github.com/cloudflare/cloudflare-go/commit/9be94383bdac5126d2bd69c88b74dfedc36cf402))
* **api:** api update ([bde7ebc](https://github.com/cloudflare/cloudflare-go/commit/bde7ebcf88ef6df6fc323e4d800013ff20ed5a08))
* **api:** api update ([878943e](https://github.com/cloudflare/cloudflare-go/commit/878943eb0fe1be816d84e9873ce84a4a1857a7a5))
* **api:** api update ([bc6d589](https://github.com/cloudflare/cloudflare-go/commit/bc6d58960a0749a6c202f525880b54f376751ad4))


### Chores

* **api:** upload stainless config from cloudflare-config ([479a6c9](https://github.com/cloudflare/cloudflare-go/commit/479a6c9ec7156fb4e93763dc03929e38ccc38ab6))
* **api:** upload stainless config from cloudflare-config ([a34c220](https://github.com/cloudflare/cloudflare-go/commit/a34c220175671c4202d6847989f5e2c6337a1188))
* **api:** upload stainless config from cloudflare-config ([8fbbc09](https://github.com/cloudflare/cloudflare-go/commit/8fbbc0979f094be4077bf3a5f7298010130ccc4e))

## 5.1.0 (2025-08-14)

Full Changelog: [v5.0.0...v5.1.0](https://github.com/cloudflare/cloudflare-go/compare/v5.0.0...v5.1.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/cloudflare/cloudflare-go/v4@v5.1.0'
go get -u 'github.com/cloudflare/cloudflare-go/v4@v5.2.0'
```

<!-- x-release-please-end -->
Expand Down
62 changes: 38 additions & 24 deletions api.md

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions brand_protection/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ func (r *QueryService) Delete(ctx context.Context, params QueryDeleteParams, opt
return
}

// Return a success message after creating new saved string queries in bulk
func (r *QueryService) Bulk(ctx context.Context, params QueryBulkParams, opts ...option.RequestOption) (err error) {
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if params.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
}
path := fmt.Sprintf("accounts/%s/brand-protection/queries/bulk", params.AccountID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, nil, opts...)
return
}

type QueryNewParams struct {
AccountID param.Field[string] `path:"account_id,required"`
ID param.Field[string] `query:"id"`
Expand Down Expand Up @@ -100,3 +113,12 @@ func (r QueryDeleteParams) URLQuery() (v url.Values) {
NestedFormat: apiquery.NestedQueryFormatDots,
})
}

type QueryBulkParams struct {
AccountID param.Field[string] `path:"account_id,required"`
Queries param.Field[[]map[string]interface{}] `json:"queries"`
}

func (r QueryBulkParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
29 changes: 29 additions & 0 deletions brand_protection/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,32 @@ func TestQueryDeleteWithOptionalParams(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}

func TestQueryBulkWithOptionalParams(t *testing.T) {
t.Skip("TODO: investigate broken test, 401 Unauthorized")
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("[email protected]"),
)
err := client.BrandProtection.Queries.Bulk(context.TODO(), brand_protection.QueryBulkParams{
AccountID: cloudflare.F("x"),
Queries: cloudflare.F([]map[string]interface{}{{
"foo": "bar",
}}),
})
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())
}
}
51 changes: 0 additions & 51 deletions cloudforce_one/threatevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,16 @@ func (r *ThreatEventService) Get(ctx context.Context, eventID string, query Thre
}

type ThreatEventNewResponse struct {
ID float64 `json:"id,required"`
AccountID float64 `json:"accountId,required"`
Attacker string `json:"attacker,required"`
AttackerCountry string `json:"attackerCountry,required"`
Category string `json:"category,required"`
Date string `json:"date,required"`
Event string `json:"event,required"`
Indicator string `json:"indicator,required"`
IndicatorType string `json:"indicatorType,required"`
IndicatorTypeID float64 `json:"indicatorTypeId,required"`
KillChain float64 `json:"killChain,required"`
MitreAttack []string `json:"mitreAttack,required"`
NumReferenced float64 `json:"numReferenced,required"`
NumReferences float64 `json:"numReferences,required"`
RawID string `json:"rawId,required"`
Referenced []string `json:"referenced,required"`
ReferencedIDs []float64 `json:"referencedIds,required"`
References []string `json:"references,required"`
Expand All @@ -183,28 +178,22 @@ type ThreatEventNewResponse struct {
TLP string `json:"tlp,required"`
UUID string `json:"uuid,required"`
Insight string `json:"insight"`
ReleasabilityID string `json:"releasabilityId"`
JSON threatEventNewResponseJSON `json:"-"`
}

// threatEventNewResponseJSON contains the JSON metadata for the struct
// [ThreatEventNewResponse]
type threatEventNewResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
Attacker apijson.Field
AttackerCountry apijson.Field
Category apijson.Field
Date apijson.Field
Event apijson.Field
Indicator apijson.Field
IndicatorType apijson.Field
IndicatorTypeID apijson.Field
KillChain apijson.Field
MitreAttack apijson.Field
NumReferenced apijson.Field
NumReferences apijson.Field
RawID apijson.Field
Referenced apijson.Field
ReferencedIDs apijson.Field
References apijson.Field
Expand All @@ -215,7 +204,6 @@ type threatEventNewResponseJSON struct {
TLP apijson.Field
UUID apijson.Field
Insight apijson.Field
ReleasabilityID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand All @@ -229,21 +217,16 @@ func (r threatEventNewResponseJSON) RawJSON() string {
}

type ThreatEventListResponse struct {
ID float64 `json:"id,required"`
AccountID float64 `json:"accountId,required"`
Attacker string `json:"attacker,required"`
AttackerCountry string `json:"attackerCountry,required"`
Category string `json:"category,required"`
Date string `json:"date,required"`
Event string `json:"event,required"`
Indicator string `json:"indicator,required"`
IndicatorType string `json:"indicatorType,required"`
IndicatorTypeID float64 `json:"indicatorTypeId,required"`
KillChain float64 `json:"killChain,required"`
MitreAttack []string `json:"mitreAttack,required"`
NumReferenced float64 `json:"numReferenced,required"`
NumReferences float64 `json:"numReferences,required"`
RawID string `json:"rawId,required"`
Referenced []string `json:"referenced,required"`
ReferencedIDs []float64 `json:"referencedIds,required"`
References []string `json:"references,required"`
Expand All @@ -254,28 +237,22 @@ type ThreatEventListResponse struct {
TLP string `json:"tlp,required"`
UUID string `json:"uuid,required"`
Insight string `json:"insight"`
ReleasabilityID string `json:"releasabilityId"`
JSON threatEventListResponseJSON `json:"-"`
}

// threatEventListResponseJSON contains the JSON metadata for the struct
// [ThreatEventListResponse]
type threatEventListResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
Attacker apijson.Field
AttackerCountry apijson.Field
Category apijson.Field
Date apijson.Field
Event apijson.Field
Indicator apijson.Field
IndicatorType apijson.Field
IndicatorTypeID apijson.Field
KillChain apijson.Field
MitreAttack apijson.Field
NumReferenced apijson.Field
NumReferences apijson.Field
RawID apijson.Field
Referenced apijson.Field
ReferencedIDs apijson.Field
References apijson.Field
Expand All @@ -286,7 +263,6 @@ type threatEventListResponseJSON struct {
TLP apijson.Field
UUID apijson.Field
Insight apijson.Field
ReleasabilityID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand Down Expand Up @@ -321,21 +297,16 @@ func (r threatEventDeleteResponseJSON) RawJSON() string {
}

type ThreatEventEditResponse struct {
ID float64 `json:"id,required"`
AccountID float64 `json:"accountId,required"`
Attacker string `json:"attacker,required"`
AttackerCountry string `json:"attackerCountry,required"`
Category string `json:"category,required"`
Date string `json:"date,required"`
Event string `json:"event,required"`
Indicator string `json:"indicator,required"`
IndicatorType string `json:"indicatorType,required"`
IndicatorTypeID float64 `json:"indicatorTypeId,required"`
KillChain float64 `json:"killChain,required"`
MitreAttack []string `json:"mitreAttack,required"`
NumReferenced float64 `json:"numReferenced,required"`
NumReferences float64 `json:"numReferences,required"`
RawID string `json:"rawId,required"`
Referenced []string `json:"referenced,required"`
ReferencedIDs []float64 `json:"referencedIds,required"`
References []string `json:"references,required"`
Expand All @@ -346,28 +317,22 @@ type ThreatEventEditResponse struct {
TLP string `json:"tlp,required"`
UUID string `json:"uuid,required"`
Insight string `json:"insight"`
ReleasabilityID string `json:"releasabilityId"`
JSON threatEventEditResponseJSON `json:"-"`
}

// threatEventEditResponseJSON contains the JSON metadata for the struct
// [ThreatEventEditResponse]
type threatEventEditResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
Attacker apijson.Field
AttackerCountry apijson.Field
Category apijson.Field
Date apijson.Field
Event apijson.Field
Indicator apijson.Field
IndicatorType apijson.Field
IndicatorTypeID apijson.Field
KillChain apijson.Field
MitreAttack apijson.Field
NumReferenced apijson.Field
NumReferences apijson.Field
RawID apijson.Field
Referenced apijson.Field
ReferencedIDs apijson.Field
References apijson.Field
Expand All @@ -378,7 +343,6 @@ type threatEventEditResponseJSON struct {
TLP apijson.Field
UUID apijson.Field
Insight apijson.Field
ReleasabilityID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand All @@ -392,21 +356,16 @@ func (r threatEventEditResponseJSON) RawJSON() string {
}

type ThreatEventGetResponse struct {
ID float64 `json:"id,required"`
AccountID float64 `json:"accountId,required"`
Attacker string `json:"attacker,required"`
AttackerCountry string `json:"attackerCountry,required"`
Category string `json:"category,required"`
Date string `json:"date,required"`
Event string `json:"event,required"`
Indicator string `json:"indicator,required"`
IndicatorType string `json:"indicatorType,required"`
IndicatorTypeID float64 `json:"indicatorTypeId,required"`
KillChain float64 `json:"killChain,required"`
MitreAttack []string `json:"mitreAttack,required"`
NumReferenced float64 `json:"numReferenced,required"`
NumReferences float64 `json:"numReferences,required"`
RawID string `json:"rawId,required"`
Referenced []string `json:"referenced,required"`
ReferencedIDs []float64 `json:"referencedIds,required"`
References []string `json:"references,required"`
Expand All @@ -417,28 +376,22 @@ type ThreatEventGetResponse struct {
TLP string `json:"tlp,required"`
UUID string `json:"uuid,required"`
Insight string `json:"insight"`
ReleasabilityID string `json:"releasabilityId"`
JSON threatEventGetResponseJSON `json:"-"`
}

// threatEventGetResponseJSON contains the JSON metadata for the struct
// [ThreatEventGetResponse]
type threatEventGetResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
Attacker apijson.Field
AttackerCountry apijson.Field
Category apijson.Field
Date apijson.Field
Event apijson.Field
Indicator apijson.Field
IndicatorType apijson.Field
IndicatorTypeID apijson.Field
KillChain apijson.Field
MitreAttack apijson.Field
NumReferenced apijson.Field
NumReferences apijson.Field
RawID apijson.Field
Referenced apijson.Field
ReferencedIDs apijson.Field
References apijson.Field
Expand All @@ -449,7 +402,6 @@ type threatEventGetResponseJSON struct {
TLP apijson.Field
UUID apijson.Field
Insight apijson.Field
ReleasabilityID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand All @@ -468,7 +420,6 @@ type ThreatEventNewParams struct {
Category param.Field[string] `json:"category,required"`
Date param.Field[time.Time] `json:"date,required" format:"date-time"`
Event param.Field[string] `json:"event,required"`
IndicatorType param.Field[string] `json:"indicatorType,required"`
Raw param.Field[ThreatEventNewParamsRaw] `json:"raw,required"`
TLP param.Field[string] `json:"tlp,required"`
BodyAccountID param.Field[float64] `json:"accountId"`
Expand Down Expand Up @@ -605,7 +556,6 @@ type ThreatEventBulkNewParamsData struct {
Category param.Field[string] `json:"category,required"`
Date param.Field[time.Time] `json:"date,required" format:"date-time"`
Event param.Field[string] `json:"event,required"`
IndicatorType param.Field[string] `json:"indicatorType,required"`
Raw param.Field[ThreatEventBulkNewParamsDataRaw] `json:"raw,required"`
TLP param.Field[string] `json:"tlp,required"`
AccountID param.Field[float64] `json:"accountId"`
Expand Down Expand Up @@ -641,7 +591,6 @@ type ThreatEventEditParams struct {
Date param.Field[time.Time] `json:"date" format:"date-time"`
Event param.Field[string] `json:"event"`
Indicator param.Field[string] `json:"indicator"`
IndicatorType param.Field[string] `json:"indicatorType"`
Insight param.Field[string] `json:"insight"`
Raw param.Field[ThreatEventEditParamsRaw] `json:"raw"`
TargetCountry param.Field[string] `json:"targetCountry"`
Expand Down
Loading