/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { authServiceAccountsCreate } from "../funcs/authServiceAccountsCreate.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import * as errors from "../models/errors/index.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKError } from "../models/errors/sdkerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { useSDKContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type AuthServiceAccountsCreateMutationVariables = { request: operations.CreateServiceAccountRequest; options?: RequestOptions; }; export type AuthServiceAccountsCreateMutationData = operations.CreateServiceAccountResponseBody; export type AuthServiceAccountsCreateMutationError = | errors.CreateServiceAccountResponseBody | errors.CreateServiceAccountAuthServiceAccountsResponseBody | errors.CreateServiceAccountAuthServiceAccountsResponseResponseBody | errors.CreateServiceAccountAuthServiceAccountsResponse404ResponseBody | errors.CreateServiceAccountAuthServiceAccountsResponse409ResponseBody | errors.CreateServiceAccountAuthServiceAccountsResponse429ResponseBody | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Create a service account * * @remarks * Mint a non-human principal scoped to this org (org owner/admin only). */ export function useAuthServiceAccountsCreateMutation( options?: MutationHookOptions< AuthServiceAccountsCreateMutationData, AuthServiceAccountsCreateMutationError, AuthServiceAccountsCreateMutationVariables >, ): UseMutationResult< AuthServiceAccountsCreateMutationData, AuthServiceAccountsCreateMutationError, AuthServiceAccountsCreateMutationVariables > { const client = useSDKContext(); return useMutation({ ...buildAuthServiceAccountsCreateMutation(client, options), ...options, }); } export function mutationKeyAuthServiceAccountsCreate(): MutationKey { return ["@meetkai/mka1", "serviceAccounts", "create"]; } export function buildAuthServiceAccountsCreateMutation( client$: SDKCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: AuthServiceAccountsCreateMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyAuthServiceAccountsCreate(), mutationFn: function authServiceAccountsCreateMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(authServiceAccountsCreate( client$, request, mergedOptions, )); }, }; }