-
Notifications
You must be signed in to change notification settings - Fork 611
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): update via SDK Studio (#1784)
- Loading branch information
1 parent
0adf3e1
commit 1079b16
Showing
11 changed files
with
678 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
configured_endpoints: 1256 | ||
configured_endpoints: 1259 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
} | ||
} |
Oops, something went wrong.