Skip to content

Commit

Permalink
Release v0.0.874
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed May 27, 2024
1 parent e0afea7 commit 77a329e
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/client_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,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/fern-api/generator-exec-go")
headers.Set("X-Fern-SDK-Version", "v0.0.869")
headers.Set("X-Fern-SDK-Version", "v0.0.874")
return headers
}
66 changes: 64 additions & 2 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ func (g *GeneratorEnvironment) Accept(visitor GeneratorEnvironmentVisitor) error
}

type GeneratorOutputConfig struct {
Path string `json:"path"`
Path string `json:"path"`
// A static file that defines the list of features supported by the generator.
FeaturesFilepath *string `json:"featuresFilepath,omitempty"`
SnippetFilepath *string `json:"snippetFilepath,omitempty"`
SnippetTemplateFilepath *string `json:"snippetTemplateFilepath,omitempty"`
PublishingMetadata *PublishingMetadata `json:"publishingMetadata,omitempty"`
Expand Down Expand Up @@ -1635,6 +1637,63 @@ func (e *EndpointSnippet) Accept(visitor EndpointSnippetVisitor) error {
}
}

// Unique identifiers for the different features that can be demonstrated in the snippets.
type FeatureType uint

const (
FeatureTypeUsage FeatureType = iota + 1
FeatureTypeTimeouts
FeatureTypeRequestOptions
FeatureTypeRetries
FeatureTypeErrors
)

func (f FeatureType) String() string {
switch f {
default:
return strconv.Itoa(int(f))
case FeatureTypeUsage:
return "USAGE"
case FeatureTypeTimeouts:
return "TIMEOUTS"
case FeatureTypeRequestOptions:
return "REQUEST_OPTIONS"
case FeatureTypeRetries:
return "RETRIES"
case FeatureTypeErrors:
return "ERRORS"
}
}

func (f FeatureType) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("%q", f.String())), nil
}

func (f *FeatureType) UnmarshalJSON(data []byte) error {
var raw string
if err := json.Unmarshal(data, &raw); err != nil {
return err
}
switch raw {
case "USAGE":
value := FeatureTypeUsage
*f = value
case "TIMEOUTS":
value := FeatureTypeTimeouts
*f = value
case "REQUEST_OPTIONS":
value := FeatureTypeRequestOptions
*f = value
case "RETRIES":
value := FeatureTypeRetries
*f = value
case "ERRORS":
value := FeatureTypeErrors
*f = value
}
return nil
}

type GoEndpointSnippet struct {
// A full endpoint snippet, including the client instantiation, e.g.
//
Expand Down Expand Up @@ -1740,8 +1799,11 @@ type Snippets struct {
Endpoints []*Endpoint `json:"endpoints,omitempty"`
// A collection of endpoint snippets that demonstrate a particular feature.
//
// For simplicity, this is just a simple map for now.
// The key is a free-form string to allow for features not yet defined in the schema,
// but users are expected to use the FeatureType enum string representations.
Features map[string][]*Endpoint `json:"features,omitempty"`
// A list of requirements to use the generated snippets.
Requirements []string `json:"requirements,omitempty"`
}

type TypeId = string
Expand Down

0 comments on commit 77a329e

Please sign in to comment.