diff --git a/src/api/endpoints/index.ts b/src/api/endpoints/index.ts index 1fe20fb0..e51b7d0a 100644 --- a/src/api/endpoints/index.ts +++ b/src/api/endpoints/index.ts @@ -13,14 +13,12 @@ const useApi = () => api; const BASE_GROUP = "base"; const BASE_EXTENSION = "jsonld"; -export const getOrganizations = async () => { - /** Call endpoint for retrieving organizations, this is a mock endpoint - created by us */ - const { getOrganizations } = useMockApi(); +export const getOrganizations = async (group) => { + 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; @@ -28,8 +26,6 @@ export const getOrganizations = async () => { } 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(); @@ -206,10 +213,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, @@ -224,10 +231,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/api/endpoints/interLexURIStructureAPI.ts b/src/api/endpoints/interLexURIStructureAPI.ts index 10abf38c..8c28cda5 100644 --- a/src/api/endpoints/interLexURIStructureAPI.ts +++ b/src/api/endpoints/interLexURIStructureAPI.ts @@ -1075,6 +1075,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,) => { @@ -1186,6 +1375,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, @@ -1247,6 +1578,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 */ @@ -1720,87 +2120,96 @@ export const useGetDiffOntologiesUrisVersion = ,signal?: AbortSignal +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 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; - } + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/diff/${otherGroupDiff}/ontologies/${ontPath}/${filename}.${extension}`, + method: 'GET', + signal + }, + options + ); +} - -export const getGetDiffOntologiesQueryOptions = >, TError = ErrorType>(group: string, - otherGroupDiff: string, - ontPath: string, - filename: string, - extension: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +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; +} -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); +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 } + 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 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 */ @@ -2143,17 +2552,168 @@ export const useGetDiffUris = >, otherGroupDiff: string, uriPath: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} - ): UseQueryResult & { queryKey: QueryKey } => { + ): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetDiffUrisQueryOptions(group,otherGroupDiff,uriPath,options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey ; + + 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 - const queryOptions = getGetDiffUrisQueryOptions(group,otherGroupDiff,uriPath,options) +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 query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + const queryOptions = getGetDiffVersionsCuriesQueryOptionsExtension(group, otherGroupDiff, epochVerstrId, prefixIriCurie, extension, options); - query.queryKey = queryOptions.queryKey ; + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey; return query; } + + + export const getDiffVersionsReadable = ( group: string, otherGroupDiff: string, @@ -4244,6 +4804,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; +} + + /** @@ -5029,85 +5722,98 @@ export const usePostOwnOntologiesUrisVersion = , 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 +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 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; - } + return customInstance( + { + url: `https://uri.olympiangods.org/${group}/own/${otherGroup}/ontologies/${ontPath}/${filename}.${extension}`, + method: 'GET', + signal + }, + options + ); +} - -export const getGetOwnOntologiesQueryOptions = >, TError = ErrorType>(group: string, - otherGroup: string, - ontPath: string, - filename: string, - extension: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +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; +} -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); +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 } + return { + queryKey, + queryFn, + enabled: !!(group && otherGroup && ontPath && filename && extension), + ...queryOptions + } as UseQueryOptions>, TError, TData> & { queryKey: QueryKey }; } -export type GetOwnOntologiesQueryResult = NonNullable>> -export type GetOwnOntologiesQueryError = ErrorType +export type GetOwnOntologiesQueryResultExtension = NonNullable>> +export type GetOwnOntologiesQueryErrorExtension = 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 }; - - 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 */ @@ -5497,76 +6203,140 @@ const {mutation: mutationOptions, request: requestOptions} = options ?? {}; export type PatchOwnOntologiesIlxSpecMutationError = ErrorType - /** - * @summary needed because ontologies appear under other routes - */ -export const usePatchOwnOntologiesIlxSpec = , - TContext = unknown>(options?: { mutation?:UseMutationOptions>, TError,{group: string;otherGroup: string;fragPrefId: string;extension: string}, TContext>, request?: SecondParameter} -): UseMutationResult< - Awaited>, - TError, - {group: string;otherGroup: string;fragPrefId: string;extension: string}, - TContext - > => { + /** + * @summary needed because ontologies appear under other routes + */ +export const usePatchOwnOntologiesIlxSpec = , + TContext = unknown>(options?: { mutation?:UseMutationOptions>, TError,{group: string;otherGroup: string;fragPrefId: string;extension: string}, TContext>, request?: SecondParameter} +): UseMutationResult< + Awaited>, + TError, + {group: string;otherGroup: string;fragPrefId: string;extension: string}, + TContext + > => { + + const mutationOptions = getPatchOwnOntologiesIlxSpecMutationOptions(options); + + return useMutation(mutationOptions); + } + +export const getOwnUris = ( + group: string, + otherGroup: string, + uriPath: string, + options?: SecondParameter,signal?: AbortSignal +) => { + + + return customInstance( + {url: `https://uri.olympiangods.org/${group}/own/${otherGroup}/uris/${uriPath}`, method: 'GET', signal + }, + options); + } + + +export const getGetOwnUrisQueryKey = (group: string, + otherGroup: string, + uriPath: string,) => { + return [`https://uri.olympiangods.org/${group}/own/${otherGroup}/uris/${uriPath}`] as const; + } + + +export const getGetOwnUrisQueryOptions = >, TError = ErrorType>(group: string, + otherGroup: string, + uriPath: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +) => { + +const {query: queryOptions, request: requestOptions} = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getGetOwnUrisQueryKey(group,otherGroup,uriPath); + + + + const queryFn: QueryFunction>> = ({ signal }) => getOwnUris(group,otherGroup,uriPath, requestOptions, signal); + + + + + + return { queryKey, queryFn, enabled: !!(group && otherGroup && uriPath), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } +} + +export type GetOwnUrisQueryResult = NonNullable>> +export type GetOwnUrisQueryError = ErrorType + +export const useGetOwnUris = >, TError = ErrorType>( + group: string, + otherGroup: string, + uriPath: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + + ): UseQueryResult & { queryKey: QueryKey } => { + + const queryOptions = getGetOwnUrisQueryOptions(group,otherGroup,uriPath,options) + + const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; + + query.queryKey = queryOptions.queryKey ; + + return query; +} + + - const mutationOptions = getPatchOwnOntologiesIlxSpecMutationOptions(options); - return useMutation(mutationOptions); - } - -export const getOwnUris = ( +export const getOwnVersionsCuries = ( group: string, otherGroup: string, - uriPath: string, + epochVerstrId: string, options?: SecondParameter,signal?: AbortSignal ) => { return customInstance( - {url: `https://uri.olympiangods.org/${group}/own/${otherGroup}/uris/${uriPath}`, method: 'GET', signal + {url: `https://uri.olympiangods.org/${group}/own/${otherGroup}/versions/${epochVerstrId}/curies`, method: 'GET', signal }, options); } -export const getGetOwnUrisQueryKey = (group: string, +export const getGetOwnVersionsCuriesQueryKey = (group: string, otherGroup: string, - uriPath: string,) => { - return [`https://uri.olympiangods.org/${group}/own/${otherGroup}/uris/${uriPath}`] as const; + epochVerstrId: string,) => { + return [`https://uri.olympiangods.org/${group}/own/${otherGroup}/versions/${epochVerstrId}/curies`] as const; } -export const getGetOwnUrisQueryOptions = >, TError = ErrorType>(group: string, +export const getGetOwnVersionsCuriesQueryOptions = >, TError = ErrorType>(group: string, otherGroup: string, - uriPath: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + epochVerstrId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} ) => { const {query: queryOptions, request: requestOptions} = options ?? {}; - const queryKey = queryOptions?.queryKey ?? getGetOwnUrisQueryKey(group,otherGroup,uriPath); + const queryKey = queryOptions?.queryKey ?? getGetOwnVersionsCuriesQueryKey(group,otherGroup,epochVerstrId); - const queryFn: QueryFunction>> = ({ signal }) => getOwnUris(group,otherGroup,uriPath, requestOptions, signal); + const queryFn: QueryFunction>> = ({ signal }) => getOwnVersionsCuries(group,otherGroup,epochVerstrId, requestOptions, signal); - return { queryKey, queryFn, enabled: !!(group && otherGroup && uriPath), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } + return { queryKey, queryFn, enabled: !!(group && otherGroup && epochVerstrId), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: QueryKey } } -export type GetOwnUrisQueryResult = NonNullable>> -export type GetOwnUrisQueryError = ErrorType +export type GetOwnVersionsCuriesQueryResult = NonNullable>> +export type GetOwnVersionsCuriesQueryError = ErrorType -export const useGetOwnUris = >, TError = ErrorType>( +export const useGetOwnVersionsCuries = >, TError = ErrorType>( group: string, otherGroup: string, - uriPath: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + epochVerstrId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { - const queryOptions = getGetOwnUrisQueryOptions(group,otherGroup,uriPath,options) + const queryOptions = getGetOwnVersionsCuriesQueryOptions(group,otherGroup,epochVerstrId,options) const query = useQuery(queryOptions) as UseQueryResult & { queryKey: QueryKey }; @@ -5575,6 +6345,90 @@ export const useGetOwnUris = >, TE 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, @@ -7280,107 +8134,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 }; @@ -7389,8 +8241,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, @@ -8212,6 +9256,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/Auth/Login.jsx b/src/components/Auth/Login.jsx index 698abcdf..631afa1a 100644 --- a/src/components/Auth/Login.jsx +++ b/src/components/Auth/Login.jsx @@ -80,6 +80,8 @@ const Login = () => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [isLoading]); + const { setUserData } = useContext(GlobalDataContext); + const handleInputChange = (e) => { const { name, value } = e.target; setFormData((prev) => ({ ...prev, [name]: value })); 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..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"; @@ -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) } @@ -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 daffdee0..2f33151b 100644 --- a/src/contexts/DataContext.jsx +++ b/src/contexts/DataContext.jsx @@ -47,7 +47,7 @@ const GlobalDataProvider = ({ children }) => { setPredicatesSingleTermData, editBulkSearchFilters, setEditBulkSearchData - }; + }; return (