UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

98 lines (97 loc) 2.59 kB
import { useSynapseContext as u } from "../../utils/context/SynapseContext.js"; import { useInfiniteQuery as c, useQueryClient as i, useMutation as r } from "@tanstack/react-query"; function k(e) { const { synapseClient: t, keyFactory: s } = u(); return c({ ...e, initialPageParam: void 0, queryKey: s.getWebhooksQueryKey(), queryFn: async (n) => t.webhookServicesClient.postRepoV1WebhookList({ listUserWebhooksRequest: { nextPageToken: n.pageParam } }), getNextPageParam: (n) => n.nextPageToken }); } function b(e) { const { synapseClient: t, keyFactory: s } = u(), n = i(); return r( { ...e, mutationFn: (o) => t.webhookServicesClient.postRepoV1Webhook({ createOrUpdateWebhookRequest: o }), onSuccess: (...o) => { n.invalidateQueries({ queryKey: s.getWebhooksQueryKey() }), e?.onSuccess && e.onSuccess(...o); } } ); } function h(e) { const { synapseClient: t, keyFactory: s } = u(), n = i(); return r({ ...e, mutationFn: (o) => t.webhookServicesClient.putRepoV1WebhookWebhookId( o ), onSuccess: (...o) => { n.invalidateQueries({ queryKey: s.getWebhooksQueryKey() }), e?.onSuccess && e.onSuccess(...o); } }); } function l(e) { const { synapseClient: t, keyFactory: s } = u(), n = i(); return r({ ...e, mutationFn: (o) => t.webhookServicesClient.deleteRepoV1WebhookWebhookId({ webhookId: o }), onSuccess: (...o) => { n.invalidateQueries({ queryKey: s.getWebhooksQueryKey() }), e?.onSuccess && e.onSuccess(...o); } }); } function W(e) { const { synapseClient: t, keyFactory: s } = u(), n = i(); return r({ ...e, mutationFn: (o) => t.webhookServicesClient.postRepoV1WebhookWebhookIdVerify( o ), onSuccess: (...o) => { n.invalidateQueries({ queryKey: s.getWebhooksQueryKey() }), e?.onSuccess && e.onSuccess(...o); } }); } function C(e) { const { synapseClient: t, keyFactory: s } = u(), n = i(); return r({ ...e, mutationFn: (o) => t.webhookServicesClient.putRepoV1WebhookWebhookIdVerificationCode( { webhookId: o } ), onSuccess: (...o) => { n.invalidateQueries({ queryKey: s.getWebhooksQueryKey() }), e?.onSuccess && e.onSuccess(...o); } }); } export { b as useCreateWebhook, l as useDeleteWebhook, k as useGetWebhooksInfinite, C as useResendVerificationCode, h as useUpdateWebhook, W as useVerifyWebhook }; //# sourceMappingURL=useWebhook.js.map