mirror of
https://github.com/SigNoz/signoz.git
synced 2026-02-03 08:33:26 +00:00
feature: init open api ts code gen (#10011)
Some checks failed
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Some checks failed
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
* feature: init open api ts code gen * chore: update custom instance to a separate axios instance * chore: update code owners * chore: set up node version in CI * fix: node version * chore: update jsci.yaml * chore: update goci.yaml * chore: rename instance * chore: resolve comments
This commit is contained in:
8
.github/CODEOWNERS
vendored
8
.github/CODEOWNERS
vendored
@@ -103,10 +103,18 @@
|
|||||||
|
|
||||||
/tests/integration/ @vikrantgupta25
|
/tests/integration/ @vikrantgupta25
|
||||||
|
|
||||||
|
# OpenAPI types generator
|
||||||
|
|
||||||
|
/frontend/src/api @SigNoz/frontend-maintainers
|
||||||
|
|
||||||
# Dashboard Owners
|
# Dashboard Owners
|
||||||
|
|
||||||
/frontend/src/hooks/dashboard/ @SigNoz/pulse-frontend
|
/frontend/src/hooks/dashboard/ @SigNoz/pulse-frontend
|
||||||
|
|
||||||
|
## Dashboard Types
|
||||||
|
|
||||||
|
/frontend/src/api/types/dashboard/ @SigNoz/pulse-frontend
|
||||||
|
|
||||||
## Dashboard List
|
## Dashboard List
|
||||||
|
|
||||||
/frontend/src/pages/DashboardsListPage/ @SigNoz/pulse-frontend
|
/frontend/src/pages/DashboardsListPage/ @SigNoz/pulse-frontend
|
||||||
|
|||||||
4
.github/workflows/goci.yaml
vendored
4
.github/workflows/goci.yaml
vendored
@@ -65,6 +65,10 @@ jobs:
|
|||||||
set -ex
|
set -ex
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y gcc-aarch64-linux-gnu musl-tools
|
sudo apt-get install -y gcc-aarch64-linux-gnu musl-tools
|
||||||
|
- name: node-install
|
||||||
|
uses: actions/setup-node@v5
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
- name: docker-community
|
- name: docker-community
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
13
.github/workflows/jsci.yaml
vendored
13
.github/workflows/jsci.yaml
vendored
@@ -17,10 +17,23 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
- name: setup node
|
||||||
|
uses: actions/setup-node@v5
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
- name: install
|
- name: install
|
||||||
run: cd frontend && yarn install
|
run: cd frontend && yarn install
|
||||||
- name: tsc
|
- name: tsc
|
||||||
run: cd frontend && yarn tsc
|
run: cd frontend && yarn tsc
|
||||||
|
tsc2:
|
||||||
|
if: |
|
||||||
|
(github.event_name == 'pull_request' && ! github.event.pull_request.head.repo.fork && github.event.pull_request.user.login != 'dependabot[bot]' && ! contains(github.event.pull_request.labels.*.name, 'safe-to-test')) ||
|
||||||
|
(github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe-to-test'))
|
||||||
|
uses: signoz/primus.workflows/.github/workflows/js-tsc.yaml@main
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
PRIMUS_REF: main
|
||||||
|
JS_SRC: frontend
|
||||||
test:
|
test:
|
||||||
if: |
|
if: |
|
||||||
(github.event_name == 'pull_request' && ! github.event.pull_request.head.repo.fork && github.event.pull_request.user.login != 'dependabot[bot]' && ! contains(github.event.pull_request.labels.*.name, 'safe-to-test')) ||
|
(github.event_name == 'pull_request' && ! github.event.pull_request.head.repo.fork && github.event.pull_request.user.login != 'dependabot[bot]' && ! contains(github.event.pull_request.labels.*.name, 'safe-to-test')) ||
|
||||||
|
|||||||
@@ -2,4 +2,6 @@ node_modules
|
|||||||
build
|
build
|
||||||
*.typegen.ts
|
*.typegen.ts
|
||||||
i18-generate-hash.js
|
i18-generate-hash.js
|
||||||
src/parser/TraceOperatorParser/**
|
src/parser/TraceOperatorParser/**
|
||||||
|
|
||||||
|
orval.config.ts
|
||||||
@@ -124,4 +124,16 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
'react/jsx-props-no-spreading': 'off',
|
'react/jsx-props-no-spreading': 'off',
|
||||||
},
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['src/api/generated/**/*.ts'],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||||
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||||
|
'no-nested-ternary': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'warn',
|
||||||
|
'sonarjs/no-duplicate-string': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
97
frontend/orval.config.ts
Normal file
97
frontend/orval.config.ts
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* When making changes to this file, remove this the file name from .eslintignore and tsconfig.json
|
||||||
|
* The reason this is required because of the moduleResolution being "node". Changing this is a more detailed effort.
|
||||||
|
* So, until then, we will keep this file ignored for eslint and typescript.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { defineConfig } from 'orval';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
signoz: {
|
||||||
|
input: {
|
||||||
|
target: '../docs/api/openapi.yml',
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
target: './src/api/generated/services',
|
||||||
|
client: 'react-query',
|
||||||
|
httpClient: 'axios',
|
||||||
|
mode: 'tags-split',
|
||||||
|
prettier: true,
|
||||||
|
headers: true,
|
||||||
|
clean: true,
|
||||||
|
override: {
|
||||||
|
query: {
|
||||||
|
useQuery: true,
|
||||||
|
useMutation: true,
|
||||||
|
useInvalidate: true,
|
||||||
|
signal: true,
|
||||||
|
useOperationIdAsQueryKey: true,
|
||||||
|
},
|
||||||
|
useDates: true,
|
||||||
|
useNamedParameters: true,
|
||||||
|
enumGenerationType: 'enum',
|
||||||
|
mutator: {
|
||||||
|
path: './src/api/index.ts',
|
||||||
|
name: 'GeneratedAPIInstance',
|
||||||
|
},
|
||||||
|
|
||||||
|
jsDoc: {
|
||||||
|
filter: (schema) => {
|
||||||
|
const allowlist = [
|
||||||
|
'type',
|
||||||
|
'format',
|
||||||
|
'maxLength',
|
||||||
|
'minLength',
|
||||||
|
'description',
|
||||||
|
'minimum',
|
||||||
|
'maximum',
|
||||||
|
'exclusiveMinimum',
|
||||||
|
'exclusiveMaximum',
|
||||||
|
'pattern',
|
||||||
|
'nullable',
|
||||||
|
'enum',
|
||||||
|
];
|
||||||
|
return Object.entries(schema || {})
|
||||||
|
.filter(([key]) => allowlist.includes(key))
|
||||||
|
.map(([key, value]: [string, any]) => ({
|
||||||
|
key,
|
||||||
|
value,
|
||||||
|
}))
|
||||||
|
.sort((a, b) => a.key.length - b.key.length);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
components: {
|
||||||
|
schemas: {
|
||||||
|
suffix: 'DTO',
|
||||||
|
},
|
||||||
|
responses: {
|
||||||
|
suffix: 'Response',
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
suffix: 'Params',
|
||||||
|
},
|
||||||
|
requestBodies: {
|
||||||
|
suffix: 'Body',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// info is of type InfoObject from openapi spec
|
||||||
|
header: (info: { title: string; version: string }): string[] => [
|
||||||
|
`! Do not edit manually`,
|
||||||
|
`* The file has been auto-generated using Orval for SigNoz`,
|
||||||
|
`* regenerate with 'yarn generate:api'`,
|
||||||
|
...(info.title ? [info.title] : []),
|
||||||
|
...(info.version ? [`OpenAPI spec version: ${info.version}`] : []),
|
||||||
|
],
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
// propertySortOrder, urlEncodeParameters, aliasCombinedTypes
|
||||||
|
// are valid options in the document without types
|
||||||
|
propertySortOrder: 'Alphabetical',
|
||||||
|
urlEncodeParameters: true,
|
||||||
|
aliasCombinedTypes: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -18,7 +18,8 @@
|
|||||||
"husky:configure": "cd .. && husky install frontend/.husky && cd frontend && chmod ug+x .husky/*",
|
"husky:configure": "cd .. && husky install frontend/.husky && cd frontend && chmod ug+x .husky/*",
|
||||||
"commitlint": "commitlint --edit $1",
|
"commitlint": "commitlint --edit $1",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:changedsince": "jest --changedSince=main --coverage --silent"
|
"test:changedsince": "jest --changedSince=main --coverage --silent",
|
||||||
|
"generate:api": "orval --config ./orval.config.ts && sh scripts/post-types-generation.sh && prettier --write src/api/generated && (eslint --fix src/api/generated || true)"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.15.0"
|
"node": ">=16.15.0"
|
||||||
@@ -238,6 +239,7 @@
|
|||||||
"lint-staged": "^12.5.0",
|
"lint-staged": "^12.5.0",
|
||||||
"msw": "1.3.2",
|
"msw": "1.3.2",
|
||||||
"npm-run-all": "latest",
|
"npm-run-all": "latest",
|
||||||
|
"orval": "7.18.0",
|
||||||
"portfinder-sync": "^0.0.2",
|
"portfinder-sync": "^0.0.2",
|
||||||
"postcss": "8.4.38",
|
"postcss": "8.4.38",
|
||||||
"prettier": "2.2.1",
|
"prettier": "2.2.1",
|
||||||
|
|||||||
14
frontend/scripts/post-types-generation.sh
Executable file
14
frontend/scripts/post-types-generation.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Rename tag files to index.ts in services directories
|
||||||
|
# tags-split creates: services/tagName/tagName.ts -> rename to services/tagName/index.ts
|
||||||
|
find src/api/generated/services -mindepth 1 -maxdepth 1 -type d | while read -r dir; do
|
||||||
|
dirname=$(basename "$dir")
|
||||||
|
tagfile="$dir/$dirname.ts"
|
||||||
|
if [ -f "$tagfile" ]; then
|
||||||
|
mv "$tagfile" "$dir/index.ts"
|
||||||
|
echo "Renamed $tagfile -> $dir/index.ts"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Tag files renamed to index.ts"
|
||||||
371
frontend/src/api/generated/services/authdomains/index.ts
Normal file
371
frontend/src/api/generated/services/authdomains/index.ts
Normal file
@@ -0,0 +1,371 @@
|
|||||||
|
/**
|
||||||
|
* ! Do not edit manually
|
||||||
|
* * The file has been auto-generated using Orval for SigNoz
|
||||||
|
* * regenerate with 'yarn generate:api'
|
||||||
|
* SigNoz
|
||||||
|
*/
|
||||||
|
import type {
|
||||||
|
InvalidateOptions,
|
||||||
|
MutationFunction,
|
||||||
|
QueryClient,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from 'react-query';
|
||||||
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
|
import type {
|
||||||
|
AuthtypesPostableAuthDomainDTO,
|
||||||
|
AuthtypesUpdateableAuthDomainDTO,
|
||||||
|
CreateAuthDomain200,
|
||||||
|
DeleteAuthDomainPathParameters,
|
||||||
|
ListAuthDomains200,
|
||||||
|
RenderErrorResponseDTO,
|
||||||
|
UpdateAuthDomainPathParameters,
|
||||||
|
} from '../sigNoz.schemas';
|
||||||
|
|
||||||
|
type AwaitedInput<T> = PromiseLike<T> | T;
|
||||||
|
|
||||||
|
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint lists all auth domains
|
||||||
|
* @summary List all auth domains
|
||||||
|
*/
|
||||||
|
export const listAuthDomains = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<ListAuthDomains200>({
|
||||||
|
url: `/api/v1/domains`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getListAuthDomainsQueryKey = () => ['listAuthDomains'] as const;
|
||||||
|
|
||||||
|
export const getListAuthDomainsQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof listAuthDomains>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listAuthDomains>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getListAuthDomainsQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof listAuthDomains>>> = ({
|
||||||
|
signal,
|
||||||
|
}) => listAuthDomains(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listAuthDomains>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ListAuthDomainsQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof listAuthDomains>>
|
||||||
|
>;
|
||||||
|
export type ListAuthDomainsQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary List all auth domains
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useListAuthDomains<
|
||||||
|
TData = Awaited<ReturnType<typeof listAuthDomains>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listAuthDomains>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getListAuthDomainsQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary List all auth domains
|
||||||
|
*/
|
||||||
|
export const invalidateListAuthDomains = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getListAuthDomainsQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint creates an auth domain
|
||||||
|
* @summary Create auth domain
|
||||||
|
*/
|
||||||
|
export const createAuthDomain = (
|
||||||
|
authtypesPostableAuthDomainDTO: AuthtypesPostableAuthDomainDTO,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<CreateAuthDomain200>({
|
||||||
|
url: `/api/v1/domains`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: authtypesPostableAuthDomainDTO,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getCreateAuthDomainMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableAuthDomainDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableAuthDomainDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['createAuthDomain'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||||
|
{ data: AuthtypesPostableAuthDomainDTO }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return createAuthDomain(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreateAuthDomainMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof createAuthDomain>>
|
||||||
|
>;
|
||||||
|
export type CreateAuthDomainMutationBody = AuthtypesPostableAuthDomainDTO;
|
||||||
|
export type CreateAuthDomainMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Create auth domain
|
||||||
|
*/
|
||||||
|
export const useCreateAuthDomain = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableAuthDomainDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableAuthDomainDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getCreateAuthDomainMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint deletes an auth domain
|
||||||
|
* @summary Delete auth domain
|
||||||
|
*/
|
||||||
|
export const deleteAuthDomain = ({ id }: DeleteAuthDomainPathParameters) =>
|
||||||
|
GeneratedAPIInstance<void>({
|
||||||
|
url: `/api/v1/domains/${id}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getDeleteAuthDomainMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteAuthDomainPathParameters },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteAuthDomainPathParameters },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['deleteAuthDomain'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof deleteAuthDomain>>,
|
||||||
|
{ pathParams: DeleteAuthDomainPathParameters }
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams } = props ?? {};
|
||||||
|
|
||||||
|
return deleteAuthDomain(pathParams);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DeleteAuthDomainMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof deleteAuthDomain>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type DeleteAuthDomainMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Delete auth domain
|
||||||
|
*/
|
||||||
|
export const useDeleteAuthDomain = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteAuthDomainPathParameters },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof deleteAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteAuthDomainPathParameters },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getDeleteAuthDomainMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint updates an auth domain
|
||||||
|
* @summary Update auth domain
|
||||||
|
*/
|
||||||
|
export const updateAuthDomain = (
|
||||||
|
{ id }: UpdateAuthDomainPathParameters,
|
||||||
|
authtypesUpdateableAuthDomainDTO: AuthtypesUpdateableAuthDomainDTO,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<void>({
|
||||||
|
url: `/api/v1/domains/${id}`,
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: authtypesUpdateableAuthDomainDTO,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getUpdateAuthDomainMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateAuthDomainPathParameters;
|
||||||
|
data: AuthtypesUpdateableAuthDomainDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateAuthDomainPathParameters;
|
||||||
|
data: AuthtypesUpdateableAuthDomainDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['updateAuthDomain'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof updateAuthDomain>>,
|
||||||
|
{
|
||||||
|
pathParams: UpdateAuthDomainPathParameters;
|
||||||
|
data: AuthtypesUpdateableAuthDomainDTO;
|
||||||
|
}
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams, data } = props ?? {};
|
||||||
|
|
||||||
|
return updateAuthDomain(pathParams, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdateAuthDomainMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof updateAuthDomain>>
|
||||||
|
>;
|
||||||
|
export type UpdateAuthDomainMutationBody = AuthtypesUpdateableAuthDomainDTO;
|
||||||
|
export type UpdateAuthDomainMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Update auth domain
|
||||||
|
*/
|
||||||
|
export const useUpdateAuthDomain = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateAuthDomainPathParameters;
|
||||||
|
data: AuthtypesUpdateableAuthDomainDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof updateAuthDomain>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateAuthDomainPathParameters;
|
||||||
|
data: AuthtypesUpdateableAuthDomainDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getUpdateAuthDomainMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
620
frontend/src/api/generated/services/dashboard/index.ts
Normal file
620
frontend/src/api/generated/services/dashboard/index.ts
Normal file
@@ -0,0 +1,620 @@
|
|||||||
|
/**
|
||||||
|
* ! Do not edit manually
|
||||||
|
* * The file has been auto-generated using Orval for SigNoz
|
||||||
|
* * regenerate with 'yarn generate:api'
|
||||||
|
* SigNoz
|
||||||
|
*/
|
||||||
|
import type {
|
||||||
|
InvalidateOptions,
|
||||||
|
MutationFunction,
|
||||||
|
QueryClient,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from 'react-query';
|
||||||
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
|
import type {
|
||||||
|
CreatePublicDashboard201,
|
||||||
|
CreatePublicDashboardPathParameters,
|
||||||
|
DashboardtypesPostablePublicDashboardDTO,
|
||||||
|
DashboardtypesUpdatablePublicDashboardDTO,
|
||||||
|
DeletePublicDashboardPathParameters,
|
||||||
|
GetPublicDashboard200,
|
||||||
|
GetPublicDashboardData200,
|
||||||
|
GetPublicDashboardDataPathParameters,
|
||||||
|
GetPublicDashboardPathParameters,
|
||||||
|
GetPublicDashboardWidgetQueryRange200,
|
||||||
|
GetPublicDashboardWidgetQueryRangePathParameters,
|
||||||
|
RenderErrorResponseDTO,
|
||||||
|
UpdatePublicDashboardPathParameters,
|
||||||
|
} from '../sigNoz.schemas';
|
||||||
|
|
||||||
|
type AwaitedInput<T> = PromiseLike<T> | T;
|
||||||
|
|
||||||
|
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoints deletes the public sharing config and disables the public sharing of a dashboard
|
||||||
|
* @summary Delete public dashboard
|
||||||
|
*/
|
||||||
|
export const deletePublicDashboard = ({
|
||||||
|
id,
|
||||||
|
}: DeletePublicDashboardPathParameters) =>
|
||||||
|
GeneratedAPIInstance<string>({
|
||||||
|
url: `/api/v1/dashboards/${id}/public`,
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getDeletePublicDashboardMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deletePublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeletePublicDashboardPathParameters },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deletePublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeletePublicDashboardPathParameters },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['deletePublicDashboard'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof deletePublicDashboard>>,
|
||||||
|
{ pathParams: DeletePublicDashboardPathParameters }
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams } = props ?? {};
|
||||||
|
|
||||||
|
return deletePublicDashboard(pathParams);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DeletePublicDashboardMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof deletePublicDashboard>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type DeletePublicDashboardMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Delete public dashboard
|
||||||
|
*/
|
||||||
|
export const useDeletePublicDashboard = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deletePublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeletePublicDashboardPathParameters },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof deletePublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeletePublicDashboardPathParameters },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getDeletePublicDashboardMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoints returns public sharing config for a dashboard
|
||||||
|
* @summary Get public dashboard
|
||||||
|
*/
|
||||||
|
export const getPublicDashboard = (
|
||||||
|
{ id }: GetPublicDashboardPathParameters,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<GetPublicDashboard200>({
|
||||||
|
url: `/api/v1/dashboards/${id}/public`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetPublicDashboardQueryKey = ({
|
||||||
|
id,
|
||||||
|
}: GetPublicDashboardPathParameters) => ['getPublicDashboard'] as const;
|
||||||
|
|
||||||
|
export const getGetPublicDashboardQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getPublicDashboard>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(
|
||||||
|
{ id }: GetPublicDashboardPathParameters,
|
||||||
|
options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey =
|
||||||
|
queryOptions?.queryKey ?? getGetPublicDashboardQueryKey({ id });
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboard>>
|
||||||
|
> = ({ signal }) => getPublicDashboard({ id }, signal);
|
||||||
|
|
||||||
|
return {
|
||||||
|
queryKey,
|
||||||
|
queryFn,
|
||||||
|
enabled: !!id,
|
||||||
|
...queryOptions,
|
||||||
|
} as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetPublicDashboardQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboard>>
|
||||||
|
>;
|
||||||
|
export type GetPublicDashboardQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get public dashboard
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetPublicDashboard<
|
||||||
|
TData = Awaited<ReturnType<typeof getPublicDashboard>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(
|
||||||
|
{ id }: GetPublicDashboardPathParameters,
|
||||||
|
options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetPublicDashboardQueryOptions({ id }, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get public dashboard
|
||||||
|
*/
|
||||||
|
export const invalidateGetPublicDashboard = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
{ id }: GetPublicDashboardPathParameters,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetPublicDashboardQueryKey({ id }) },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoints creates public sharing config and enables public sharing of the dashboard
|
||||||
|
* @summary Create public dashboard
|
||||||
|
*/
|
||||||
|
export const createPublicDashboard = (
|
||||||
|
{ id }: CreatePublicDashboardPathParameters,
|
||||||
|
dashboardtypesPostablePublicDashboardDTO: DashboardtypesPostablePublicDashboardDTO,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<CreatePublicDashboard201>({
|
||||||
|
url: `/api/v1/dashboards/${id}/public`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: dashboardtypesPostablePublicDashboardDTO,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getCreatePublicDashboardMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createPublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: CreatePublicDashboardPathParameters;
|
||||||
|
data: DashboardtypesPostablePublicDashboardDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createPublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: CreatePublicDashboardPathParameters;
|
||||||
|
data: DashboardtypesPostablePublicDashboardDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['createPublicDashboard'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof createPublicDashboard>>,
|
||||||
|
{
|
||||||
|
pathParams: CreatePublicDashboardPathParameters;
|
||||||
|
data: DashboardtypesPostablePublicDashboardDTO;
|
||||||
|
}
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams, data } = props ?? {};
|
||||||
|
|
||||||
|
return createPublicDashboard(pathParams, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreatePublicDashboardMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof createPublicDashboard>>
|
||||||
|
>;
|
||||||
|
export type CreatePublicDashboardMutationBody = DashboardtypesPostablePublicDashboardDTO;
|
||||||
|
export type CreatePublicDashboardMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Create public dashboard
|
||||||
|
*/
|
||||||
|
export const useCreatePublicDashboard = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createPublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: CreatePublicDashboardPathParameters;
|
||||||
|
data: DashboardtypesPostablePublicDashboardDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof createPublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: CreatePublicDashboardPathParameters;
|
||||||
|
data: DashboardtypesPostablePublicDashboardDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getCreatePublicDashboardMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoints updates the public sharing config for a dashboard
|
||||||
|
* @summary Update public dashboard
|
||||||
|
*/
|
||||||
|
export const updatePublicDashboard = (
|
||||||
|
{ id }: UpdatePublicDashboardPathParameters,
|
||||||
|
dashboardtypesUpdatablePublicDashboardDTO: DashboardtypesUpdatablePublicDashboardDTO,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<string>({
|
||||||
|
url: `/api/v1/dashboards/${id}/public`,
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: dashboardtypesUpdatablePublicDashboardDTO,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getUpdatePublicDashboardMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updatePublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdatePublicDashboardPathParameters;
|
||||||
|
data: DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updatePublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdatePublicDashboardPathParameters;
|
||||||
|
data: DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['updatePublicDashboard'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof updatePublicDashboard>>,
|
||||||
|
{
|
||||||
|
pathParams: UpdatePublicDashboardPathParameters;
|
||||||
|
data: DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
|
}
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams, data } = props ?? {};
|
||||||
|
|
||||||
|
return updatePublicDashboard(pathParams, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdatePublicDashboardMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof updatePublicDashboard>>
|
||||||
|
>;
|
||||||
|
export type UpdatePublicDashboardMutationBody = DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
|
export type UpdatePublicDashboardMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Update public dashboard
|
||||||
|
*/
|
||||||
|
export const useUpdatePublicDashboard = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updatePublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdatePublicDashboardPathParameters;
|
||||||
|
data: DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof updatePublicDashboard>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdatePublicDashboardPathParameters;
|
||||||
|
data: DashboardtypesUpdatablePublicDashboardDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getUpdatePublicDashboardMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoints returns the sanitized dashboard data for public access
|
||||||
|
* @summary Get public dashboard data
|
||||||
|
*/
|
||||||
|
export const getPublicDashboardData = (
|
||||||
|
{ id }: GetPublicDashboardDataPathParameters,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<GetPublicDashboardData200>({
|
||||||
|
url: `/api/v1/public/dashboards/${id}`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetPublicDashboardDataQueryKey = ({
|
||||||
|
id,
|
||||||
|
}: GetPublicDashboardDataPathParameters) => ['getPublicDashboardData'] as const;
|
||||||
|
|
||||||
|
export const getGetPublicDashboardDataQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getPublicDashboardData>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(
|
||||||
|
{ id }: GetPublicDashboardDataPathParameters,
|
||||||
|
options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboardData>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey =
|
||||||
|
queryOptions?.queryKey ?? getGetPublicDashboardDataQueryKey({ id });
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboardData>>
|
||||||
|
> = ({ signal }) => getPublicDashboardData({ id }, signal);
|
||||||
|
|
||||||
|
return {
|
||||||
|
queryKey,
|
||||||
|
queryFn,
|
||||||
|
enabled: !!id,
|
||||||
|
...queryOptions,
|
||||||
|
} as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboardData>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetPublicDashboardDataQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboardData>>
|
||||||
|
>;
|
||||||
|
export type GetPublicDashboardDataQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get public dashboard data
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetPublicDashboardData<
|
||||||
|
TData = Awaited<ReturnType<typeof getPublicDashboardData>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(
|
||||||
|
{ id }: GetPublicDashboardDataPathParameters,
|
||||||
|
options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboardData>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetPublicDashboardDataQueryOptions({ id }, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get public dashboard data
|
||||||
|
*/
|
||||||
|
export const invalidateGetPublicDashboardData = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
{ id }: GetPublicDashboardDataPathParameters,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetPublicDashboardDataQueryKey({ id }) },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint return query range results for a widget of public dashboard
|
||||||
|
* @summary Get query range result
|
||||||
|
*/
|
||||||
|
export const getPublicDashboardWidgetQueryRange = (
|
||||||
|
{ id, idx }: GetPublicDashboardWidgetQueryRangePathParameters,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<GetPublicDashboardWidgetQueryRange200>({
|
||||||
|
url: `/api/v1/public/dashboards/${id}/widgets/${idx}/query_range`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetPublicDashboardWidgetQueryRangeQueryKey = ({
|
||||||
|
id,
|
||||||
|
idx,
|
||||||
|
}: GetPublicDashboardWidgetQueryRangePathParameters) =>
|
||||||
|
['getPublicDashboardWidgetQueryRange'] as const;
|
||||||
|
|
||||||
|
export const getGetPublicDashboardWidgetQueryRangeQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(
|
||||||
|
{ id, idx }: GetPublicDashboardWidgetQueryRangePathParameters,
|
||||||
|
options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey =
|
||||||
|
queryOptions?.queryKey ??
|
||||||
|
getGetPublicDashboardWidgetQueryRangeQueryKey({ id, idx });
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>
|
||||||
|
> = ({ signal }) => getPublicDashboardWidgetQueryRange({ id, idx }, signal);
|
||||||
|
|
||||||
|
return {
|
||||||
|
queryKey,
|
||||||
|
queryFn,
|
||||||
|
enabled: !!(id && idx),
|
||||||
|
...queryOptions,
|
||||||
|
} as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetPublicDashboardWidgetQueryRangeQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>
|
||||||
|
>;
|
||||||
|
export type GetPublicDashboardWidgetQueryRangeQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get query range result
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetPublicDashboardWidgetQueryRange<
|
||||||
|
TData = Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(
|
||||||
|
{ id, idx }: GetPublicDashboardWidgetQueryRangePathParameters,
|
||||||
|
options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getPublicDashboardWidgetQueryRange>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetPublicDashboardWidgetQueryRangeQueryOptions(
|
||||||
|
{ id, idx },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get query range result
|
||||||
|
*/
|
||||||
|
export const invalidateGetPublicDashboardWidgetQueryRange = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
{ id, idx }: GetPublicDashboardWidgetQueryRangePathParameters,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetPublicDashboardWidgetQueryRangeQueryKey({ id, idx }) },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
105
frontend/src/api/generated/services/features/index.ts
Normal file
105
frontend/src/api/generated/services/features/index.ts
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
* ! Do not edit manually
|
||||||
|
* * The file has been auto-generated using Orval for SigNoz
|
||||||
|
* * regenerate with 'yarn generate:api'
|
||||||
|
* SigNoz
|
||||||
|
*/
|
||||||
|
import type {
|
||||||
|
InvalidateOptions,
|
||||||
|
QueryClient,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from 'react-query';
|
||||||
|
import { useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
|
import type { GetFeatures200, RenderErrorResponseDTO } from '../sigNoz.schemas';
|
||||||
|
|
||||||
|
type AwaitedInput<T> = PromiseLike<T> | T;
|
||||||
|
|
||||||
|
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint returns the supported features and their details
|
||||||
|
* @summary Get features
|
||||||
|
*/
|
||||||
|
export const getFeatures = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<GetFeatures200>({
|
||||||
|
url: `/api/v2/features`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetFeaturesQueryKey = () => ['getFeatures'] as const;
|
||||||
|
|
||||||
|
export const getGetFeaturesQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getFeatures>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getFeatures>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getGetFeaturesQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof getFeatures>>> = ({
|
||||||
|
signal,
|
||||||
|
}) => getFeatures(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getFeatures>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetFeaturesQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getFeatures>>
|
||||||
|
>;
|
||||||
|
export type GetFeaturesQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get features
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetFeatures<
|
||||||
|
TData = Awaited<ReturnType<typeof getFeatures>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getFeatures>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetFeaturesQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get features
|
||||||
|
*/
|
||||||
|
export const invalidateGetFeatures = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetFeaturesQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
734
frontend/src/api/generated/services/gateway/index.ts
Normal file
734
frontend/src/api/generated/services/gateway/index.ts
Normal file
@@ -0,0 +1,734 @@
|
|||||||
|
/**
|
||||||
|
* ! Do not edit manually
|
||||||
|
* * The file has been auto-generated using Orval for SigNoz
|
||||||
|
* * regenerate with 'yarn generate:api'
|
||||||
|
* SigNoz
|
||||||
|
*/
|
||||||
|
import type {
|
||||||
|
InvalidateOptions,
|
||||||
|
MutationFunction,
|
||||||
|
QueryClient,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from 'react-query';
|
||||||
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
|
import type {
|
||||||
|
CreateIngestionKey200,
|
||||||
|
CreateIngestionKeyLimit201,
|
||||||
|
CreateIngestionKeyLimitPathParameters,
|
||||||
|
DeleteIngestionKeyLimitPathParameters,
|
||||||
|
DeleteIngestionKeyPathParameters,
|
||||||
|
GatewaytypesPostableIngestionKeyDTO,
|
||||||
|
GatewaytypesPostableIngestionKeyLimitDTO,
|
||||||
|
GatewaytypesUpdatableIngestionKeyLimitDTO,
|
||||||
|
GetIngestionKeys200,
|
||||||
|
RenderErrorResponseDTO,
|
||||||
|
SearchIngestionKeys200,
|
||||||
|
UpdateIngestionKeyLimitPathParameters,
|
||||||
|
UpdateIngestionKeyPathParameters,
|
||||||
|
} from '../sigNoz.schemas';
|
||||||
|
|
||||||
|
type AwaitedInput<T> = PromiseLike<T> | T;
|
||||||
|
|
||||||
|
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint returns the ingestion keys for a workspace
|
||||||
|
* @summary Get ingestion keys for workspace
|
||||||
|
*/
|
||||||
|
export const getIngestionKeys = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<GetIngestionKeys200>({
|
||||||
|
url: `/api/v2/gateway/ingestion_keys`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetIngestionKeysQueryKey = () => ['getIngestionKeys'] as const;
|
||||||
|
|
||||||
|
export const getGetIngestionKeysQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getIngestionKeys>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getIngestionKeys>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getGetIngestionKeysQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof getIngestionKeys>>> = ({
|
||||||
|
signal,
|
||||||
|
}) => getIngestionKeys(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getIngestionKeys>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetIngestionKeysQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getIngestionKeys>>
|
||||||
|
>;
|
||||||
|
export type GetIngestionKeysQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get ingestion keys for workspace
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetIngestionKeys<
|
||||||
|
TData = Awaited<ReturnType<typeof getIngestionKeys>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getIngestionKeys>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetIngestionKeysQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get ingestion keys for workspace
|
||||||
|
*/
|
||||||
|
export const invalidateGetIngestionKeys = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetIngestionKeysQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint creates an ingestion key for the workspace
|
||||||
|
* @summary Create ingestion key for workspace
|
||||||
|
*/
|
||||||
|
export const createIngestionKey = (
|
||||||
|
gatewaytypesPostableIngestionKeyDTO: GatewaytypesPostableIngestionKeyDTO,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<CreateIngestionKey200>({
|
||||||
|
url: `/api/v2/gateway/ingestion_keys`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: gatewaytypesPostableIngestionKeyDTO,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getCreateIngestionKeyMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{ data: GatewaytypesPostableIngestionKeyDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{ data: GatewaytypesPostableIngestionKeyDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['createIngestionKey'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||||
|
{ data: GatewaytypesPostableIngestionKeyDTO }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return createIngestionKey(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreateIngestionKeyMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKey>>
|
||||||
|
>;
|
||||||
|
export type CreateIngestionKeyMutationBody = GatewaytypesPostableIngestionKeyDTO;
|
||||||
|
export type CreateIngestionKeyMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Create ingestion key for workspace
|
||||||
|
*/
|
||||||
|
export const useCreateIngestionKey = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{ data: GatewaytypesPostableIngestionKeyDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{ data: GatewaytypesPostableIngestionKeyDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getCreateIngestionKeyMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint deletes an ingestion key for the workspace
|
||||||
|
* @summary Delete ingestion key for workspace
|
||||||
|
*/
|
||||||
|
export const deleteIngestionKey = ({
|
||||||
|
keyId,
|
||||||
|
}: DeleteIngestionKeyPathParameters) =>
|
||||||
|
GeneratedAPIInstance<void>({
|
||||||
|
url: `/api/v2/gateway/ingestion_keys/${keyId}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getDeleteIngestionKeyMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteIngestionKeyPathParameters },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteIngestionKeyPathParameters },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['deleteIngestionKey'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKey>>,
|
||||||
|
{ pathParams: DeleteIngestionKeyPathParameters }
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams } = props ?? {};
|
||||||
|
|
||||||
|
return deleteIngestionKey(pathParams);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DeleteIngestionKeyMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKey>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type DeleteIngestionKeyMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Delete ingestion key for workspace
|
||||||
|
*/
|
||||||
|
export const useDeleteIngestionKey = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteIngestionKeyPathParameters },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteIngestionKeyPathParameters },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getDeleteIngestionKeyMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint updates an ingestion key for the workspace
|
||||||
|
* @summary Update ingestion key for workspace
|
||||||
|
*/
|
||||||
|
export const updateIngestionKey = (
|
||||||
|
{ keyId }: UpdateIngestionKeyPathParameters,
|
||||||
|
gatewaytypesPostableIngestionKeyDTO: GatewaytypesPostableIngestionKeyDTO,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<void>({
|
||||||
|
url: `/api/v2/gateway/ingestion_keys/${keyId}`,
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: gatewaytypesPostableIngestionKeyDTO,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getUpdateIngestionKeyMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateIngestionKeyPathParameters;
|
||||||
|
data: GatewaytypesPostableIngestionKeyDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateIngestionKeyPathParameters;
|
||||||
|
data: GatewaytypesPostableIngestionKeyDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['updateIngestionKey'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKey>>,
|
||||||
|
{
|
||||||
|
pathParams: UpdateIngestionKeyPathParameters;
|
||||||
|
data: GatewaytypesPostableIngestionKeyDTO;
|
||||||
|
}
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams, data } = props ?? {};
|
||||||
|
|
||||||
|
return updateIngestionKey(pathParams, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdateIngestionKeyMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKey>>
|
||||||
|
>;
|
||||||
|
export type UpdateIngestionKeyMutationBody = GatewaytypesPostableIngestionKeyDTO;
|
||||||
|
export type UpdateIngestionKeyMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Update ingestion key for workspace
|
||||||
|
*/
|
||||||
|
export const useUpdateIngestionKey = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateIngestionKeyPathParameters;
|
||||||
|
data: GatewaytypesPostableIngestionKeyDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKey>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateIngestionKeyPathParameters;
|
||||||
|
data: GatewaytypesPostableIngestionKeyDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getUpdateIngestionKeyMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint creates an ingestion key limit
|
||||||
|
* @summary Create limit for the ingestion key
|
||||||
|
*/
|
||||||
|
export const createIngestionKeyLimit = (
|
||||||
|
{ keyId }: CreateIngestionKeyLimitPathParameters,
|
||||||
|
gatewaytypesPostableIngestionKeyLimitDTO: GatewaytypesPostableIngestionKeyLimitDTO,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<CreateIngestionKeyLimit201>({
|
||||||
|
url: `/api/v2/gateway/ingestion_keys/${keyId}/limits`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: gatewaytypesPostableIngestionKeyLimitDTO,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getCreateIngestionKeyLimitMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||||
|
data: GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||||
|
data: GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['createIngestionKeyLimit'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKeyLimit>>,
|
||||||
|
{
|
||||||
|
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||||
|
data: GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
|
}
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams, data } = props ?? {};
|
||||||
|
|
||||||
|
return createIngestionKeyLimit(pathParams, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreateIngestionKeyLimitMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKeyLimit>>
|
||||||
|
>;
|
||||||
|
export type CreateIngestionKeyLimitMutationBody = GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
|
export type CreateIngestionKeyLimitMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Create limit for the ingestion key
|
||||||
|
*/
|
||||||
|
export const useCreateIngestionKeyLimit = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||||
|
data: GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof createIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||||
|
data: GatewaytypesPostableIngestionKeyLimitDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getCreateIngestionKeyLimitMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint deletes an ingestion key limit
|
||||||
|
* @summary Delete limit for the ingestion key
|
||||||
|
*/
|
||||||
|
export const deleteIngestionKeyLimit = ({
|
||||||
|
limitId,
|
||||||
|
}: DeleteIngestionKeyLimitPathParameters) =>
|
||||||
|
GeneratedAPIInstance<void>({
|
||||||
|
url: `/api/v2/gateway/ingestion_keys/limits/${limitId}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getDeleteIngestionKeyLimitMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteIngestionKeyLimitPathParameters },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteIngestionKeyLimitPathParameters },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['deleteIngestionKeyLimit'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKeyLimit>>,
|
||||||
|
{ pathParams: DeleteIngestionKeyLimitPathParameters }
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams } = props ?? {};
|
||||||
|
|
||||||
|
return deleteIngestionKeyLimit(pathParams);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DeleteIngestionKeyLimitMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKeyLimit>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type DeleteIngestionKeyLimitMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Delete limit for the ingestion key
|
||||||
|
*/
|
||||||
|
export const useDeleteIngestionKeyLimit = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteIngestionKeyLimitPathParameters },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof deleteIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{ pathParams: DeleteIngestionKeyLimitPathParameters },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getDeleteIngestionKeyLimitMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint updates an ingestion key limit
|
||||||
|
* @summary Update limit for the ingestion key
|
||||||
|
*/
|
||||||
|
export const updateIngestionKeyLimit = (
|
||||||
|
{ limitId }: UpdateIngestionKeyLimitPathParameters,
|
||||||
|
gatewaytypesUpdatableIngestionKeyLimitDTO: GatewaytypesUpdatableIngestionKeyLimitDTO,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<void>({
|
||||||
|
url: `/api/v2/gateway/ingestion_keys/limits/${limitId}`,
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: gatewaytypesUpdatableIngestionKeyLimitDTO,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getUpdateIngestionKeyLimitMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||||
|
data: GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||||
|
data: GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['updateIngestionKeyLimit'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKeyLimit>>,
|
||||||
|
{
|
||||||
|
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||||
|
data: GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
|
}
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams, data } = props ?? {};
|
||||||
|
|
||||||
|
return updateIngestionKeyLimit(pathParams, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdateIngestionKeyLimitMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKeyLimit>>
|
||||||
|
>;
|
||||||
|
export type UpdateIngestionKeyLimitMutationBody = GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
|
export type UpdateIngestionKeyLimitMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Update limit for the ingestion key
|
||||||
|
*/
|
||||||
|
export const useUpdateIngestionKeyLimit = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||||
|
data: GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof updateIngestionKeyLimit>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||||
|
data: GatewaytypesUpdatableIngestionKeyLimitDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getUpdateIngestionKeyLimitMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint returns the ingestion keys for a workspace
|
||||||
|
* @summary Search ingestion keys for workspace
|
||||||
|
*/
|
||||||
|
export const searchIngestionKeys = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<SearchIngestionKeys200>({
|
||||||
|
url: `/api/v2/gateway/ingestion_keys/search`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getSearchIngestionKeysQueryKey = () =>
|
||||||
|
['searchIngestionKeys'] as const;
|
||||||
|
|
||||||
|
export const getSearchIngestionKeysQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof searchIngestionKeys>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof searchIngestionKeys>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getSearchIngestionKeysQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof searchIngestionKeys>>
|
||||||
|
> = ({ signal }) => searchIngestionKeys(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof searchIngestionKeys>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SearchIngestionKeysQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof searchIngestionKeys>>
|
||||||
|
>;
|
||||||
|
export type SearchIngestionKeysQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Search ingestion keys for workspace
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useSearchIngestionKeys<
|
||||||
|
TData = Awaited<ReturnType<typeof searchIngestionKeys>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof searchIngestionKeys>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getSearchIngestionKeysQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Search ingestion keys for workspace
|
||||||
|
*/
|
||||||
|
export const invalidateSearchIngestionKeys = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getSearchIngestionKeysQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
108
frontend/src/api/generated/services/global/index.ts
Normal file
108
frontend/src/api/generated/services/global/index.ts
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/**
|
||||||
|
* ! Do not edit manually
|
||||||
|
* * The file has been auto-generated using Orval for SigNoz
|
||||||
|
* * regenerate with 'yarn generate:api'
|
||||||
|
* SigNoz
|
||||||
|
*/
|
||||||
|
import type {
|
||||||
|
InvalidateOptions,
|
||||||
|
QueryClient,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from 'react-query';
|
||||||
|
import { useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
|
import type {
|
||||||
|
GetGlobalConfig200,
|
||||||
|
RenderErrorResponseDTO,
|
||||||
|
} from '../sigNoz.schemas';
|
||||||
|
|
||||||
|
type AwaitedInput<T> = PromiseLike<T> | T;
|
||||||
|
|
||||||
|
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoints returns global config
|
||||||
|
* @summary Get global config
|
||||||
|
*/
|
||||||
|
export const getGlobalConfig = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<GetGlobalConfig200>({
|
||||||
|
url: `/api/v1/global/config`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetGlobalConfigQueryKey = () => ['getGlobalConfig'] as const;
|
||||||
|
|
||||||
|
export const getGetGlobalConfigQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getGlobalConfig>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getGlobalConfig>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getGetGlobalConfigQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof getGlobalConfig>>> = ({
|
||||||
|
signal,
|
||||||
|
}) => getGlobalConfig(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getGlobalConfig>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetGlobalConfigQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getGlobalConfig>>
|
||||||
|
>;
|
||||||
|
export type GetGlobalConfigQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get global config
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetGlobalConfig<
|
||||||
|
TData = Awaited<ReturnType<typeof getGlobalConfig>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getGlobalConfig>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetGlobalConfigQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get global config
|
||||||
|
*/
|
||||||
|
export const invalidateGetGlobalConfig = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetGlobalConfigQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
199
frontend/src/api/generated/services/logs/index.ts
Normal file
199
frontend/src/api/generated/services/logs/index.ts
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
/**
|
||||||
|
* ! Do not edit manually
|
||||||
|
* * The file has been auto-generated using Orval for SigNoz
|
||||||
|
* * regenerate with 'yarn generate:api'
|
||||||
|
* SigNoz
|
||||||
|
*/
|
||||||
|
import type {
|
||||||
|
InvalidateOptions,
|
||||||
|
MutationFunction,
|
||||||
|
QueryClient,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from 'react-query';
|
||||||
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
|
import type {
|
||||||
|
ListPromotedAndIndexedPaths200,
|
||||||
|
PromotetypesPromotePathDTO,
|
||||||
|
RenderErrorResponseDTO,
|
||||||
|
} from '../sigNoz.schemas';
|
||||||
|
|
||||||
|
type AwaitedInput<T> = PromiseLike<T> | T;
|
||||||
|
|
||||||
|
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoints promotes and indexes paths
|
||||||
|
* @summary Promote and index paths
|
||||||
|
*/
|
||||||
|
export const listPromotedAndIndexedPaths = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<ListPromotedAndIndexedPaths200>({
|
||||||
|
url: `/api/v1/logs/promote_paths`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getListPromotedAndIndexedPathsQueryKey = () =>
|
||||||
|
['listPromotedAndIndexedPaths'] as const;
|
||||||
|
|
||||||
|
export const getListPromotedAndIndexedPathsQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey =
|
||||||
|
queryOptions?.queryKey ?? getListPromotedAndIndexedPathsQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>
|
||||||
|
> = ({ signal }) => listPromotedAndIndexedPaths(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ListPromotedAndIndexedPathsQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>
|
||||||
|
>;
|
||||||
|
export type ListPromotedAndIndexedPathsQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Promote and index paths
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useListPromotedAndIndexedPaths<
|
||||||
|
TData = Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listPromotedAndIndexedPaths>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getListPromotedAndIndexedPathsQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Promote and index paths
|
||||||
|
*/
|
||||||
|
export const invalidateListPromotedAndIndexedPaths = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getListPromotedAndIndexedPathsQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoints promotes and indexes paths
|
||||||
|
* @summary Promote and index paths
|
||||||
|
*/
|
||||||
|
export const handlePromoteAndIndexPaths = (
|
||||||
|
promotetypesPromotePathDTONull: PromotetypesPromotePathDTO[] | null,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<void>({
|
||||||
|
url: `/api/v1/logs/promote_paths`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: promotetypesPromotePathDTONull,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getHandlePromoteAndIndexPathsMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||||
|
TError,
|
||||||
|
{ data: PromotetypesPromotePathDTO[] | null },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||||
|
TError,
|
||||||
|
{ data: PromotetypesPromotePathDTO[] | null },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['handlePromoteAndIndexPaths'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||||
|
{ data: PromotetypesPromotePathDTO[] | null }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return handlePromoteAndIndexPaths(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type HandlePromoteAndIndexPathsMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>
|
||||||
|
>;
|
||||||
|
export type HandlePromoteAndIndexPathsMutationBody =
|
||||||
|
| PromotetypesPromotePathDTO[]
|
||||||
|
| null;
|
||||||
|
export type HandlePromoteAndIndexPathsMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Promote and index paths
|
||||||
|
*/
|
||||||
|
export const useHandlePromoteAndIndexPaths = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||||
|
TError,
|
||||||
|
{ data: PromotetypesPromotePathDTO[] | null },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||||
|
TError,
|
||||||
|
{ data: PromotetypesPromotePathDTO[] | null },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getHandlePromoteAndIndexPathsMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
719
frontend/src/api/generated/services/metrics/index.ts
Normal file
719
frontend/src/api/generated/services/metrics/index.ts
Normal file
@@ -0,0 +1,719 @@
|
|||||||
|
/**
|
||||||
|
* ! Do not edit manually
|
||||||
|
* * The file has been auto-generated using Orval for SigNoz
|
||||||
|
* * regenerate with 'yarn generate:api'
|
||||||
|
* SigNoz
|
||||||
|
*/
|
||||||
|
import type {
|
||||||
|
InvalidateOptions,
|
||||||
|
MutationFunction,
|
||||||
|
QueryClient,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from 'react-query';
|
||||||
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
|
import type {
|
||||||
|
GetMetricAlerts200,
|
||||||
|
GetMetricAttributes200,
|
||||||
|
GetMetricDashboards200,
|
||||||
|
GetMetricHighlights200,
|
||||||
|
GetMetricMetadata200,
|
||||||
|
GetMetricsStats200,
|
||||||
|
GetMetricsTreemap200,
|
||||||
|
MetricsexplorertypesMetricAttributesRequestDTO,
|
||||||
|
MetricsexplorertypesStatsRequestDTO,
|
||||||
|
MetricsexplorertypesTreemapRequestDTO,
|
||||||
|
MetricsexplorertypesUpdateMetricMetadataRequestDTO,
|
||||||
|
RenderErrorResponseDTO,
|
||||||
|
UpdateMetricMetadataPathParameters,
|
||||||
|
} from '../sigNoz.schemas';
|
||||||
|
|
||||||
|
type AwaitedInput<T> = PromiseLike<T> | T;
|
||||||
|
|
||||||
|
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint returns associated alerts for a specified metric
|
||||||
|
* @summary Get metric alerts
|
||||||
|
*/
|
||||||
|
export const getMetricAlerts = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<GetMetricAlerts200>({
|
||||||
|
url: `/api/v2/metric/alerts`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetMetricAlertsQueryKey = () => ['getMetricAlerts'] as const;
|
||||||
|
|
||||||
|
export const getGetMetricAlertsQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getMetricAlerts>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricAlerts>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getGetMetricAlertsQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMetricAlerts>>> = ({
|
||||||
|
signal,
|
||||||
|
}) => getMetricAlerts(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricAlerts>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetMetricAlertsQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getMetricAlerts>>
|
||||||
|
>;
|
||||||
|
export type GetMetricAlertsQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get metric alerts
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetMetricAlerts<
|
||||||
|
TData = Awaited<ReturnType<typeof getMetricAlerts>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricAlerts>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetMetricAlertsQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get metric alerts
|
||||||
|
*/
|
||||||
|
export const invalidateGetMetricAlerts = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetMetricAlertsQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint returns associated dashboards for a specified metric
|
||||||
|
* @summary Get metric dashboards
|
||||||
|
*/
|
||||||
|
export const getMetricDashboards = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<GetMetricDashboards200>({
|
||||||
|
url: `/api/v2/metric/dashboards`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetMetricDashboardsQueryKey = () =>
|
||||||
|
['getMetricDashboards'] as const;
|
||||||
|
|
||||||
|
export const getGetMetricDashboardsQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getMetricDashboards>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricDashboards>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getGetMetricDashboardsQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof getMetricDashboards>>
|
||||||
|
> = ({ signal }) => getMetricDashboards(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricDashboards>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetMetricDashboardsQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getMetricDashboards>>
|
||||||
|
>;
|
||||||
|
export type GetMetricDashboardsQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get metric dashboards
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetMetricDashboards<
|
||||||
|
TData = Awaited<ReturnType<typeof getMetricDashboards>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricDashboards>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetMetricDashboardsQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get metric dashboards
|
||||||
|
*/
|
||||||
|
export const invalidateGetMetricDashboards = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetMetricDashboardsQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint returns highlights like number of datapoints, totaltimeseries, active time series, last received time for a specified metric
|
||||||
|
* @summary Get metric highlights
|
||||||
|
*/
|
||||||
|
export const getMetricHighlights = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<GetMetricHighlights200>({
|
||||||
|
url: `/api/v2/metric/highlights`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetMetricHighlightsQueryKey = () =>
|
||||||
|
['getMetricHighlights'] as const;
|
||||||
|
|
||||||
|
export const getGetMetricHighlightsQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getMetricHighlights>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricHighlights>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getGetMetricHighlightsQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof getMetricHighlights>>
|
||||||
|
> = ({ signal }) => getMetricHighlights(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricHighlights>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetMetricHighlightsQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getMetricHighlights>>
|
||||||
|
>;
|
||||||
|
export type GetMetricHighlightsQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get metric highlights
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetMetricHighlights<
|
||||||
|
TData = Awaited<ReturnType<typeof getMetricHighlights>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricHighlights>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetMetricHighlightsQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get metric highlights
|
||||||
|
*/
|
||||||
|
export const invalidateGetMetricHighlights = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetMetricHighlightsQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint helps to update metadata information like metric description, unit, type, temporality, monotonicity for a specified metric
|
||||||
|
* @summary Update metric metadata
|
||||||
|
*/
|
||||||
|
export const updateMetricMetadata = (
|
||||||
|
{ metricName }: UpdateMetricMetadataPathParameters,
|
||||||
|
metricsexplorertypesUpdateMetricMetadataRequestDTO: MetricsexplorertypesUpdateMetricMetadataRequestDTO,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<string>({
|
||||||
|
url: `/api/v2/metrics/${metricName}/metadata`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: metricsexplorertypesUpdateMetricMetadataRequestDTO,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getUpdateMetricMetadataMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateMetricMetadata>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateMetricMetadataPathParameters;
|
||||||
|
data: MetricsexplorertypesUpdateMetricMetadataRequestDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateMetricMetadata>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateMetricMetadataPathParameters;
|
||||||
|
data: MetricsexplorertypesUpdateMetricMetadataRequestDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['updateMetricMetadata'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof updateMetricMetadata>>,
|
||||||
|
{
|
||||||
|
pathParams: UpdateMetricMetadataPathParameters;
|
||||||
|
data: MetricsexplorertypesUpdateMetricMetadataRequestDTO;
|
||||||
|
}
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams, data } = props ?? {};
|
||||||
|
|
||||||
|
return updateMetricMetadata(pathParams, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdateMetricMetadataMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof updateMetricMetadata>>
|
||||||
|
>;
|
||||||
|
export type UpdateMetricMetadataMutationBody = MetricsexplorertypesUpdateMetricMetadataRequestDTO;
|
||||||
|
export type UpdateMetricMetadataMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Update metric metadata
|
||||||
|
*/
|
||||||
|
export const useUpdateMetricMetadata = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateMetricMetadata>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateMetricMetadataPathParameters;
|
||||||
|
data: MetricsexplorertypesUpdateMetricMetadataRequestDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof updateMetricMetadata>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateMetricMetadataPathParameters;
|
||||||
|
data: MetricsexplorertypesUpdateMetricMetadataRequestDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getUpdateMetricMetadataMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint returns attribute keys and their unique values for a specified metric
|
||||||
|
* @summary Get metric attributes
|
||||||
|
*/
|
||||||
|
export const getMetricAttributes = (
|
||||||
|
metricsexplorertypesMetricAttributesRequestDTO: MetricsexplorertypesMetricAttributesRequestDTO,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<GetMetricAttributes200>({
|
||||||
|
url: `/api/v2/metrics/attributes`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: metricsexplorertypesMetricAttributesRequestDTO,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetMetricAttributesMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricAttributes>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesMetricAttributesRequestDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricAttributes>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesMetricAttributesRequestDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['getMetricAttributes'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof getMetricAttributes>>,
|
||||||
|
{ data: MetricsexplorertypesMetricAttributesRequestDTO }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return getMetricAttributes(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetMetricAttributesMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getMetricAttributes>>
|
||||||
|
>;
|
||||||
|
export type GetMetricAttributesMutationBody = MetricsexplorertypesMetricAttributesRequestDTO;
|
||||||
|
export type GetMetricAttributesMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get metric attributes
|
||||||
|
*/
|
||||||
|
export const useGetMetricAttributes = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricAttributes>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesMetricAttributesRequestDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof getMetricAttributes>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesMetricAttributesRequestDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getGetMetricAttributesMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint returns metadata information like metric description, unit, type, temporality, monotonicity for a specified metric
|
||||||
|
* @summary Get metric metadata
|
||||||
|
*/
|
||||||
|
export const getMetricMetadata = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<GetMetricMetadata200>({
|
||||||
|
url: `/api/v2/metrics/metadata`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetMetricMetadataQueryKey = () =>
|
||||||
|
['getMetricMetadata'] as const;
|
||||||
|
|
||||||
|
export const getGetMetricMetadataQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getMetricMetadata>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricMetadata>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getGetMetricMetadataQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof getMetricMetadata>>
|
||||||
|
> = ({ signal }) => getMetricMetadata(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricMetadata>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetMetricMetadataQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getMetricMetadata>>
|
||||||
|
>;
|
||||||
|
export type GetMetricMetadataQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get metric metadata
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetMetricMetadata<
|
||||||
|
TData = Awaited<ReturnType<typeof getMetricMetadata>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricMetadata>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetMetricMetadataQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get metric metadata
|
||||||
|
*/
|
||||||
|
export const invalidateGetMetricMetadata = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetMetricMetadataQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint provides list of metrics with their number of samples and timeseries for the given time range
|
||||||
|
* @summary Get metrics statistics
|
||||||
|
*/
|
||||||
|
export const getMetricsStats = (
|
||||||
|
metricsexplorertypesStatsRequestDTO: MetricsexplorertypesStatsRequestDTO,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<GetMetricsStats200>({
|
||||||
|
url: `/api/v2/metrics/stats`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: metricsexplorertypesStatsRequestDTO,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetMetricsStatsMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricsStats>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesStatsRequestDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricsStats>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesStatsRequestDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['getMetricsStats'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof getMetricsStats>>,
|
||||||
|
{ data: MetricsexplorertypesStatsRequestDTO }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return getMetricsStats(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetMetricsStatsMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getMetricsStats>>
|
||||||
|
>;
|
||||||
|
export type GetMetricsStatsMutationBody = MetricsexplorertypesStatsRequestDTO;
|
||||||
|
export type GetMetricsStatsMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get metrics statistics
|
||||||
|
*/
|
||||||
|
export const useGetMetricsStats = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricsStats>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesStatsRequestDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof getMetricsStats>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesStatsRequestDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getGetMetricsStatsMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint returns a treemap visualization showing the proportional distribution of metrics by sample count or time series count
|
||||||
|
* @summary Get metrics treemap
|
||||||
|
*/
|
||||||
|
export const getMetricsTreemap = (
|
||||||
|
metricsexplorertypesTreemapRequestDTO: MetricsexplorertypesTreemapRequestDTO,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<GetMetricsTreemap200>({
|
||||||
|
url: `/api/v2/metrics/treemap`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: metricsexplorertypesTreemapRequestDTO,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetMetricsTreemapMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricsTreemap>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesTreemapRequestDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricsTreemap>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesTreemapRequestDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['getMetricsTreemap'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof getMetricsTreemap>>,
|
||||||
|
{ data: MetricsexplorertypesTreemapRequestDTO }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return getMetricsTreemap(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetMetricsTreemapMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getMetricsTreemap>>
|
||||||
|
>;
|
||||||
|
export type GetMetricsTreemapMutationBody = MetricsexplorertypesTreemapRequestDTO;
|
||||||
|
export type GetMetricsTreemapMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get metrics treemap
|
||||||
|
*/
|
||||||
|
export const useGetMetricsTreemap = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof getMetricsTreemap>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesTreemapRequestDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof getMetricsTreemap>>,
|
||||||
|
TError,
|
||||||
|
{ data: MetricsexplorertypesTreemapRequestDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getGetMetricsTreemapMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
194
frontend/src/api/generated/services/orgs/index.ts
Normal file
194
frontend/src/api/generated/services/orgs/index.ts
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
/**
|
||||||
|
* ! Do not edit manually
|
||||||
|
* * The file has been auto-generated using Orval for SigNoz
|
||||||
|
* * regenerate with 'yarn generate:api'
|
||||||
|
* SigNoz
|
||||||
|
*/
|
||||||
|
import type {
|
||||||
|
InvalidateOptions,
|
||||||
|
MutationFunction,
|
||||||
|
QueryClient,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from 'react-query';
|
||||||
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
|
import type {
|
||||||
|
GetMyOrganization200,
|
||||||
|
RenderErrorResponseDTO,
|
||||||
|
TypesOrganizationDTO,
|
||||||
|
} from '../sigNoz.schemas';
|
||||||
|
|
||||||
|
type AwaitedInput<T> = PromiseLike<T> | T;
|
||||||
|
|
||||||
|
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint returns the organization I belong to
|
||||||
|
* @summary Get my organization
|
||||||
|
*/
|
||||||
|
export const getMyOrganization = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<GetMyOrganization200>({
|
||||||
|
url: `/api/v2/orgs/me`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetMyOrganizationQueryKey = () =>
|
||||||
|
['getMyOrganization'] as const;
|
||||||
|
|
||||||
|
export const getGetMyOrganizationQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getMyOrganization>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMyOrganization>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getGetMyOrganizationQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof getMyOrganization>>
|
||||||
|
> = ({ signal }) => getMyOrganization(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMyOrganization>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetMyOrganizationQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getMyOrganization>>
|
||||||
|
>;
|
||||||
|
export type GetMyOrganizationQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get my organization
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetMyOrganization<
|
||||||
|
TData = Awaited<ReturnType<typeof getMyOrganization>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getMyOrganization>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetMyOrganizationQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get my organization
|
||||||
|
*/
|
||||||
|
export const invalidateGetMyOrganization = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetMyOrganizationQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint updates the organization I belong to
|
||||||
|
* @summary Update my organization
|
||||||
|
*/
|
||||||
|
export const updateMyOrganization = (
|
||||||
|
typesOrganizationDTO: TypesOrganizationDTO,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<void>({
|
||||||
|
url: `/api/v2/orgs/me`,
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: typesOrganizationDTO,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getUpdateMyOrganizationMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||||
|
TError,
|
||||||
|
{ data: TypesOrganizationDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||||
|
TError,
|
||||||
|
{ data: TypesOrganizationDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['updateMyOrganization'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||||
|
{ data: TypesOrganizationDTO }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return updateMyOrganization(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdateMyOrganizationMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof updateMyOrganization>>
|
||||||
|
>;
|
||||||
|
export type UpdateMyOrganizationMutationBody = TypesOrganizationDTO;
|
||||||
|
export type UpdateMyOrganizationMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Update my organization
|
||||||
|
*/
|
||||||
|
export const useUpdateMyOrganization = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||||
|
TError,
|
||||||
|
{ data: TypesOrganizationDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||||
|
TError,
|
||||||
|
{ data: TypesOrganizationDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getUpdateMyOrganizationMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
599
frontend/src/api/generated/services/preferences/index.ts
Normal file
599
frontend/src/api/generated/services/preferences/index.ts
Normal file
@@ -0,0 +1,599 @@
|
|||||||
|
/**
|
||||||
|
* ! Do not edit manually
|
||||||
|
* * The file has been auto-generated using Orval for SigNoz
|
||||||
|
* * regenerate with 'yarn generate:api'
|
||||||
|
* SigNoz
|
||||||
|
*/
|
||||||
|
import type {
|
||||||
|
InvalidateOptions,
|
||||||
|
MutationFunction,
|
||||||
|
QueryClient,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from 'react-query';
|
||||||
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
|
import type {
|
||||||
|
GetOrgPreference200,
|
||||||
|
GetOrgPreferencePathParameters,
|
||||||
|
GetUserPreference200,
|
||||||
|
GetUserPreferencePathParameters,
|
||||||
|
ListOrgPreferences200,
|
||||||
|
ListUserPreferences200,
|
||||||
|
PreferencetypesUpdatablePreferenceDTO,
|
||||||
|
RenderErrorResponseDTO,
|
||||||
|
UpdateOrgPreferencePathParameters,
|
||||||
|
UpdateUserPreferencePathParameters,
|
||||||
|
} from '../sigNoz.schemas';
|
||||||
|
|
||||||
|
type AwaitedInput<T> = PromiseLike<T> | T;
|
||||||
|
|
||||||
|
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint lists all org preferences
|
||||||
|
* @summary List org preferences
|
||||||
|
*/
|
||||||
|
export const listOrgPreferences = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<ListOrgPreferences200>({
|
||||||
|
url: `/api/v1/org/preferences`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getListOrgPreferencesQueryKey = () =>
|
||||||
|
['listOrgPreferences'] as const;
|
||||||
|
|
||||||
|
export const getListOrgPreferencesQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof listOrgPreferences>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listOrgPreferences>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getListOrgPreferencesQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof listOrgPreferences>>
|
||||||
|
> = ({ signal }) => listOrgPreferences(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listOrgPreferences>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ListOrgPreferencesQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof listOrgPreferences>>
|
||||||
|
>;
|
||||||
|
export type ListOrgPreferencesQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary List org preferences
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useListOrgPreferences<
|
||||||
|
TData = Awaited<ReturnType<typeof listOrgPreferences>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listOrgPreferences>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getListOrgPreferencesQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary List org preferences
|
||||||
|
*/
|
||||||
|
export const invalidateListOrgPreferences = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getListOrgPreferencesQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint returns the org preference by name
|
||||||
|
* @summary Get org preference
|
||||||
|
*/
|
||||||
|
export const getOrgPreference = (
|
||||||
|
{ name }: GetOrgPreferencePathParameters,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<GetOrgPreference200>({
|
||||||
|
url: `/api/v1/org/preferences/${name}`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetOrgPreferenceQueryKey = ({
|
||||||
|
name,
|
||||||
|
}: GetOrgPreferencePathParameters) => ['getOrgPreference'] as const;
|
||||||
|
|
||||||
|
export const getGetOrgPreferenceQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getOrgPreference>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(
|
||||||
|
{ name }: GetOrgPreferencePathParameters,
|
||||||
|
options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getOrgPreference>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey =
|
||||||
|
queryOptions?.queryKey ?? getGetOrgPreferenceQueryKey({ name });
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrgPreference>>> = ({
|
||||||
|
signal,
|
||||||
|
}) => getOrgPreference({ name }, signal);
|
||||||
|
|
||||||
|
return {
|
||||||
|
queryKey,
|
||||||
|
queryFn,
|
||||||
|
enabled: !!name,
|
||||||
|
...queryOptions,
|
||||||
|
} as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getOrgPreference>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetOrgPreferenceQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getOrgPreference>>
|
||||||
|
>;
|
||||||
|
export type GetOrgPreferenceQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get org preference
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetOrgPreference<
|
||||||
|
TData = Awaited<ReturnType<typeof getOrgPreference>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(
|
||||||
|
{ name }: GetOrgPreferencePathParameters,
|
||||||
|
options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getOrgPreference>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetOrgPreferenceQueryOptions({ name }, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get org preference
|
||||||
|
*/
|
||||||
|
export const invalidateGetOrgPreference = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
{ name }: GetOrgPreferencePathParameters,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetOrgPreferenceQueryKey({ name }) },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint updates the org preference by name
|
||||||
|
* @summary Update org preference
|
||||||
|
*/
|
||||||
|
export const updateOrgPreference = (
|
||||||
|
{ name }: UpdateOrgPreferencePathParameters,
|
||||||
|
preferencetypesUpdatablePreferenceDTO: PreferencetypesUpdatablePreferenceDTO,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<void>({
|
||||||
|
url: `/api/v1/org/preferences/${name}`,
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: preferencetypesUpdatablePreferenceDTO,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getUpdateOrgPreferenceMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateOrgPreference>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateOrgPreferencePathParameters;
|
||||||
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateOrgPreference>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateOrgPreferencePathParameters;
|
||||||
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['updateOrgPreference'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof updateOrgPreference>>,
|
||||||
|
{
|
||||||
|
pathParams: UpdateOrgPreferencePathParameters;
|
||||||
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
}
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams, data } = props ?? {};
|
||||||
|
|
||||||
|
return updateOrgPreference(pathParams, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdateOrgPreferenceMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof updateOrgPreference>>
|
||||||
|
>;
|
||||||
|
export type UpdateOrgPreferenceMutationBody = PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
export type UpdateOrgPreferenceMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Update org preference
|
||||||
|
*/
|
||||||
|
export const useUpdateOrgPreference = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateOrgPreference>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateOrgPreferencePathParameters;
|
||||||
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof updateOrgPreference>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateOrgPreferencePathParameters;
|
||||||
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getUpdateOrgPreferenceMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint lists all user preferences
|
||||||
|
* @summary List user preferences
|
||||||
|
*/
|
||||||
|
export const listUserPreferences = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<ListUserPreferences200>({
|
||||||
|
url: `/api/v1/user/preferences`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getListUserPreferencesQueryKey = () =>
|
||||||
|
['listUserPreferences'] as const;
|
||||||
|
|
||||||
|
export const getListUserPreferencesQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof listUserPreferences>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listUserPreferences>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getListUserPreferencesQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof listUserPreferences>>
|
||||||
|
> = ({ signal }) => listUserPreferences(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listUserPreferences>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ListUserPreferencesQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof listUserPreferences>>
|
||||||
|
>;
|
||||||
|
export type ListUserPreferencesQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary List user preferences
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useListUserPreferences<
|
||||||
|
TData = Awaited<ReturnType<typeof listUserPreferences>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listUserPreferences>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getListUserPreferencesQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary List user preferences
|
||||||
|
*/
|
||||||
|
export const invalidateListUserPreferences = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getListUserPreferencesQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint returns the user preference by name
|
||||||
|
* @summary Get user preference
|
||||||
|
*/
|
||||||
|
export const getUserPreference = (
|
||||||
|
{ name }: GetUserPreferencePathParameters,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<GetUserPreference200>({
|
||||||
|
url: `/api/v1/user/preferences/${name}`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetUserPreferenceQueryKey = ({
|
||||||
|
name,
|
||||||
|
}: GetUserPreferencePathParameters) => ['getUserPreference'] as const;
|
||||||
|
|
||||||
|
export const getGetUserPreferenceQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getUserPreference>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(
|
||||||
|
{ name }: GetUserPreferencePathParameters,
|
||||||
|
options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getUserPreference>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey =
|
||||||
|
queryOptions?.queryKey ?? getGetUserPreferenceQueryKey({ name });
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof getUserPreference>>
|
||||||
|
> = ({ signal }) => getUserPreference({ name }, signal);
|
||||||
|
|
||||||
|
return {
|
||||||
|
queryKey,
|
||||||
|
queryFn,
|
||||||
|
enabled: !!name,
|
||||||
|
...queryOptions,
|
||||||
|
} as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getUserPreference>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetUserPreferenceQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getUserPreference>>
|
||||||
|
>;
|
||||||
|
export type GetUserPreferenceQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get user preference
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetUserPreference<
|
||||||
|
TData = Awaited<ReturnType<typeof getUserPreference>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(
|
||||||
|
{ name }: GetUserPreferencePathParameters,
|
||||||
|
options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getUserPreference>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetUserPreferenceQueryOptions({ name }, options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get user preference
|
||||||
|
*/
|
||||||
|
export const invalidateGetUserPreference = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
{ name }: GetUserPreferencePathParameters,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetUserPreferenceQueryKey({ name }) },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint updates the user preference by name
|
||||||
|
* @summary Update user preference
|
||||||
|
*/
|
||||||
|
export const updateUserPreference = (
|
||||||
|
{ name }: UpdateUserPreferencePathParameters,
|
||||||
|
preferencetypesUpdatablePreferenceDTO: PreferencetypesUpdatablePreferenceDTO,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<void>({
|
||||||
|
url: `/api/v1/user/preferences/${name}`,
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: preferencetypesUpdatablePreferenceDTO,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getUpdateUserPreferenceMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateUserPreference>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateUserPreferencePathParameters;
|
||||||
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateUserPreference>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateUserPreferencePathParameters;
|
||||||
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['updateUserPreference'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof updateUserPreference>>,
|
||||||
|
{
|
||||||
|
pathParams: UpdateUserPreferencePathParameters;
|
||||||
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
}
|
||||||
|
> = (props) => {
|
||||||
|
const { pathParams, data } = props ?? {};
|
||||||
|
|
||||||
|
return updateUserPreference(pathParams, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type UpdateUserPreferenceMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof updateUserPreference>>
|
||||||
|
>;
|
||||||
|
export type UpdateUserPreferenceMutationBody = PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
export type UpdateUserPreferenceMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Update user preference
|
||||||
|
*/
|
||||||
|
export const useUpdateUserPreference = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof updateUserPreference>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateUserPreferencePathParameters;
|
||||||
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof updateUserPreference>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
pathParams: UpdateUserPreferencePathParameters;
|
||||||
|
data: PreferencetypesUpdatablePreferenceDTO;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getUpdateUserPreferenceMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
738
frontend/src/api/generated/services/sessions/index.ts
Normal file
738
frontend/src/api/generated/services/sessions/index.ts
Normal file
@@ -0,0 +1,738 @@
|
|||||||
|
/**
|
||||||
|
* ! Do not edit manually
|
||||||
|
* * The file has been auto-generated using Orval for SigNoz
|
||||||
|
* * regenerate with 'yarn generate:api'
|
||||||
|
* SigNoz
|
||||||
|
*/
|
||||||
|
import type {
|
||||||
|
InvalidateOptions,
|
||||||
|
MutationFunction,
|
||||||
|
QueryClient,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UseMutationOptions,
|
||||||
|
UseMutationResult,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from 'react-query';
|
||||||
|
import { useMutation, useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { GeneratedAPIInstance } from '../../../index';
|
||||||
|
import type {
|
||||||
|
AuthtypesDeprecatedPostableLoginDTO,
|
||||||
|
AuthtypesPostableEmailPasswordSessionDTO,
|
||||||
|
AuthtypesPostableRotateTokenDTO,
|
||||||
|
CreateSessionByEmailPassword200,
|
||||||
|
CreateSessionByGoogleCallback303,
|
||||||
|
CreateSessionByOIDCCallback303,
|
||||||
|
CreateSessionBySAMLCallback303,
|
||||||
|
CreateSessionBySAMLCallbackBody,
|
||||||
|
CreateSessionBySAMLCallbackParams,
|
||||||
|
DeprecatedCreateSessionByEmailPassword200,
|
||||||
|
GetSessionContext200,
|
||||||
|
RenderErrorResponseDTO,
|
||||||
|
RotateSession200,
|
||||||
|
} from '../sigNoz.schemas';
|
||||||
|
|
||||||
|
type AwaitedInput<T> = PromiseLike<T> | T;
|
||||||
|
|
||||||
|
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint creates a session for a user using google callback
|
||||||
|
* @summary Create session by google callback
|
||||||
|
*/
|
||||||
|
export const createSessionByGoogleCallback = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<unknown>({
|
||||||
|
url: `/api/v1/complete/google`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getCreateSessionByGoogleCallbackQueryKey = () =>
|
||||||
|
['createSessionByGoogleCallback'] as const;
|
||||||
|
|
||||||
|
export const getCreateSessionByGoogleCallbackQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
||||||
|
TError = CreateSessionByGoogleCallback303 | RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey =
|
||||||
|
queryOptions?.queryKey ?? getCreateSessionByGoogleCallbackQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof createSessionByGoogleCallback>>
|
||||||
|
> = ({ signal }) => createSessionByGoogleCallback(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreateSessionByGoogleCallbackQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof createSessionByGoogleCallback>>
|
||||||
|
>;
|
||||||
|
export type CreateSessionByGoogleCallbackQueryError =
|
||||||
|
| CreateSessionByGoogleCallback303
|
||||||
|
| RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Create session by google callback
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useCreateSessionByGoogleCallback<
|
||||||
|
TData = Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
||||||
|
TError = CreateSessionByGoogleCallback303 | RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionByGoogleCallback>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getCreateSessionByGoogleCallbackQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Create session by google callback
|
||||||
|
*/
|
||||||
|
export const invalidateCreateSessionByGoogleCallback = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getCreateSessionByGoogleCallbackQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint creates a session for a user using oidc callback
|
||||||
|
* @summary Create session by oidc callback
|
||||||
|
*/
|
||||||
|
export const createSessionByOIDCCallback = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<unknown>({
|
||||||
|
url: `/api/v1/complete/oidc`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getCreateSessionByOIDCCallbackQueryKey = () =>
|
||||||
|
['createSessionByOIDCCallback'] as const;
|
||||||
|
|
||||||
|
export const getCreateSessionByOIDCCallbackQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
||||||
|
TError = CreateSessionByOIDCCallback303 | RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey =
|
||||||
|
queryOptions?.queryKey ?? getCreateSessionByOIDCCallbackQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof createSessionByOIDCCallback>>
|
||||||
|
> = ({ signal }) => createSessionByOIDCCallback(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreateSessionByOIDCCallbackQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof createSessionByOIDCCallback>>
|
||||||
|
>;
|
||||||
|
export type CreateSessionByOIDCCallbackQueryError =
|
||||||
|
| CreateSessionByOIDCCallback303
|
||||||
|
| RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Create session by oidc callback
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useCreateSessionByOIDCCallback<
|
||||||
|
TData = Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
||||||
|
TError = CreateSessionByOIDCCallback303 | RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionByOIDCCallback>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getCreateSessionByOIDCCallbackQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Create session by oidc callback
|
||||||
|
*/
|
||||||
|
export const invalidateCreateSessionByOIDCCallback = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getCreateSessionByOIDCCallbackQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint creates a session for a user using saml callback
|
||||||
|
* @summary Create session by saml callback
|
||||||
|
*/
|
||||||
|
export const createSessionBySAMLCallback = (
|
||||||
|
createSessionBySAMLCallbackBody: CreateSessionBySAMLCallbackBody,
|
||||||
|
params?: CreateSessionBySAMLCallbackParams,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) => {
|
||||||
|
const formUrlEncoded = new URLSearchParams();
|
||||||
|
if (createSessionBySAMLCallbackBody.RelayState !== undefined) {
|
||||||
|
formUrlEncoded.append(
|
||||||
|
`RelayState`,
|
||||||
|
createSessionBySAMLCallbackBody.RelayState,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (createSessionBySAMLCallbackBody.SAMLResponse !== undefined) {
|
||||||
|
formUrlEncoded.append(
|
||||||
|
`SAMLResponse`,
|
||||||
|
createSessionBySAMLCallbackBody.SAMLResponse,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GeneratedAPIInstance<unknown>({
|
||||||
|
url: `/api/v1/complete/saml`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
|
data: formUrlEncoded,
|
||||||
|
params,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getCreateSessionBySAMLCallbackMutationOptions = <
|
||||||
|
TError = CreateSessionBySAMLCallback303 | RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
data: CreateSessionBySAMLCallbackBody;
|
||||||
|
params?: CreateSessionBySAMLCallbackParams;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
data: CreateSessionBySAMLCallbackBody;
|
||||||
|
params?: CreateSessionBySAMLCallbackParams;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['createSessionBySAMLCallback'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||||
|
{
|
||||||
|
data: CreateSessionBySAMLCallbackBody;
|
||||||
|
params?: CreateSessionBySAMLCallbackParams;
|
||||||
|
}
|
||||||
|
> = (props) => {
|
||||||
|
const { data, params } = props ?? {};
|
||||||
|
|
||||||
|
return createSessionBySAMLCallback(data, params);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreateSessionBySAMLCallbackMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>
|
||||||
|
>;
|
||||||
|
export type CreateSessionBySAMLCallbackMutationBody = CreateSessionBySAMLCallbackBody;
|
||||||
|
export type CreateSessionBySAMLCallbackMutationError =
|
||||||
|
| CreateSessionBySAMLCallback303
|
||||||
|
| RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Create session by saml callback
|
||||||
|
*/
|
||||||
|
export const useCreateSessionBySAMLCallback = <
|
||||||
|
TError = CreateSessionBySAMLCallback303 | RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
data: CreateSessionBySAMLCallbackBody;
|
||||||
|
params?: CreateSessionBySAMLCallbackParams;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||||
|
TError,
|
||||||
|
{
|
||||||
|
data: CreateSessionBySAMLCallbackBody;
|
||||||
|
params?: CreateSessionBySAMLCallbackParams;
|
||||||
|
},
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getCreateSessionBySAMLCallbackMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint is deprecated and will be removed in the future
|
||||||
|
* @deprecated
|
||||||
|
* @summary Deprecated create session by email password
|
||||||
|
*/
|
||||||
|
export const deprecatedCreateSessionByEmailPassword = (
|
||||||
|
authtypesDeprecatedPostableLoginDTO: AuthtypesDeprecatedPostableLoginDTO,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<DeprecatedCreateSessionByEmailPassword200>({
|
||||||
|
url: `/api/v1/login`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: authtypesDeprecatedPostableLoginDTO,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getDeprecatedCreateSessionByEmailPasswordMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deprecatedCreateSessionByEmailPassword>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesDeprecatedPostableLoginDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deprecatedCreateSessionByEmailPassword>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesDeprecatedPostableLoginDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['deprecatedCreateSessionByEmailPassword'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof deprecatedCreateSessionByEmailPassword>>,
|
||||||
|
{ data: AuthtypesDeprecatedPostableLoginDTO }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return deprecatedCreateSessionByEmailPassword(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DeprecatedCreateSessionByEmailPasswordMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof deprecatedCreateSessionByEmailPassword>>
|
||||||
|
>;
|
||||||
|
export type DeprecatedCreateSessionByEmailPasswordMutationBody = AuthtypesDeprecatedPostableLoginDTO;
|
||||||
|
export type DeprecatedCreateSessionByEmailPasswordMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @summary Deprecated create session by email password
|
||||||
|
*/
|
||||||
|
export const useDeprecatedCreateSessionByEmailPassword = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deprecatedCreateSessionByEmailPassword>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesDeprecatedPostableLoginDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof deprecatedCreateSessionByEmailPassword>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesDeprecatedPostableLoginDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getDeprecatedCreateSessionByEmailPasswordMutationOptions(
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint deletes the session
|
||||||
|
* @summary Delete session
|
||||||
|
*/
|
||||||
|
export const deleteSession = () =>
|
||||||
|
GeneratedAPIInstance<void>({
|
||||||
|
url: `/api/v2/sessions`,
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getDeleteSessionMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteSession>>,
|
||||||
|
TError,
|
||||||
|
void,
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteSession>>,
|
||||||
|
TError,
|
||||||
|
void,
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['deleteSession'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof deleteSession>>,
|
||||||
|
void
|
||||||
|
> = () => deleteSession();
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DeleteSessionMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof deleteSession>>
|
||||||
|
>;
|
||||||
|
|
||||||
|
export type DeleteSessionMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Delete session
|
||||||
|
*/
|
||||||
|
export const useDeleteSession = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof deleteSession>>,
|
||||||
|
TError,
|
||||||
|
void,
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof deleteSession>>,
|
||||||
|
TError,
|
||||||
|
void,
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getDeleteSessionMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint returns the context for the session
|
||||||
|
* @summary Get session context
|
||||||
|
*/
|
||||||
|
export const getSessionContext = (signal?: AbortSignal) =>
|
||||||
|
GeneratedAPIInstance<GetSessionContext200>({
|
||||||
|
url: `/api/v2/sessions/context`,
|
||||||
|
method: 'GET',
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getGetSessionContextQueryKey = () =>
|
||||||
|
['getSessionContext'] as const;
|
||||||
|
|
||||||
|
export const getGetSessionContextQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof getSessionContext>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getSessionContext>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getGetSessionContextQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<
|
||||||
|
Awaited<ReturnType<typeof getSessionContext>>
|
||||||
|
> = ({ signal }) => getSessionContext(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getSessionContext>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: QueryKey };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetSessionContextQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof getSessionContext>>
|
||||||
|
>;
|
||||||
|
export type GetSessionContextQueryError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get session context
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useGetSessionContext<
|
||||||
|
TData = Awaited<ReturnType<typeof getSessionContext>>,
|
||||||
|
TError = RenderErrorResponseDTO
|
||||||
|
>(options?: {
|
||||||
|
query?: UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof getSessionContext>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
>;
|
||||||
|
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||||
|
const queryOptions = getGetSessionContextQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: QueryKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get session context
|
||||||
|
*/
|
||||||
|
export const invalidateGetSessionContext = async (
|
||||||
|
queryClient: QueryClient,
|
||||||
|
options?: InvalidateOptions,
|
||||||
|
): Promise<QueryClient> => {
|
||||||
|
await queryClient.invalidateQueries(
|
||||||
|
{ queryKey: getGetSessionContextQueryKey() },
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return queryClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This endpoint creates a session for a user using email and password.
|
||||||
|
* @summary Create session by email and password
|
||||||
|
*/
|
||||||
|
export const createSessionByEmailPassword = (
|
||||||
|
authtypesPostableEmailPasswordSessionDTO: AuthtypesPostableEmailPasswordSessionDTO,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<CreateSessionByEmailPassword200>({
|
||||||
|
url: `/api/v2/sessions/email_password`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: authtypesPostableEmailPasswordSessionDTO,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getCreateSessionByEmailPasswordMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableEmailPasswordSessionDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableEmailPasswordSessionDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['createSessionByEmailPassword'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||||
|
{ data: AuthtypesPostableEmailPasswordSessionDTO }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return createSessionByEmailPassword(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreateSessionByEmailPasswordMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>
|
||||||
|
>;
|
||||||
|
export type CreateSessionByEmailPasswordMutationBody = AuthtypesPostableEmailPasswordSessionDTO;
|
||||||
|
export type CreateSessionByEmailPasswordMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Create session by email and password
|
||||||
|
*/
|
||||||
|
export const useCreateSessionByEmailPassword = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableEmailPasswordSessionDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableEmailPasswordSessionDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getCreateSessionByEmailPasswordMutationOptions(
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This endpoint rotates the session
|
||||||
|
* @summary Rotate session
|
||||||
|
*/
|
||||||
|
export const rotateSession = (
|
||||||
|
authtypesPostableRotateTokenDTO: AuthtypesPostableRotateTokenDTO,
|
||||||
|
signal?: AbortSignal,
|
||||||
|
) =>
|
||||||
|
GeneratedAPIInstance<RotateSession200>({
|
||||||
|
url: `/api/v2/sessions/rotate`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
data: authtypesPostableRotateTokenDTO,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getRotateSessionMutationOptions = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof rotateSession>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableRotateTokenDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof rotateSession>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableRotateTokenDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationKey = ['rotateSession'];
|
||||||
|
const { mutation: mutationOptions } = options
|
||||||
|
? options.mutation &&
|
||||||
|
'mutationKey' in options.mutation &&
|
||||||
|
options.mutation.mutationKey
|
||||||
|
? options
|
||||||
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
|
const mutationFn: MutationFunction<
|
||||||
|
Awaited<ReturnType<typeof rotateSession>>,
|
||||||
|
{ data: AuthtypesPostableRotateTokenDTO }
|
||||||
|
> = (props) => {
|
||||||
|
const { data } = props ?? {};
|
||||||
|
|
||||||
|
return rotateSession(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
return { mutationFn, ...mutationOptions };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RotateSessionMutationResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof rotateSession>>
|
||||||
|
>;
|
||||||
|
export type RotateSessionMutationBody = AuthtypesPostableRotateTokenDTO;
|
||||||
|
export type RotateSessionMutationError = RenderErrorResponseDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Rotate session
|
||||||
|
*/
|
||||||
|
export const useRotateSession = <
|
||||||
|
TError = RenderErrorResponseDTO,
|
||||||
|
TContext = unknown
|
||||||
|
>(options?: {
|
||||||
|
mutation?: UseMutationOptions<
|
||||||
|
Awaited<ReturnType<typeof rotateSession>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableRotateTokenDTO },
|
||||||
|
TContext
|
||||||
|
>;
|
||||||
|
}): UseMutationResult<
|
||||||
|
Awaited<ReturnType<typeof rotateSession>>,
|
||||||
|
TError,
|
||||||
|
{ data: AuthtypesPostableRotateTokenDTO },
|
||||||
|
TContext
|
||||||
|
> => {
|
||||||
|
const mutationOptions = getRotateSessionMutationOptions(options);
|
||||||
|
|
||||||
|
return useMutation(mutationOptions);
|
||||||
|
};
|
||||||
1931
frontend/src/api/generated/services/sigNoz.schemas.ts
Normal file
1931
frontend/src/api/generated/services/sigNoz.schemas.ts
Normal file
File diff suppressed because it is too large
Load Diff
1536
frontend/src/api/generated/services/users/index.ts
Normal file
1536
frontend/src/api/generated/services/users/index.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -229,6 +229,17 @@ export const GatewayApiV2Instance = axios.create({
|
|||||||
baseURL: `${ENVIRONMENT.baseURL}${gatewayApiV2}`,
|
baseURL: `${ENVIRONMENT.baseURL}${gatewayApiV2}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// generated API Instance
|
||||||
|
export const GeneratedAPIInstance = axios.create({
|
||||||
|
baseURL: ENVIRONMENT.baseURL,
|
||||||
|
});
|
||||||
|
|
||||||
|
GeneratedAPIInstance.interceptors.request.use(interceptorsRequestResponse);
|
||||||
|
GeneratedAPIInstance.interceptors.response.use(
|
||||||
|
interceptorsResponse,
|
||||||
|
interceptorRejected,
|
||||||
|
);
|
||||||
|
|
||||||
GatewayApiV2Instance.interceptors.response.use(
|
GatewayApiV2Instance.interceptors.response.use(
|
||||||
interceptorsResponse,
|
interceptorsResponse,
|
||||||
interceptorRejected,
|
interceptorRejected,
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
],
|
],
|
||||||
"types": ["node", "jest"]
|
"types": ["node", "jest"]
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "src/parser/*.ts", "src/parser/TraceOperatorParser/*.ts"],
|
"exclude": ["node_modules", "src/parser/*.ts", "src/parser/TraceOperatorParser/*.ts", "orval.config.ts"],
|
||||||
"include": [
|
"include": [
|
||||||
"./src",
|
"./src",
|
||||||
"./src/**/*.ts",
|
"./src/**/*.ts",
|
||||||
|
|||||||
1811
frontend/yarn.lock
1811
frontend/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user