Skip to content

Commit cf1173b

Browse files
Add C# code snippets to retries documentation (#1587)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Niels Swimberghe <[email protected]>
1 parent df1cb17 commit cf1173b

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

fern/products/sdks/guides/retries-with-backoff.mdx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,34 @@ default retry limit when instantiating the client.
6868
)
6969
```
7070
</CodeBlock>
71+
<CodeBlock title="C#">
72+
```csharp {4}
73+
using Imdb;
74+
75+
var client = new ImdbClient(new ClientOptions {
76+
MaxRetries = 1 // overrides the default retry limit to 1
77+
});
78+
```
79+
</CodeBlock>
80+
<CodeBlock title="Swift">
81+
```swift {5}
82+
import Imdb
83+
84+
let client = ImdbClient(
85+
baseURL: "https://api.imdb.com",
86+
maxRetries: 1 // overrides the default retry limit to 1
87+
)
88+
```
89+
</CodeBlock>
90+
<CodeBlock title="PHP">
91+
```php {4}
92+
use Imdb\ImdbClient;
93+
94+
$client = new ImdbClient([
95+
"maxRetries" => 1 // overrides the default retry limit to 1
96+
]);
97+
```
98+
</CodeBlock>
7199
</CodeBlocks>
72100

73101
It's also possible to override the retry limit on a per-request basis.
@@ -103,5 +131,26 @@ It's also possible to override the retry limit on a per-request basis.
103131
)
104132
```
105133
</CodeBlock>
134+
<CodeBlock title="C#">
135+
```csharp {2}
136+
var movie = await client.Movie.GetAsync("tt0111161", new RequestOptions {
137+
MaxRetries = 3 // overrides the default retry limit to 3
138+
});
139+
```
140+
</CodeBlock>
141+
<CodeBlock title="Swift">
142+
```swift {2}
143+
let movie = try await client.movie.get("tt0111161", requestOptions: RequestOptions(
144+
maxRetries: 3 // overrides the default retry limit to 3
145+
))
146+
```
147+
</CodeBlock>
148+
<CodeBlock title="PHP">
149+
```php {2}
150+
$movie = $client->movie->get("tt0111161", [
151+
"maxRetries" => 3 // overrides the default retry limit to 3
152+
]);
153+
```
154+
</CodeBlock>
106155
</CodeBlocks>
107156

0 commit comments

Comments
 (0)