Skip to content

Commit

Permalink
Merge pull request #978 from hey-api/docs/tanstack-query-plugin
Browse files Browse the repository at this point in the history
docs: add basic TanStack Query plugin description
  • Loading branch information
mrlubos authored Aug 26, 2024
2 parents 26f2b68 + 2e051a5 commit 771d762
Show file tree
Hide file tree
Showing 18 changed files with 825 additions and 798 deletions.
8 changes: 8 additions & 0 deletions .changeset/ten-mice-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@example/openapi-ts-tanstack-svelte-query': patch
'@example/openapi-ts-tanstack-react-query': patch
'@example/openapi-ts-tanstack-vue-query': patch
'@hey-api/docs': patch
---

docs: add basic TanStack Query plugin description
2 changes: 1 addition & 1 deletion docs/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default defineConfig({
},
{
link: '/openapi-ts/tanstack-query',
text: 'TanStack Query <span class="soon">soon</span>',
text: 'TanStack Query',
},
],
text: 'Plugins',
Expand Down
7 changes: 7 additions & 0 deletions docs/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export const embedProject = (projectId: string) => async (event: Event) => {
'openapi-ts.config.ts,src/client/schemas.gen.ts,src/client/services.gen.ts,src/client/types.gen.ts,src/App.tsx',
view: 'editor',
});
case 'hey-api-client-fetch-plugin-tanstack-react-query-example':
return await sdk.embedProjectId(container, projectId, {
height: 700,
openFile:
'openapi-ts.config.ts,src/client/@tanstack/react-query.gen.ts,src/client/types.gen.ts,src/App.tsx',
view: 'editor',
});
case 'hey-api-example':
return await sdk.embedProjectId(container, projectId, {
height: 700,
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ features:
link: /openapi-ts/integrations
linkText: Find out more
- icon: <svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 190 190"><g fill="none" fill-rule="evenodd"><path d="M150.276 61.344c3.093-14.981 3.756-26.471 1.757-34.815-1.189-4.962-3.362-9.01-6.668-11.93-3.49-3.084-7.901-4.597-12.858-4.597-8.178 0-16.775 3.725-25.963 10.802-3.747 2.887-7.636 6.366-11.676 10.44a8.743 8.743 0 0 0-1.09-1.163C82.36 19.915 72.746 13.599 64.523 11.164c-4.89-1.448-9.48-1.586-13.66-.181-4.414 1.483-7.93 4.55-10.41 8.845-4.094 7.089-5.174 16.403-3.648 27.904.623 4.688 1.686 9.794 3.189 15.327a8.725 8.725 0 0 0-1.698.38c-14.489 4.797-24.749 9.955-30.96 15.85-3.696 3.506-6.109 7.41-6.981 11.733-.921 4.562-.023 9.137 2.454 13.43 4.087 7.078 11.6 12.66 22.304 17.082 4.298 1.776 9.161 3.384 14.595 4.83a8.735 8.735 0 0 0-.57 1.776c-3.092 14.98-3.756 26.47-1.756 34.814 1.188 4.962 3.362 9.01 6.667 11.93 3.49 3.084 7.902 4.597 12.86 4.597 8.177 0 16.774-3.725 25.962-10.802 3.787-2.917 7.72-6.44 11.805-10.57.42.656.936 1.267 1.546 1.81 11.42 10.166 21.034 16.482 29.257 18.917 4.89 1.448 9.48 1.586 13.66.181 4.414-1.483 7.93-4.55 10.41-8.845 4.094-7.089 5.174-16.403 3.648-27.904-.645-4.857-1.764-10.164-3.354-15.929a8.715 8.715 0 0 0 1.863-.398c14.489-4.797 24.749-9.955 30.96-15.85 3.696-3.506 6.109-7.41 6.981-11.733.921-4.562.023-9.137-2.454-13.43-4.087-7.078-11.6-12.66-22.304-17.082-4.427-1.828-9.452-3.48-15.082-4.959.2-.49.36-1.006.47-1.543Z" fill="#002C4B" fill-rule="nonzero"/><path d="M80.397 64h29.211a5 5 0 0 1 4.337 2.512l14.632 25.5a5 5 0 0 1 0 4.976l-14.632 25.5a5 5 0 0 1-4.337 2.512H80.397a5 5 0 0 1-4.337-2.512l-14.632-25.5a5 5 0 0 1 0-4.976l14.632-25.5A5 5 0 0 1 80.397 64Zm25.59 6.277a5 5 0 0 1 4.339 2.513l11.017 19.224a5 5 0 0 1 0 4.972l-11.017 19.224a5 5 0 0 1-4.338 2.513h-21.97a5 5 0 0 1-4.339-2.513L68.662 96.986a5 5 0 0 1 0-4.972L79.679 72.79a5 5 0 0 1 4.338-2.513h21.97Zm-3.906 6.864H87.924a5 5 0 0 0-4.335 2.51l-7.1 12.358a5 5 0 0 0 0 4.982l7.1 12.358a5 5 0 0 0 4.335 2.51h14.157a5 5 0 0 0 4.335-2.51l7.1-12.358a5 5 0 0 0 0-4.982l-7.1-12.358a5 5 0 0 0-4.335-2.51Zm-3.762 6.571a5 5 0 0 1 4.334 2.506l3.33 5.788a5 5 0 0 1 0 4.988l-3.33 5.788a5 5 0 0 1-4.334 2.506h-6.633a5 5 0 0 1-4.334-2.506l-3.33-5.788a5 5 0 0 1 0-4.988l3.33-5.788a5 5 0 0 1 4.334-2.506h6.633Zm-3.315 6.473a4.313 4.313 0 1 0-.003 8.63 4.313 4.313 0 1 0 .003-8.63ZM60 94.5h7.768" fill="#FFD94C"/><path d="M54.86 108.358a2.713 2.713 0 0 1 3.718 1.041l.475.845a269.421 269.421 0 0 0 11.888 19.191c4.867 7.15 10.34 14.39 16.421 21.716a2.776 2.776 0 0 1-.296 3.847l-.612.537c-20.107 17.568-33.176 21.078-39.206 10.527-5.898-10.32-3.764-29.08 6.403-56.28a2.748 2.748 0 0 1 1.21-1.424Zm85.674 20.684a2.708 2.708 0 0 1 3.126 2.152l.153.792c4.97 26.01 1.47 39.014-10.497 39.014-11.706 0-26.607-11.091-44.703-33.273a2.725 2.725 0 0 1-.613-1.745 2.712 2.712 0 0 1 2.73-2.694l.955.007c7.62.041 15.03-.223 22.226-.794 8.498-.673 17.373-1.826 26.623-3.46Zm6.875-55.23c.523-1.41 2.1-2.149 3.546-1.663l.788.266c25.84 8.803 35.66 18.477 29.455 29.022-6.068 10.314-23.714 17.823-52.936 22.527a2.852 2.852 0 0 1-1.88-.345 2.726 2.726 0 0 1-.993-3.772l.5-.837c3.988-6.694 7.592-13.356 10.813-19.986 3.803-7.83 7.372-16.233 10.707-25.212Zm-85.67-7.776a2.852 2.852 0 0 1 1.878.345 2.726 2.726 0 0 1 .994 3.772l-.5.837c-3.988 6.694-7.592 13.356-10.813 19.986-3.803 7.83-7.372 16.233-10.707 25.212-.523 1.41-2.1 2.149-3.546 1.663l-.788-.266c-25.84-8.803-35.66-18.477-29.455-29.022C14.87 78.25 32.516 70.74 61.738 66.036Zm41.807-31.57c20.107-17.57 33.176-21.079 39.206-10.528 5.898 10.32 3.764 29.08-6.403 56.28a2.748 2.748 0 0 1-1.21 1.424 2.713 2.713 0 0 1-3.717-1.041l-.475-.845a269.421 269.421 0 0 0-11.888-19.191c-4.867-7.15-10.34-14.39-16.421-21.716a2.776 2.776 0 0 1 .296-3.847ZM57.684 18c11.706 0 26.607 11.091 44.703 33.273.402.492.618 1.11.613 1.745a2.712 2.712 0 0 1-2.73 2.694l-.955-.007c-7.62-.041-15.03.223-22.226.794-8.498.673-17.373 1.826-26.623 3.46a2.708 2.708 0 0 1-3.126-2.153l-.153-.792C42.217 31.004 45.717 18 57.684 18Z" fill="#FF4154"/></g></svg>
title: TanStack Query <span class="soon">Soon</span>
details: Generate query keys and query functions. Use them with our REST clients or bring your own.
title: TanStack Query
details: Generate query keys and functions. Use them with our REST clients or bring your own.
link: /openapi-ts/tanstack-query
linkText: Find out more
---
Expand Down
6 changes: 3 additions & 3 deletions docs/openapi-ts/clients/axios.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ bun add @hey-api/client-axios

Ensure you have already [configured](/openapi-ts/get-started) `@hey-api/openapi-ts`. Update your configuration to use the Axios client package.

```js{2}
```js
export default {
client: '@hey-api/client-axios',
client: '@hey-api/client-axios', // [!code ++]
input: 'path/to/openapi.json',
output: 'src/client',
}
};
```

You can now run `openapi-ts` to use the new Axios client. 🎉
Expand Down
6 changes: 3 additions & 3 deletions docs/openapi-ts/clients/fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ bun add @hey-api/client-fetch

Ensure you have already [configured](/openapi-ts/get-started) `@hey-api/openapi-ts`. Update your configuration to use the Fetch API client package.

```js{2}
```js
export default {
client: '@hey-api/client-fetch',
client: '@hey-api/client-fetch', // [!code ++]
input: 'path/to/openapi.json',
output: 'src/client',
}
};
```

You can now run `openapi-ts` to use the new Fetch API client. 🎉
Expand Down
30 changes: 15 additions & 15 deletions docs/openapi-ts/clients/legacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,44 @@ Before standalone client packages, clients were generated using `@hey-api/openap

::: code-group

```js{2} [fetch]
```js [fetch]
export default {
client: 'fetch',
client: 'fetch', // [!code ++]
input: 'path/to/openapi.json',
output: 'src/client',
}
};
```

```js{2} [axios]
```js [axios]
export default {
client: 'axios',
client: 'axios', // [!code ++]
input: 'path/to/openapi.json',
output: 'src/client',
}
};
```

```js{2} [angular]
```js [angular]
export default {
client: 'angular',
client: 'angular', // [!code ++]
input: 'path/to/openapi.json',
output: 'src/client',
}
};
```

```js{2} [node]
```js [node]
export default {
client: 'node',
client: 'node', // [!code ++]
input: 'path/to/openapi.json',
output: 'src/client',
}
};
```

```js{2} [xhr]
```js [xhr]
export default {
client: 'xhr',
client: 'xhr', // [!code ++]
input: 'path/to/openapi.json',
output: 'src/client',
}
};
```

:::
Expand Down
72 changes: 36 additions & 36 deletions docs/openapi-ts/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,37 +84,37 @@ By default, `@hey-api/openapi-ts` will only emit enums as types. You may want to

::: code-group

```js{6} [disabled]
```js [disabled]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: 'src/client',
types: {
enums: false,
enums: false, // [!code ++]
},
}
};
```

```js{6} [javascript]
```js [javascript]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: 'src/client',
types: {
enums: 'javascript',
enums: 'javascript', // [!code ++]
},
}
};
```

```js{6} [typescript]
```js [typescript]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: 'src/client',
types: {
enums: 'typescript',
enums: 'typescript', // [!code ++]
},
}
};
```

:::
Expand All @@ -127,35 +127,35 @@ By default, `@hey-api/openapi-ts` generates schemas from your OpenAPI specificat

::: code-group

```js{6} [json]
```js [json]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: 'src/client',
schemas: {
type: 'json'
type: 'json', // [!code ++]
},
}
};
```

```js{6} [form]
```js [form]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: 'src/client',
schemas: {
type: 'form'
type: 'form', // [!code ++]
},
}
};
```

```js{5} [disabled]
```js [disabled]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: 'src/client',
schemas: false,
}
schemas: false, // [!code ++]
};
```

:::
Expand All @@ -166,37 +166,37 @@ By default, `@hey-api/openapi-ts` will not automatically format your output. To

::: code-group

```js{5} [disabled]
```js [disabled]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: {
format: false,
format: false, // [!code ++]
path: 'src/client',
},
}
};
```

```js{5} [prettier]
```js [prettier]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: {
format: 'prettier',
format: 'prettier', // [!code ++]
path: 'src/client',
},
}
};
```

```js{5} [biome]
```js [biome]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: {
format: 'biome',
format: 'biome', // [!code ++]
path: 'src/client',
},
}
};
```

:::
Expand All @@ -209,37 +209,37 @@ By default, `@hey-api/openapi-ts` will not automatically lint your output. To en

::: code-group

```js{5} [disabled]
```js [disabled]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: {
lint: false,
lint: false, // [!code ++]
path: 'src/client',
},
}
};
```

```js{5} [eslint]
```js [eslint]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: {
lint: 'eslint',
lint: 'eslint', // [!code ++]
path: 'src/client',
},
}
};
```

```js{5} [biome]
```js [biome]
export default {
client: '@hey-api/client-fetch',
input: 'path/to/openapi.json',
output: {
lint: 'biome',
lint: 'biome', // [!code ++]
path: 'src/client',
},
}
};
```

:::
Expand Down
Loading

0 comments on commit 771d762

Please sign in to comment.