feat: orval generate
This commit is contained in:
parent
0f08a7007d
commit
9d44b23565
6
app.vue
6
app.vue
|
@ -5,10 +5,12 @@
|
|||
<div class="flex justify-between">
|
||||
<h1>Welcome to Nuxt UI Starter</h1>
|
||||
<ColorScheme><USelect v-model="$colorMode.preference" :options="['system', 'light', 'dark']" /></ColorScheme>
|
||||
<UButton icon="i-heroicons-pencil-square"/>
|
||||
<UButton icon="i-heroicons-pencil-square" />
|
||||
</div>
|
||||
</template>
|
||||
<UButton icon="i-heroicons-book-open" to="https://ui.nuxt.com" target="_blank">Open Nuxt UI Documentation</UButton>
|
||||
<UButton icon="i-heroicons-book-open" to="https://ui.nuxt.com" target="_blank">
|
||||
Open Nuxt UI Documentation
|
||||
</UButton>
|
||||
</UCard>
|
||||
</UContainer>
|
||||
</template>
|
||||
|
|
|
@ -7,7 +7,7 @@ export default defineConfig({
|
|||
target: 'src/cakes.ts',
|
||||
schemas: 'src/shared/model',
|
||||
client: 'vue-query',
|
||||
mock: true,
|
||||
// mock: true,
|
||||
},
|
||||
input: './cakes.json',
|
||||
},
|
||||
|
|
10
package.json
10
package.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "nuxt-app",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "nuxt build",
|
||||
"dev": "nuxt dev",
|
||||
|
@ -9,6 +9,9 @@
|
|||
"preview": "nuxt preview",
|
||||
"postinstall": "nuxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/vue-query": "^5.51.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^2.24.0",
|
||||
"@nuxt/devtools": "latest",
|
||||
|
@ -22,8 +25,5 @@
|
|||
"typescript": "^5.5.4",
|
||||
"unocss": "^0.61.7",
|
||||
"vue-tsc": "^1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/vue-query": "^5.51.15"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
import type {
|
||||
DehydratedState,
|
||||
VueQueryPluginOptions,
|
||||
DehydratedState,
|
||||
VueQueryPluginOptions,
|
||||
} from '@tanstack/vue-query'
|
||||
import {
|
||||
VueQueryPlugin,
|
||||
QueryClient,
|
||||
hydrate,
|
||||
dehydrate,
|
||||
QueryClient,
|
||||
VueQueryPlugin,
|
||||
dehydrate,
|
||||
hydrate,
|
||||
} from '@tanstack/vue-query'
|
||||
// Nuxt 3 app aliases
|
||||
import { defineNuxtPlugin, useState } from '#imports'
|
||||
|
||||
export default defineNuxtPlugin((nuxt) => {
|
||||
const vueQueryState = useState<DehydratedState | null>('vue-query')
|
||||
const vueQueryState = useState<DehydratedState | null>('vue-query')
|
||||
|
||||
// Modify your Vue Query global settings here
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { staleTime: 5000 } },
|
||||
// Modify your Vue Query global settings here
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { staleTime: 5000 } },
|
||||
})
|
||||
const options: VueQueryPluginOptions = { queryClient }
|
||||
|
||||
nuxt.vueApp.use(VueQueryPlugin, options)
|
||||
|
||||
if (import.meta.server) {
|
||||
nuxt.hooks.hook('app:rendered', () => {
|
||||
vueQueryState.value = dehydrate(queryClient)
|
||||
})
|
||||
const options: VueQueryPluginOptions = { queryClient }
|
||||
}
|
||||
|
||||
nuxt.vueApp.use(VueQueryPlugin, options)
|
||||
|
||||
if (import.meta.server) {
|
||||
nuxt.hooks.hook('app:rendered', () => {
|
||||
vueQueryState.value = dehydrate(queryClient)
|
||||
})
|
||||
}
|
||||
|
||||
if (import.meta.client) {
|
||||
nuxt.hooks.hook('app:created', () => {
|
||||
hydrate(queryClient, vueQueryState.value)
|
||||
})
|
||||
}
|
||||
if (import.meta.client) {
|
||||
nuxt.hooks.hook('app:created', () => {
|
||||
hydrate(queryClient, vueQueryState.value)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
@ -0,0 +1,327 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import {
|
||||
useMutation,
|
||||
useQuery,
|
||||
} from '@tanstack/vue-query'
|
||||
import type {
|
||||
MutationFunction,
|
||||
QueryFunction,
|
||||
QueryKey,
|
||||
UseMutationOptions,
|
||||
UseMutationReturnType,
|
||||
UseQueryOptions,
|
||||
UseQueryReturnType,
|
||||
} from '@tanstack/vue-query'
|
||||
import axios from 'axios'
|
||||
import type {
|
||||
AxiosError,
|
||||
AxiosRequestConfig,
|
||||
AxiosResponse,
|
||||
} from 'axios'
|
||||
import {
|
||||
computed,
|
||||
unref,
|
||||
} from 'vue'
|
||||
import type {
|
||||
MaybeRef,
|
||||
} from 'vue'
|
||||
import type {
|
||||
ApiHttpBody,
|
||||
CRMSearchParams,
|
||||
CrabscrmOrder,
|
||||
CrmBreadcrumbsRsp,
|
||||
CrmCartRsp,
|
||||
CrmCatalogRsp,
|
||||
CrmOrderItem,
|
||||
CrmOrderRsp,
|
||||
CrmPositionsRsp,
|
||||
CrmProductRsp,
|
||||
RpcStatus,
|
||||
} from '.././shared/model'
|
||||
|
||||
export function cRMGetCart(crmOrderItem: MaybeRef<CrmOrderItem[]>, options?: AxiosRequestConfig): Promise<AxiosResponse<CrmCartRsp>> {
|
||||
crmOrderItem = unref(crmOrderItem)
|
||||
return axios.post(
|
||||
`/cart`,
|
||||
crmOrderItem,
|
||||
options,
|
||||
)
|
||||
}
|
||||
|
||||
export function getCRMGetCartMutationOptions<TError = AxiosError<RpcStatus>, TContext = unknown>(options?: { mutation?: UseMutationOptions<Awaited<ReturnType<typeof cRMGetCart>>, TError, { data: CrmOrderItem[] }, TContext>, axios?: AxiosRequestConfig }): UseMutationOptions<Awaited<ReturnType<typeof cRMGetCart>>, TError, { data: CrmOrderItem[] }, TContext> {
|
||||
const { mutation: mutationOptions, axios: axiosOptions } = options ?? {}
|
||||
|
||||
const mutationFn: MutationFunction<Awaited<ReturnType<typeof cRMGetCart>>, { data: CrmOrderItem[] }> = (props) => {
|
||||
const { data } = props ?? {}
|
||||
|
||||
return cRMGetCart(data, axiosOptions)
|
||||
}
|
||||
|
||||
return { mutationFn, ...mutationOptions }
|
||||
}
|
||||
|
||||
export type CRMGetCartMutationResult = NonNullable<Awaited<ReturnType<typeof cRMGetCart>>>
|
||||
export type CRMGetCartMutationBody = CrmOrderItem[]
|
||||
export type CRMGetCartMutationError = AxiosError<RpcStatus>
|
||||
|
||||
export function useCRMGetCart<TError = AxiosError<RpcStatus>, TContext = unknown>(options?: { mutation?: UseMutationOptions<Awaited<ReturnType<typeof cRMGetCart>>, TError, { data: CrmOrderItem[] }, TContext>, axios?: AxiosRequestConfig }): UseMutationReturnType<
|
||||
Awaited<ReturnType<typeof cRMGetCart>>,
|
||||
TError,
|
||||
{ data: CrmOrderItem[] },
|
||||
TContext
|
||||
> {
|
||||
const mutationOptions = getCRMGetCartMutationOptions(options)
|
||||
|
||||
return useMutation(mutationOptions)
|
||||
}
|
||||
export function cRMGetCatalog(options?: AxiosRequestConfig): Promise<AxiosResponse<CrmCatalogRsp>> {
|
||||
return axios.get(
|
||||
`/catalog`,
|
||||
options,
|
||||
)
|
||||
}
|
||||
|
||||
export function getCRMGetCatalogQueryKey() {
|
||||
return ['catalog'] as const
|
||||
}
|
||||
|
||||
export function getCRMGetCatalogQueryOptions<TData = Awaited<ReturnType<typeof cRMGetCatalog>>, TError = AxiosError<RpcStatus>>(options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMGetCatalog>>, TError, TData>>, axios?: AxiosRequestConfig }) {
|
||||
const { query: queryOptions, axios: axiosOptions } = options ?? {}
|
||||
|
||||
const queryKey = getCRMGetCatalogQueryKey()
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof cRMGetCatalog>>> = ({ signal }) => cRMGetCatalog({ signal, ...axiosOptions })
|
||||
|
||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<Awaited<ReturnType<typeof cRMGetCatalog>>, TError, TData>
|
||||
}
|
||||
|
||||
export type CRMGetCatalogQueryResult = NonNullable<Awaited<ReturnType<typeof cRMGetCatalog>>>
|
||||
export type CRMGetCatalogQueryError = AxiosError<RpcStatus>
|
||||
|
||||
export function useCRMGetCatalog<TData = Awaited<ReturnType<typeof cRMGetCatalog>>, TError = AxiosError<RpcStatus>>(options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMGetCatalog>>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getCRMGetCatalogQueryOptions(options)
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryReturnType<TData, TError> & { queryKey: QueryKey }
|
||||
|
||||
query.queryKey = unref(queryOptions).queryKey as QueryKey
|
||||
|
||||
return query
|
||||
}
|
||||
|
||||
export function cRMGetImage(name: MaybeRef<string>, options?: AxiosRequestConfig): Promise<AxiosResponse<ApiHttpBody>> {
|
||||
name = unref(name)
|
||||
return axios.get(
|
||||
`/images/${name}`,
|
||||
options,
|
||||
)
|
||||
}
|
||||
|
||||
export function getCRMGetImageQueryKey(name: MaybeRef<string>) {
|
||||
return ['images', name] as const
|
||||
}
|
||||
|
||||
export function getCRMGetImageQueryOptions<TData = Awaited<ReturnType<typeof cRMGetImage>>, TError = AxiosError<RpcStatus>>(name: MaybeRef<string>, options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMGetImage>>, TError, TData>>, axios?: AxiosRequestConfig }) {
|
||||
const { query: queryOptions, axios: axiosOptions } = options ?? {}
|
||||
|
||||
const queryKey = getCRMGetImageQueryKey(name)
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof cRMGetImage>>> = ({ signal }) => cRMGetImage(name, { signal, ...axiosOptions })
|
||||
|
||||
return { queryKey, queryFn, enabled: computed(() => !!(unref(name))), ...queryOptions } as UseQueryOptions<Awaited<ReturnType<typeof cRMGetImage>>, TError, TData>
|
||||
}
|
||||
|
||||
export type CRMGetImageQueryResult = NonNullable<Awaited<ReturnType<typeof cRMGetImage>>>
|
||||
export type CRMGetImageQueryError = AxiosError<RpcStatus>
|
||||
|
||||
export function useCRMGetImage<TData = Awaited<ReturnType<typeof cRMGetImage>>, TError = AxiosError<RpcStatus>>(name: MaybeRef<string>, options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMGetImage>>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getCRMGetImageQueryOptions(name, options)
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryReturnType<TData, TError> & { queryKey: QueryKey }
|
||||
|
||||
query.queryKey = unref(queryOptions).queryKey as QueryKey
|
||||
|
||||
return query
|
||||
}
|
||||
|
||||
export function cRMOrder(crabscrmOrder: MaybeRef<CrabscrmOrder>, options?: AxiosRequestConfig): Promise<AxiosResponse<CrmOrderRsp>> {
|
||||
crabscrmOrder = unref(crabscrmOrder)
|
||||
return axios.post(
|
||||
`/orders`,
|
||||
crabscrmOrder,
|
||||
options,
|
||||
)
|
||||
}
|
||||
|
||||
export function getCRMOrderMutationOptions<TError = AxiosError<RpcStatus>, TContext = unknown>(options?: { mutation?: UseMutationOptions<Awaited<ReturnType<typeof cRMOrder>>, TError, { data: CrabscrmOrder }, TContext>, axios?: AxiosRequestConfig }): UseMutationOptions<Awaited<ReturnType<typeof cRMOrder>>, TError, { data: CrabscrmOrder }, TContext> {
|
||||
const { mutation: mutationOptions, axios: axiosOptions } = options ?? {}
|
||||
|
||||
const mutationFn: MutationFunction<Awaited<ReturnType<typeof cRMOrder>>, { data: CrabscrmOrder }> = (props) => {
|
||||
const { data } = props ?? {}
|
||||
|
||||
return cRMOrder(data, axiosOptions)
|
||||
}
|
||||
|
||||
return { mutationFn, ...mutationOptions }
|
||||
}
|
||||
|
||||
export type CRMOrderMutationResult = NonNullable<Awaited<ReturnType<typeof cRMOrder>>>
|
||||
export type CRMOrderMutationBody = CrabscrmOrder
|
||||
export type CRMOrderMutationError = AxiosError<RpcStatus>
|
||||
|
||||
export function useCRMOrder<TError = AxiosError<RpcStatus>, TContext = unknown>(options?: { mutation?: UseMutationOptions<Awaited<ReturnType<typeof cRMOrder>>, TError, { data: CrabscrmOrder }, TContext>, axios?: AxiosRequestConfig }): UseMutationReturnType<
|
||||
Awaited<ReturnType<typeof cRMOrder>>,
|
||||
TError,
|
||||
{ data: CrabscrmOrder },
|
||||
TContext
|
||||
> {
|
||||
const mutationOptions = getCRMOrderMutationOptions(options)
|
||||
|
||||
return useMutation(mutationOptions)
|
||||
}
|
||||
export function cRMGetPositions(id: MaybeRef<string>, options?: AxiosRequestConfig): Promise<AxiosResponse<CrmPositionsRsp>> {
|
||||
id = unref(id)
|
||||
return axios.get(
|
||||
`/positions/${id}`,
|
||||
options,
|
||||
)
|
||||
}
|
||||
|
||||
export function getCRMGetPositionsQueryKey(id: MaybeRef<string>) {
|
||||
return ['positions', id] as const
|
||||
}
|
||||
|
||||
export function getCRMGetPositionsQueryOptions<TData = Awaited<ReturnType<typeof cRMGetPositions>>, TError = AxiosError<RpcStatus>>(id: MaybeRef<string>, options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMGetPositions>>, TError, TData>>, axios?: AxiosRequestConfig }) {
|
||||
const { query: queryOptions, axios: axiosOptions } = options ?? {}
|
||||
|
||||
const queryKey = getCRMGetPositionsQueryKey(id)
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof cRMGetPositions>>> = ({ signal }) => cRMGetPositions(id, { signal, ...axiosOptions })
|
||||
|
||||
return { queryKey, queryFn, enabled: computed(() => !!(unref(id))), ...queryOptions } as UseQueryOptions<Awaited<ReturnType<typeof cRMGetPositions>>, TError, TData>
|
||||
}
|
||||
|
||||
export type CRMGetPositionsQueryResult = NonNullable<Awaited<ReturnType<typeof cRMGetPositions>>>
|
||||
export type CRMGetPositionsQueryError = AxiosError<RpcStatus>
|
||||
|
||||
export function useCRMGetPositions<TData = Awaited<ReturnType<typeof cRMGetPositions>>, TError = AxiosError<RpcStatus>>(id: MaybeRef<string>, options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMGetPositions>>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getCRMGetPositionsQueryOptions(id, options)
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryReturnType<TData, TError> & { queryKey: QueryKey }
|
||||
|
||||
query.queryKey = unref(queryOptions).queryKey as QueryKey
|
||||
|
||||
return query
|
||||
}
|
||||
|
||||
export function cRMGetProduct(id: MaybeRef<string>, options?: AxiosRequestConfig): Promise<AxiosResponse<CrmProductRsp>> {
|
||||
id = unref(id)
|
||||
return axios.get(
|
||||
`/products/${id}`,
|
||||
options,
|
||||
)
|
||||
}
|
||||
|
||||
export function getCRMGetProductQueryKey(id: MaybeRef<string>) {
|
||||
return ['products', id] as const
|
||||
}
|
||||
|
||||
export function getCRMGetProductQueryOptions<TData = Awaited<ReturnType<typeof cRMGetProduct>>, TError = AxiosError<RpcStatus>>(id: MaybeRef<string>, options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMGetProduct>>, TError, TData>>, axios?: AxiosRequestConfig }) {
|
||||
const { query: queryOptions, axios: axiosOptions } = options ?? {}
|
||||
|
||||
const queryKey = getCRMGetProductQueryKey(id)
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof cRMGetProduct>>> = ({ signal }) => cRMGetProduct(id, { signal, ...axiosOptions })
|
||||
|
||||
return { queryKey, queryFn, enabled: computed(() => !!(unref(id))), ...queryOptions } as UseQueryOptions<Awaited<ReturnType<typeof cRMGetProduct>>, TError, TData>
|
||||
}
|
||||
|
||||
export type CRMGetProductQueryResult = NonNullable<Awaited<ReturnType<typeof cRMGetProduct>>>
|
||||
export type CRMGetProductQueryError = AxiosError<RpcStatus>
|
||||
|
||||
export function useCRMGetProduct<TData = Awaited<ReturnType<typeof cRMGetProduct>>, TError = AxiosError<RpcStatus>>(id: MaybeRef<string>, options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMGetProduct>>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getCRMGetProductQueryOptions(id, options)
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryReturnType<TData, TError> & { queryKey: QueryKey }
|
||||
|
||||
query.queryKey = unref(queryOptions).queryKey as QueryKey
|
||||
|
||||
return query
|
||||
}
|
||||
|
||||
export function cRMGetBreadcrumbs(id: MaybeRef<string>, options?: AxiosRequestConfig): Promise<AxiosResponse<CrmBreadcrumbsRsp>> {
|
||||
id = unref(id)
|
||||
return axios.get(
|
||||
`/products/${id}/breadcrumbs`,
|
||||
options,
|
||||
)
|
||||
}
|
||||
|
||||
export function getCRMGetBreadcrumbsQueryKey(id: MaybeRef<string>) {
|
||||
return ['products', id, 'breadcrumbs'] as const
|
||||
}
|
||||
|
||||
export function getCRMGetBreadcrumbsQueryOptions<TData = Awaited<ReturnType<typeof cRMGetBreadcrumbs>>, TError = AxiosError<RpcStatus>>(id: MaybeRef<string>, options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMGetBreadcrumbs>>, TError, TData>>, axios?: AxiosRequestConfig }) {
|
||||
const { query: queryOptions, axios: axiosOptions } = options ?? {}
|
||||
|
||||
const queryKey = getCRMGetBreadcrumbsQueryKey(id)
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof cRMGetBreadcrumbs>>> = ({ signal }) => cRMGetBreadcrumbs(id, { signal, ...axiosOptions })
|
||||
|
||||
return { queryKey, queryFn, enabled: computed(() => !!(unref(id))), ...queryOptions } as UseQueryOptions<Awaited<ReturnType<typeof cRMGetBreadcrumbs>>, TError, TData>
|
||||
}
|
||||
|
||||
export type CRMGetBreadcrumbsQueryResult = NonNullable<Awaited<ReturnType<typeof cRMGetBreadcrumbs>>>
|
||||
export type CRMGetBreadcrumbsQueryError = AxiosError<RpcStatus>
|
||||
|
||||
export function useCRMGetBreadcrumbs<TData = Awaited<ReturnType<typeof cRMGetBreadcrumbs>>, TError = AxiosError<RpcStatus>>(id: MaybeRef<string>, options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMGetBreadcrumbs>>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getCRMGetBreadcrumbsQueryOptions(id, options)
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryReturnType<TData, TError> & { queryKey: QueryKey }
|
||||
|
||||
query.queryKey = unref(queryOptions).queryKey as QueryKey
|
||||
|
||||
return query
|
||||
}
|
||||
|
||||
export function cRMSearch(params?: MaybeRef<CRMSearchParams>, options?: AxiosRequestConfig): Promise<AxiosResponse<CrmPositionsRsp>> {
|
||||
params = unref(params)
|
||||
return axios.get(
|
||||
`/search`,
|
||||
{
|
||||
...options,
|
||||
params: { ...unref(params), ...options?.params },
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
export function getCRMSearchQueryKey(params?: MaybeRef<CRMSearchParams>) {
|
||||
return ['search', ...(params ? [params] : [])] as const
|
||||
}
|
||||
|
||||
export function getCRMSearchQueryOptions<TData = Awaited<ReturnType<typeof cRMSearch>>, TError = AxiosError<RpcStatus>>(params?: MaybeRef<CRMSearchParams>, options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMSearch>>, TError, TData>>, axios?: AxiosRequestConfig }) {
|
||||
const { query: queryOptions, axios: axiosOptions } = options ?? {}
|
||||
|
||||
const queryKey = getCRMSearchQueryKey(params)
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof cRMSearch>>> = ({ signal }) => cRMSearch(params, { signal, ...axiosOptions })
|
||||
|
||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<Awaited<ReturnType<typeof cRMSearch>>, TError, TData>
|
||||
}
|
||||
|
||||
export type CRMSearchQueryResult = NonNullable<Awaited<ReturnType<typeof cRMSearch>>>
|
||||
export type CRMSearchQueryError = AxiosError<RpcStatus>
|
||||
|
||||
export function useCRMSearch<TData = Awaited<ReturnType<typeof cRMSearch>>, TError = AxiosError<RpcStatus>>(params?: MaybeRef<CRMSearchParams>, options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof cRMSearch>>, TError, TData>>, axios?: AxiosRequestConfig }): UseQueryReturnType<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getCRMSearchQueryOptions(params, options)
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryReturnType<TData, TError> & { queryKey: QueryKey }
|
||||
|
||||
query.queryKey = unref(queryOptions).queryKey as QueryKey
|
||||
|
||||
return query
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import type { ProtobufAny } from './protobufAny'
|
||||
|
||||
/**
|
||||
* Message that represents an arbitrary HTTP body. It should only be used for
|
||||
payload formats that can't be represented as JSON, such as raw binary or
|
||||
an HTML page.
|
||||
|
||||
|
||||
This message can be used both in streaming and non-streaming API methods in
|
||||
the request as well as the response.
|
||||
|
||||
It can be used as a top-level request field, which is convenient if one
|
||||
wants to extract parameters from either the URL or HTTP template into the
|
||||
request fields and also want access to the raw HTTP body.
|
||||
|
||||
Example:
|
||||
|
||||
message GetResourceRequest {
|
||||
// A unique request id.
|
||||
string request_id = 1;
|
||||
|
||||
// The raw HTTP body is bound to this field.
|
||||
google.api.HttpBody http_body = 2;
|
||||
|
||||
}
|
||||
|
||||
service ResourceService {
|
||||
rpc GetResource(GetResourceRequest)
|
||||
returns (google.api.HttpBody);
|
||||
rpc UpdateResource(google.api.HttpBody)
|
||||
returns (google.protobuf.Empty);
|
||||
|
||||
}
|
||||
|
||||
Example with streaming methods:
|
||||
|
||||
service CaldavService {
|
||||
rpc GetCalendar(stream google.api.HttpBody)
|
||||
returns (stream google.api.HttpBody);
|
||||
rpc UpdateCalendar(stream google.api.HttpBody)
|
||||
returns (stream google.api.HttpBody);
|
||||
|
||||
}
|
||||
|
||||
Use of this type only changes how the request and response bodies are
|
||||
handled, all other features will continue to work unchanged.
|
||||
*/
|
||||
export interface ApiHttpBody {
|
||||
/** The HTTP Content-Type header value specifying the content type of the body. */
|
||||
contentType?: string
|
||||
/** The HTTP request/response body as raw binary. */
|
||||
data?: string
|
||||
/**
|
||||
Application specific response metadata. Must be set in the first response
|
||||
for streaming APIs.
|
||||
*/
|
||||
extensions?: ProtobufAny[]
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
|
||||
export interface CRMSearchParams {
|
||||
text?: string
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
|
||||
export interface CrabscrmLabel {
|
||||
name?: string
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import type { CrmOrderItem } from './crmOrderItem'
|
||||
|
||||
export interface CrabscrmOrder {
|
||||
items?: CrmOrderItem[]
|
||||
name?: string
|
||||
phone?: string
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import type { CrmCategory } from './crmCategory'
|
||||
|
||||
export interface CrmBreadcrumbsRsp {
|
||||
categories?: CrmCategory[]
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import type { CrabscrmLabel } from './crabscrmLabel'
|
||||
import type { CrmVariant } from './crmVariant'
|
||||
|
||||
export interface CrmCartItem {
|
||||
amount?: string
|
||||
amountOld?: string
|
||||
article?: string
|
||||
count?: string
|
||||
id?: string
|
||||
images?: string[]
|
||||
inventory?: number
|
||||
labels?: CrabscrmLabel[]
|
||||
name?: string
|
||||
unit?: string
|
||||
uri?: string
|
||||
variants?: CrmVariant[]
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import type { CrmCartItem } from './crmCartItem'
|
||||
|
||||
export interface CrmCartRsp {
|
||||
amount?: string
|
||||
amountOld?: string
|
||||
items?: CrmCartItem[]
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import type { CrmCategory } from './crmCategory'
|
||||
|
||||
export interface CrmCatalogRsp {
|
||||
categories?: CrmCategory[]
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
|
||||
export interface CrmCategory {
|
||||
children?: CrmCategory[]
|
||||
id?: string
|
||||
name?: string
|
||||
uri?: string
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
|
||||
export interface CrmCharacteristic {
|
||||
name?: string
|
||||
value?: string
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
|
||||
export interface CrmGroupedProduct {
|
||||
image?: string
|
||||
name?: string
|
||||
uri?: string
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
|
||||
export interface CrmOrderItem {
|
||||
count?: string
|
||||
productId?: string
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
|
||||
export interface CrmOrderRsp { [key: string]: unknown }
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import type { CrmProduct } from './crmProduct'
|
||||
|
||||
export interface CrmPositionsRsp {
|
||||
products?: CrmProduct[]
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import type { CrmCharacteristic } from './crmCharacteristic'
|
||||
import type { CrmGroupedProduct } from './crmGroupedProduct'
|
||||
import type { CrabscrmLabel } from './crabscrmLabel'
|
||||
import type { CrmVariant } from './crmVariant'
|
||||
|
||||
export interface CrmProduct {
|
||||
article?: string
|
||||
category?: string
|
||||
characteristics?: CrmCharacteristic[]
|
||||
description?: string
|
||||
groupedProducts?: CrmGroupedProduct[]
|
||||
id?: string
|
||||
images?: string[]
|
||||
inventory?: number
|
||||
labels?: CrabscrmLabel[]
|
||||
name?: string
|
||||
unit?: string
|
||||
uri?: string
|
||||
variants?: CrmVariant[]
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import type { CrmProduct } from './crmProduct'
|
||||
|
||||
export interface CrmProductRsp {
|
||||
product?: CrmProduct
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
|
||||
export interface CrmProperty {
|
||||
name?: string
|
||||
value?: string
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import type { CrmProperty } from './crmProperty'
|
||||
|
||||
export interface CrmVariant {
|
||||
active?: boolean
|
||||
price?: string
|
||||
properties?: CrmProperty[]
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
|
||||
export * from './apiHttpBody'
|
||||
export * from './cRMSearchParams'
|
||||
export * from './crabscrmLabel'
|
||||
export * from './crabscrmOrder'
|
||||
export * from './crmBreadcrumbsRsp'
|
||||
export * from './crmCartItem'
|
||||
export * from './crmCartRsp'
|
||||
export * from './crmCatalogRsp'
|
||||
export * from './crmCategory'
|
||||
export * from './crmCharacteristic'
|
||||
export * from './crmGroupedProduct'
|
||||
export * from './crmOrderItem'
|
||||
export * from './crmOrderRsp'
|
||||
export * from './crmPositionsRsp'
|
||||
export * from './crmProduct'
|
||||
export * from './crmProductRsp'
|
||||
export * from './crmProperty'
|
||||
export * from './crmVariant'
|
||||
export * from './protobufAny'
|
||||
export * from './rpcStatus'
|
|
@ -0,0 +1,128 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
|
||||
/**
|
||||
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
||||
URL that describes the type of the serialized message.
|
||||
|
||||
Protobuf library provides support to pack/unpack Any values in the form
|
||||
of utility functions or additional generated methods of the Any type.
|
||||
|
||||
Example 1: Pack and unpack a message in C++.
|
||||
|
||||
Foo foo = ...;
|
||||
Any any;
|
||||
any.PackFrom(foo);
|
||||
...
|
||||
if (any.UnpackTo(&foo)) {
|
||||
...
|
||||
}
|
||||
|
||||
Example 2: Pack and unpack a message in Java.
|
||||
|
||||
Foo foo = ...;
|
||||
Any any = Any.pack(foo);
|
||||
...
|
||||
if (any.is(Foo.class)) {
|
||||
foo = any.unpack(Foo.class);
|
||||
}
|
||||
// or ...
|
||||
if (any.isSameTypeAs(Foo.getDefaultInstance())) {
|
||||
foo = any.unpack(Foo.getDefaultInstance());
|
||||
}
|
||||
|
||||
Example 3: Pack and unpack a message in Python.
|
||||
|
||||
foo = Foo(...)
|
||||
any = Any()
|
||||
any.Pack(foo)
|
||||
...
|
||||
if any.Is(Foo.DESCRIPTOR):
|
||||
any.Unpack(foo)
|
||||
...
|
||||
|
||||
Example 4: Pack and unpack a message in Go
|
||||
|
||||
foo := &pb.Foo{...}
|
||||
any, err := anypb.New(foo)
|
||||
if err != nil {
|
||||
...
|
||||
}
|
||||
...
|
||||
foo := &pb.Foo{}
|
||||
if err := any.UnmarshalTo(foo); err != nil {
|
||||
...
|
||||
}
|
||||
|
||||
The pack methods provided by protobuf library will by default use
|
||||
'type.googleapis.com/full.type.name' as the type URL and the unpack
|
||||
methods only use the fully qualified type name after the last '/'
|
||||
in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
||||
name "y.z".
|
||||
|
||||
JSON
|
||||
====
|
||||
The JSON representation of an `Any` value uses the regular
|
||||
representation of the deserialized, embedded message, with an
|
||||
additional field `@type` which contains the type URL. Example:
|
||||
|
||||
package google.profile;
|
||||
message Person {
|
||||
string first_name = 1;
|
||||
string last_name = 2;
|
||||
}
|
||||
|
||||
{
|
||||
"@type": "type.googleapis.com/google.profile.Person",
|
||||
"firstName": <string>,
|
||||
"lastName": <string>
|
||||
}
|
||||
|
||||
If the embedded message type is well-known and has a custom JSON
|
||||
representation, that representation will be embedded adding a field
|
||||
`value` which holds the custom JSON in addition to the `@type`
|
||||
field. Example (for message [google.protobuf.Duration][]):
|
||||
|
||||
{
|
||||
"@type": "type.googleapis.com/google.protobuf.Duration",
|
||||
"value": "1.212s"
|
||||
}
|
||||
*/
|
||||
export interface ProtobufAny {
|
||||
/**
|
||||
A URL/resource name that uniquely identifies the type of the serialized
|
||||
protocol buffer message. This string must contain at least
|
||||
one "/" character. The last segment of the URL's path must represent
|
||||
the fully qualified name of the type (as in
|
||||
`path/google.protobuf.Duration`). The name should be in a canonical form
|
||||
(e.g., leading "." is not accepted).
|
||||
|
||||
In practice, teams usually precompile into the binary all types that they
|
||||
expect it to use in the context of Any. However, for URLs which use the
|
||||
scheme `http`, `https`, or no scheme, one can optionally set up a type
|
||||
server that maps type URLs to message definitions as follows:
|
||||
|
||||
* If no scheme is provided, `https` is assumed.
|
||||
* An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
||||
value in binary format, or produce an error.
|
||||
* Applications are allowed to cache lookup results based on the
|
||||
URL, or have them precompiled into a binary to avoid any
|
||||
lookup. Therefore, binary compatibility needs to be preserved
|
||||
on changes to types. (Use versioned type names to manage
|
||||
breaking changes.)
|
||||
|
||||
Note: this functionality is not currently available in the official
|
||||
protobuf release, and it is not used for type URLs beginning with
|
||||
type.googleapis.com. As of May 2023, there are no widely used type server
|
||||
implementations and no plans to implement one.
|
||||
|
||||
Schemes other than `http`, `https` (or the empty scheme) might be
|
||||
used with implementation specific semantics.
|
||||
*/
|
||||
'@type'?: string
|
||||
[key: string]: unknown
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Generated by orval v6.31.0 🍺
|
||||
* Do not edit manually.
|
||||
* main.proto
|
||||
* OpenAPI spec version: version not set
|
||||
*/
|
||||
import type { ProtobufAny } from './protobufAny'
|
||||
|
||||
export interface RpcStatus {
|
||||
code?: number
|
||||
details?: ProtobufAny[]
|
||||
message?: string
|
||||
}
|
|
@ -2,5 +2,5 @@
|
|||
import { defineConfig } from 'unocss'
|
||||
|
||||
export default defineConfig({
|
||||
// ...UnoCSS options
|
||||
})
|
||||
// ...UnoCSS options
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue