Skip to content

Commit

Permalink
Release v0.3.20
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Apr 8, 2024
1 parent 27fdfc4 commit 37554ea
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/client_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ func (c *ClientOptions) cloneHeader() http.Header {
headers := c.HTTPHeader.Clone()
headers.Set("X-Fern-Language", "Go")
headers.Set("X-Fern-SDK-Name", "github.com/vellum-ai/vellum-client-go")
headers.Set("X-Fern-SDK-Version", "v0.3.19")
headers.Set("X-Fern-SDK-Version", "v0.3.20")
return headers
}
7 changes: 7 additions & 0 deletions test_suites.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

package api

type ListTestSuiteTestCasesRequest struct {
// Number of results to return per page.
Limit *int `json:"-"`
// The initial index from which to return the results.
Offset *int `json:"-"`
}

type UpsertTestSuiteTestCaseRequest struct {
UpsertTestSuiteTestCaseRequestId *string `json:"id,omitempty"`
Label *string `json:"label,omitempty"`
Expand Down
37 changes: 37 additions & 0 deletions testsuites/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
vellumclientgo "github.com/vellum-ai/vellum-client-go"
core "github.com/vellum-ai/vellum-client-go/core"
http "net/http"
url "net/url"
)

type Client struct {
Expand All @@ -28,6 +29,42 @@ func NewClient(opts ...core.ClientOption) *Client {
}
}

// List the Test Cases associated with a Test Suite
//
// A UUID string identifying this test suite.
func (c *Client) ListTestSuiteTestCases(ctx context.Context, id string, request *vellumclientgo.ListTestSuiteTestCasesRequest) (*vellumclientgo.PaginatedTestSuiteTestCaseList, error) {
baseURL := "https://api.vellum.ai"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"v1/test-suites/%v/test-cases", id)

queryParams := make(url.Values)
if request.Limit != nil {
queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit))
}
if request.Offset != nil {
queryParams.Add("offset", fmt.Sprintf("%v", *request.Offset))
}
if len(queryParams) > 0 {
endpointURL += "?" + queryParams.Encode()
}

var response *vellumclientgo.PaginatedTestSuiteTestCaseList
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodGet,
Headers: c.header,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

// Upserts a new test case for a test suite, keying off of the optionally provided test case id.
//
// If an id is provided and has a match, the test case will be updated. If no id is provided or no match
Expand Down
88 changes: 88 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5975,6 +5975,38 @@ func (p *PaginatedTestSuiteRunExecutionList) String() string {
return fmt.Sprintf("%#v", p)
}

type PaginatedTestSuiteTestCaseList struct {
Count int `json:"count"`
Next *string `json:"next,omitempty"`
Previous *string `json:"previous,omitempty"`
Results []*TestSuiteTestCase `json:"results,omitempty"`

_rawJSON json.RawMessage
}

func (p *PaginatedTestSuiteTestCaseList) UnmarshalJSON(data []byte) error {
type unmarshaler PaginatedTestSuiteTestCaseList
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*p = PaginatedTestSuiteTestCaseList(value)
p._rawJSON = json.RawMessage(data)
return nil
}

func (p *PaginatedTestSuiteTestCaseList) String() string {
if len(p._rawJSON) > 0 {
if value, err := core.StringifyJSON(p._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(p); err == nil {
return value
}
return fmt.Sprintf("%#v", p)
}

// - `EXCEEDED_CHARACTER_LIMIT` - Exceeded Character Limit
// - `INVALID_FILE` - Invalid File
type ProcessingFailureReasonEnum string
Expand Down Expand Up @@ -10522,10 +10554,15 @@ type TestSuiteRunMetricNumberOutputTypeEnum = string

type TestSuiteRunMetricOutput struct {
Type string
String *TestSuiteRunMetricStringOutput
Number *TestSuiteRunMetricNumberOutput
Error *TestSuiteRunMetricErrorOutput
}

func NewTestSuiteRunMetricOutputFromString(value *TestSuiteRunMetricStringOutput) *TestSuiteRunMetricOutput {
return &TestSuiteRunMetricOutput{Type: "STRING", String: value}
}

func NewTestSuiteRunMetricOutputFromNumber(value *TestSuiteRunMetricNumberOutput) *TestSuiteRunMetricOutput {
return &TestSuiteRunMetricOutput{Type: "NUMBER", Number: value}
}
Expand All @@ -10543,6 +10580,12 @@ func (t *TestSuiteRunMetricOutput) UnmarshalJSON(data []byte) error {
}
t.Type = unmarshaler.Type
switch unmarshaler.Type {
case "STRING":
value := new(TestSuiteRunMetricStringOutput)
if err := json.Unmarshal(data, &value); err != nil {
return err
}
t.String = value
case "NUMBER":
value := new(TestSuiteRunMetricNumberOutput)
if err := json.Unmarshal(data, &value); err != nil {
Expand All @@ -10563,6 +10606,15 @@ func (t TestSuiteRunMetricOutput) MarshalJSON() ([]byte, error) {
switch t.Type {
default:
return nil, fmt.Errorf("invalid type %s in %T", t.Type, t)
case "STRING":
var marshaler = struct {
Type string `json:"type"`
*TestSuiteRunMetricStringOutput
}{
Type: t.Type,
TestSuiteRunMetricStringOutput: t.String,
}
return json.Marshal(marshaler)
case "NUMBER":
var marshaler = struct {
Type string `json:"type"`
Expand All @@ -10585,6 +10637,7 @@ func (t TestSuiteRunMetricOutput) MarshalJSON() ([]byte, error) {
}

type TestSuiteRunMetricOutputVisitor interface {
VisitString(*TestSuiteRunMetricStringOutput) error
VisitNumber(*TestSuiteRunMetricNumberOutput) error
VisitError(*TestSuiteRunMetricErrorOutput) error
}
Expand All @@ -10593,13 +10646,48 @@ func (t *TestSuiteRunMetricOutput) Accept(visitor TestSuiteRunMetricOutputVisito
switch t.Type {
default:
return fmt.Errorf("invalid type %s in %T", t.Type, t)
case "STRING":
return visitor.VisitString(t.String)
case "NUMBER":
return visitor.VisitNumber(t.Number)
case "ERROR":
return visitor.VisitError(t.Error)
}
}

// Output for a test suite run metric that is of type STRING
type TestSuiteRunMetricStringOutput struct {
Value string `json:"value"`
Name string `json:"name"`

_rawJSON json.RawMessage
}

func (t *TestSuiteRunMetricStringOutput) UnmarshalJSON(data []byte) error {
type unmarshaler TestSuiteRunMetricStringOutput
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*t = TestSuiteRunMetricStringOutput(value)
t._rawJSON = json.RawMessage(data)
return nil
}

func (t *TestSuiteRunMetricStringOutput) String() string {
if len(t._rawJSON) > 0 {
if value, err := core.StringifyJSON(t._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(t); err == nil {
return value
}
return fmt.Sprintf("%#v", t)
}

type TestSuiteRunMetricStringOutputTypeEnum = string

type TestSuiteRunRead struct {
Id string `json:"id"`
Created time.Time `json:"created"`
Expand Down

0 comments on commit 37554ea

Please sign in to comment.