/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { industrySelectionUpdate } from "../funcs/industrySelectionUpdate.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GustoEmbeddedError } from "../models/errors/gustoembeddederror.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import { NotFoundErrorObject } from "../models/errors/notfounderrorobject.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { UnprocessableEntityError } from "../models/errors/unprocessableentityerror.js"; import { PutV1CompanyIndustryRequest, PutV1CompanyIndustryResponse, } from "../models/operations/putv1companyindustry.js"; import { unwrapAsync } from "../types/fp.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type IndustrySelectionUpdateMutationVariables = { request: PutV1CompanyIndustryRequest; options?: RequestOptions; }; export type IndustrySelectionUpdateMutationData = PutV1CompanyIndustryResponse; export type IndustrySelectionUpdateMutationError = | NotFoundErrorObject | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Update a company industry selection * * @remarks * Update the industry classification for a company by passing in a [NAICS code](https://www.naics.com). * * Optionally provide an industry title and [SIC codes](https://siccode.com/). If you do not provide SIC codes, * we will use the NAICS code to perform an internal lookup. * * Our UI leverages [Middesk API](https://docs.middesk.com/reference/introduction) to determine industry * classification codes. * * scope: `companies:write` */ export function useIndustrySelectionUpdateMutation( options?: MutationHookOptions< IndustrySelectionUpdateMutationData, IndustrySelectionUpdateMutationError, IndustrySelectionUpdateMutationVariables >, ): UseMutationResult< IndustrySelectionUpdateMutationData, IndustrySelectionUpdateMutationError, IndustrySelectionUpdateMutationVariables > { const client = useGustoEmbeddedContext(); return useMutation({ ...buildIndustrySelectionUpdateMutation(client, options), ...options, }); } export function mutationKeyIndustrySelectionUpdate(): MutationKey { return ["@gusto/embedded-api", "industrySelection", "update"]; } export function buildIndustrySelectionUpdateMutation( client$: GustoEmbeddedCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: IndustrySelectionUpdateMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyIndustrySelectionUpdate(), mutationFn: function industrySelectionUpdateMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(industrySelectionUpdate( client$, request, mergedOptions, )); }, }; }