fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #2181 from hey-api/docs/client-custom-implementation

docs: add client section on custom implementation

authored by

Lubos and committed by
GitHub
a18dd003 2bae35a6

+68 -4
+17 -1
docs/openapi-ts/clients/axios.md
··· 64 64 65 65 ### `setConfig()` 66 66 67 - This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Axios configuration option to `setConfig()` (except for `auth`), and even your own Axios implementation. 67 + This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Axios configuration option to `setConfig()` (except for `auth`), and even your own [Axios](#custom-axios) implementation. 68 68 69 69 ```js 70 70 import { client } from 'client/client.gen'; ··· 205 205 }); 206 206 console.log(url); // prints '/foo/1?bar=baz' 207 207 ``` 208 + 209 + ## Custom `axios` 210 + 211 + You can implement your own `axios` instance. This is useful if you need to extend the default `axios` instance with extra functionality, or replace it altogether. 212 + 213 + ```js 214 + import { client } from 'client/client.gen'; 215 + 216 + client.setConfig({ 217 + axios: () => { 218 + /* custom `axios` instance */ 219 + }, 220 + }); 221 + ``` 222 + 223 + You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom instance to be. 208 224 209 225 <!--@include: ../../examples.md--> 210 226 <!--@include: ../../sponsors.md-->
+17 -1
docs/openapi-ts/clients/fetch.md
··· 70 70 71 71 ### `setConfig()` 72 72 73 - This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Fetch API configuration option to `setConfig()`, and even your own Fetch implementation. 73 + This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Fetch API configuration option to `setConfig()`, and even your own [Fetch](#custom-fetch) implementation. 74 74 75 75 ```js 76 76 import { client } from 'client/client.gen'; ··· 282 282 }); 283 283 console.log(url); // prints '/foo/1?bar=baz' 284 284 ``` 285 + 286 + ## Custom `fetch` 287 + 288 + You can implement your own `fetch` method. This is useful if you need to extend the default `fetch` method with extra functionality, or replace it altogether. 289 + 290 + ```js 291 + import { client } from 'client/client.gen'; 292 + 293 + client.setConfig({ 294 + fetch: () => { 295 + /* custom `fetch` method */ 296 + }, 297 + }); 298 + ``` 299 + 300 + You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom method to be. 285 301 286 302 <!--@include: ../../examples.md--> 287 303 <!--@include: ../../sponsors.md-->
+17 -1
docs/openapi-ts/clients/next-js.md
··· 92 92 93 93 ### `setConfig()` 94 94 95 - This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Fetch API configuration option to `setConfig()`, and even your own Fetch implementation. 95 + This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Fetch API configuration option to `setConfig()`, and even your own [Fetch](#custom-fetch) implementation. 96 96 97 97 ```js 98 98 import { client } from 'client/client.gen'; ··· 269 269 }); 270 270 console.log(url); // prints '/foo/1?bar=baz' 271 271 ``` 272 + 273 + ## Custom `fetch` 274 + 275 + You can implement your own `fetch` method. This is useful if you need to extend the default `fetch` method with extra functionality, or replace it altogether. 276 + 277 + ```js 278 + import { client } from 'client/client.gen'; 279 + 280 + client.setConfig({ 281 + fetch: () => { 282 + /* custom `fetch` method */ 283 + }, 284 + }); 285 + ``` 286 + 287 + You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom method to be. 272 288 273 289 <!--@include: ../../examples.md--> 274 290 <!--@include: ../../sponsors.md-->
+17 -1
docs/openapi-ts/clients/nuxt.md
··· 86 86 87 87 ### `setConfig()` 88 88 89 - This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Nuxt configuration option to `setConfig()`, and even your own `$fetch` implementation. 89 + This is the simpler approach. You can call the `setConfig()` method at the beginning of your application or anytime you need to update the client configuration. You can pass any Nuxt configuration option to `setConfig()`, and even your own [`$fetch`](#custom-fetch) implementation. 90 90 91 91 ```js 92 92 import { client } from 'client/client.gen'; ··· 231 231 }); 232 232 console.log(url); // prints '/foo/1?bar=baz' 233 233 ``` 234 + 235 + ## Custom `$fetch` 236 + 237 + You can implement your own `$fetch` method. This is useful if you need to extend the default `$fetch` method with extra functionality, or replace it altogether. 238 + 239 + ```js 240 + import { client } from 'client/client.gen'; 241 + 242 + client.setConfig({ 243 + $fetch: () => { 244 + /* custom `$fetch` method */ 245 + }, 246 + }); 247 + ``` 248 + 249 + You can use any of the approaches mentioned in [Configuration](#configuration), depending on how granular you want your custom method to be. 234 250 235 251 <!--@include: ../../examples.md--> 236 252 <!--@include: ../../sponsors.md-->