MCPcopy Create free account
hub / github.com/getsentry/sentry / _apiOptions

Function _apiOptions

static/app/utils/api/apiOptions.ts:50–74  ·  view source on GitHub ↗
(
  path: TApiPath,
  ...[
    {staleTime, path: pathParams, ...options},
  ]: ExtractPathParams<TApiPath> extends never
    ? [Options & {path?: never}]
    : [Options & PathParamOptions<TApiPath>]
)

Source from the content-addressed store, hash-verified

48): ApiResponse<TData> => data;
49
50function _apiOptions<
51 // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
52 TManualData = never,
53 TApiPath extends KnownApiUrls = KnownApiUrls,
54 // todo: infer the actual data type from the ApiMapping
55 TActualData = TManualData,
56>(
57 path: TApiPath,
58 ...[
59 {staleTime, path: pathParams, ...options},
60 ]: ExtractPathParams<TApiPath> extends never
61 ? [Options & {path?: never}]
62 : [Options & PathParamOptions<TApiPath>]
63) {
64 const url = getApiUrl(path, ...([{path: pathParams}] as OptionalPathParams<TApiPath>));
65 const strippedOptions = stripUndefinedValues(options);
66
67 return queryOptions({
68 queryKey: [url, strippedOptions, {infinite: false}] as const,
69 queryFn: pathParams === skipToken ? skipToken : apiFetch<TActualData>,
70 enabled: pathParams !== skipToken,
71 staleTime,
72 select: selectJson,
73 });
74}
75
76function parsePageParam<TQueryFnData = unknown>(dir: 'previous' | 'next') {
77 // oxlint-disable-next-line react/function-component-definition -- This callback is not a React component.

Callers 1

apiOptions.tsFile · 0.85

Calls 2

getApiUrlFunction · 0.90
stripUndefinedValuesFunction · 0.85

Tested by

no test coverage detected