Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed May 13, 2024
1 parent 05539a9 commit cfa92e7
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 291 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: 1281
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-09cd12c71c1bf4d47a96a1b013ea92dfdfbac4647336dd53fdda685632b3c43a.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e9768930aab7041f58b5f317137699bbd040d5be0864adcee08df4a026b99300.yml
46 changes: 15 additions & 31 deletions ai_gateway/aigateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,13 @@ func (r aiGatewayNewResponseJSON) RawJSON() string {
}

type AIGatewayNewResponseTask struct {
ID string `json:"id,required" format:"uuid"`
// gateway slug
ID string `json:"id,required"`
CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"`
CacheTTL int64 `json:"cache_ttl,required"`
CollectLogs bool `json:"collect_logs,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
Name string `json:"name,required"`
Slug string `json:"slug,required"`
RateLimitingInterval int64 `json:"rate_limiting_interval"`
RateLimitingLimit int64 `json:"rate_limiting_limit"`
RateLimitingTechnique string `json:"rate_limiting_technique"`
Expand All @@ -158,8 +157,6 @@ type aiGatewayNewResponseTaskJSON struct {
CollectLogs apijson.Field
CreatedAt apijson.Field
ModifiedAt apijson.Field
Name apijson.Field
Slug apijson.Field
RateLimitingInterval apijson.Field
RateLimitingLimit apijson.Field
RateLimitingTechnique apijson.Field
Expand All @@ -176,14 +173,13 @@ func (r aiGatewayNewResponseTaskJSON) RawJSON() string {
}

type AIGatewayUpdateResponse struct {
ID string `json:"id,required" format:"uuid"`
// gateway slug
ID string `json:"id,required"`
CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"`
CacheTTL int64 `json:"cache_ttl,required"`
CollectLogs bool `json:"collect_logs,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
Name string `json:"name,required"`
Slug string `json:"slug,required"`
RateLimitingInterval int64 `json:"rate_limiting_interval"`
RateLimitingLimit int64 `json:"rate_limiting_limit"`
RateLimitingTechnique string `json:"rate_limiting_technique"`
Expand All @@ -199,8 +195,6 @@ type aiGatewayUpdateResponseJSON struct {
CollectLogs apijson.Field
CreatedAt apijson.Field
ModifiedAt apijson.Field
Name apijson.Field
Slug apijson.Field
RateLimitingInterval apijson.Field
RateLimitingLimit apijson.Field
RateLimitingTechnique apijson.Field
Expand All @@ -217,14 +211,13 @@ func (r aiGatewayUpdateResponseJSON) RawJSON() string {
}

type AIGatewayListResponse struct {
ID string `json:"id,required" format:"uuid"`
// gateway slug
ID string `json:"id,required"`
CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"`
CacheTTL int64 `json:"cache_ttl,required"`
CollectLogs bool `json:"collect_logs,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
Name string `json:"name,required"`
Slug string `json:"slug,required"`
RateLimitingInterval int64 `json:"rate_limiting_interval"`
RateLimitingLimit int64 `json:"rate_limiting_limit"`
RateLimitingTechnique string `json:"rate_limiting_technique"`
Expand All @@ -240,8 +233,6 @@ type aiGatewayListResponseJSON struct {
CollectLogs apijson.Field
CreatedAt apijson.Field
ModifiedAt apijson.Field
Name apijson.Field
Slug apijson.Field
RateLimitingInterval apijson.Field
RateLimitingLimit apijson.Field
RateLimitingTechnique apijson.Field
Expand All @@ -258,14 +249,13 @@ func (r aiGatewayListResponseJSON) RawJSON() string {
}

type AIGatewayDeleteResponse struct {
ID string `json:"id,required" format:"uuid"`
// gateway slug
ID string `json:"id,required"`
CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"`
CacheTTL int64 `json:"cache_ttl,required"`
CollectLogs bool `json:"collect_logs,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
Name string `json:"name,required"`
Slug string `json:"slug,required"`
RateLimitingInterval int64 `json:"rate_limiting_interval"`
RateLimitingLimit int64 `json:"rate_limiting_limit"`
RateLimitingTechnique string `json:"rate_limiting_technique"`
Expand All @@ -281,8 +271,6 @@ type aiGatewayDeleteResponseJSON struct {
CollectLogs apijson.Field
CreatedAt apijson.Field
ModifiedAt apijson.Field
Name apijson.Field
Slug apijson.Field
RateLimitingInterval apijson.Field
RateLimitingLimit apijson.Field
RateLimitingTechnique apijson.Field
Expand All @@ -299,14 +287,13 @@ func (r aiGatewayDeleteResponseJSON) RawJSON() string {
}

type AIGatewayGetResponse struct {
ID string `json:"id,required" format:"uuid"`
// gateway slug
ID string `json:"id,required"`
CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"`
CacheTTL int64 `json:"cache_ttl,required"`
CollectLogs bool `json:"collect_logs,required"`
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
Name string `json:"name,required"`
Slug string `json:"slug,required"`
RateLimitingInterval int64 `json:"rate_limiting_interval"`
RateLimitingLimit int64 `json:"rate_limiting_limit"`
RateLimitingTechnique string `json:"rate_limiting_technique"`
Expand All @@ -322,8 +309,6 @@ type aiGatewayGetResponseJSON struct {
CollectLogs apijson.Field
CreatedAt apijson.Field
ModifiedAt apijson.Field
Name apijson.Field
Slug apijson.Field
RateLimitingInterval apijson.Field
RateLimitingLimit apijson.Field
RateLimitingTechnique apijson.Field
Expand All @@ -340,12 +325,12 @@ func (r aiGatewayGetResponseJSON) RawJSON() string {
}

type AIGatewayNewParams struct {
AccountID param.Field[string] `path:"account_id,required"`
AccountID param.Field[string] `path:"account_id,required"`
// gateway slug
ID param.Field[string] `json:"id,required"`
CacheInvalidateOnUpdate param.Field[bool] `json:"cache_invalidate_on_update,required"`
CacheTTL param.Field[int64] `json:"cache_ttl,required"`
CollectLogs param.Field[bool] `json:"collect_logs,required"`
Name param.Field[string] `json:"name,required"`
Slug param.Field[string] `json:"slug,required"`
RateLimitingInterval param.Field[int64] `json:"rate_limiting_interval"`
RateLimitingLimit param.Field[int64] `json:"rate_limiting_limit"`
RateLimitingTechnique param.Field[string] `json:"rate_limiting_technique"`
Expand Down Expand Up @@ -383,8 +368,6 @@ type AIGatewayUpdateParams struct {
CacheInvalidateOnUpdate param.Field[bool] `json:"cache_invalidate_on_update,required"`
CacheTTL param.Field[int64] `json:"cache_ttl,required"`
CollectLogs param.Field[bool] `json:"collect_logs,required"`
Name param.Field[string] `json:"name,required"`
Slug param.Field[string] `json:"slug,required"`
RateLimitingInterval param.Field[int64] `json:"rate_limiting_interval"`
RateLimitingLimit param.Field[int64] `json:"rate_limiting_limit"`
RateLimitingTechnique param.Field[string] `json:"rate_limiting_technique"`
Expand Down Expand Up @@ -419,7 +402,8 @@ func (r aiGatewayUpdateResponseEnvelopeJSON) RawJSON() string {

type AIGatewayListParams struct {
AccountID param.Field[string] `path:"account_id,required"`
ID param.Field[string] `query:"id" format:"uuid"`
// gateway slug
ID param.Field[string] `query:"id"`
// Order By Column Name
OrderBy param.Field[string] `query:"order_by"`
Page param.Field[int64] `query:"page"`
Expand Down
13 changes: 5 additions & 8 deletions ai_gateway/aigateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ func TestAIGatewayNewWithOptionalParams(t *testing.T) {
)
_, err := client.AIGateway.New(context.TODO(), ai_gateway.AIGatewayNewParams{
AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"),
ID: cloudflare.F("my-gateway"),
CacheInvalidateOnUpdate: cloudflare.F(true),
CacheTTL: cloudflare.F(int64(0)),
CollectLogs: cloudflare.F(true),
Name: cloudflare.F("string"),
Slug: cloudflare.F("string"),
RateLimitingInterval: cloudflare.F(int64(0)),
RateLimitingLimit: cloudflare.F(int64(0)),
RateLimitingTechnique: cloudflare.F("string"),
Expand Down Expand Up @@ -62,14 +61,12 @@ func TestAIGatewayUpdateWithOptionalParams(t *testing.T) {
)
_, err := client.AIGateway.Update(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"my-gateway",
ai_gateway.AIGatewayUpdateParams{
AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"),
CacheInvalidateOnUpdate: cloudflare.F(true),
CacheTTL: cloudflare.F(int64(0)),
CollectLogs: cloudflare.F(true),
Name: cloudflare.F("string"),
Slug: cloudflare.F("string"),
RateLimitingInterval: cloudflare.F(int64(0)),
RateLimitingLimit: cloudflare.F(int64(0)),
RateLimitingTechnique: cloudflare.F("string"),
Expand Down Expand Up @@ -99,7 +96,7 @@ func TestAIGatewayListWithOptionalParams(t *testing.T) {
)
_, err := client.AIGateway.List(context.TODO(), ai_gateway.AIGatewayListParams{
AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"),
ID: cloudflare.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
ID: cloudflare.F("my-gateway"),
OrderBy: cloudflare.F("string"),
Page: cloudflare.F(int64(1)),
PerPage: cloudflare.F(int64(5)),
Expand Down Expand Up @@ -128,7 +125,7 @@ func TestAIGatewayDelete(t *testing.T) {
)
_, err := client.AIGateway.Delete(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"my-gateway",
ai_gateway.AIGatewayDeleteParams{
AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"),
},
Expand Down Expand Up @@ -157,7 +154,7 @@ func TestAIGatewayGet(t *testing.T) {
)
_, err := client.AIGateway.Get(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"my-gateway",
ai_gateway.AIGatewayGetParams{
AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"),
},
Expand Down
2 changes: 1 addition & 1 deletion ai_gateway/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestLogGetWithOptionalParams(t *testing.T) {
)
_, err := client.AIGateway.Logs.Get(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"my-gateway",
ai_gateway.LogGetParams{
AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"),
Cached: cloudflare.F(true),
Expand Down

0 comments on commit cfa92e7

Please sign in to comment.