Skip to content

Commit 0834c78

Browse files
authored
Minor edits to various SDK pages (#63)
1 parent a4217f3 commit 0834c78

File tree

11 files changed

+29
-43
lines changed

11 files changed

+29
-43
lines changed

fern/products/sdks/overview/dotnet/quickstart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ This command adds the following to `generators.yml`:
7878
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
7979

8080
```bash
81-
fern/ # created in step 1
81+
fern/ # created by fern init
8282
sdks/ # created by fern generate --group sdk
8383
├─ csharp
8484
└─ src/

fern/products/sdks/overview/go/quickstart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ This command adds the following to `generators.yml`:
7878
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
7979

8080
```bash
81-
fern/ # created in step 1
81+
fern/ # created by fern init
8282
sdks/ # created by fern generate --group sdk
8383
├─ go
8484
├─ core/

fern/products/sdks/overview/java/configuration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ groups:
1212
- name: fernapi/fern-java-sdk
1313
version: <Markdown src="/snippets/version-number.mdx"/>
1414
config:
15-
client_class_name: YourApiClient
15+
client-class-name: YourApiClient
1616
```
1717
1818
## SDK Configuration Options

fern/products/sdks/overview/java/quickstart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ This command adds the following to `generators.yml`:
7878
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
7979

8080
```bash
81-
fern/ # created in step 1
81+
fern/ # created by fern init
8282
sdks/ # created by fern generate --group sdk
8383
├─ java
8484
├─ YourOrganizationApiClient.java

fern/products/sdks/overview/php/quickstart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ This command adds the following to `generators.yml`:
7878
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
7979

8080
```bash
81-
fern/ # created in step 1
81+
fern/ # created by fern init
8282
sdks/ # created by fern generate --group sdk
8383
├─ php
8484
└─ sdk/

fern/products/sdks/overview/python/custom-code.mdx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ description: Augment your Python SDK with custom utilities
1616

1717
```python title="src/<package>/helper.py"
1818
def my_helper() -> None:
19-
print "Hello World!"
19+
print("Hello World!")
2020
```
2121

2222
### Add your file to `.fernignore`
@@ -78,17 +78,15 @@ description: Augment your Python SDK with custom utilities
7878

7979
First, import the Fern generated base clients from `.base_client.py` and extend them to create your custom clients. Then, add whatever methods you want.
8080

81-
```python title="src/<package>/client.py"
82-
from .base_client import \
83-
BaseClient
84-
85-
class YourClient(BaseClient):
86-
87-
def my_helper(self) -> None
88-
print("Hello World")
89-
90-
```
91-
81+
```python title="src/<package>/client.py"
82+
from .base_client import BaseClient // import generated client
83+
84+
class YourClient(BaseClient): // extend generated client
85+
def my_helper(self) -> None:
86+
print("Hello World!")
87+
def my_helper(self) -> None:
88+
print("Hello World")
89+
```
9290
<Note>
9391
See an example [client.py](https://github.com/elevenlabs/elevenlabs-python/blob/main/src/elevenlabs/client.py) from ElevenLabs.
9492
</Note>

fern/products/sdks/overview/python/quickstart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ This command adds the following to `generators.yml`:
7878
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
7979

8080
```bash
81-
fern/ # created in step 1
81+
fern/ # created by fern init
8282
sdks/ # created by fern generate --group sdk
8383
├─ python
8484
├─ __init__.py

fern/products/sdks/overview/ruby/configuration.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ default-group: local
1010
groups:
1111
local:
1212
generators:
13-
- name: fernapi/fern-python
13+
- name: fernapi/fern-ruby
1414
version: <Markdown src="/snippets/version-number.mdx"/>
1515
config:
16-
clientName: YourClientName
16+
clientClassName: YourClientName
1717
```
1818
1919
## SDK Configuration Options

fern/products/sdks/overview/ruby/quickstart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ This command adds the following to `generators.yml`:
7878
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
7979

8080
```bash
81-
fern/ # created in step 1
81+
fern/ # created by fern init
8282
sdks/ # created by fern generate --group sdk
8383
├─ ruby
8484
├─ YourOrganization_api_client.gemspec

fern/products/sdks/overview/typescript/custom-code.mdx

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,19 @@ title: Adding custom code
33
description: Augment your TypeScript SDK with custom utilities
44
---
55

6-
Fern-generated SDKs are designed to be extended with custom code. Your custom
7-
code can add additional functionality to the SDK and live in harmony with the
8-
generated code. This page explains how to configure custom logic using a
9-
`.fernignore` file, create custom SDK methods, and add additional dependencies to your SDK.
6+
<Markdown src="/products/sdks/snippets/custom-code-intro.mdx"/>
107

118
## Adding custom logic
129

13-
If you want your SDK to do more than just make basic API calls (like combining
14-
multiple calls, processing data, adding utilities), you can use `.fernignore` to
15-
protect your custom code from being overwritten during regeneration.
16-
17-
Simply add your custom files to the SDK repository and list them out in `.fernignore`. Fern
18-
won't override any files that you add in `.fernignore`.
19-
20-
To get started adding custom code:
10+
<Markdown src="/products/sdks/snippets/custom-logic-intro.mdx"/>
2111

2212
<Steps>
2313

2414
### Create a new file and add your custom logic
2515

2616
```typescript title="src/helper.ts"
2717
export function myHelper(): void {
28-
return console.log("Hello world!");
18+
return console.log("Hello world!");
2919
}
3020
```
3121

@@ -42,7 +32,7 @@ To get started adding custom code:
4232

4333
### Consume the helper
4434

45-
Now your users can consume the helper function by importing it from the SDK:
35+
<Markdown src="/products/sdks/snippets/consume-method.mdx"/>
4636

4737
```typescript
4838
import { myHelper } from "sdk/helper";
@@ -53,9 +43,7 @@ To get started adding custom code:
5343

5444
## Custom SDK methods
5545

56-
Fern also allows you to add custom methods to the SDK itself (e.g.
57-
`client.my_method()` ). by inheriting the Fern generated client and then
58-
extending it.
46+
<Markdown src="/products/sdks/snippets/custom-sdk-methods-intro.mdx"/>
5947

6048
<Note>
6149
See an example from Flatfile using this process in their [TypeScript SDK](https://github.com/FlatFilers/flatfile-node)
@@ -88,11 +76,11 @@ To get started adding custom code:
8876
Update your `index.ts` file to export the **extended client** instead of the generated client.
8977

9078
```typescript title="src/index.ts"
91-
export { MyClient } from src/wrapper/MyClient; // instead of `src/Client`
79+
export { MyClient } from "src/wrapper/MyClient"; // instead of "src/client"
9280
```
9381

9482
<Note>
95-
See an example [index.ts](https://github.com/FlatFilers/flatfile-node/blob/main/src/index.ts) from Flatline
83+
See an example [index.ts](https://github.com/FlatFilers/flatfile-node/blob/main/src/index.ts) from Flatfile
9684
</Note>
9785

9886
### Update `.fernignore`
@@ -105,13 +93,13 @@ To get started adding custom code:
10593
```
10694

10795
<Note>
108-
See an example [.fernignore](https://github.com/FlatFilers/flatfile-node/blob/main/.fernignore) from Flatline
96+
See an example [.fernignore](https://github.com/FlatFilers/flatfile-node/blob/main/.fernignore) from Flatfile
10997
</Note>
11098

11199

112100
### Consume the method
113101

114-
Now your users can consume the helper function by importing it from the SDK:
102+
<Markdown src="/products/sdks/snippets/consume-method.mdx"/>
115103

116104
```typescript
117105
client.myHelper()

0 commit comments

Comments
 (0)