/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
libs/internal-sdk/src/react-query/environmentVariablesUpdate.ts
120 строк
4 KB
Dima Grossman
chore(api): Update internal SDK gen (#11057)
11 май 2026, 13:08
Не верифицирован
11 май 2026, 13:08
2446092
Код
Авторство
О чём код?
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { NovuCore } from "../core.js"; import { environmentVariablesUpdate } from "../funcs/environmentVariablesUpdate.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import * as errors from "../models/errors/index.js"; import { NovuError } from "../models/errors/novuerror.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { useNovuContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type EnvironmentVariablesUpdateMutationVariables = { updateEnvironmentVariableRequestDto: components.UpdateEnvironmentVariableRequestDto; variableKey: string; idempotencyKey?: string | undefined; options?: RequestOptions; }; export type EnvironmentVariablesUpdateMutationData = operations.EnvironmentVariablesControllerUpdateEnvironmentVariableResponse; export type EnvironmentVariablesUpdateMutationError = | errors.ErrorDto | errors.ValidationErrorDto | NovuError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Update a variable * * @remarks * Updates an existing environment variable. Providing `values` merges them into the existing per-environment values by `_environmentId`; envs not present in the request keep their stored value. Submitting the masked secret placeholder (the value returned by read endpoints for secret variables) as a real value is rejected. */ export function useEnvironmentVariablesUpdateMutation( options?: MutationHookOptions< EnvironmentVariablesUpdateMutationData, EnvironmentVariablesUpdateMutationError, EnvironmentVariablesUpdateMutationVariables >, ): UseMutationResult< EnvironmentVariablesUpdateMutationData, EnvironmentVariablesUpdateMutationError, EnvironmentVariablesUpdateMutationVariables > { const client = useNovuContext(); return useMutation({ ...buildEnvironmentVariablesUpdateMutation(client, options), ...options, }); } export function mutationKeyEnvironmentVariablesUpdate(): MutationKey { return ["@novu/api", "Environment Variables", "update"]; } export function buildEnvironmentVariablesUpdateMutation( client$: NovuCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: EnvironmentVariablesUpdateMutationVariables, ) => Promise<EnvironmentVariablesUpdateMutationData>; } { return { mutationKey: mutationKeyEnvironmentVariablesUpdate(), mutationFn: function environmentVariablesUpdateMutationFn({ updateEnvironmentVariableRequestDto, variableKey, idempotencyKey, options, }): Promise<EnvironmentVariablesUpdateMutationData> { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(environmentVariablesUpdate( client$, updateEnvironmentVariableRequestDto, variableKey, idempotencyKey, mergedOptions, )); }, }; }