From 3224934904fc0ade71faa8bb07ab0ebe7fbce97f Mon Sep 17 00:00:00 2001 From: jrmartin Date: Mon, 24 Mar 2025 09:06:25 +0100 Subject: [PATCH 1/2] #91 - Update endpoint to use organizations from backend --- src/api/endpoints/index.ts | 8 +- src/api/endpoints/interLexURIStructureAPI.ts | 1572 +++++++++++++++-- .../SingleOrganization/CreateForkDialog.jsx | 2 +- src/components/organizations/index.jsx | 2 +- 4 files changed, 1385 insertions(+), 199 deletions(-) diff --git a/src/api/endpoints/index.ts b/src/api/endpoints/index.ts index 1155e7f3..e3e0d0a7 100644 --- a/src/api/endpoints/index.ts +++ b/src/api/endpoints/index.ts @@ -13,14 +13,14 @@ const useApi = () => api; const BASE_GROUP = "base"; const BASE_EXTENSION = "jsonld"; -export const getOrganizations = async () => { +export const getOrganizations = async (group) => { /** Call endpoint for retrieving organizations, this is a mock endpoint created by us */ - const { getOrganizations } = useMockApi(); + const { getPrivRoleOtherGroup } = useApi(); /** Call Endpoint */ - return await getOrganizations().then((data) => { - return data as Organizations; + return await getPrivRoleOtherGroup(group).then((data) => { + return data; }) .catch((error) => { return error; diff --git a/src/api/endpoints/interLexURIStructureAPI.ts b/src/api/endpoints/interLexURIStructureAPI.ts index 2b79b428..1ff240c8 100644 --- a/src/api/endpoints/interLexURIStructureAPI.ts +++ b/src/api/endpoints/interLexURIStructureAPI.ts @@ -1058,6 +1058,195 @@ export const useGetEndpointsGroup = , signal?: AbortSignal +) => { + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/contributions`, + method: 'GET', + signal + }, + options + ); +} + +export const getGetEndpointsContributionsQueryKeyExtension = (group: string,) => { + return [`https://uri.olympiangods.org/${group}/contributions`] as const; +} + +export const getGetEndpointsContributionsQueryOptionsExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetEndpointsContributionsQueryKeyExtension(group); + + const queryFn: QueryFunction>> = ({ signal }) => + getEndpointsContributionsExtension(group, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!group, + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; +} + +export type GetEndpointsContributionsQueryResultExtension = NonNullable>> +export type GetEndpointsContributionsQueryErrorExtension = ErrorType + +export const useGetEndpointsContributionsExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + const queryOptions = getGetEndpointsContributionsQueryOptionsExtension(group, options); + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + query.queryKey = queryOptions.queryKey; + return query; +} + +// Second version with `/contributions/interlex` +export const getEndpointsContributionsExtensionInterlex = ( + group: string, + options?: SecondParameter, signal?: AbortSignal +) => { + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/contributions/interlex`, + method: 'GET', + signal + }, + options + ); +} + +export const getGetEndpointsContributionsQueryKeyExtensionInterlex = (group: string,) => { + return [`https://uri.olympiangods.org/${group}/contributions/interlex`] as const; +} + +export const getGetEndpointsContributionsQueryOptionsExtensionInterlex = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetEndpointsContributionsQueryKeyExtensionInterlex(group); + + const queryFn: QueryFunction>> = ({ signal }) => + getEndpointsContributionsExtensionInterlex(group, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!group, + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; +} + +export type GetEndpointsContributionsQueryResultExtensionInterlex = NonNullable>> +export type GetEndpointsContributionsQueryErrorExtensionInterlex = ErrorType + +export const useGetEndpointsContributionsExtensionInterlex = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + const queryOptions = getGetEndpointsContributionsQueryOptionsExtensionInterlex(group, options); + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + query.queryKey = queryOptions.queryKey; + return query; +} + +// --------------------------------------- + +export const getEndpointsCuriesExtension = ( + group: string, + options?: SecondParameter, signal?: AbortSignal +) => { + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/curies`, + method: 'GET', + signal + }, + options + ); +} + +export const getGetEndpointsCuriesQueryKeyExtension = (group: string,) => { + return [`https://uri.olympiangods.org/${group}/curies`] as const; +} + +export const getGetEndpointsCuriesQueryOptionsExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetEndpointsCuriesQueryKeyExtension(group); + + const queryFn: QueryFunction>> = ({ signal }) => + getEndpointsCuriesExtension(group, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!group, + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; +} + +export type GetEndpointsCuriesQueryResultExtension = NonNullable>> +export type GetEndpointsCuriesQueryErrorExtension = ErrorType + +export const useGetEndpointsCuriesExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + const queryOptions = getGetEndpointsCuriesQueryOptionsExtension(group, options); + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + query.queryKey = queryOptions.queryKey; + return query; +} + export const postEndpointsCuries = ( group: string, options?: SecondParameter,) => { @@ -1169,6 +1358,148 @@ export const useGetEndpointsCuries = ,signal?: AbortSignal +) => { + + + return customInstance( + {url: `https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/curies`, method: 'GET', signal + }, + options); + } + + +export const getGetDiffCuriesQueryKey = (group: string, + otherGroupDiff: string,) => { + return [`https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/curies`] as const; + } + + +export const getGetDiffCuriesQueryOptions = >, TError = ErrorType>(group: string, + otherGroupDiff: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +) => { + +const {query: queryOptions, request: requestOptions} = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetDiffCuriesQueryKey(group,otherGroupDiff); + + + + const queryFn: QueryFunction>> = ({ signal }) => getDiffCuries(group,otherGroupDiff, requestOptions, signal); + + + + + + return { queryKey, queryFn, enabled: !!(group && otherGroupDiff), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } +} + +export type GetDiffCuriesQueryResult = NonNullable>> +export type GetDiffCuriesQueryError = ErrorType + +export const useGetDiffCuries = >, TError = ErrorType>( + group: string, + otherGroupDiff: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + + ): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetDiffCuriesQueryOptions(group,otherGroupDiff,options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey ; + + return query; +} + + +export const getDiffCuriesExtension = ( + group: string, + otherGroupDiff: string, + prefixIriCurie: string, + extension: string, + options?: SecondParameter, signal?: AbortSignal +) => { + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/curies/${prefixIriCurie}.${extension}`, + method: 'GET', + signal + }, + options + ); +} + +export const getGetDiffCuriesQueryKeyExtension = ( + group: string, + otherGroupDiff: string, + prefixIriCurie: string, + extension: string, +) => { + return [`https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/curies/${prefixIriCurie}.${extension}`] as const; +} + +export const getGetDiffCuriesQueryOptionsExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherGroupDiff: string, + prefixIriCurie: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetDiffCuriesQueryKeyExtension(group, otherGroupDiff, prefixIriCurie, extension); + + const queryFn: QueryFunction>> = ({ signal }) => + getDiffCuriesExtension(group, otherGroupDiff, prefixIriCurie, extension, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!(group && otherGroupDiff && prefixIriCurie && extension), + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; +} + +export type GetDiffCuriesQueryResultExtension = NonNullable>> +export type GetDiffCuriesQueryErrorExtension = ErrorType + +export const useGetDiffCuriesExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherGroupDiff: string, + prefixIriCurie: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetDiffCuriesQueryOptionsExtension(group, otherGroupDiff, prefixIriCurie, extension, options); + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + + export const getDiffLexical = ( group: string, otherGroupDiff: string, @@ -1230,6 +1561,75 @@ export const useGetDiffLexical = ,signal?: AbortSignal +) => { + + + return customInstance( + {url: `https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/ontologies`, method: 'GET', signal + }, + options); + } + + +export const getGetDiffOntologiesQueryKey = (group: string, + otherGroupDiff: string,) => { + return [`https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/ontologies`] as const; + } + + +export const getGetDiffOntologiesQueryOptions = >, TError = ErrorType>(group: string, + otherGroupDiff: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +) => { + +const {query: queryOptions, request: requestOptions} = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetDiffOntologiesQueryKey(group,otherGroupDiff); + + + + const queryFn: QueryFunction>> = ({ signal }) => getDiffOntologies(group,otherGroupDiff, requestOptions, signal); + + + + + + return { queryKey, queryFn, enabled: !!(group && otherGroupDiff), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } +} + +export type GetDiffOntologiesQueryResult = NonNullable>> +export type GetDiffOntologiesQueryError = ErrorType + +/** + * @summary The terminal ontologies query does go on endpoints + */ +export const useGetDiffOntologies = >, TError = ErrorType>( + group: string, + otherGroupDiff: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + + ): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetDiffOntologiesQueryOptions(group,otherGroupDiff,options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey ; + + return query; +} + + + + /** * @summary needed because ontologies appear under other routes */ @@ -1703,87 +2103,96 @@ export const useGetDiffOntologiesUrisVersion = ,signal?: AbortSignal -) => { - - - return customInstance( - {url: `https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/ontologies/${ontPath}/${filename}.${extension}`, method: 'GET', signal - }, - options); - } - - -export const getGetDiffOntologiesQueryKey = (group: string, - otherGroupDiff: string, - ontPath: string, - filename: string, - extension: string,) => { - return [`https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/ontologies/${ontPath}/${filename}.${extension}`] as const; - } - - -export const getGetDiffOntologiesQueryOptions = >, TError = ErrorType>(group: string, - otherGroupDiff: string, - ontPath: string, - filename: string, - extension: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} -) => { - -const {query: queryOptions, request: requestOptions} = options ?? {}; - - const queryKey = queryOptions?.queryKey ?? getGetDiffOntologiesQueryKey(group,otherGroupDiff,ontPath,filename,extension); - - - - const queryFn: QueryFunction>> = ({ signal }) => getDiffOntologies(group,otherGroupDiff,ontPath,filename,extension, requestOptions, signal); - - - - - - return { queryKey, queryFn, enabled: !!(group && otherGroupDiff && ontPath && filename && extension), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } -} - -export type GetDiffOntologiesQueryResult = NonNullable>> -export type GetDiffOntologiesQueryError = ErrorType +export const getDiffOntologiesExtension = ( + group: string, + otherGroupDiff: string, + ontPath: string, + filename: string, + extension: string, + options?: SecondParameter, signal?: AbortSignal +) => { + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/ontologies/${ontPath}/${filename}.${extension}`, + method: 'GET', + signal + }, + options + ); +} + +export const getGetDiffOntologiesQueryKeyExtension = ( + group: string, + otherGroupDiff: string, + ontPath: string, + filename: string, + extension: string, +) => { + return [`https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/ontologies/${ontPath}/${filename}.${extension}`] as const; +} + +export const getGetDiffOntologiesQueryOptionsExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherGroupDiff: string, + ontPath: string, + filename: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetDiffOntologiesQueryKeyExtension(group, otherGroupDiff, ontPath, filename, extension); + + const queryFn: QueryFunction>> = ({ signal }) => + getDiffOntologiesExtension(group, otherGroupDiff, ontPath, filename, extension, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!(group && otherGroupDiff && ontPath && filename && extension), + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; +} + +export type GetDiffOntologiesQueryResultExtension = NonNullable>> +export type GetDiffOntologiesQueryErrorExtension = ErrorType /** - * @summary needed because ontologies appear under other routes - */ -export const useGetDiffOntologies = >, TError = ErrorType>( - group: string, - otherGroupDiff: string, - ontPath: string, - filename: string, - extension: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} - - ): UseQueryResult & { queryKey: QueryKey } => { - - const queryOptions = getGetDiffOntologiesQueryOptions(group,otherGroupDiff,ontPath,filename,extension,options) - - const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; - - query.queryKey = queryOptions.queryKey ; +* @summary needed because ontologies appear under other routes +*/ +export const useGetDiffOntologiesExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherGroupDiff: string, + ontPath: string, + filename: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetDiffOntologiesQueryOptionsExtension(group, otherGroupDiff, ontPath, filename, extension, options); + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey; return query; } - - - /** * @summary needed because ontologies appear under other routes */ @@ -2137,6 +2546,157 @@ export const useGetDiffUris = >, return query; } + + + +export const getDiffVersionsCuries = ( + group: string, + otherGroupDiff: string, + epochVerstrId: string, + options?: SecondParameter,signal?: AbortSignal +) => { + + + return customInstance( + {url: `https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/versions/${epochVerstrId}/curies`, method: 'GET', signal + }, + options); + } + + +export const getGetDiffVersionsCuriesQueryKey = (group: string, + otherGroupDiff: string, + epochVerstrId: string,) => { + return [`https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/versions/${epochVerstrId}/curies`] as const; + } + + +export const getGetDiffVersionsCuriesQueryOptions = >, TError = ErrorType>(group: string, + otherGroupDiff: string, + epochVerstrId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +) => { + +const {query: queryOptions, request: requestOptions} = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetDiffVersionsCuriesQueryKey(group,otherGroupDiff,epochVerstrId); + + + + const queryFn: QueryFunction>> = ({ signal }) => getDiffVersionsCuries(group,otherGroupDiff,epochVerstrId, requestOptions, signal); + + + + + + return { queryKey, queryFn, enabled: !!(group && otherGroupDiff && epochVerstrId), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } +} + +export type GetDiffVersionsCuriesQueryResult = NonNullable>> +export type GetDiffVersionsCuriesQueryError = ErrorType + +export const useGetDiffVersionsCuries = >, TError = ErrorType>( + group: string, + otherGroupDiff: string, + epochVerstrId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + + ): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetDiffVersionsCuriesQueryOptions(group,otherGroupDiff,epochVerstrId,options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey ; + + return query; +} + +export const getDiffVersionsCuriesExtension = ( + group: string, + otherGroupDiff: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, + options?: SecondParameter, signal?: AbortSignal +) => { + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/versions/${epochVerstrId}/curies/${prefixIriCurie}.${extension}`, + method: 'GET', + signal + }, + options + ); +} + +export const getGetDiffVersionsCuriesQueryKeyExtension = ( + group: string, + otherGroupDiff: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, +) => { + return [`https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/versions/${epochVerstrId}/curies/${prefixIriCurie}.${extension}`] as const; +} + +export const getGetDiffVersionsCuriesQueryOptionsExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherGroupDiff: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetDiffVersionsCuriesQueryKeyExtension(group, otherGroupDiff, epochVerstrId, prefixIriCurie, extension); + + const queryFn: QueryFunction>> = ({ signal }) => + getDiffVersionsCuriesExtension(group, otherGroupDiff, epochVerstrId, prefixIriCurie, extension, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!(group && otherGroupDiff && epochVerstrId && prefixIriCurie && extension), + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; +} + +export type GetDiffVersionsCuriesQueryResultExtension = NonNullable>> +export type GetDiffVersionsCuriesQueryErrorExtension = ErrorType + +export const useGetDiffVersionsCuriesExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherGroupDiff: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetDiffVersionsCuriesQueryOptionsExtension(group, otherGroupDiff, epochVerstrId, prefixIriCurie, extension, options); + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + + + + export const getDiffVersionsReadable = ( group: string, otherGroupDiff: string, @@ -4227,6 +4787,139 @@ const {mutation: mutationOptions, request: requestOptions} = options ?? {}; return useMutation(mutationOptions); } + +export const getOwnCuriesExtension = ( + group: string, + otherGroup: string, + prefixIriCurie: string, + extension: string, + options?: SecondParameter,signal?: AbortSignal +) => { + + + return customInstance( + {url: `https://uri.olympiangods.org/${group}/own/${otherGroup}/curies/${prefixIriCurie}.${extension}`, method: 'GET', signal + }, + options); + } + + +export const getGetOwnCuriesQueryKeyExtension = (group: string, + otherGroup: string, + prefixIriCurie: string, + extension: string,) => { + return [`https://uri.olympiangods.org/${group}/own/${otherGroup}/curies/${prefixIriCurie}.${extension}`] as const; + } + + +export const getGetOwnCuriesQueryOptionsExtension = >, TError = ErrorType>(group: string, + otherGroup: string, + prefixIriCurie: string, + extension: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +) => { + +const {query: queryOptions, request: requestOptions} = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetOwnCuriesQueryKeyExtension(group,otherGroup,prefixIriCurie,extension); + + + + const queryFn: QueryFunction>> = ({ signal }) => getOwnCuriesExtension(group,otherGroup,prefixIriCurie,extension, requestOptions, signal); + + + + + + return { queryKey, queryFn, enabled: !!(group && otherGroup && prefixIriCurie && extension), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } +} + +export type GetOwnCuriesQueryResultExtension = NonNullable>> +export type GetOwnCuriesQueryErrorExtension = ErrorType + +export const useGetOwnCuriesExtension = >, TError = ErrorType>( + group: string, + otherGroup: string, + prefixIriCurie: string, + extension: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + + ): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetOwnCuriesQueryOptionsExtension(group,otherGroup,prefixIriCurie,extension,options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey ; + + return query; +} + + + + +/** + * @summary The terminal ontologies query does go on endpoints + */ +export const getOwnOntologies = ( + group: string, + otherGroup: string, + options?: SecondParameter,signal?: AbortSignal +) => { + + + return customInstance( + {url: `https://uri.olympiangods.org/${group}/own/${otherGroup}/ontologies`, method: 'GET', signal + }, + options); + } + + +export const getGetOwnOntologiesQueryKey = (group: string, + otherGroup: string,) => { + return [`https://uri.olympiangods.org/${group}/own/${otherGroup}/ontologies`] as const; + } + + +export const getGetOwnOntologiesQueryOptions = >, TError = ErrorType>(group: string, + otherGroup: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +) => { + +const {query: queryOptions, request: requestOptions} = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetOwnOntologiesQueryKey(group,otherGroup); + + + + const queryFn: QueryFunction>> = ({ signal }) => getOwnOntologies(group,otherGroup, requestOptions, signal); + + + + + + return { queryKey, queryFn, enabled: !!(group && otherGroup), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } +} + +export type GetOwnOntologiesQueryResult = NonNullable>> +export type GetOwnOntologiesQueryError = ErrorType + +/** + * @summary The terminal ontologies query does go on endpoints + */ +export const useGetOwnOntologies = >, TError = ErrorType>( + group: string, + otherGroup: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + + ): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetOwnOntologiesQueryOptions(group,otherGroup,options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey ; + + return query; +} + + /** @@ -5010,87 +5703,100 @@ export const usePostOwnOntologiesUrisVersion = , const mutationOptions = getPostOwnOntologiesUrisVersionMutationOptions(options); - return useMutation(mutationOptions); - } - -/** - * @summary needed because ontologies appear under other routes - */ -export const getOwnOntologies = ( - group: string, - otherGroup: string, - ontPath: string, - filename: string, - extension: string, - options?: SecondParameter,signal?: AbortSignal -) => { - - - return customInstance( - {url: `https://uri.olympiangods.org/${group}/own/${otherGroup}/ontologies/${ontPath}/${filename}.${extension}`, method: 'GET', signal - }, - options); - } - - -export const getGetOwnOntologiesQueryKey = (group: string, - otherGroup: string, - ontPath: string, - filename: string, - extension: string,) => { - return [`https://uri.olympiangods.org/${group}/own/${otherGroup}/ontologies/${ontPath}/${filename}.${extension}`] as const; - } - - -export const getGetOwnOntologiesQueryOptions = >, TError = ErrorType>(group: string, - otherGroup: string, - ontPath: string, - filename: string, - extension: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} -) => { - -const {query: queryOptions, request: requestOptions} = options ?? {}; - - const queryKey = queryOptions?.queryKey ?? getGetOwnOntologiesQueryKey(group,otherGroup,ontPath,filename,extension); - - - - const queryFn: QueryFunction>> = ({ signal }) => getOwnOntologies(group,otherGroup,ontPath,filename,extension, requestOptions, signal); - - - - - - return { queryKey, queryFn, enabled: !!(group && otherGroup && ontPath && filename && extension), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } -} - -export type GetOwnOntologiesQueryResult = NonNullable>> -export type GetOwnOntologiesQueryError = ErrorType - -/** - * @summary needed because ontologies appear under other routes - */ -export const useGetOwnOntologies = >, TError = ErrorType>( - group: string, - otherGroup: string, - ontPath: string, - filename: string, - extension: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} - - ): UseQueryResult & { queryKey: QueryKey } => { - - const queryOptions = getGetOwnOntologiesQueryOptions(group,otherGroup,ontPath,filename,extension,options) - - const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + return useMutation(mutationOptions); + } +/** + * @summary needed because ontologies appear under other routes + */ +export const getOwnOntologiesExtension = ( + group: string, + otherGroup: string, + ontPath: string, + filename: string, + extension: string, + options?: SecondParameter, signal?: AbortSignal +) => { + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/own/${otherGroup}/ontologies/${ontPath}/${filename}.${extension}`, + method: 'GET', + signal + }, + options + ); +} + +export const getGetOwnOntologiesQueryKeyExtension = ( + group: string, + otherGroup: string, + ontPath: string, + filename: string, + extension: string, +) => { + return [`https://uri.olympiangods.org/${group}/own/${otherGroup}/ontologies/${ontPath}/${filename}.${extension}`] as const; +} + +export const getGetOwnOntologiesQueryOptionsExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherGroup: string, + ontPath: string, + filename: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetOwnOntologiesQueryKeyExtension(group, otherGroup, ontPath, filename, extension); + + const queryFn: QueryFunction>> = ({ signal }) => + getOwnOntologiesExtension(group, otherGroup, ontPath, filename, extension, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!(group && otherGroup && ontPath && filename && extension), + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; +} + +export type GetOwnOntologiesQueryResultExtension = NonNullable>> +export type GetOwnOntologiesQueryErrorExtension = ErrorType - query.queryKey = queryOptions.queryKey ; +/** +* @summary needed because ontologies appear under other routes +*/ +export const useGetOwnOntologiesExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherGroup: string, + ontPath: string, + filename: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetOwnOntologiesQueryOptionsExtension(group, otherGroup, ontPath, filename, extension, options); + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey; return query; } - /** * @summary needed because ontologies appear under other routes */ @@ -5558,6 +6264,154 @@ export const useGetOwnUris = >, TE return query; } + + + +export const getOwnVersionsCuries = ( + group: string, + otherGroup: string, + epochVerstrId: string, + options?: SecondParameter,signal?: AbortSignal +) => { + + + return customInstance( + {url: `https://uri.olympiangods.org/${group}/own/${otherGroup}/versions/${epochVerstrId}/curies`, method: 'GET', signal + }, + options); + } + + +export const getGetOwnVersionsCuriesQueryKey = (group: string, + otherGroup: string, + epochVerstrId: string,) => { + return [`https://uri.olympiangods.org/${group}/own/${otherGroup}/versions/${epochVerstrId}/curies`] as const; + } + + +export const getGetOwnVersionsCuriesQueryOptions = >, TError = ErrorType>(group: string, + otherGroup: string, + epochVerstrId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +) => { + +const {query: queryOptions, request: requestOptions} = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetOwnVersionsCuriesQueryKey(group,otherGroup,epochVerstrId); + + + + const queryFn: QueryFunction>> = ({ signal }) => getOwnVersionsCuries(group,otherGroup,epochVerstrId, requestOptions, signal); + + + + + + return { queryKey, queryFn, enabled: !!(group && otherGroup && epochVerstrId), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } +} + +export type GetOwnVersionsCuriesQueryResult = NonNullable>> +export type GetOwnVersionsCuriesQueryError = ErrorType + +export const useGetOwnVersionsCuries = >, TError = ErrorType>( + group: string, + otherGroup: string, + epochVerstrId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + + ): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetOwnVersionsCuriesQueryOptions(group,otherGroup,epochVerstrId,options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey ; + + return query; +} + +export const getOwnVersionsCuriesExtension = ( + group: string, + otherGroup: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, + options?: SecondParameter, signal?: AbortSignal +) => { + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/own/${otherGroup}/versions/${epochVerstrId}/curies/${prefixIriCurie}.${extension}`, + method: 'GET', + signal + }, + options + ); +} + +export const getGetOwnVersionsCuriesQueryKeyExtension = ( + group: string, + otherGroup: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, +) => { + return [`https://uri.olympiangods.org/${group}/own/${otherGroup}/versions/${epochVerstrId}/curies/${prefixIriCurie}.${extension}`] as const; +} + +export const getGetOwnVersionsCuriesQueryOptionsExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherGroup: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetOwnVersionsCuriesQueryKeyExtension(group, otherGroup, epochVerstrId, prefixIriCurie, extension); + + const queryFn: QueryFunction>> = ({ signal }) => + getOwnVersionsCuriesExtension(group, otherGroup, epochVerstrId, prefixIriCurie, extension, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!(group && otherGroup && epochVerstrId && prefixIriCurie && extension), + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; +} + +export type GetOwnVersionsCuriesQueryResultExtension = NonNullable>> +export type GetOwnVersionsCuriesQueryErrorExtension = ErrorType + +export const useGetOwnVersionsCuriesExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherGroup: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetOwnVersionsCuriesQueryOptionsExtension(group, otherGroup, epochVerstrId, prefixIriCurie, extension, options); + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + export const getOwnVersionsReadable = ( group: string, otherGroup: string, @@ -7263,107 +8117,105 @@ const {mutation: mutationOptions, request: requestOptions} = options ?? {}; return useMutation(mutationOptions); } - -export const deletePrivRoleOtherGroup = ( + +export const getPrivUserRole = ( group: string, - otherRoleGroup: string, - options?: SecondParameter,) => { + options?: SecondParameter,signal?: AbortSignal +) => { return customInstance( - {url: `https://uri.olympiangods.org/${group}/priv/role-other/${otherRoleGroup}`, method: 'DELETE' + {url: `https://uri.olympiangods.org/${group}/priv/role`, method: 'GET', signal }, options); } +export const getGetPrivUserRoleQueryKey = (group: string,) => { + return [`https://uri.olympiangods.org/${group}/priv/role`] as const; + } -export const getDeletePrivRoleOtherGroupMutationOptions = , - TContext = unknown>(options?: { mutation?:UseMutationOptions>, TError,{group: string;otherRoleGroup: string}, TContext>, request?: SecondParameter} -): UseMutationOptions>, TError,{group: string;otherRoleGroup: string}, TContext> => { -const {mutation: mutationOptions, request: requestOptions} = options ?? {}; + +export const getGetPrivUserRoleQueryOptions = >, TError = ErrorType>(group: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +) => { + +const {query: queryOptions, request: requestOptions} = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetPrivUserRoleQueryKey(group); + + + + const queryFn: QueryFunction>> = ({ signal }) => getPrivUserRole(group, requestOptions, signal); + - const mutationFn: MutationFunction>, {group: string;otherRoleGroup: string}> = (props) => { - const {group,otherRoleGroup} = props ?? {}; + return { queryKey, queryFn, enabled: !!(group), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } +} - return deletePrivRoleOtherGroup(group,otherRoleGroup,requestOptions) - } +export type GetPrivUserRoleQueryResult = NonNullable>> +export type GetPrivUserRoleQueryError = ErrorType - +export const useGetPrivUserRole = >, TError = ErrorType>( + group: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + ): UseQueryResult & { queryKey: QueryKey } => { - return { mutationFn, ...mutationOptions }} + const queryOptions = getGetPrivUserRoleQueryOptions(group,options) - export type DeletePrivRoleOtherGroupMutationResult = NonNullable>> - - export type DeletePrivRoleOtherGroupMutationError = ErrorType + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; - export const useDeletePrivRoleOtherGroup = , - TContext = unknown>(options?: { mutation?:UseMutationOptions>, TError,{group: string;otherRoleGroup: string}, TContext>, request?: SecondParameter} -): UseMutationResult< - Awaited>, - TError, - {group: string;otherRoleGroup: string}, - TContext - > => { + query.queryKey = queryOptions.queryKey ; - const mutationOptions = getDeletePrivRoleOtherGroupMutationOptions(options); + return query; +} - return useMutation(mutationOptions); - } - -export const getPrivUserRole = ( +export const getPrivRoleOtherGroup = ( group: string, - user: string, options?: SecondParameter,signal?: AbortSignal ) => { return customInstance( - {url: `https://uri.olympiangods.org/${group}/priv/role/${user}`, method: 'GET', signal + {url: `https://uri.olympiangods.org/${group}/priv/role-other`, method: 'GET', signal }, options); } -export const getGetPrivUserRoleQueryKey = (group: string, - user: string,) => { - return [`https://uri.olympiangods.org/${group}/priv/role/${user}`] as const; +export const getGetPrivRoleOtherGroupQueryKey = (group: string,) => { + return [`https://uri.olympiangods.org/${group}/priv/role-other`] as const; } -export const getGetPrivUserRoleQueryOptions = >, TError = ErrorType>(group: string, - user: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +export const getGetPrivRoleOtherGroupQueryOptions = >, TError = ErrorType>(group: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} ) => { const {query: queryOptions, request: requestOptions} = options ?? {}; - const queryKey = queryOptions?.queryKey ?? getGetPrivUserRoleQueryKey(group,user); + const queryKey = queryOptions?.queryKey ?? getGetPrivRoleOtherGroupQueryKey(group); - const queryFn: QueryFunction>> = ({ signal }) => getPrivUserRole(group,user, requestOptions, signal); + const queryFn: QueryFunction>> = ({ signal }) => getPrivRoleOtherGroup(group, requestOptions, signal); - return { queryKey, queryFn, enabled: !!(group && user), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } + return { queryKey, queryFn, enabled: !!(group), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } } -export type GetPrivUserRoleQueryResult = NonNullable>> -export type GetPrivUserRoleQueryError = ErrorType +export type GetPrivRoleOtherGroupQueryResult = NonNullable>> +export type GetPrivRoleOtherGroupQueryError = ErrorType -export const useGetPrivUserRole = >, TError = ErrorType>( - group: string, - user: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +export const useGetPrivRoleOtherGroup = >, TError = ErrorType>( + group: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { - const queryOptions = getGetPrivUserRoleQueryOptions(group,user,options) + const queryOptions = getGetPrivRoleOtherGroupQueryOptions(group,options) const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; @@ -7372,8 +8224,200 @@ export const useGetPrivUserRole = , signal?: AbortSignal +) => { + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/priv/role-other/${otherRoleGroup}`, + method: 'GET', + signal + }, + options + ); +} + +export const getGetPrivRoleOtherGroupQueryKeyOther = ( + group: string, + otherRoleGroup: string, +) => { + return [`https://uri.olympiangods.org/${group}/priv/role-other/${otherRoleGroup}`] as const; +} + +export const getGetPrivRoleOtherGroupQueryOptionsOther = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherRoleGroup: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetPrivRoleOtherGroupQueryKeyOther(group, otherRoleGroup); + + const queryFn: QueryFunction>> = ({ signal }) => + getPrivRoleOtherGroupOther(group, otherRoleGroup, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!(group && otherRoleGroup), + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; +} + +export type GetPrivRoleOtherGroupQueryResultOther = NonNullable>> +export type GetPrivRoleOtherGroupQueryErrorOther = ErrorType + +export const useGetPrivRoleOtherGroupOther = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + otherRoleGroup: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetPrivRoleOtherGroupQueryOptionsOther(group, otherRoleGroup, options); + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +export const deletePrivRoleOtherGroup = ( + group: string, + otherRoleGroup: string, + options?: SecondParameter,) => { + + + return customInstance( + {url: `https://uri.olympiangods.org/${group}/priv/role-other/${otherRoleGroup}`, method: 'DELETE' + }, + options); + } + + + +export const getDeletePrivRoleOtherGroupMutationOptions = , + TContext = unknown>(options?: { mutation?:UseMutationOptions>, TError,{group: string;otherRoleGroup: string}, TContext>, request?: SecondParameter} +): UseMutationOptions>, TError,{group: string;otherRoleGroup: string}, TContext> => { +const {mutation: mutationOptions, request: requestOptions} = options ?? {}; + + + + + const mutationFn: MutationFunction>, {group: string;otherRoleGroup: string}> = (props) => { + const {group,otherRoleGroup} = props ?? {}; + + return deletePrivRoleOtherGroup(group,otherRoleGroup,requestOptions) + } + + + + + return { mutationFn, ...mutationOptions }} + + export type DeletePrivRoleOtherGroupMutationResult = NonNullable>> + + export type DeletePrivRoleOtherGroupMutationError = ErrorType + + export const useDeletePrivRoleOtherGroup = , + TContext = unknown>(options?: { mutation?:UseMutationOptions>, TError,{group: string;otherRoleGroup: string}, TContext>, request?: SecondParameter} +): UseMutationResult< + Awaited>, + TError, + {group: string;otherRoleGroup: string}, + TContext + > => { + + const mutationOptions = getDeletePrivRoleOtherGroupMutationOptions(options); + return useMutation(mutationOptions); + } + export const getPrivUserRoleUser = ( + group: string, + user: string, + options?: SecondParameter, signal?: AbortSignal + ) => { + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/priv/role/${user}`, + method: 'GET', + signal + }, + options + ); + } + + export const getGetPrivUserRoleQueryKeyUser = ( + group: string, + user: string, + ) => { + return [`https://uri.olympiangods.org/${group}/priv/role/${user}`] as const; + } + + export const getGetPrivUserRoleQueryOptionsUser = < + TData = Awaited>, + TError = ErrorType + >( + group: string, + user: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } + ) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetPrivUserRoleQueryKeyUser(group, user); + + const queryFn: QueryFunction>> = ({ signal }) => + getPrivUserRoleUser(group, user, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!(group && user), + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; + } + + export type GetPrivUserRoleQueryResultUser = NonNullable>> + export type GetPrivUserRoleQueryErrorUser = ErrorType + + export const useGetPrivUserRoleUser = < + TData = Awaited>, + TError = ErrorType + >( + group: string, + user: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } + ): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetPrivUserRoleQueryOptionsUser(group, user, options); + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey; + + return query; + } export const deletePrivUserRole = ( group: string, @@ -8195,6 +9239,148 @@ export const useGetEndpointsUris = ,signal?: AbortSignal +) => { + + + return customInstance( + {url: `https://uri.olympiangods.org/${group}/versions/${epochVerstrId}/curies`, method: 'GET', signal + }, + options); + } + + +export const getGetVersionsCuriesQueryKey = (group: string, + epochVerstrId: string,) => { + return [`https://uri.olympiangods.org/${group}/versions/${epochVerstrId}/curies`] as const; + } + + +export const getGetVersionsCuriesQueryOptions = >, TError = ErrorType>(group: string, + epochVerstrId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +) => { + +const {query: queryOptions, request: requestOptions} = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetVersionsCuriesQueryKey(group,epochVerstrId); + + + + const queryFn: QueryFunction>> = ({ signal }) => getVersionsCuries(group,epochVerstrId, requestOptions, signal); + + + + + + return { queryKey, queryFn, enabled: !!(group && epochVerstrId), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } +} + +export type GetVersionsCuriesQueryResult = NonNullable>> +export type GetVersionsCuriesQueryError = ErrorType + +export const useGetVersionsCuries = >, TError = ErrorType>( + group: string, + epochVerstrId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + + ): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetVersionsCuriesQueryOptions(group,epochVerstrId,options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey ; + + return query; +} + +export const getVersionsCuriesExtension = ( + group: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, + options?: SecondParameter, signal?: AbortSignal +) => { + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/versions/${epochVerstrId}/curies/${prefixIriCurie}.${extension}`, + method: 'GET', + signal + }, + options + ); +} + +export const getGetVersionsCuriesQueryKeyExtension = ( + group: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, +) => { + return [`https://uri.olympiangods.org/${group}/versions/${epochVerstrId}/curies/${prefixIriCurie}.${extension}`] as const; +} + +export const getGetVersionsCuriesQueryOptionsExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetVersionsCuriesQueryKeyExtension(group, epochVerstrId, prefixIriCurie, extension); + + const queryFn: QueryFunction>> = ({ signal }) => + getVersionsCuriesExtension(group, epochVerstrId, prefixIriCurie, extension, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!(group && epochVerstrId && prefixIriCurie && extension), + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; +} + +export type GetVersionsCuriesQueryResultExtension = NonNullable>> +export type GetVersionsCuriesQueryErrorExtension = ErrorType + +export const useGetVersionsCuriesExtension = < + TData = Awaited>, + TError = ErrorType +>( + group: string, + epochVerstrId: string, + prefixIriCurie: string, + extension: string, + options?: { + query?: Partial>, TError, TData>>, + request?: SecondParameter + } +): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetVersionsCuriesQueryOptionsExtension(group, epochVerstrId, prefixIriCurie, extension, options); + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + + + export const getVersionsReadable = ( group: string, epochVerstrId: string, diff --git a/src/components/SingleOrganization/CreateForkDialog.jsx b/src/components/SingleOrganization/CreateForkDialog.jsx index 503a4542..0e879396 100644 --- a/src/components/SingleOrganization/CreateForkDialog.jsx +++ b/src/components/SingleOrganization/CreateForkDialog.jsx @@ -60,7 +60,7 @@ const CreateForkDialog = ({ open, handleClose, onSubmit }) => { ); const fetchOrganizations = async () => { - const organizations = await getOrganizations() + const organizations = await getOrganizations("base") setOrganizations(organizations); setLoading(false) } diff --git a/src/components/organizations/index.jsx b/src/components/organizations/index.jsx index e0673821..41647540 100644 --- a/src/components/organizations/index.jsx +++ b/src/components/organizations/index.jsx @@ -11,7 +11,7 @@ const Organizations = () => { const [loading, setLoading] = useState(true); const fetchOrganizations = async() => { - const organizations = await getOrganizations() + const organizations = await getOrganizations("base") setOrganizations(organizations); setLoading(false) } From 31492a9cdd0f393da23484f3de0928ffb3b34c0a Mon Sep 17 00:00:00 2001 From: jrmartin Date: Mon, 24 Mar 2025 18:16:51 +0100 Subject: [PATCH 2/2] #91 - Create links to endpoints contacting olympian gods --- src/api/endpoints/index.ts | 27 ++++++++++++++++---------- src/components/Auth/Login.jsx | 9 +++++++-- src/components/organizations/index.jsx | 5 +++-- src/contexts/DataContext.jsx | 6 +++++- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/api/endpoints/index.ts b/src/api/endpoints/index.ts index e3e0d0a7..43aeaaac 100644 --- a/src/api/endpoints/index.ts +++ b/src/api/endpoints/index.ts @@ -14,8 +14,6 @@ const BASE_GROUP = "base"; const BASE_EXTENSION = "jsonld"; export const getOrganizations = async (group) => { - /** Call endpoint for retrieving organizations, this is a mock endpoint - created by us */ const { getPrivRoleOtherGroup } = useApi(); /** Call Endpoint */ @@ -28,8 +26,6 @@ export const getOrganizations = async (group) => { } export const getOrganization = async (id) => { - /** Call endpoint for retrieving organizations, this is a mock endpoint - created by us */ const { getOrganization } = useMockApi(); /** Call Endpoint */ @@ -42,8 +38,6 @@ export const getOrganization = async (id) => { } export const getOrganizationTerms = async (id) => { - /** Call endpoint for retrieving organizations, this is a mock endpoint - created by us */ const { getOrganizationsTerms } = useMockApi(); /** Call Endpoint */ @@ -55,6 +49,19 @@ export const getOrganizationTerms = async (id) => { }); } +export const newOrganization = async (organization) => { + const { postPrivOrgNew } = useApi(); + + /** Call Endpoint */ + return postPrivOrgNew(organization).then((response) => { + console.log("Post new organization ", response) + return response + }) + .catch((error) => { + return error; + }); +} + export const getOrganizationCuries = async (id) => { const { getOrganizationsCuries } = useMockApi(); @@ -192,10 +199,10 @@ export const searchAll = async (term, filters = {}) => { } export const patchTerm = async (group, termID, term) => { - const patchEndpointsIlx= ""; + const {patchEndpointsIlx} = useApi(); /** Call Endpoint */ - return patchEndpointsIlx(group, termID).then((data) => { + return patchEndpointsIlx(group, termID, term).then((data) => { let termParsed = getTerm(data.data); let response = { status : data.status, @@ -210,10 +217,10 @@ export const patchTerm = async (group, termID, term) => { } export const addTerm = async (group, term) => { - const { addTerm } = useMockApi(); + const { postPrivEntityNew } = useApi(); /** Call Endpoint */ - return addTerm(group, term).then((data) => { + return postPrivEntityNew(group, term).then((data) => { let termParsed = getTerm(data.data); let response = { status : data.status, diff --git a/src/components/Auth/Login.jsx b/src/components/Auth/Login.jsx index 5aeed8b9..ed3816dd 100644 --- a/src/components/Auth/Login.jsx +++ b/src/components/Auth/Login.jsx @@ -15,6 +15,8 @@ import { CheckedIcon, UncheckedIcon, OrcidIcon } from "../../Icons"; import FormField from "./UI/Formfield"; import PasswordField from "./UI/PasswordField"; import { handleLogin } from "../../api/endpoints/index"; +import {GlobalDataContext} from "../../contexts/DataContext"; +import { useContext } from 'react'; const Login = () => { const [formData, setFormData] = React.useState({ @@ -22,6 +24,8 @@ const Login = () => { password: "", }); + const { setUserData } = useContext(GlobalDataContext); + const handleInputChange = (e) => { const { name, value } = e.target; setFormData((prev) => ({ @@ -32,8 +36,9 @@ const Login = () => { const loginUser = async () => { try { - await handleLogin(formData.email, formData.password); - console.log("Login successful"); + const response = await handleLogin(formData.email, formData.password); + console.log("Login successful ", response); + setUserData(response.data) } catch (error) { console.error("Login error:", error); } diff --git a/src/components/organizations/index.jsx b/src/components/organizations/index.jsx index 41647540..10c1b79a 100644 --- a/src/components/organizations/index.jsx +++ b/src/components/organizations/index.jsx @@ -1,5 +1,5 @@ import {useEffect, useState } from "react"; -import { getOrganizations } from "../../api/endpoints"; +import { getOrganizations, newOrganization } from "../../api/endpoints"; import OrganizationsList from "../common/OrganizationsList"; import {Box, Typography, CircularProgress} from "@mui/material"; @@ -19,6 +19,7 @@ const Organizations = () => { useEffect( () => { setLoading(true) fetchOrganizations(); + newOrganization("test"); }, []); if (loading) { @@ -30,7 +31,7 @@ const Organizations = () => { return ( - {organizations.length} Organizations + {organizations?.length} Organizations diff --git a/src/contexts/DataContext.jsx b/src/contexts/DataContext.jsx index fc3ba719..d83e9e7b 100644 --- a/src/contexts/DataContext.jsx +++ b/src/contexts/DataContext.jsx @@ -34,6 +34,9 @@ const GlobalDataProvider = ({ children }) => { setEditBulkSearchFilters(filters); }; + const setUserData = (user) => { + setUser(user) + } // eslint-disable-next-line react-hooks/exhaustive-deps const fetchUser= useCallback(debounce(async () => { @@ -47,6 +50,7 @@ const GlobalDataProvider = ({ children }) => { const dataContextValue = { user, + setUserData, activeOntology, setOntologyData, searchOrganizationFilters, @@ -57,7 +61,7 @@ const GlobalDataProvider = ({ children }) => { setPredicatesSingleTermData, editBulkSearchFilters, setEditBulkSearchData - }; + }; return (