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): update via SDK Studio #1784

Merged
merged 1 commit into from
Apr 15, 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 +1 @@
configured_endpoints: 1256
configured_endpoints: 1259
26 changes: 26 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6814,3 +6814,29 @@ Methods:
- <code title="delete /accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}">client.CloudforceOne.Requests.Priority.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/cloudforce_one#RequestPriorityService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, accountIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>, priorityIdentifer <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/cloudforce_one">cloudforce_one</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/cloudforce_one#RequestPriorityDeleteResponseUnion">RequestPriorityDeleteResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}">client.CloudforceOne.Requests.Priority.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/cloudforce_one#RequestPriorityService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, accountIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>, priorityIdentifer <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/cloudforce_one">cloudforce_one</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/cloudforce_one#Item">Item</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/priority/quota">client.CloudforceOne.Requests.Priority.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/cloudforce_one#RequestPriorityService.Quota">Quota</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, accountIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/cloudforce_one">cloudforce_one</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/cloudforce_one#Quota">Quota</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# EventNotifications

## R2

### Configuration

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications">event_notifications</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationGetResponse">R2ConfigurationGetResponse</a>

Methods:

- <code title="get /accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration">client.EventNotifications.R2.Configuration.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, bucketName <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications">event_notifications</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationGetParams">R2ConfigurationGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications">event_notifications</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationGetResponse">R2ConfigurationGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

#### Queues

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications">event_notifications</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationQueueUpdateResponse">R2ConfigurationQueueUpdateResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications">event_notifications</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationQueueDeleteResponseUnion">R2ConfigurationQueueDeleteResponseUnion</a>

Methods:

- <code title="put /accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}">client.EventNotifications.R2.Configuration.Queues.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationQueueService.Update">Update</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, bucketName <a href="https://pkg.go.dev/builtin#string">string</a>, queueID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications">event_notifications</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationQueueUpdateParams">R2ConfigurationQueueUpdateParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications">event_notifications</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationQueueUpdateResponse">R2ConfigurationQueueUpdateResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="delete /accounts/{account_id}/event_notifications/r2/{bucket_name}/configuration/queues/{queue_id}">client.EventNotifications.R2.Configuration.Queues.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationQueueService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, bucketName <a href="https://pkg.go.dev/builtin#string">string</a>, queueID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications">event_notifications</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationQueueDeleteParams">R2ConfigurationQueueDeleteParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications">event_notifications</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/event_notifications#R2ConfigurationQueueDeleteResponseUnion">R2ConfigurationQueueDeleteResponseUnion</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
3 changes: 3 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/cloudflare/cloudflare-go/v2/dnssec"
"github.com/cloudflare/cloudflare-go/v2/durable_objects"
"github.com/cloudflare/cloudflare-go/v2/email_routing"
"github.com/cloudflare/cloudflare-go/v2/event_notifications"
"github.com/cloudflare/cloudflare-go/v2/filters"
"github.com/cloudflare/cloudflare-go/v2/firewall"
"github.com/cloudflare/cloudflare-go/v2/healthchecks"
Expand Down Expand Up @@ -176,6 +177,7 @@ type Client struct {
Snippets *snippets.SnippetService
Calls *calls.CallService
CloudforceOne *cloudforce_one.CloudforceOneService
EventNotifications *event_notifications.EventNotificationService
}

// NewClient generates a new client with the default option read from the
Expand Down Expand Up @@ -281,6 +283,7 @@ func NewClient(opts ...option.RequestOption) (r *Client) {
r.Snippets = snippets.NewSnippetService(opts...)
r.Calls = calls.NewCallService(opts...)
r.CloudforceOne = cloudforce_one.NewCloudforceOneService(opts...)
r.EventNotifications = event_notifications.NewEventNotificationService(opts...)

return
}
Expand Down
109 changes: 109 additions & 0 deletions event_notifications/aliases.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package event_notifications

import (
"github.com/cloudflare/cloudflare-go/v2/internal/apierror"
"github.com/cloudflare/cloudflare-go/v2/internal/shared"
)

type Error = apierror.Error

// This is an alias to an internal type.
type AuditLog = shared.AuditLog

// This is an alias to an internal type.
type AuditLogAction = shared.AuditLogAction

// This is an alias to an internal type.
type AuditLogActor = shared.AuditLogActor

// The type of actor, whether a User, Cloudflare Admin, or an Automated System.
//
// This is an alias to an internal type.
type AuditLogActorType = shared.AuditLogActorType

// This is an alias to an internal value.
const AuditLogActorTypeUser = shared.AuditLogActorTypeUser

// This is an alias to an internal value.
const AuditLogActorTypeAdmin = shared.AuditLogActorTypeAdmin

// This is an alias to an internal value.
const AuditLogActorTypeCloudflare = shared.AuditLogActorTypeCloudflare

// This is an alias to an internal type.
type AuditLogOwner = shared.AuditLogOwner

// This is an alias to an internal type.
type AuditLogResource = shared.AuditLogResource

// A Cloudflare Tunnel that connects your origin to Cloudflare's edge.
//
// This is an alias to an internal type.
type CloudflareTunnel = shared.CloudflareTunnel

// This is an alias to an internal type.
type CloudflareTunnelConnection = shared.CloudflareTunnelConnection

// The type of tunnel.
//
// This is an alias to an internal type.
type CloudflareTunnelTunType = shared.CloudflareTunnelTunType

// This is an alias to an internal value.
const CloudflareTunnelTunTypeCfdTunnel = shared.CloudflareTunnelTunTypeCfdTunnel

// This is an alias to an internal value.
const CloudflareTunnelTunTypeWARPConnector = shared.CloudflareTunnelTunTypeWARPConnector

// This is an alias to an internal value.
const CloudflareTunnelTunTypeIPSec = shared.CloudflareTunnelTunTypeIPSec

// This is an alias to an internal value.
const CloudflareTunnelTunTypeGRE = shared.CloudflareTunnelTunTypeGRE

// This is an alias to an internal value.
const CloudflareTunnelTunTypeCNI = shared.CloudflareTunnelTunTypeCNI

// This is an alias to an internal type.
type ErrorData = shared.ErrorData

// This is an alias to an internal type.
type Permission = shared.Permission

// This is an alias to an internal type.
type PermissionGrant = shared.PermissionGrant

// This is an alias to an internal type.
type PermissionGrantParam = shared.PermissionGrantParam

// This is an alias to an internal type.
type ResponseInfo = shared.ResponseInfo

// This is an alias to an internal type.
type Role = shared.Role

// This is an alias to an internal type.
type User = shared.User

// This is an alias to an internal type.
type UserRole = shared.UserRole

// This is an alias to an internal type.
type UserRolesPermissions = shared.UserRolesPermissions

// This is an alias to an internal type.
type UserUser = shared.UserUser

// This is an alias to an internal type.
type UserParam = shared.UserParam

// This is an alias to an internal type.
type UserRoleParam = shared.UserRoleParam

// This is an alias to an internal type.
type UserRolesPermissionsParam = shared.UserRolesPermissionsParam

// This is an alias to an internal type.
type UserUserParam = shared.UserUserParam
27 changes: 27 additions & 0 deletions event_notifications/eventnotification.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package event_notifications

import (
"github.com/cloudflare/cloudflare-go/v2/option"
)

// EventNotificationService contains methods and other services that help with
// interacting with the cloudflare API. Note, unlike clients, this service does not
// read variables from the environment automatically. You should not instantiate
// this service directly, and instead use the [NewEventNotificationService] method
// instead.
type EventNotificationService struct {
Options []option.RequestOption
R2 *R2Service
}

// NewEventNotificationService generates a new service that applies the given
// options to each request. These options are applied after the parent client's
// options (if there is one), and before any request-specific options.
func NewEventNotificationService(opts ...option.RequestOption) (r *EventNotificationService) {
r = &EventNotificationService{}
r.Options = opts
r.R2 = NewR2Service(opts...)
return
}
26 changes: 26 additions & 0 deletions event_notifications/r2.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package event_notifications

import (
"github.com/cloudflare/cloudflare-go/v2/option"
)

// R2Service contains methods and other services that help with interacting with
// the cloudflare API. Note, unlike clients, this service does not read variables
// from the environment automatically. You should not instantiate this service
// directly, and instead use the [NewR2Service] method instead.
type R2Service struct {
Options []option.RequestOption
Configuration *R2ConfigurationService
}

// NewR2Service generates a new service that applies the given options to each
// request. These options are applied after the parent client's options (if there
// is one), and before any request-specific options.
func NewR2Service(opts ...option.RequestOption) (r *R2Service) {
r = &R2Service{}
r.Options = opts
r.Configuration = NewR2ConfigurationService(opts...)
return
}
99 changes: 99 additions & 0 deletions event_notifications/r2configuration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package event_notifications

import (
"context"
"fmt"
"net/http"

"github.com/cloudflare/cloudflare-go/v2/internal/apijson"
"github.com/cloudflare/cloudflare-go/v2/internal/param"
"github.com/cloudflare/cloudflare-go/v2/internal/requestconfig"
"github.com/cloudflare/cloudflare-go/v2/internal/shared"
"github.com/cloudflare/cloudflare-go/v2/option"
)

// R2ConfigurationService contains methods and other services that help with
// interacting with the cloudflare API. Note, unlike clients, this service does not
// read variables from the environment automatically. You should not instantiate
// this service directly, and instead use the [NewR2ConfigurationService] method
// instead.
type R2ConfigurationService struct {
Options []option.RequestOption
Queues *R2ConfigurationQueueService
}

// NewR2ConfigurationService generates a new service that applies the given options
// to each request. These options are applied after the parent client's options (if
// there is one), and before any request-specific options.
func NewR2ConfigurationService(opts ...option.RequestOption) (r *R2ConfigurationService) {
r = &R2ConfigurationService{}
r.Options = opts
r.Queues = NewR2ConfigurationQueueService(opts...)
return
}

// Returns all notification rules for each queue for which bucket notifications are
// produced.
func (r *R2ConfigurationService) Get(ctx context.Context, bucketName string, query R2ConfigurationGetParams, opts ...option.RequestOption) (res *R2ConfigurationGetResponse, err error) {
opts = append(r.Options[:], opts...)
var env R2ConfigurationGetResponseEnvelope
path := fmt.Sprintf("accounts/%s/event_notifications/r2/%s/configuration", query.AccountID, bucketName)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
return
}
res = &env.Result
return
}

type R2ConfigurationGetResponse map[string]map[string]R2ConfigurationGetResponse

type R2ConfigurationGetParams struct {
// Identifier
AccountID param.Field[string] `path:"account_id,required"`
}

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

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

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

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

// Whether the API call was successful
type R2ConfigurationGetResponseEnvelopeSuccess bool

const (
R2ConfigurationGetResponseEnvelopeSuccessTrue R2ConfigurationGetResponseEnvelopeSuccess = true
)

func (r R2ConfigurationGetResponseEnvelopeSuccess) IsKnown() bool {
switch r {
case R2ConfigurationGetResponseEnvelopeSuccessTrue:
return true
}
return false
}
45 changes: 45 additions & 0 deletions event_notifications/r2configuration_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package event_notifications_test

import (
"context"
"errors"
"os"
"testing"

"github.com/cloudflare/cloudflare-go/v2"
"github.com/cloudflare/cloudflare-go/v2/event_notifications"
"github.com/cloudflare/cloudflare-go/v2/internal/testutil"
"github.com/cloudflare/cloudflare-go/v2/option"
)

func TestR2ConfigurationGet(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
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.EventNotifications.R2.Configuration.Get(
context.TODO(),
"023e105f4ecef8ad9ca31a8372d0c353",
event_notifications.R2ConfigurationGetParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
},
)
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())
}
}
Loading