feat(platform): add the notification inbox and deterministic match search

This commit is contained in:
shira committed 2026-10-09 13:14:46 +03:00
1 parent 5edff21d2d
commit 0b11021b16
169 files changed
+17083 -443

No files matched your search

@@ -0,0 +1,95 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import {
faker
} from '@faker-js/faker';
import {
fakeFromPattern
} from '../../mock-pattern';
import {
HttpResponse,
http
} from 'msw';
import type {
RequestHandlerOptions
} from 'msw';
import type {
NotificationContent,
NotificationList,
NotificationReadReceipt
} from '../../schemas';
export const getListMyNotificationsResponseNotificationContentMock = (overrideResponse: Partial<NotificationContent> = {}): NotificationContent => ({...{title: faker.string.alpha({length: {min: 1, max: 120}}), summary: faker.string.alpha({length: {min: 1, max: 500}}), link_path: faker.helpers.arrayElement([fakeFromPattern("^/[A-Za-z0-9/_-]{0,255}$", {maxLength: 256}), null])}, ...overrideResponse});
export const getListMyNotificationsResponseMock = (overrideResponse: Partial<Extract<NotificationList, object>> = {}): NotificationList => ({items: Array.from({ length: faker.number.int({min: 1, max: 100}) }, (_, i) => i + 1).map(() => ({id: faker.string.uuid(), kind: faker.helpers.arrayElement(['invitation_delivered','synthetic'] as const), organization_id: faker.string.uuid(), delivered_at: faker.date.past().toISOString().slice(0, 19) + 'Z', read_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), content: faker.helpers.arrayElement([{...getListMyNotificationsResponseNotificationContentMock()},null,])})), page: {has_more: faker.datatype.boolean(), next_cursor: faker.helpers.arrayElement([fakeFromPattern("^[A-Za-z0-9_-]+$", {minLength: 1, maxLength: 512}), null])}, ...overrideResponse})
export const getMarkMyNotificationReadResponseMock = (overrideResponse: Partial<Extract<NotificationReadReceipt, object>> = {}): NotificationReadReceipt => ({id: faker.string.uuid(), read_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse})
export const getListOrganizationNotificationsResponseNotificationContentMock = (overrideResponse: Partial<NotificationContent> = {}): NotificationContent => ({...{title: faker.string.alpha({length: {min: 1, max: 120}}), summary: faker.string.alpha({length: {min: 1, max: 500}}), link_path: faker.helpers.arrayElement([fakeFromPattern("^/[A-Za-z0-9/_-]{0,255}$", {maxLength: 256}), null])}, ...overrideResponse});
export const getListOrganizationNotificationsResponseMock = (overrideResponse: Partial<Extract<NotificationList, object>> = {}): NotificationList => ({items: Array.from({ length: faker.number.int({min: 1, max: 100}) }, (_, i) => i + 1).map(() => ({id: faker.string.uuid(), kind: faker.helpers.arrayElement(['invitation_delivered','synthetic'] as const), organization_id: faker.string.uuid(), delivered_at: faker.date.past().toISOString().slice(0, 19) + 'Z', read_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), content: faker.helpers.arrayElement([{...getListOrganizationNotificationsResponseNotificationContentMock()},null,])})), page: {has_more: faker.datatype.boolean(), next_cursor: faker.helpers.arrayElement([fakeFromPattern("^[A-Za-z0-9_-]+$", {minLength: 1, maxLength: 512}), null])}, ...overrideResponse})
export const getMarkOrganizationNotificationReadResponseMock = (overrideResponse: Partial<Extract<NotificationReadReceipt, object>> = {}): NotificationReadReceipt => ({id: faker.string.uuid(), read_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse})
export const getListMyNotificationsMockHandler = (overrideResponse?: NotificationList | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<NotificationList> | NotificationList), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/me/notifications', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getListMyNotificationsResponseMock(),
{ status: 200
})
}, options)
}
export const getMarkMyNotificationReadMockHandler = (overrideResponse?: NotificationReadReceipt | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<NotificationReadReceipt> | NotificationReadReceipt), options?: RequestHandlerOptions) => {
return http.post('*/api/v1/me/notifications/:notificationId/read', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getMarkMyNotificationReadResponseMock(),
{ status: 200
})
}, options)
}
export const getListOrganizationNotificationsMockHandler = (overrideResponse?: NotificationList | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<NotificationList> | NotificationList), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/organizations/:orgId/notifications', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getListOrganizationNotificationsResponseMock(),
{ status: 200
})
}, options)
}
export const getMarkOrganizationNotificationReadMockHandler = (overrideResponse?: NotificationReadReceipt | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<NotificationReadReceipt> | NotificationReadReceipt), options?: RequestHandlerOptions) => {
return http.post('*/api/v1/organizations/:orgId/notifications/:notificationId/read', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getMarkOrganizationNotificationReadResponseMock(),
{ status: 200
})
}, options)
}
export const getNotificationMock = () => [
getListMyNotificationsMockHandler(),
getMarkMyNotificationReadMockHandler(),
getListOrganizationNotificationsMockHandler(),
getMarkOrganizationNotificationReadMockHandler()
]
@@ -0,0 +1,450 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import {
useMutation,
useQuery
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
MutationFunction,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
UseQueryResult
} from '@tanstack/react-query';
import type {
ListMyNotificationsParams,
ListOrganizationNotificationsParams,
NotificationList,
NotificationReadReceipt,
Problem
} from '../../schemas';
import { apiRequest } from '../../client';
import type { ErrorType } from '../../client';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
const withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {
const result = { queryKey } as T & { queryKey: K };
for (const key of Object.keys(query)) {
// The explicit queryKey always wins, matching the previous
// `{ ...query, queryKey }` spread where it was set last.
if (key === 'queryKey') continue;
Object.defineProperty(result, key, {
enumerable: true,
configurable: true,
get: () => (query as Record<string, unknown>)[key],
});
}
return result;
};
export const getListMyNotificationsUrl = (params?: ListMyNotificationsParams,) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `/api/v1/me/notifications?${stringifiedParams}` : `/api/v1/me/notifications`
}
/**
* Requires the session cookie of a candidate account with a confirmed email. The recipient comes from the session, never from a request parameter, so the response holds only the caller's own items. Returns a page, newest delivery first with the identifier as the tie-breaker, with cursor pagination. The response is `Cache-Control: no-store`.
*
* The inbox is the in-platform delivery state of a notification. An item exists as soon as the event reached the platform, whether or not any email was sent, and an email that failed or was never sent does not block it. The inbox stores a reference to the event, not its text: the `content` of every item is resolved from the current source for this recipient on this read. When the source is gone or the recipient may not see it now (for example the candidate hid the organization), the item stays in the list with `content` null, and no earlier text is shown. An event that is delivered twice is one item.
*
* Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account answers 403 forbidden. A malformed `limit` or `cursor`, or a cursor of another account, answers 400 validation_failed.
* @summary List the inbox of the current candidate.
*/
export const listMyNotifications = async (params?: ListMyNotificationsParams, options?: Parameters<typeof apiRequest>[1]): Promise<NotificationList> => {
return apiRequest<NotificationList>(getListMyNotificationsUrl(params),
{
...options,
method: 'GET'
}
);}
export const getListMyNotificationsQueryKey = (params?: ListMyNotificationsParams,) => {
return [
`/api/v1/me/notifications`, ...(params ? [params] : [])
] as const;
}
export const getListMyNotificationsQueryOptions = <TData = Awaited<ReturnType<typeof listMyNotifications>>, TError = ErrorType<Problem>>(params?: ListMyNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyNotifications>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getListMyNotificationsQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof listMyNotifications>>> = ({ signal }) => listMyNotifications(params, { signal, ...requestOptions });
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listMyNotifications>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type ListMyNotificationsQueryResult = NonNullable<Awaited<ReturnType<typeof listMyNotifications>>>
export type ListMyNotificationsQueryError = ErrorType<Problem>
export function useListMyNotifications<TData = Awaited<ReturnType<typeof listMyNotifications>>, TError = ErrorType<Problem>>(
params: undefined | ListMyNotificationsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyNotifications>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof listMyNotifications>>,
TError,
Awaited<ReturnType<typeof listMyNotifications>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useListMyNotifications<TData = Awaited<ReturnType<typeof listMyNotifications>>, TError = ErrorType<Problem>>(
params?: ListMyNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyNotifications>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof listMyNotifications>>,
TError,
Awaited<ReturnType<typeof listMyNotifications>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useListMyNotifications<TData = Awaited<ReturnType<typeof listMyNotifications>>, TError = ErrorType<Problem>>(
params?: ListMyNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyNotifications>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary List the inbox of the current candidate.
*/
export function useListMyNotifications<TData = Awaited<ReturnType<typeof listMyNotifications>>, TError = ErrorType<Problem>>(
params?: ListMyNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listMyNotifications>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getListMyNotificationsQueryOptions(params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
export const getMarkMyNotificationReadUrl = (notificationId: string,) => {
return `/api/v1/me/notifications/${notificationId}/read`
}
/**
* Requires the session cookie of a candidate account with a confirmed email, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The recipient comes from the session. The request has no body.
*
* The command is idempotent by its effect: the first mark stores the read time and every repeat returns that first time, so it needs no Idempotency-Key. It never reads the source and returns no content, so marking an item whose content is no longer available still works. It changes no other item.
*
* The general rate limit can answer 429 with Retry-After before any check.
*
* Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a missing or wrong CSRF token or a disallowed Origin answers 403 csrf_check_failed; an employer account answers 403 forbidden; an item of another account and an unknown identifier both answer 404 not_found, so identifiers cannot be enumerated. A `notification_id` that is not a UUID answers 400 validation_failed with the path pointer.
* @summary Mark an item of the inbox of the current candidate as read.
*/
export const markMyNotificationRead = async (notificationId: string, options?: Parameters<typeof apiRequest>[1]): Promise<NotificationReadReceipt> => {
return apiRequest<NotificationReadReceipt>(getMarkMyNotificationReadUrl(notificationId),
{
...options,
method: 'POST'
}
);}
export const getMarkMyNotificationReadMutationKey = () => ['markMyNotificationRead'] as const;
export const getMarkMyNotificationReadMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof markMyNotificationRead>>, TError,MarkMyNotificationReadMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof markMyNotificationRead>>, TError,MarkMyNotificationReadMutationVariables, TContext> => {
const mutationKey = getMarkMyNotificationReadMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof markMyNotificationRead>>, MarkMyNotificationReadMutationVariables> = (props) => {
const {notificationId} = props ?? {};
return markMyNotificationRead(notificationId,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type MarkMyNotificationReadMutationResult = NonNullable<Awaited<ReturnType<typeof markMyNotificationRead>>>
export type MarkMyNotificationReadMutationError = ErrorType<Problem>
export type MarkMyNotificationReadMutationVariables = {notificationId: string}
/**
* @summary Mark an item of the inbox of the current candidate as read.
*/
export const useMarkMyNotificationRead = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof markMyNotificationRead>>, TError,MarkMyNotificationReadMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof markMyNotificationRead>>,
TError,
MarkMyNotificationReadMutationVariables,
TContext
> => {
return useMutation(getMarkMyNotificationReadMutationOptions(options), queryClient);
}
export const getListOrganizationNotificationsUrl = (orgId: string,
params?: ListOrganizationNotificationsParams,) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `/api/v1/organizations/${orgId}/notifications?${stringifiedParams}` : `/api/v1/organizations/${orgId}/notifications`
}
/**
* Requires the session cookie of an employer account with a confirmed email and an active membership in `org_id`, whatever its role. The recipient comes from the session and the organization from the path and the membership that the server holds, never from the request. Returns only the items addressed to the caller in this organization, newest delivery first with the identifier as the tie-breaker, with cursor pagination. An item of the same account in another organization, and an item of another member, are never listed. The response is `Cache-Control: no-store`.
*
* Items follow the rules of ListMyNotifications: the inbox stores a reference to the event, an email never blocks an item, and the `content` of every item is resolved from the current source for this recipient on this read. An employer sees content only while the membership is active.
*
* Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden, and an employer account with an unconfirmed email answers 403 email_not_verified; an account without an active membership in the organization and an unknown organization both answer 404 not_found, so organizations cannot be enumerated. A malformed `org_id`, `limit`, or `cursor`, or a cursor of another account or organization, answers 400 validation_failed.
* @summary List the inbox of the current employer in one organization.
*/
export const listOrganizationNotifications = async (orgId: string,
params?: ListOrganizationNotificationsParams, options?: Parameters<typeof apiRequest>[1]): Promise<NotificationList> => {
return apiRequest<NotificationList>(getListOrganizationNotificationsUrl(orgId,params),
{
...options,
method: 'GET'
}
);}
export const getListOrganizationNotificationsQueryKey = (orgId: string,
params?: ListOrganizationNotificationsParams,) => {
return [
`/api/v1/organizations/${orgId}/notifications`, ...(params ? [params] : [])
] as const;
}
export const getListOrganizationNotificationsQueryOptions = <TData = Awaited<ReturnType<typeof listOrganizationNotifications>>, TError = ErrorType<Problem>>(orgId: string,
params?: ListOrganizationNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNotifications>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getListOrganizationNotificationsQueryKey(orgId,params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof listOrganizationNotifications>>> = ({ signal }) => listOrganizationNotifications(orgId,params, { signal, ...requestOptions });
return { queryKey, queryFn, enabled: orgId !== null && orgId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNotifications>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type ListOrganizationNotificationsQueryResult = NonNullable<Awaited<ReturnType<typeof listOrganizationNotifications>>>
export type ListOrganizationNotificationsQueryError = ErrorType<Problem>
export function useListOrganizationNotifications<TData = Awaited<ReturnType<typeof listOrganizationNotifications>>, TError = ErrorType<Problem>>(
orgId: string,
params: undefined | ListOrganizationNotificationsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNotifications>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof listOrganizationNotifications>>,
TError,
Awaited<ReturnType<typeof listOrganizationNotifications>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useListOrganizationNotifications<TData = Awaited<ReturnType<typeof listOrganizationNotifications>>, TError = ErrorType<Problem>>(
orgId: string,
params?: ListOrganizationNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNotifications>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof listOrganizationNotifications>>,
TError,
Awaited<ReturnType<typeof listOrganizationNotifications>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useListOrganizationNotifications<TData = Awaited<ReturnType<typeof listOrganizationNotifications>>, TError = ErrorType<Problem>>(
orgId: string,
params?: ListOrganizationNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNotifications>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary List the inbox of the current employer in one organization.
*/
export function useListOrganizationNotifications<TData = Awaited<ReturnType<typeof listOrganizationNotifications>>, TError = ErrorType<Problem>>(
orgId: string,
params?: ListOrganizationNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listOrganizationNotifications>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getListOrganizationNotificationsQueryOptions(orgId,params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
export const getMarkOrganizationNotificationReadUrl = (orgId: string,
notificationId: string,) => {
return `/api/v1/organizations/${orgId}/notifications/${notificationId}/read`
}
/**
* Requires the session cookie of an employer account with a confirmed email and an active membership in `org_id`, whatever its role, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The recipient comes from the session and the organization from the path and the server-side membership. The request has no body.
*
* The command is idempotent by its effect and returns no content, like MarkMyNotificationRead. The item must belong to the caller in this organization.
*
* The general rate limit can answer 429 with Retry-After before any check.
*
* Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a missing or wrong CSRF token or a disallowed Origin answers 403 csrf_check_failed; a candidate account answers 403 forbidden, and an employer account with an unconfirmed email answers 403 email_not_verified; an account without an active membership in the organization, an unknown organization, an item of another account, an item of another organization, and an unknown identifier all answer 404 not_found. A malformed `org_id` or `notification_id` answers 400 validation_failed with the path pointer.
* @summary Mark an item of the inbox of the current employer in one organization as read.
*/
export const markOrganizationNotificationRead = async (orgId: string,
notificationId: string, options?: Parameters<typeof apiRequest>[1]): Promise<NotificationReadReceipt> => {
return apiRequest<NotificationReadReceipt>(getMarkOrganizationNotificationReadUrl(orgId,notificationId),
{
...options,
method: 'POST'
}
);}
export const getMarkOrganizationNotificationReadMutationKey = () => ['markOrganizationNotificationRead'] as const;
export const getMarkOrganizationNotificationReadMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof markOrganizationNotificationRead>>, TError,MarkOrganizationNotificationReadMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof markOrganizationNotificationRead>>, TError,MarkOrganizationNotificationReadMutationVariables, TContext> => {
const mutationKey = getMarkOrganizationNotificationReadMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof markOrganizationNotificationRead>>, MarkOrganizationNotificationReadMutationVariables> = (props) => {
const {orgId,notificationId} = props ?? {};
return markOrganizationNotificationRead(orgId,notificationId,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type MarkOrganizationNotificationReadMutationResult = NonNullable<Awaited<ReturnType<typeof markOrganizationNotificationRead>>>
export type MarkOrganizationNotificationReadMutationError = ErrorType<Problem>
export type MarkOrganizationNotificationReadMutationVariables = {orgId: string;notificationId: string}
/**
* @summary Mark an item of the inbox of the current employer in one organization as read.
*/
export const useMarkOrganizationNotificationRead = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof markOrganizationNotificationRead>>, TError,MarkOrganizationNotificationReadMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof markOrganizationNotificationRead>>,
TError,
MarkOrganizationNotificationReadMutationVariables,
TContext
> => {
return useMutation(getMarkOrganizationNotificationReadMutationOptions(options), queryClient);
}