@@ -7,9 +7,11 @@ import (
77 "errors"
88 "fmt"
99 "net/http"
10+ "net/url"
1011 "slices"
1112
1213 "github.com/cloudflare/cloudflare-go/v6/internal/apijson"
14+ "github.com/cloudflare/cloudflare-go/v6/internal/apiquery"
1315 "github.com/cloudflare/cloudflare-go/v6/internal/param"
1416 "github.com/cloudflare/cloudflare-go/v6/internal/requestconfig"
1517 "github.com/cloudflare/cloudflare-go/v6/option"
@@ -46,15 +48,15 @@ func (r *ThreatEventCategoryService) New(ctx context.Context, params ThreatEvent
4648 return
4749}
4850
49- // Lists categories
50- func (r * ThreatEventCategoryService ) List (ctx context.Context , query ThreatEventCategoryListParams , opts ... option.RequestOption ) (res * []ThreatEventCategoryListResponse , err error ) {
51+ // Lists categories across multiple datasets
52+ func (r * ThreatEventCategoryService ) List (ctx context.Context , params ThreatEventCategoryListParams , opts ... option.RequestOption ) (res * []ThreatEventCategoryListResponse , err error ) {
5153 opts = slices .Concat (r .Options , opts )
52- if query .AccountID .Value == "" {
54+ if params .AccountID .Value == "" {
5355 err = errors .New ("missing required account_id parameter" )
5456 return
5557 }
56- path := fmt .Sprintf ("accounts/%s/cloudforce-one/events/categories" , query .AccountID )
57- err = requestconfig .ExecuteNewRequest (ctx , http .MethodGet , path , nil , & res , opts ... )
58+ path := fmt .Sprintf ("accounts/%s/cloudforce-one/events/categories" , params .AccountID )
59+ err = requestconfig .ExecuteNewRequest (ctx , http .MethodGet , path , params , & res , opts ... )
5860 return
5961}
6062
@@ -259,6 +261,18 @@ func (r ThreatEventCategoryNewParams) MarshalJSON() (data []byte, err error) {
259261type ThreatEventCategoryListParams struct {
260262 // Account ID.
261263 AccountID param.Field [string ] `path:"account_id,required"`
264+ // Array of dataset IDs to query categories from. If not provided, returns all
265+ // categories from D1 database.
266+ DatasetIDs param.Field [[]string ] `query:"datasetIds"`
267+ }
268+
269+ // URLQuery serializes [ThreatEventCategoryListParams]'s query parameters as
270+ // `url.Values`.
271+ func (r ThreatEventCategoryListParams ) URLQuery () (v url.Values ) {
272+ return apiquery .MarshalWithSettings (r , apiquery.QuerySettings {
273+ ArrayFormat : apiquery .ArrayQueryFormatRepeat ,
274+ NestedFormat : apiquery .NestedQueryFormatDots ,
275+ })
262276}
263277
264278type ThreatEventCategoryDeleteParams struct {
0 commit comments