// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. package anthropic_test import ( "bytes" "context" "errors" "io" "os" "testing" "github.com/anthropics/anthropic-sdk-go" "github.com/anthropics/anthropic-sdk-go/internal/testutil" "github.com/anthropics/anthropic-sdk-go/option" ) func TestBetaSkillVersionNewWithOptionalParams(t *testing.T) { t.Skip("This test needs a mock server (Steady from NPM)") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL } if !testutil.CheckTestServer(t, baseURL) { return } client := anthropic.NewClient( option.WithBaseURL(baseURL), option.WithAPIKey("my-anthropic-api-key"), ) _, err := client.Beta.Skills.Versions.New( context.TODO(), "skill_id", anthropic.BetaSkillVersionNewParams{ Files: []io.Reader{io.Reader(bytes.NewBuffer([]byte("Example data")))}, Betas: []anthropic.AnthropicBeta{anthropic.AnthropicBetaMessageBatches2024_09_24}, }, ) if err != nil { var apierr *anthropic.Error if errors.As(err, &apierr) { t.Log(string(apierr.DumpRequest(true))) } t.Fatalf("err should be nil: %s", err.Error()) } } func TestBetaSkillVersionGetWithOptionalParams(t *testing.T) { t.Skip("This test needs a mock server (Steady from NPM)") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL } if !testutil.CheckTestServer(t, baseURL) { return } client := anthropic.NewClient( option.WithBaseURL(baseURL), option.WithAPIKey("my-anthropic-api-key"), ) _, err := client.Beta.Skills.Versions.Get( context.TODO(), "version", anthropic.BetaSkillVersionGetParams{ SkillID: "skill_id", Betas: []anthropic.AnthropicBeta{anthropic.AnthropicBetaMessageBatches2024_09_24}, }, ) if err != nil { var apierr *anthropic.Error if errors.As(err, &apierr) { t.Log(string(apierr.DumpRequest(true))) } t.Fatalf("err should be nil: %s", err.Error()) } } func TestBetaSkillVersionListWithOptionalParams(t *testing.T) { t.Skip("This test needs a mock server (Steady from NPM)") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL } if !testutil.CheckTestServer(t, baseURL) { return } client := anthropic.NewClient( option.WithBaseURL(baseURL), option.WithAPIKey("my-anthropic-api-key"), ) _, err := client.Beta.Skills.Versions.List( context.TODO(), "skill_id", anthropic.BetaSkillVersionListParams{ Limit: anthropic.Int(0), Page: anthropic.String("page"), Betas: []anthropic.AnthropicBeta{anthropic.AnthropicBetaMessageBatches2024_09_24}, }, ) if err != nil { var apierr *anthropic.Error if errors.As(err, &apierr) { t.Log(string(apierr.DumpRequest(true))) } t.Fatalf("err should be nil: %s", err.Error()) } } func TestBetaSkillVersionDeleteWithOptionalParams(t *testing.T) { t.Skip("This test needs a mock server (Steady from NPM)") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL } if !testutil.CheckTestServer(t, baseURL) { return } client := anthropic.NewClient( option.WithBaseURL(baseURL), option.WithAPIKey("my-anthropic-api-key"), ) _, err := client.Beta.Skills.Versions.Delete( context.TODO(), "version", anthropic.BetaSkillVersionDeleteParams{ SkillID: "skill_id", Betas: []anthropic.AnthropicBeta{anthropic.AnthropicBetaMessageBatches2024_09_24}, }, ) if err != nil { var apierr *anthropic.Error if errors.As(err, &apierr) { t.Log(string(apierr.DumpRequest(true))) } t.Fatalf("err should be nil: %s", err.Error()) } }