Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(go): Add configurable exportedClientName #5003

Merged
merged 2 commits into from
Oct 25, 2024
Merged

Conversation

amckinney
Copy link
Member

This adds support for the exportedClientName configuration, which can be used to customize the generated client name and constructor included in snippets. For example, consider the following generator configuration:

- name: fernapi/fern-go-sdk
  version: 0.28.0
  config:
    exportedClientName: AcmeClient

This will produce a snippet that looks like the following:

import (
  acme "github.com/acme/acme-go"
  acmeclient "github.com/acme/acme-go/client"
  option "github.com/acme/acme-go/option"
)

client := acmeclient.NewAcmeClient(
  option.WithToken("YOUR_AUTH_TOKEN"),
)
client.User.Create(
  context.TODO(),
  &acme.CreateUserRequest{
    Name: "John Doe",
  },
)

Note that this configuration option assumes that the SDK includes a hand-written client constructor defined in the client package.

@amckinney amckinney requested a review from dsinghvi as a code owner October 25, 2024 15:41
Copy link

github-actions bot commented Oct 25, 2024

@amckinney amckinney merged commit 5796c5b into main Oct 25, 2024
55 checks passed
@amckinney amckinney deleted the amckinney/go/clientName branch October 25, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants