Skip to content

Commit

Permalink
feat(api): api update (#3812)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Jan 9, 2025
1 parent 3fb83df commit 191f5e2
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 138 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1488
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-fee9d85436424e5c77534fd3dcd19c5ea9719f4a4ad5bad168489377c7c4c09d.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-ec93436d15bbd89482ee65b633607110b8dda7c4955138041022dbf71a0c0cfb.yml
54 changes: 32 additions & 22 deletions ai_gateway/aigateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,13 @@ func (r *AIGatewayService) Get(ctx context.Context, id string, query AIGatewayGe
type AIGatewayNewResponse struct {
// gateway id
ID string `json:"id,required"`
AccountID string `json:"account_id,required"`
AccountTag string `json:"account_tag,required"`
CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"`
CacheTTL int64 `json:"cache_ttl,required,nullable"`
CollectLogs bool `json:"collect_logs,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
InternalID string `json:"internal_id,required" format:"uuid"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
RateLimitingInterval int64 `json:"rate_limiting_interval,required,nullable"`
RateLimitingLimit int64 `json:"rate_limiting_limit,required,nullable"`
Expand All @@ -172,10 +175,13 @@ type AIGatewayNewResponse struct {
// [AIGatewayNewResponse]
type aiGatewayNewResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
AccountTag apijson.Field
CacheInvalidateOnUpdate apijson.Field
CacheTTL apijson.Field
CollectLogs apijson.Field
CreatedAt apijson.Field
InternalID apijson.Field
ModifiedAt apijson.Field
RateLimitingInterval apijson.Field
RateLimitingLimit apijson.Field
Expand Down Expand Up @@ -212,10 +218,13 @@ func (r AIGatewayNewResponseRateLimitingTechnique) IsKnown() bool {
type AIGatewayUpdateResponse struct {
// gateway id
ID string `json:"id,required"`
AccountID string `json:"account_id,required"`
AccountTag string `json:"account_tag,required"`
CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"`
CacheTTL int64 `json:"cache_ttl,required,nullable"`
CollectLogs bool `json:"collect_logs,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
InternalID string `json:"internal_id,required" format:"uuid"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
RateLimitingInterval int64 `json:"rate_limiting_interval,required,nullable"`
RateLimitingLimit int64 `json:"rate_limiting_limit,required,nullable"`
Expand All @@ -229,10 +238,13 @@ type AIGatewayUpdateResponse struct {
// [AIGatewayUpdateResponse]
type aiGatewayUpdateResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
AccountTag apijson.Field
CacheInvalidateOnUpdate apijson.Field
CacheTTL apijson.Field
CollectLogs apijson.Field
CreatedAt apijson.Field
InternalID apijson.Field
ModifiedAt apijson.Field
RateLimitingInterval apijson.Field
RateLimitingLimit apijson.Field
Expand Down Expand Up @@ -269,10 +281,13 @@ func (r AIGatewayUpdateResponseRateLimitingTechnique) IsKnown() bool {
type AIGatewayListResponse struct {
// gateway id
ID string `json:"id,required"`
AccountID string `json:"account_id,required"`
AccountTag string `json:"account_tag,required"`
CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"`
CacheTTL int64 `json:"cache_ttl,required,nullable"`
CollectLogs bool `json:"collect_logs,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
InternalID string `json:"internal_id,required" format:"uuid"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
RateLimitingInterval int64 `json:"rate_limiting_interval,required,nullable"`
RateLimitingLimit int64 `json:"rate_limiting_limit,required,nullable"`
Expand All @@ -286,10 +301,13 @@ type AIGatewayListResponse struct {
// [AIGatewayListResponse]
type aiGatewayListResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
AccountTag apijson.Field
CacheInvalidateOnUpdate apijson.Field
CacheTTL apijson.Field
CollectLogs apijson.Field
CreatedAt apijson.Field
InternalID apijson.Field
ModifiedAt apijson.Field
RateLimitingInterval apijson.Field
RateLimitingLimit apijson.Field
Expand Down Expand Up @@ -326,10 +344,13 @@ func (r AIGatewayListResponseRateLimitingTechnique) IsKnown() bool {
type AIGatewayDeleteResponse struct {
// gateway id
ID string `json:"id,required"`
AccountID string `json:"account_id,required"`
AccountTag string `json:"account_tag,required"`
CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"`
CacheTTL int64 `json:"cache_ttl,required,nullable"`
CollectLogs bool `json:"collect_logs,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
InternalID string `json:"internal_id,required" format:"uuid"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
RateLimitingInterval int64 `json:"rate_limiting_interval,required,nullable"`
RateLimitingLimit int64 `json:"rate_limiting_limit,required,nullable"`
Expand All @@ -343,10 +364,13 @@ type AIGatewayDeleteResponse struct {
// [AIGatewayDeleteResponse]
type aiGatewayDeleteResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
AccountTag apijson.Field
CacheInvalidateOnUpdate apijson.Field
CacheTTL apijson.Field
CollectLogs apijson.Field
CreatedAt apijson.Field
InternalID apijson.Field
ModifiedAt apijson.Field
RateLimitingInterval apijson.Field
RateLimitingLimit apijson.Field
Expand Down Expand Up @@ -383,10 +407,13 @@ func (r AIGatewayDeleteResponseRateLimitingTechnique) IsKnown() bool {
type AIGatewayGetResponse struct {
// gateway id
ID string `json:"id,required"`
AccountID string `json:"account_id,required"`
AccountTag string `json:"account_tag,required"`
CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"`
CacheTTL int64 `json:"cache_ttl,required,nullable"`
CollectLogs bool `json:"collect_logs,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
InternalID string `json:"internal_id,required" format:"uuid"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
RateLimitingInterval int64 `json:"rate_limiting_interval,required,nullable"`
RateLimitingLimit int64 `json:"rate_limiting_limit,required,nullable"`
Expand All @@ -400,10 +427,13 @@ type AIGatewayGetResponse struct {
// [AIGatewayGetResponse]
type aiGatewayGetResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
AccountTag apijson.Field
CacheInvalidateOnUpdate apijson.Field
CacheTTL apijson.Field
CollectLogs apijson.Field
CreatedAt apijson.Field
InternalID apijson.Field
ModifiedAt apijson.Field
RateLimitingInterval apijson.Field
RateLimitingLimit apijson.Field
Expand Down Expand Up @@ -549,12 +579,8 @@ func (r aiGatewayUpdateResponseEnvelopeJSON) RawJSON() string {

type AIGatewayListParams struct {
AccountID param.Field[string] `path:"account_id,required"`
// Order By Column Name
OrderBy param.Field[string] `query:"order_by"`
// Order By Direction
OrderByDirection param.Field[AIGatewayListParamsOrderByDirection] `query:"order_by_direction"`
Page param.Field[int64] `query:"page"`
PerPage param.Field[int64] `query:"per_page"`
Page param.Field[int64] `query:"page"`
PerPage param.Field[int64] `query:"per_page"`
// Search by id
Search param.Field[string] `query:"search"`
}
Expand All @@ -567,22 +593,6 @@ func (r AIGatewayListParams) URLQuery() (v url.Values) {
})
}

// Order By Direction
type AIGatewayListParamsOrderByDirection string

const (
AIGatewayListParamsOrderByDirectionAsc AIGatewayListParamsOrderByDirection = "asc"
AIGatewayListParamsOrderByDirectionDesc AIGatewayListParamsOrderByDirection = "desc"
)

func (r AIGatewayListParamsOrderByDirection) IsKnown() bool {
switch r {
case AIGatewayListParamsOrderByDirectionAsc, AIGatewayListParamsOrderByDirectionDesc:
return true
}
return false
}

type AIGatewayDeleteParams struct {
AccountID param.Field[string] `path:"account_id,required"`
}
Expand Down
10 changes: 4 additions & 6 deletions ai_gateway/aigateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,10 @@ func TestAIGatewayListWithOptionalParams(t *testing.T) {
option.WithAPIEmail("user@example.com"),
)
_, err := client.AIGateway.List(context.TODO(), ai_gateway.AIGatewayListParams{
AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"),
OrderBy: cloudflare.F("order_by"),
OrderByDirection: cloudflare.F(ai_gateway.AIGatewayListParamsOrderByDirectionAsc),
Page: cloudflare.F(int64(1)),
PerPage: cloudflare.F(int64(1)),
Search: cloudflare.F("search"),
AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"),
Page: cloudflare.F(int64(1)),
PerPage: cloudflare.F(int64(1)),
Search: cloudflare.F("search"),
})
if err != nil {
var apierr *cloudflare.Error
Expand Down
84 changes: 42 additions & 42 deletions ai_gateway/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,12 @@ func (r *DatasetService) Get(ctx context.Context, gatewayID string, id string, q
}

type DatasetNewResponse struct {
ID string `json:"id,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Enable bool `json:"enable,required"`
Filters []DatasetNewResponseFilter `json:"filters,required"`
ID string `json:"id,required"`
AccountID string `json:"account_id,required"`
AccountTag string `json:"account_tag,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Enable bool `json:"enable,required"`
Filters []DatasetNewResponseFilter `json:"filters,required"`
// gateway id
GatewayID string `json:"gateway_id,required"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
Expand All @@ -183,6 +185,8 @@ type DatasetNewResponse struct {
// [DatasetNewResponse]
type datasetNewResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
AccountTag apijson.Field
CreatedAt apijson.Field
Enable apijson.Field
Filters apijson.Field
Expand Down Expand Up @@ -299,10 +303,12 @@ func init() {
}

type DatasetUpdateResponse struct {
ID string `json:"id,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Enable bool `json:"enable,required"`
Filters []DatasetUpdateResponseFilter `json:"filters,required"`
ID string `json:"id,required"`
AccountID string `json:"account_id,required"`
AccountTag string `json:"account_tag,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Enable bool `json:"enable,required"`
Filters []DatasetUpdateResponseFilter `json:"filters,required"`
// gateway id
GatewayID string `json:"gateway_id,required"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
Expand All @@ -314,6 +320,8 @@ type DatasetUpdateResponse struct {
// [DatasetUpdateResponse]
type datasetUpdateResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
AccountTag apijson.Field
CreatedAt apijson.Field
Enable apijson.Field
Filters apijson.Field
Expand Down Expand Up @@ -430,10 +438,12 @@ func init() {
}

type DatasetListResponse struct {
ID string `json:"id,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Enable bool `json:"enable,required"`
Filters []DatasetListResponseFilter `json:"filters,required"`
ID string `json:"id,required"`
AccountID string `json:"account_id,required"`
AccountTag string `json:"account_tag,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Enable bool `json:"enable,required"`
Filters []DatasetListResponseFilter `json:"filters,required"`
// gateway id
GatewayID string `json:"gateway_id,required"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
Expand All @@ -445,6 +455,8 @@ type DatasetListResponse struct {
// [DatasetListResponse]
type datasetListResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
AccountTag apijson.Field
CreatedAt apijson.Field
Enable apijson.Field
Filters apijson.Field
Expand Down Expand Up @@ -561,10 +573,12 @@ func init() {
}

type DatasetDeleteResponse struct {
ID string `json:"id,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Enable bool `json:"enable,required"`
Filters []DatasetDeleteResponseFilter `json:"filters,required"`
ID string `json:"id,required"`
AccountID string `json:"account_id,required"`
AccountTag string `json:"account_tag,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Enable bool `json:"enable,required"`
Filters []DatasetDeleteResponseFilter `json:"filters,required"`
// gateway id
GatewayID string `json:"gateway_id,required"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
Expand All @@ -576,6 +590,8 @@ type DatasetDeleteResponse struct {
// [DatasetDeleteResponse]
type datasetDeleteResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
AccountTag apijson.Field
CreatedAt apijson.Field
Enable apijson.Field
Filters apijson.Field
Expand Down Expand Up @@ -692,10 +708,12 @@ func init() {
}

type DatasetGetResponse struct {
ID string `json:"id,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Enable bool `json:"enable,required"`
Filters []DatasetGetResponseFilter `json:"filters,required"`
ID string `json:"id,required"`
AccountID string `json:"account_id,required"`
AccountTag string `json:"account_tag,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
Enable bool `json:"enable,required"`
Filters []DatasetGetResponseFilter `json:"filters,required"`
// gateway id
GatewayID string `json:"gateway_id,required"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
Expand All @@ -707,6 +725,8 @@ type DatasetGetResponse struct {
// [DatasetGetResponse]
type datasetGetResponseJSON struct {
ID apijson.Field
AccountID apijson.Field
AccountTag apijson.Field
CreatedAt apijson.Field
Enable apijson.Field
Filters apijson.Field
Expand Down Expand Up @@ -1010,12 +1030,8 @@ type DatasetListParams struct {
AccountID param.Field[string] `path:"account_id,required"`
Enable param.Field[bool] `query:"enable"`
Name param.Field[string] `query:"name"`
// Order By Column Name
OrderBy param.Field[string] `query:"order_by"`
// Order By Direction
OrderByDirection param.Field[DatasetListParamsOrderByDirection] `query:"order_by_direction"`
Page param.Field[int64] `query:"page"`
PerPage param.Field[int64] `query:"per_page"`
Page param.Field[int64] `query:"page"`
PerPage param.Field[int64] `query:"per_page"`
// Search by id, name, filters
Search param.Field[string] `query:"search"`
}
Expand All @@ -1028,22 +1044,6 @@ func (r DatasetListParams) URLQuery() (v url.Values) {
})
}

// Order By Direction
type DatasetListParamsOrderByDirection string

const (
DatasetListParamsOrderByDirectionAsc DatasetListParamsOrderByDirection = "asc"
DatasetListParamsOrderByDirectionDesc DatasetListParamsOrderByDirection = "desc"
)

func (r DatasetListParamsOrderByDirection) IsKnown() bool {
switch r {
case DatasetListParamsOrderByDirectionAsc, DatasetListParamsOrderByDirectionDesc:
return true
}
return false
}

type DatasetDeleteParams struct {
AccountID param.Field[string] `path:"account_id,required"`
}
Expand Down
Loading

0 comments on commit 191f5e2

Please sign in to comment.