Skip to content

Commit 0d82f8e

Browse files
Add Swift and PHP retry snippets, verified retry support exists
- Added Swift examples for client-level and request-level retry configuration - Added PHP examples for client-level and request-level retry configuration - Verified retry support exists in generated SDKs before adding examples - Ruby retry support not implemented (parameter exists but not used in RawClient) Co-Authored-By: Niels Swimberghe <[email protected]>
1 parent e4c9ae2 commit 0d82f8e

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,25 @@ default retry limit when instantiating the client.
7777
});
7878
```
7979
</CodeBlock>
80+
<CodeBlock title="Swift">
81+
```swift {4}
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 {3}
92+
use Imdb\ImdbClient;
93+
94+
$client = new ImdbClient([
95+
"maxRetries" => 1 // overrides the default retry limit to 1
96+
]);
97+
```
98+
</CodeBlock>
8099
</CodeBlocks>
81100

82101
It's also possible to override the retry limit on a per-request basis.
@@ -119,5 +138,19 @@ It's also possible to override the retry limit on a per-request basis.
119138
});
120139
```
121140
</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>
122155
</CodeBlocks>
123156

0 commit comments

Comments
 (0)