Skip to content

Commit

Permalink
feat: generated
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Feb 12, 2024
1 parent 0f60420 commit 908f5e7
Show file tree
Hide file tree
Showing 27 changed files with 975 additions and 3,208 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
lint:
name: lint
runs-on: ubuntu-latest
if: github.repository == 'cloudflare/cloudflare-sdk-go'


steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 346
configured_endpoints: 333
1,440 changes: 733 additions & 707 deletions accessapp.go

Large diffs are not rendered by default.

92 changes: 46 additions & 46 deletions accessapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/cloudflare/cloudflare-sdk-go/option"
)

func TestAccessAppNewWithOptionalParams(t *testing.T) {
func TestAccessAppGet(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 {
Expand All @@ -30,24 +30,56 @@ func TestAccessAppNewWithOptionalParams(t *testing.T) {
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
option.WithUserServiceKey("My User Service Key"),
)
_, err := client.Access.Apps.New(
_, err := client.Access.Apps.Get(
context.TODO(),
"string",
"023e105f4ecef8ad9ca31a8372d0c353",
cloudflare.AccessAppNewParamsVariant0{
shared.UnionString("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())
}
}

func TestAccessAppUpdateWithOptionalParams(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("dev@cloudflare.com"),
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
option.WithUserServiceKey("My User Service Key"),
)
_, err := client.Access.Apps.Update(
context.TODO(),
"string",
"023e105f4ecef8ad9ca31a8372d0c353",
shared.UnionString("023e105f4ecef8ad9ca31a8372d0c353"),
cloudflare.AccessAppUpdateParamsVariant0{
Domain: cloudflare.F("test.example.com/admin"),
Type: cloudflare.F("self_hosted"),
AllowAuthenticateViaWarp: cloudflare.F(true),
AllowedIdps: cloudflare.F([]string{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}),
AppLauncherVisible: cloudflare.F(true),
AutoRedirectToIdentity: cloudflare.F(true),
CorsHeaders: cloudflare.F(cloudflare.AccessAppNewParamsVariant0CorsHeaders{
CorsHeaders: cloudflare.F(cloudflare.AccessAppUpdateParamsVariant0CorsHeaders{
AllowAllHeaders: cloudflare.F(true),
AllowAllMethods: cloudflare.F(true),
AllowAllOrigins: cloudflare.F(true),
AllowCredentials: cloudflare.F(true),
AllowedHeaders: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}),
AllowedMethods: cloudflare.F([]cloudflare.AccessAppNewParamsVariant0CorsHeadersAllowedMethod{cloudflare.AccessAppNewParamsVariant0CorsHeadersAllowedMethodGet}),
AllowedMethods: cloudflare.F([]cloudflare.AccessAppUpdateParamsVariant0CorsHeadersAllowedMethod{cloudflare.AccessAppUpdateParamsVariant0CorsHeadersAllowedMethodGet}),
AllowedOrigins: cloudflare.F([]interface{}{"https://example.com"}),
MaxAge: cloudflare.F(-1.000000),
}),
Expand Down Expand Up @@ -77,7 +109,7 @@ func TestAccessAppNewWithOptionalParams(t *testing.T) {
}
}

func TestAccessAppGet(t *testing.T) {
func TestAccessAppDelete(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 {
Expand All @@ -93,7 +125,7 @@ func TestAccessAppGet(t *testing.T) {
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
option.WithUserServiceKey("My User Service Key"),
)
_, err := client.Access.Apps.Get(
_, err := client.Access.Apps.Delete(
context.TODO(),
"string",
"023e105f4ecef8ad9ca31a8372d0c353",
Expand All @@ -108,7 +140,7 @@ func TestAccessAppGet(t *testing.T) {
}
}

func TestAccessAppUpdateWithOptionalParams(t *testing.T) {
func TestAccessAppAccessApplicationsAddAnApplicationWithOptionalParams(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 {
Expand All @@ -124,25 +156,24 @@ func TestAccessAppUpdateWithOptionalParams(t *testing.T) {
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
option.WithUserServiceKey("My User Service Key"),
)
_, err := client.Access.Apps.Update(
_, err := client.Access.Apps.AccessApplicationsAddAnApplication(
context.TODO(),
"string",
"023e105f4ecef8ad9ca31a8372d0c353",
shared.UnionString("023e105f4ecef8ad9ca31a8372d0c353"),
cloudflare.AccessAppUpdateParamsVariant0{
cloudflare.AccessAppAccessApplicationsAddAnApplicationParamsVariant0{
Domain: cloudflare.F("test.example.com/admin"),
Type: cloudflare.F("self_hosted"),
AllowAuthenticateViaWarp: cloudflare.F(true),
AllowedIdps: cloudflare.F([]string{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}),
AppLauncherVisible: cloudflare.F(true),
AutoRedirectToIdentity: cloudflare.F(true),
CorsHeaders: cloudflare.F(cloudflare.AccessAppUpdateParamsVariant0CorsHeaders{
CorsHeaders: cloudflare.F(cloudflare.AccessAppAccessApplicationsAddAnApplicationParamsVariant0CorsHeaders{
AllowAllHeaders: cloudflare.F(true),
AllowAllMethods: cloudflare.F(true),
AllowAllOrigins: cloudflare.F(true),
AllowCredentials: cloudflare.F(true),
AllowedHeaders: cloudflare.F([]interface{}{map[string]interface{}{}, map[string]interface{}{}, map[string]interface{}{}}),
AllowedMethods: cloudflare.F([]cloudflare.AccessAppUpdateParamsVariant0CorsHeadersAllowedMethod{cloudflare.AccessAppUpdateParamsVariant0CorsHeadersAllowedMethodGet}),
AllowedMethods: cloudflare.F([]cloudflare.AccessAppAccessApplicationsAddAnApplicationParamsVariant0CorsHeadersAllowedMethod{cloudflare.AccessAppAccessApplicationsAddAnApplicationParamsVariant0CorsHeadersAllowedMethodGet}),
AllowedOrigins: cloudflare.F([]interface{}{"https://example.com"}),
MaxAge: cloudflare.F(-1.000000),
}),
Expand Down Expand Up @@ -172,7 +203,7 @@ func TestAccessAppUpdateWithOptionalParams(t *testing.T) {
}
}

func TestAccessAppList(t *testing.T) {
func TestAccessAppAccessApplicationsListAccessApplications(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 {
Expand All @@ -188,7 +219,7 @@ func TestAccessAppList(t *testing.T) {
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
option.WithUserServiceKey("My User Service Key"),
)
_, err := client.Access.Apps.List(
_, err := client.Access.Apps.AccessApplicationsListAccessApplications(
context.TODO(),
"string",
"023e105f4ecef8ad9ca31a8372d0c353",
Expand All @@ -201,34 +232,3 @@ func TestAccessAppList(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}

func TestAccessAppDelete(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("dev@cloudflare.com"),
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
option.WithUserServiceKey("My User Service Key"),
)
_, err := client.Access.Apps.Delete(
context.TODO(),
"string",
"023e105f4ecef8ad9ca31a8372d0c353",
shared.UnionString("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())
}
}
14 changes: 13 additions & 1 deletion ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ import (
// from the environment automatically. You should not instantiate this service
// directly, and instead use the [NewAIService] method instead.
type AIService struct {
Options []option.RequestOption
Options []option.RequestOption
Huggingface *AIHuggingfaceService
Baai *AIBaaiService
OpenAI *AIOpenAIService
Microsoft *AIMicrosoftService
Meta *AIMetaService
Mistral *AIMistralService
}

// NewAIService generates a new service that applies the given options to each
Expand All @@ -27,6 +33,12 @@ type AIService struct {
func NewAIService(opts ...option.RequestOption) (r *AIService) {
r = &AIService{}
r.Options = opts
r.Huggingface = NewAIHuggingfaceService(opts...)
r.Baai = NewAIBaaiService(opts...)
r.OpenAI = NewAIOpenAIService(opts...)
r.Microsoft = NewAIMicrosoftService(opts...)
r.Meta = NewAIMetaService(opts...)
r.Mistral = NewAIMistralService(opts...)
return
}

Expand Down
24 changes: 24 additions & 0 deletions aibaai.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// File generated from our OpenAPI spec by Stainless.

package cloudflare

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

// AIBaaiService 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 [NewAIBaaiService] method instead.
type AIBaaiService struct {
Options []option.RequestOption
}

// NewAIBaaiService 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 NewAIBaaiService(opts ...option.RequestOption) (r *AIBaaiService) {
r = &AIBaaiService{}
r.Options = opts
return
}
25 changes: 25 additions & 0 deletions aihuggingface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// File generated from our OpenAPI spec by Stainless.

package cloudflare

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

// AIHuggingfaceService 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 [NewAIHuggingfaceService] method
// instead.
type AIHuggingfaceService struct {
Options []option.RequestOption
}

// NewAIHuggingfaceService 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 NewAIHuggingfaceService(opts ...option.RequestOption) (r *AIHuggingfaceService) {
r = &AIHuggingfaceService{}
r.Options = opts
return
}
24 changes: 24 additions & 0 deletions aimeta.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// File generated from our OpenAPI spec by Stainless.

package cloudflare

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

// AIMetaService 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 [NewAIMetaService] method instead.
type AIMetaService struct {
Options []option.RequestOption
}

// NewAIMetaService 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 NewAIMetaService(opts ...option.RequestOption) (r *AIMetaService) {
r = &AIMetaService{}
r.Options = opts
return
}
25 changes: 25 additions & 0 deletions aimicrosoft.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// File generated from our OpenAPI spec by Stainless.

package cloudflare

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

// AIMicrosoftService 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 [NewAIMicrosoftService] method
// instead.
type AIMicrosoftService struct {
Options []option.RequestOption
}

// NewAIMicrosoftService 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 NewAIMicrosoftService(opts ...option.RequestOption) (r *AIMicrosoftService) {
r = &AIMicrosoftService{}
r.Options = opts
return
}
24 changes: 24 additions & 0 deletions aimistral.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// File generated from our OpenAPI spec by Stainless.

package cloudflare

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

// AIMistralService 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 [NewAIMistralService] method instead.
type AIMistralService struct {
Options []option.RequestOption
}

// NewAIMistralService 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 NewAIMistralService(opts ...option.RequestOption) (r *AIMistralService) {
r = &AIMistralService{}
r.Options = opts
return
}
24 changes: 24 additions & 0 deletions aiopenai.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// File generated from our OpenAPI spec by Stainless.

package cloudflare

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

// AIOpenAIService 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 [NewAIOpenAIService] method instead.
type AIOpenAIService struct {
Options []option.RequestOption
}

// NewAIOpenAIService 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 NewAIOpenAIService(opts ...option.RequestOption) (r *AIOpenAIService) {
r = &AIOpenAIService{}
r.Options = opts
return
}
Loading

0 comments on commit 908f5e7

Please sign in to comment.