@qualisero/openapi-endpoint 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/openapi-endpoint.d.ts.map +1 -1
- package/dist/openapi-endpoint.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,4 +58,28 @@ const api = useOpenApi({
|
|
|
58
58
|
operations: operationInfoDict as OperationsWithInfo,
|
|
59
59
|
axios: axiosInstance,
|
|
60
60
|
})
|
|
61
|
+
|
|
62
|
+
// Export for use in other parts of your application
|
|
63
|
+
export { api }
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 2. Use the API in your components
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// In your Vue components
|
|
70
|
+
import { api } from './api/init'
|
|
71
|
+
import { OperationId } from './generated/api-operations'
|
|
72
|
+
|
|
73
|
+
// Use queries for GET operations
|
|
74
|
+
const { data: pets, isLoading } = api.useQuery(OperationId.listPets, {})
|
|
75
|
+
const { data: pet } = api.useQuery(OperationId.getPet, { petId: '123' })
|
|
76
|
+
|
|
77
|
+
// Use mutations for POST/PUT/PATCH/DELETE operations
|
|
78
|
+
const createPetMutation = api.useMutation(OperationId.createPet, {})
|
|
79
|
+
const updatePetMutation = api.useMutation(OperationId.updatePet, { petId: '123' })
|
|
80
|
+
|
|
81
|
+
// Execute mutations
|
|
82
|
+
await createPetMutation.mutateAsync({
|
|
83
|
+
data: { name: 'Fluffy', species: 'cat' },
|
|
84
|
+
})
|
|
61
85
|
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-endpoint.d.ts","sourceRoot":"","sources":["../src/openapi-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAoB,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,sBAAsB,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,EACf,OAAO,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAC/C,mBAAmB,CAAC,EAChB,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,GAC/D,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,eAAe,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAC/F,aAAa,CAAC,EAAE,gBAAgB,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,eAAe,CAAC,GAAG,EAAE,EAAE,CAAC,GACxG,gBAAgB,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,IAAI,GAAG,mBAAmB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,sBAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,CAkBzG"}
|
package/dist/openapi-endpoint.js
CHANGED
|
@@ -26,7 +26,7 @@ import { useEndpointMutation } from './openapi-mutation';
|
|
|
26
26
|
* @param optionsOrNull Optional query or mutation options, including Vue Query options.
|
|
27
27
|
* @returns Query or mutation object with strict typing and helpers.
|
|
28
28
|
*/
|
|
29
|
-
export function useEndpoint(operationId, helpers, pathParamsOrOptions, optionsOrNull
|
|
29
|
+
export function useEndpoint(operationId, helpers, pathParamsOrOptions, optionsOrNull) {
|
|
30
30
|
if (helpers.isMutationOperation(operationId)) {
|
|
31
31
|
return useEndpointMutation(operationId, helpers, pathParamsOrOptions, optionsOrNull);
|
|
32
32
|
}
|