UNPKG

helixzypher-api-client

Version:

Orval generated API client for heliZypher

217 lines (216 loc) 10.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRetrieveCompanyForSuggestionsQueryOptions = exports.getRetrieveCompanyForSuggestionsQueryKey = exports.retrieveCompanyForSuggestions = exports.useCreateCompany = exports.getCreateCompanyMutationOptions = exports.createCompany = exports.getSearchCompaniesQueryOptions = exports.getSearchCompaniesQueryKey = exports.searchCompanies = exports.useUpdateCompanyStatus = exports.getUpdateCompanyStatusMutationOptions = exports.updateCompanyStatus = exports.useDeleteCompanyById = exports.getDeleteCompanyByIdMutationOptions = exports.deleteCompanyById = exports.useUpdateCompany = exports.getUpdateCompanyMutationOptions = exports.updateCompany = exports.getGetCompanyByIdQueryOptions = exports.getGetCompanyByIdQueryKey = exports.getCompanyById = void 0; exports.useGetCompanyById = useGetCompanyById; exports.useSearchCompanies = useSearchCompanies; exports.useRetrieveCompanyForSuggestions = useRetrieveCompanyForSuggestions; /** * Generated by orval v7.9.0 🍺 * Do not edit manually. * HELIXZ helixZypher APIs * HelixZypher is a custom-built authentication server by Helixz Solutions, developed using Spring Boot with JWT and OAuth2 support. It provides a secure, scalable, and flexible foundation for managing user authentication and authorization across modern applications and microservices. * OpenAPI spec version: 1.0.0 */ const react_query_1 = require("@tanstack/react-query"); const axios = require("axios"); /** * Find Company by given company id */ const getCompanyById = (companyId, options) => { return axios.default.get(`/api/helixzypher/v1/companies/${companyId}`, options); }; exports.getCompanyById = getCompanyById; const getGetCompanyByIdQueryKey = (companyId) => { return [`/api/helixzypher/v1/companies/${companyId}`]; }; exports.getGetCompanyByIdQueryKey = getGetCompanyByIdQueryKey; const getGetCompanyByIdQueryOptions = (companyId, options) => { const { query: queryOptions, axios: axiosOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? (0, exports.getGetCompanyByIdQueryKey)(companyId); const queryFn = ({ signal, }) => (0, exports.getCompanyById)(companyId, { signal, ...axiosOptions }); return { queryKey, queryFn, enabled: !!companyId, ...queryOptions, }; }; exports.getGetCompanyByIdQueryOptions = getGetCompanyByIdQueryOptions; function useGetCompanyById(companyId, options, queryClient) { const queryOptions = (0, exports.getGetCompanyByIdQueryOptions)(companyId, options); const query = (0, react_query_1.useQuery)(queryOptions, queryClient); query.queryKey = queryOptions.queryKey; return query; } /** * Update Company using given details */ const updateCompany = (companyId, companyModifyDto, options) => { return axios.default.put(`/api/helixzypher/v1/companies/${companyId}`, companyModifyDto, options); }; exports.updateCompany = updateCompany; const getUpdateCompanyMutationOptions = (options) => { const mutationKey = ["updateCompany"]; const { mutation: mutationOptions, axios: axiosOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, axios: undefined }; const mutationFn = (props) => { const { companyId, data } = props ?? {}; return (0, exports.updateCompany)(companyId, data, axiosOptions); }; return { mutationFn, ...mutationOptions }; }; exports.getUpdateCompanyMutationOptions = getUpdateCompanyMutationOptions; const useUpdateCompany = (options, queryClient) => { const mutationOptions = (0, exports.getUpdateCompanyMutationOptions)(options); return (0, react_query_1.useMutation)(mutationOptions, queryClient); }; exports.useUpdateCompany = useUpdateCompany; /** * Delete Company by given Company id */ const deleteCompanyById = (companyId, options) => { return axios.default.delete(`/api/helixzypher/v1/companies/${companyId}`, options); }; exports.deleteCompanyById = deleteCompanyById; const getDeleteCompanyByIdMutationOptions = (options) => { const mutationKey = ["deleteCompanyById"]; const { mutation: mutationOptions, axios: axiosOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, axios: undefined }; const mutationFn = (props) => { const { companyId } = props ?? {}; return (0, exports.deleteCompanyById)(companyId, axiosOptions); }; return { mutationFn, ...mutationOptions }; }; exports.getDeleteCompanyByIdMutationOptions = getDeleteCompanyByIdMutationOptions; const useDeleteCompanyById = (options, queryClient) => { const mutationOptions = (0, exports.getDeleteCompanyByIdMutationOptions)(options); return (0, react_query_1.useMutation)(mutationOptions, queryClient); }; exports.useDeleteCompanyById = useDeleteCompanyById; /** * Soft delete Company by its ID. Marks the company as INACTIVE. */ const updateCompanyStatus = (companyId, status, options) => { return axios.default.put(`/api/helixzypher/v1/companies/${companyId}/status/${status}`, undefined, options); }; exports.updateCompanyStatus = updateCompanyStatus; const getUpdateCompanyStatusMutationOptions = (options) => { const mutationKey = ["updateCompanyStatus"]; const { mutation: mutationOptions, axios: axiosOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, axios: undefined }; const mutationFn = (props) => { const { companyId, status } = props ?? {}; return (0, exports.updateCompanyStatus)(companyId, status, axiosOptions); }; return { mutationFn, ...mutationOptions }; }; exports.getUpdateCompanyStatusMutationOptions = getUpdateCompanyStatusMutationOptions; const useUpdateCompanyStatus = (options, queryClient) => { const mutationOptions = (0, exports.getUpdateCompanyStatusMutationOptions)(options); return (0, react_query_1.useMutation)(mutationOptions, queryClient); }; exports.useUpdateCompanyStatus = useUpdateCompanyStatus; /** * Search Companies with Pagination */ const searchCompanies = (params, options) => { return axios.default.get(`/api/helixzypher/v1/companies`, { ...options, params: { ...params, ...options?.params }, }); }; exports.searchCompanies = searchCompanies; const getSearchCompaniesQueryKey = (params) => { return [ `/api/helixzypher/v1/companies`, ...(params ? [params] : []), ]; }; exports.getSearchCompaniesQueryKey = getSearchCompaniesQueryKey; const getSearchCompaniesQueryOptions = (params, options) => { const { query: queryOptions, axios: axiosOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? (0, exports.getSearchCompaniesQueryKey)(params); const queryFn = ({ signal, }) => (0, exports.searchCompanies)(params, { signal, ...axiosOptions }); return { queryKey, queryFn, ...queryOptions }; }; exports.getSearchCompaniesQueryOptions = getSearchCompaniesQueryOptions; function useSearchCompanies(params, options, queryClient) { const queryOptions = (0, exports.getSearchCompaniesQueryOptions)(params, options); const query = (0, react_query_1.useQuery)(queryOptions, queryClient); query.queryKey = queryOptions.queryKey; return query; } /** * Create new Company using given details */ const createCompany = (companyModifyDto, options) => { return axios.default.post(`/api/helixzypher/v1/companies`, companyModifyDto, options); }; exports.createCompany = createCompany; const getCreateCompanyMutationOptions = (options) => { const mutationKey = ["createCompany"]; const { mutation: mutationOptions, axios: axiosOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, axios: undefined }; const mutationFn = (props) => { const { data } = props ?? {}; return (0, exports.createCompany)(data, axiosOptions); }; return { mutationFn, ...mutationOptions }; }; exports.getCreateCompanyMutationOptions = getCreateCompanyMutationOptions; const useCreateCompany = (options, queryClient) => { const mutationOptions = (0, exports.getCreateCompanyMutationOptions)(options); return (0, react_query_1.useMutation)(mutationOptions, queryClient); }; exports.useCreateCompany = useCreateCompany; /** * Find Companies for suggestion boxes */ const retrieveCompanyForSuggestions = (params, options) => { return axios.default.get(`/api/helixzypher/v1/companies/suggestions`, { ...options, params: { ...params, ...options?.params }, }); }; exports.retrieveCompanyForSuggestions = retrieveCompanyForSuggestions; const getRetrieveCompanyForSuggestionsQueryKey = (params) => { return [ `/api/helixzypher/v1/companies/suggestions`, ...(params ? [params] : []), ]; }; exports.getRetrieveCompanyForSuggestionsQueryKey = getRetrieveCompanyForSuggestionsQueryKey; const getRetrieveCompanyForSuggestionsQueryOptions = (params, options) => { const { query: queryOptions, axios: axiosOptions } = options ?? {}; const queryKey = queryOptions?.queryKey ?? (0, exports.getRetrieveCompanyForSuggestionsQueryKey)(params); const queryFn = ({ signal }) => (0, exports.retrieveCompanyForSuggestions)(params, { signal, ...axiosOptions }); return { queryKey, queryFn, ...queryOptions }; }; exports.getRetrieveCompanyForSuggestionsQueryOptions = getRetrieveCompanyForSuggestionsQueryOptions; function useRetrieveCompanyForSuggestions(params, options, queryClient) { const queryOptions = (0, exports.getRetrieveCompanyForSuggestionsQueryOptions)(params, options); const query = (0, react_query_1.useQuery)(queryOptions, queryClient); query.queryKey = queryOptions.queryKey; return query; }