generated from stijnvanhulle/template
-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: operations for tanstack query
- Loading branch information
1 parent
2e6d2ba
commit 412325a
Showing
22 changed files
with
142 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
export function updatePet() { | ||
return "/pet"; | ||
} | ||
export function addPet() { | ||
return "/pet"; | ||
} | ||
export function findPetsByStatus() { | ||
return "/pet/findByStatus"; | ||
} | ||
export function findPetsByTags() { | ||
return "/pet/findByTags"; | ||
} | ||
export function getPetById() { | ||
return "/pet/{petId}"; | ||
} | ||
export function updatePetWithForm() { | ||
return "/pet/{petId}"; | ||
} | ||
export function deletePet() { | ||
return "/pet/{petId}"; | ||
} | ||
export function uploadFile() { | ||
return "/pet/{petId}/uploadImage"; | ||
} | ||
export function getInventory() { | ||
return "/store/inventory"; | ||
} | ||
export function placeOrder() { | ||
return "/store/order"; | ||
} | ||
export function placeOrderPatch() { | ||
return "/store/order"; | ||
} | ||
export function getOrderById() { | ||
return "/store/order/{orderId}"; | ||
} | ||
export function deleteOrder() { | ||
return "/store/order/{orderId}"; | ||
} | ||
export function createUser() { | ||
return "/user"; | ||
} | ||
export function createUsersWithListInput() { | ||
return "/user/createWithList"; | ||
} | ||
export function loginUser() { | ||
return "/user/login"; | ||
} | ||
export function logoutUser() { | ||
return "/user/logout"; | ||
} | ||
export function getUserByName() { | ||
return "/user/{username}"; | ||
} | ||
export function updateUser() { | ||
return "/user/{username}"; | ||
} | ||
export function deleteUser() { | ||
return "/user/{username}"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Editor, Function, File, useFile, usePlugin } from '@kubb/react' | ||
import { useOperations } from '@kubb/swagger/hooks' | ||
import { Operations } from '@kubb/swagger-tanstack-query/components' | ||
import React from 'react' | ||
import { FileMeta, PluginOptions } from '@kubb/swagger-tanstack-query' | ||
import { Operation } from '@kubb/swagger/oas' | ||
|
||
export const templates = { | ||
...Operations.templates, | ||
editor: function({ children }: React.ComponentProps<typeof Operations.templates.editor>) { | ||
const { key: pluginKey } = usePlugin<PluginOptions>() | ||
|
||
const file = useFile({ name: 'operations', extName: '.ts', pluginKey }) | ||
|
||
return ( | ||
<Editor language="typescript"> | ||
<File<FileMeta> | ||
baseName={file.baseName} | ||
path={file.path} | ||
meta={file.meta} | ||
> | ||
<File.Source> | ||
{children} | ||
</File.Source> | ||
</File> | ||
</Editor> | ||
) | ||
}, | ||
default: function({}: React.ComponentProps<typeof Operations.templates.default>) { | ||
const operations = useOperations() | ||
|
||
return ( | ||
<> | ||
{operations.map((item) => { | ||
return ( | ||
<Function name={item.getOperationId()} export> | ||
return {JSON.stringify(item.path)} | ||
</Function> | ||
) | ||
})} | ||
</> | ||
) | ||
}, | ||
} as const |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters