Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): OpenAPI spec update via Stainless API #2278

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1321
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-15ceeb11cd4134501a557652ceaeacda4b60ea635ea5ac2e0d06974b130cc60a.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-1f68e176f43592631364d94df7670824a599296f6734ca70ffa94454c58da466.yml
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5612,10 +5612,10 @@ Response Types:
Methods:

- <code title="post /accounts/{account_id}/gateway/proxy_endpoints">client.ZeroTrust.Gateway.ProxyEndpoints.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointNewParams">GatewayProxyEndpointNewParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#ProxyEndpoint">ProxyEndpoint</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_id}/gateway/proxy_endpoints">client.ZeroTrust.Gateway.ProxyEndpoints.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointListParams">GatewayProxyEndpointListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/internal/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/internal/pagination#SinglePage">SinglePage</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#ProxyEndpoint">ProxyEndpoint</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_id}/gateway/proxy_endpoints">client.ZeroTrust.Gateway.ProxyEndpoints.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointListParams">GatewayProxyEndpointListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#ProxyEndpoint">ProxyEndpoint</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="delete /accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}">client.ZeroTrust.Gateway.ProxyEndpoints.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, proxyEndpointID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointDeleteParams">GatewayProxyEndpointDeleteParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointDeleteResponseUnion">GatewayProxyEndpointDeleteResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="patch /accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}">client.ZeroTrust.Gateway.ProxyEndpoints.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointService.Edit">Edit</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, proxyEndpointID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointEditParams">GatewayProxyEndpointEditParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#ProxyEndpoint">ProxyEndpoint</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}">client.ZeroTrust.Gateway.ProxyEndpoints.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, proxyEndpointID <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointGetParams">GatewayProxyEndpointGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#ProxyEndpoint">ProxyEndpoint</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_id}/gateway/proxy_endpoints/{proxy_endpoint_id}">client.ZeroTrust.Gateway.ProxyEndpoints.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, proxyEndpointID <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#GatewayProxyEndpointGetParams">GatewayProxyEndpointGetParams</a>) ([]<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#ProxyEndpoint">ProxyEndpoint</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

### Rules

Expand Down
117 changes: 93 additions & 24 deletions zero_trust/gatewayproxyendpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"time"

"github.com/cloudflare/cloudflare-go/v2/internal/apijson"
"github.com/cloudflare/cloudflare-go/v2/internal/pagination"
"github.com/cloudflare/cloudflare-go/v2/internal/param"
"github.com/cloudflare/cloudflare-go/v2/internal/requestconfig"
"github.com/cloudflare/cloudflare-go/v2/option"
Expand Down Expand Up @@ -55,27 +54,21 @@ func (r *GatewayProxyEndpointService) New(ctx context.Context, params GatewayPro
return
}

// Fetches a single Zero Trust Gateway proxy endpoint.
func (r *GatewayProxyEndpointService) List(ctx context.Context, query GatewayProxyEndpointListParams, opts ...option.RequestOption) (res *pagination.SinglePage[ProxyEndpoint], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := fmt.Sprintf("accounts/%s/gateway/proxy_endpoints", query.AccountID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...)
if err != nil {
return nil, err
// Fetches all Zero Trust Gateway proxy endpoints for an account.
func (r *GatewayProxyEndpointService) List(ctx context.Context, query GatewayProxyEndpointListParams, opts ...option.RequestOption) (res *ProxyEndpoint, err error) {
opts = append(r.Options[:], opts...)
var env GatewayProxyEndpointListResponseEnvelope
if query.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
}
err = cfg.Execute()
path := fmt.Sprintf("accounts/%s/gateway/proxy_endpoints", query.AccountID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
return nil, err
return
}
res.SetPageConfig(cfg, raw)
return res, nil
}

// Fetches a single Zero Trust Gateway proxy endpoint.
func (r *GatewayProxyEndpointService) ListAutoPaging(ctx context.Context, query GatewayProxyEndpointListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[ProxyEndpoint] {
return pagination.NewSinglePageAutoPager(r.List(ctx, query, opts...))
res = &env.Result
return
}

// Deletes a configured Zero Trust Gateway proxy endpoint.
Expand Down Expand Up @@ -120,8 +113,8 @@ func (r *GatewayProxyEndpointService) Edit(ctx context.Context, proxyEndpointID
return
}

// Fetches all Zero Trust Gateway proxy endpoints for an account.
func (r *GatewayProxyEndpointService) Get(ctx context.Context, proxyEndpointID string, query GatewayProxyEndpointGetParams, opts ...option.RequestOption) (res *ProxyEndpoint, err error) {
// Fetches a single Zero Trust Gateway proxy endpoint.
func (r *GatewayProxyEndpointService) Get(ctx context.Context, proxyEndpointID string, query GatewayProxyEndpointGetParams, opts ...option.RequestOption) (res *[]ProxyEndpoint, err error) {
opts = append(r.Options[:], opts...)
var env GatewayProxyEndpointGetResponseEnvelope
if query.AccountID.Value == "" {
Expand Down Expand Up @@ -254,6 +247,49 @@ type GatewayProxyEndpointListParams struct {
AccountID param.Field[string] `path:"account_id,required"`
}

type GatewayProxyEndpointListResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
// Whether the API call was successful
Success GatewayProxyEndpointListResponseEnvelopeSuccess `json:"success,required"`
Result ProxyEndpoint `json:"result"`
JSON gatewayProxyEndpointListResponseEnvelopeJSON `json:"-"`
}

// gatewayProxyEndpointListResponseEnvelopeJSON contains the JSON metadata for the
// struct [GatewayProxyEndpointListResponseEnvelope]
type gatewayProxyEndpointListResponseEnvelopeJSON struct {
Errors apijson.Field
Messages apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *GatewayProxyEndpointListResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r gatewayProxyEndpointListResponseEnvelopeJSON) RawJSON() string {
return r.raw
}

// Whether the API call was successful
type GatewayProxyEndpointListResponseEnvelopeSuccess bool

const (
GatewayProxyEndpointListResponseEnvelopeSuccessTrue GatewayProxyEndpointListResponseEnvelopeSuccess = true
)

func (r GatewayProxyEndpointListResponseEnvelopeSuccess) IsKnown() bool {
switch r {
case GatewayProxyEndpointListResponseEnvelopeSuccessTrue:
return true
}
return false
}

type GatewayProxyEndpointDeleteParams struct {
AccountID param.Field[string] `path:"account_id,required"`
}
Expand Down Expand Up @@ -364,9 +400,10 @@ type GatewayProxyEndpointGetResponseEnvelope struct {
Errors []shared.ResponseInfo `json:"errors,required"`
Messages []shared.ResponseInfo `json:"messages,required"`
// Whether the API call was successful
Success GatewayProxyEndpointGetResponseEnvelopeSuccess `json:"success,required"`
Result ProxyEndpoint `json:"result"`
JSON gatewayProxyEndpointGetResponseEnvelopeJSON `json:"-"`
Success GatewayProxyEndpointGetResponseEnvelopeSuccess `json:"success,required"`
Result []ProxyEndpoint `json:"result,nullable"`
ResultInfo GatewayProxyEndpointGetResponseEnvelopeResultInfo `json:"result_info"`
JSON gatewayProxyEndpointGetResponseEnvelopeJSON `json:"-"`
}

// gatewayProxyEndpointGetResponseEnvelopeJSON contains the JSON metadata for the
Expand All @@ -376,6 +413,7 @@ type gatewayProxyEndpointGetResponseEnvelopeJSON struct {
Messages apijson.Field
Success apijson.Field
Result apijson.Field
ResultInfo apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand All @@ -402,3 +440,34 @@ func (r GatewayProxyEndpointGetResponseEnvelopeSuccess) IsKnown() bool {
}
return false
}

type GatewayProxyEndpointGetResponseEnvelopeResultInfo struct {
// Total number of results for the requested service
Count float64 `json:"count"`
// Current page within paginated list of results
Page float64 `json:"page"`
// Number of results per page of results
PerPage float64 `json:"per_page"`
// Total results available without any search parameters
TotalCount float64 `json:"total_count"`
JSON gatewayProxyEndpointGetResponseEnvelopeResultInfoJSON `json:"-"`
}

// gatewayProxyEndpointGetResponseEnvelopeResultInfoJSON contains the JSON metadata
// for the struct [GatewayProxyEndpointGetResponseEnvelopeResultInfo]
type gatewayProxyEndpointGetResponseEnvelopeResultInfoJSON struct {
Count apijson.Field
Page apijson.Field
PerPage apijson.Field
TotalCount apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *GatewayProxyEndpointGetResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r gatewayProxyEndpointGetResponseEnvelopeResultInfoJSON) RawJSON() string {
return r.raw
}