Skip to content

Commit

Permalink
Release v0.0.23
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed May 31, 2024
1 parent 2145e30 commit 9a30ad9
Show file tree
Hide file tree
Showing 25 changed files with 3,244 additions and 2 deletions.
1 change: 1 addition & 0 deletions .fernignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Specify files that shouldn't be modified by Fern
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ci

on: [push]

jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up go
uses: actions/setup-go@v4

- name: Compile
run: go build ./...
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up go
uses: actions/setup-go@v4

- name: Test
run: go test ./...
1 change: 1 addition & 0 deletions .mock/definition/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: generator-cli
39 changes: 39 additions & 0 deletions .mock/definition/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
types:
FeatureId:
docs: |
A unique identifier for a feature (e.g. OPTIONALS). This is typed as a freeform string
to allow for arbitrary features, but callers are expected to use the FeatureType
string representation whenever possible.
type: string

FeatureType:
docs: |
Unique identifiers for features that can be demonstrated with snippets.
enum:
- AUTHENTICATION
- ERRORS
- USAGE
- PAGINATION
- RETRIES
- REQUEST_OPTIONS
- STREAMING
- TIMEOUTS

FeatureConfig:
docs: |
The configuration used to specify a generator's set of supported features.
This is static data associated with a particular version of a generator, and
is expected to be written as a static features.yml file in the generator's
repository.
properties:
features: list<FeatureSpec>

FeatureSpec:
docs: |
A specification for a feature supported by a generator. This includes the
feature's ID, a description, and any additional information that should be
included in the README.md.
properties:
id: FeatureId
description: optional<string>
addendum: optional<string>
114 changes: 114 additions & 0 deletions .mock/definition/readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
imports:
feature: feature.yml
types:
ReadmeConfig:
docs: |
The configuration used to generate a README.md file.
The information described here is a combination of user-defined information
(i.e. specified in the generators.yml), and dynamically generated information
that comes from each generator (i.e. features, requirements, and more).
properties:
language: LanguageInfo
organization: string
bannerLink: optional<string>
docsLink: optional<string>
requirements: optional<list<string>>
features:
docs: |
Specifies the list of features supported by a specific generator.
The features are rendered in the order they're specified.
type: optional<list<ReadmeFeature>>

ReadmeFeature:
docs: |
A single feature supported by a generator (e.g. PAGINATION).
properties:
id: feature.FeatureId
description: optional<string>
addendum: optional<string>
snippets: optional<list<string>>
snippetsAreOptional:
docs: |
If true, the feature block should be rendered even if we don't receive a snippet for it.
This is useful for features that are always supported, but might not require a snippet
to explain.
type: boolean

LanguageInfo:
docs: |
The language and its associated publish information (if any).
This is used to generate badges, the installation guide, and determine what language to
use when surrounding the snippets in a code block.
union:
typescript: TypescriptInfo
python: PythonInfo
go: GoInfo
java: JavaInfo
ruby: RubyInfo
csharp: CsharpInfo

TypescriptInfo:
properties:
title: literal<"TypeScript">
format: literal<"ts">
publishInfo: optional<NpmPublishInfo>

PythonInfo:
properties:
title: literal<"Python">
format: literal<"python">
publishInfo: optional<PypiPublishInfo>

GoInfo:
properties:
title: literal<"Go">
format: literal<"go">
publishInfo: optional<GoPublishInfo>

JavaInfo:
properties:
title: literal<"Java">
format: literal<"java">
publishInfo: optional<MavenPublishInfo>

RubyInfo:
properties:
title: literal<"Ruby">
format: literal<"ruby">
publishInfo: optional<RubyGemsPublishInfo>

CsharpInfo:
properties:
title: literal<"C#">
format: literal<"csharp">
publishInfo: optional<NugetPublishInfo>

NpmPublishInfo:
properties:
packageName: string

PypiPublishInfo:
properties:
packageName: string

GoPublishInfo:
properties:
owner: string
repo: string
version: string

MavenPublishInfo:
properties:
artifact: string
group: string
version: string

RubyGemsPublishInfo:
properties:
packageName: string

NugetPublishInfo:
properties:
packageName: string
4 changes: 4 additions & 0 deletions .mock/fern.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"organization" : "fern",
"version" : "0.0.23"
}
35 changes: 35 additions & 0 deletions .mock/generators.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
default-group: local
groups:
local:
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.12.8-rc0
output:
location: local-file-system
path: ../../../packages/generator-cli/src/configuration/generated
config:
noSerdeLayer: true
outputSourceFiles: true
neverThrowErrors: true
timeoutInSeconds: infinity
outputEsm: true

sdk:
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.12.8-rc0
output:
location: npm
url: npm.buildwithfern.com
package-name: "@fern-fern/generator-cli-sdk"
config:
includeUtilsOnUnionMembers: true
useBrandedStringAliases: true

- name: fernapi/fern-go-sdk
version: 0.22.0
github:
repository: fern-api/generator-cli-go
config:
union: v1
packageName: generatorcli
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

29 changes: 29 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// This file was auto-generated by Fern from our API Definition.

package client

import (
core "github.com/fern-api/generator-cli-go/core"
option "github.com/fern-api/generator-cli-go/option"
http "net/http"
)

type Client struct {
baseURL string
caller *core.Caller
header http.Header
}

func NewClient(opts ...option.RequestOption) *Client {
options := core.NewRequestOptions(opts...)
return &Client{
baseURL: options.BaseURL,
caller: core.NewCaller(
&core.CallerParams{
Client: options.HTTPClient,
MaxAttempts: options.MaxAttempts,
},
),
header: options.ToHeader(),
}
}
45 changes: 45 additions & 0 deletions client/client_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// This file was auto-generated by Fern from our API Definition.

package client

import (
option "github.com/fern-api/generator-cli-go/option"
assert "github.com/stretchr/testify/assert"
http "net/http"
testing "testing"
time "time"
)

func TestNewClient(t *testing.T) {
t.Run("default", func(t *testing.T) {
c := NewClient()
assert.Empty(t, c.baseURL)
})

t.Run("base url", func(t *testing.T) {
c := NewClient(
option.WithBaseURL("test.co"),
)
assert.Equal(t, "test.co", c.baseURL)
})

t.Run("http client", func(t *testing.T) {
httpClient := &http.Client{
Timeout: 5 * time.Second,
}
c := NewClient(
option.WithHTTPClient(httpClient),
)
assert.Empty(t, c.baseURL)
})

t.Run("http header", func(t *testing.T) {
header := make(http.Header)
header.Set("X-API-Tenancy", "test")
c := NewClient(
option.WithHTTPHeader(header),
)
assert.Empty(t, c.baseURL)
assert.Equal(t, "test", c.header.Get("X-API-Tenancy"))
})
}
Loading

0 comments on commit 9a30ad9

Please sign in to comment.