@harnessio/react-intelligence-service-client 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/intelligence-service/src/services/hooks/useCreateRuleMutation.d.ts +40 -0
- package/dist/intelligence-service/src/services/hooks/useCreateRuleMutation.js +30 -0
- package/dist/intelligence-service/src/services/hooks/useDeleteRuleMutation.d.ts +30 -11
- package/dist/intelligence-service/src/services/hooks/useDeleteRuleMutation.js +20 -4
- package/dist/intelligence-service/src/services/hooks/useGetRuleQuery.d.ts +30 -11
- package/dist/intelligence-service/src/services/hooks/useGetRuleQuery.js +19 -5
- package/dist/intelligence-service/src/services/hooks/useGetUserSettingQuery.d.ts +20 -0
- package/dist/intelligence-service/src/services/hooks/useGetUserSettingQuery.js +14 -0
- package/dist/intelligence-service/src/services/hooks/useListRulesQuery.d.ts +46 -12
- package/dist/intelligence-service/src/services/hooks/useListRulesQuery.js +20 -4
- package/dist/intelligence-service/src/services/hooks/useListUserSettingsQuery.d.ts +17 -0
- package/dist/intelligence-service/src/services/hooks/useListUserSettingsQuery.js +14 -0
- package/dist/intelligence-service/src/services/hooks/useUpdateRuleMutation.d.ts +33 -13
- package/dist/intelligence-service/src/services/hooks/useUpdateRuleMutation.js +20 -4
- package/dist/intelligence-service/src/services/hooks/useUpdateUserSettingsMutation.d.ts +20 -0
- package/dist/intelligence-service/src/services/hooks/useUpdateUserSettingsMutation.js +14 -0
- package/dist/intelligence-service/src/services/index.d.ts +16 -26
- package/dist/intelligence-service/src/services/index.js +4 -11
- package/dist/intelligence-service/src/services/schemas/TypesSettingValueResponse.d.ts +4 -0
- package/dist/intelligence-service/src/services/schemas/TypesSettingValueResponse.js +4 -0
- package/dist/intelligence-service/src/services/schemas/TypesUserSettingRequest.d.ts +6 -0
- package/dist/intelligence-service/src/services/schemas/TypesUserSettingRequest.js +4 -0
- package/dist/intelligence-service/src/services/schemas/TypesUserSettingResponse.d.ts +8 -0
- package/dist/intelligence-service/src/services/schemas/TypesUserSettingResponse.js +4 -0
- package/dist/intelligence-service/src/services/schemas/TypesUserSettingUpdateResponse.d.ts +5 -0
- package/dist/intelligence-service/src/services/schemas/TypesUserSettingUpdateResponse.js +4 -0
- package/package.json +1 -1
- package/dist/intelligence-service/src/services/hooks/useCreateAccountRuleMutation.d.ts +0 -20
- package/dist/intelligence-service/src/services/hooks/useCreateAccountRuleMutation.js +0 -14
- package/dist/intelligence-service/src/services/hooks/useCreateOrgRuleMutation.d.ts +0 -23
- package/dist/intelligence-service/src/services/hooks/useCreateOrgRuleMutation.js +0 -14
- package/dist/intelligence-service/src/services/hooks/useCreateProjectRuleMutation.d.ts +0 -24
- package/dist/intelligence-service/src/services/hooks/useCreateProjectRuleMutation.js +0 -14
- package/dist/intelligence-service/src/services/hooks/useDeleteOrgRuleMutation.d.ts +0 -20
- package/dist/intelligence-service/src/services/hooks/useDeleteOrgRuleMutation.js +0 -14
- package/dist/intelligence-service/src/services/hooks/useDeleteProjectRuleMutation.d.ts +0 -21
- package/dist/intelligence-service/src/services/hooks/useDeleteProjectRuleMutation.js +0 -14
- package/dist/intelligence-service/src/services/hooks/useGetOrgRuleQuery.d.ts +0 -21
- package/dist/intelligence-service/src/services/hooks/useGetOrgRuleQuery.js +0 -14
- package/dist/intelligence-service/src/services/hooks/useGetProjectRuleQuery.d.ts +0 -22
- package/dist/intelligence-service/src/services/hooks/useGetProjectRuleQuery.js +0 -14
- package/dist/intelligence-service/src/services/hooks/useListOrgRulesQuery.d.ts +0 -29
- package/dist/intelligence-service/src/services/hooks/useListOrgRulesQuery.js +0 -14
- package/dist/intelligence-service/src/services/hooks/useListProjectRulesQuery.d.ts +0 -30
- package/dist/intelligence-service/src/services/hooks/useListProjectRulesQuery.js +0 -14
- package/dist/intelligence-service/src/services/hooks/useUpdateOrgRuleMutation.d.ts +0 -24
- package/dist/intelligence-service/src/services/hooks/useUpdateOrgRuleMutation.js +0 -14
- package/dist/intelligence-service/src/services/hooks/useUpdateProjectRuleMutation.d.ts +0 -25
- package/dist/intelligence-service/src/services/hooks/useUpdateProjectRuleMutation.js +0 -14
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { UseMutationOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { TypesRule } from '../schemas/TypesRule';
|
|
3
|
+
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
|
+
import type { ControllerCreateRuleInput } from '../schemas/ControllerCreateRuleInput';
|
|
5
|
+
import type { GetPathParamsType, ResponseWithPagination } from '../helpers';
|
|
6
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
7
|
+
export interface CreateRuleAccountPathParams {
|
|
8
|
+
}
|
|
9
|
+
export interface CreateRuleAccountHeaderParams {
|
|
10
|
+
'harness-account': string;
|
|
11
|
+
}
|
|
12
|
+
export type CreateRuleAccountRequestBody = ControllerCreateRuleInput;
|
|
13
|
+
export type CreateRuleAccountOKResponse = TypesRule;
|
|
14
|
+
export type CreateRuleAccountErrorResponse = UsererrorError;
|
|
15
|
+
export interface CreateRuleOrgPathParams {
|
|
16
|
+
org: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CreateRuleOrgHeaderParams {
|
|
19
|
+
'harness-account': string;
|
|
20
|
+
}
|
|
21
|
+
export type CreateRuleOrgRequestBody = ControllerCreateRuleInput;
|
|
22
|
+
export type CreateRuleOrgOKResponse = TypesRule;
|
|
23
|
+
export type CreateRuleOrgErrorResponse = UsererrorError;
|
|
24
|
+
export interface CreateRuleProjectPathParams {
|
|
25
|
+
org: string;
|
|
26
|
+
project: string;
|
|
27
|
+
}
|
|
28
|
+
export interface CreateRuleProjectHeaderParams {
|
|
29
|
+
'harness-account': string;
|
|
30
|
+
}
|
|
31
|
+
export type CreateRuleProjectRequestBody = ControllerCreateRuleInput;
|
|
32
|
+
export type CreateRuleProjectOKResponse = TypesRule;
|
|
33
|
+
export type CreateRuleProjectErrorResponse = UsererrorError;
|
|
34
|
+
export type CreateRuleOKResponse<T> = T extends CreateRuleProjectPathParams ? ResponseWithPagination<CreateRuleProjectOKResponse> : T extends CreateRuleOrgPathParams ? ResponseWithPagination<CreateRuleOrgOKResponse> : ResponseWithPagination<CreateRuleAccountOKResponse>;
|
|
35
|
+
export type CreateRuleErrorResponse<T> = T extends CreateRuleProjectPathParams ? CreateRuleProjectErrorResponse : T extends CreateRuleOrgPathParams ? CreateRuleOrgErrorResponse : CreateRuleAccountErrorResponse;
|
|
36
|
+
export interface CreateRuleProps extends Omit<FetcherOptions<unknown, unknown>, 'url'> {
|
|
37
|
+
pathParams: CreateRuleAccountPathParams | CreateRuleOrgPathParams | CreateRuleProjectPathParams;
|
|
38
|
+
}
|
|
39
|
+
export declare function createRule<T extends CreateRuleProps = CreateRuleProps>(props: T): Promise<CreateRuleOKResponse<GetPathParamsType<T>>>;
|
|
40
|
+
export declare function useCreateRuleMutation(options?: Omit<UseMutationOptions<CreateRuleOKResponse<unknown>, CreateRuleErrorResponse<unknown>, CreateRuleProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<ResponseWithPagination<TypesRule>, UsererrorError, CreateRuleProps, unknown>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// This code is autogenerated using @harnessio/oats-cli.
|
|
3
|
+
// Please do not modify this code directly.
|
|
4
|
+
import { useMutation } from '@tanstack/react-query';
|
|
5
|
+
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
function isProjectPathParams(pathParams) {
|
|
7
|
+
return !!(pathParams.org &&
|
|
8
|
+
pathParams.project);
|
|
9
|
+
}
|
|
10
|
+
function isOrgPathParams(pathParams) {
|
|
11
|
+
return !!(pathParams.org &&
|
|
12
|
+
!pathParams.project);
|
|
13
|
+
}
|
|
14
|
+
export function createRule(props) {
|
|
15
|
+
let url = `/api/v1/rules`;
|
|
16
|
+
let method = 'POST';
|
|
17
|
+
if (isProjectPathParams(props.pathParams)) {
|
|
18
|
+
url = `/api/v1/orgs/${props.pathParams.org}/projects/${props.pathParams.project}/rules`;
|
|
19
|
+
method = 'POST';
|
|
20
|
+
}
|
|
21
|
+
else if (isOrgPathParams(props.pathParams)) {
|
|
22
|
+
url = `/api/v1/orgs/${props.pathParams.org}/rules`;
|
|
23
|
+
method = 'POST';
|
|
24
|
+
}
|
|
25
|
+
return fetcher(Object.assign({ url,
|
|
26
|
+
method }, props));
|
|
27
|
+
}
|
|
28
|
+
export function useCreateRuleMutation(options) {
|
|
29
|
+
return useMutation((mutateProps) => createRule(mutateProps), options);
|
|
30
|
+
}
|
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
import { UseMutationOptions } from '@tanstack/react-query';
|
|
2
2
|
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
3
|
-
import type { ResponseWithPagination } from '../helpers';
|
|
3
|
+
import type { GetPathParamsType, ResponseWithPagination } from '../helpers';
|
|
4
4
|
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
5
|
-
export interface
|
|
5
|
+
export interface DeleteRuleAccountPathParams {
|
|
6
6
|
rule_id: string;
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface DeleteRuleAccountHeaderParams {
|
|
9
9
|
'harness-account': string;
|
|
10
10
|
}
|
|
11
|
-
export type
|
|
12
|
-
export type
|
|
13
|
-
export interface
|
|
11
|
+
export type DeleteRuleAccountOKResponse = unknown;
|
|
12
|
+
export type DeleteRuleAccountErrorResponse = UsererrorError;
|
|
13
|
+
export interface DeleteRuleOrgPathParams {
|
|
14
|
+
org: string;
|
|
15
|
+
rule_id: string;
|
|
16
|
+
}
|
|
17
|
+
export interface DeleteRuleOrgHeaderParams {
|
|
18
|
+
'harness-account': string;
|
|
19
|
+
}
|
|
20
|
+
export type DeleteRuleOrgOKResponse = unknown;
|
|
21
|
+
export type DeleteRuleOrgErrorResponse = UsererrorError;
|
|
22
|
+
export interface DeleteRuleProjectPathParams {
|
|
23
|
+
org: string;
|
|
24
|
+
project: string;
|
|
25
|
+
rule_id: string;
|
|
26
|
+
}
|
|
27
|
+
export interface DeleteRuleProjectHeaderParams {
|
|
28
|
+
'harness-account': string;
|
|
29
|
+
}
|
|
30
|
+
export type DeleteRuleProjectOKResponse = unknown;
|
|
31
|
+
export type DeleteRuleProjectErrorResponse = UsererrorError;
|
|
32
|
+
export type DeleteRuleOKResponse<T> = T extends DeleteRuleProjectPathParams ? ResponseWithPagination<DeleteRuleProjectOKResponse> : T extends DeleteRuleOrgPathParams ? ResponseWithPagination<DeleteRuleOrgOKResponse> : ResponseWithPagination<DeleteRuleAccountOKResponse>;
|
|
33
|
+
export type DeleteRuleErrorResponse<T> = T extends DeleteRuleProjectPathParams ? DeleteRuleProjectErrorResponse : T extends DeleteRuleOrgPathParams ? DeleteRuleOrgErrorResponse : DeleteRuleAccountErrorResponse;
|
|
34
|
+
export interface DeleteRuleProps extends Omit<FetcherOptions<unknown, unknown>, 'url'> {
|
|
35
|
+
pathParams: DeleteRuleAccountPathParams | DeleteRuleOrgPathParams | DeleteRuleProjectPathParams;
|
|
14
36
|
}
|
|
15
|
-
export declare function deleteRule(props:
|
|
16
|
-
|
|
17
|
-
* Delete a rule
|
|
18
|
-
*/
|
|
19
|
-
export declare function useDeleteRuleMutation(options?: Omit<UseMutationOptions<DeleteRuleOkResponse, DeleteRuleErrorResponse, DeleteRuleProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<DeleteRuleOkResponse, UsererrorError, DeleteRuleProps, unknown>;
|
|
37
|
+
export declare function deleteRule<T extends DeleteRuleProps = DeleteRuleProps>(props: T): Promise<DeleteRuleOKResponse<GetPathParamsType<T>>>;
|
|
38
|
+
export declare function useDeleteRuleMutation(options?: Omit<UseMutationOptions<DeleteRuleOKResponse<unknown>, DeleteRuleErrorResponse<unknown>, DeleteRuleProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<ResponseWithPagination<unknown>, UsererrorError, DeleteRuleProps, unknown>;
|
|
@@ -3,12 +3,28 @@
|
|
|
3
3
|
// Please do not modify this code directly.
|
|
4
4
|
import { useMutation } from '@tanstack/react-query';
|
|
5
5
|
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
function isProjectPathParams(pathParams) {
|
|
7
|
+
return !!(pathParams.org &&
|
|
8
|
+
pathParams.project);
|
|
9
|
+
}
|
|
10
|
+
function isOrgPathParams(pathParams) {
|
|
11
|
+
return !!(pathParams.org &&
|
|
12
|
+
!pathParams.project);
|
|
13
|
+
}
|
|
6
14
|
export function deleteRule(props) {
|
|
7
|
-
|
|
15
|
+
let url = `/api/v1/rules/${props.pathParams.rule_id}`;
|
|
16
|
+
let method = 'DELETE';
|
|
17
|
+
if (isProjectPathParams(props.pathParams)) {
|
|
18
|
+
url = `/api/v1/orgs/${props.pathParams.org}/projects/${props.pathParams.project}/rules/${props.pathParams.rule_id}`;
|
|
19
|
+
method = 'DELETE';
|
|
20
|
+
}
|
|
21
|
+
else if (isOrgPathParams(props.pathParams)) {
|
|
22
|
+
url = `/api/v1/orgs/${props.pathParams.org}/rules/${props.pathParams.rule_id}`;
|
|
23
|
+
method = 'DELETE';
|
|
24
|
+
}
|
|
25
|
+
return fetcher(Object.assign({ url,
|
|
26
|
+
method }, props));
|
|
8
27
|
}
|
|
9
|
-
/**
|
|
10
|
-
* Delete a rule
|
|
11
|
-
*/
|
|
12
28
|
export function useDeleteRuleMutation(options) {
|
|
13
29
|
return useMutation((mutateProps) => deleteRule(mutateProps), options);
|
|
14
30
|
}
|
|
@@ -1,20 +1,39 @@
|
|
|
1
1
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
2
|
import type { TypesRule } from '../schemas/TypesRule';
|
|
3
3
|
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
|
-
import type { ResponseWithPagination } from '../helpers';
|
|
4
|
+
import type { GetPathParamsType, ResponseWithPagination } from '../helpers';
|
|
5
5
|
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
6
|
-
export interface
|
|
6
|
+
export interface GetRuleAccountPathParams {
|
|
7
7
|
rule_id: string;
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
9
|
+
export interface GetRuleAccountHeaderParams {
|
|
10
10
|
'harness-account': string;
|
|
11
11
|
}
|
|
12
|
-
export type
|
|
13
|
-
export type
|
|
14
|
-
export interface
|
|
12
|
+
export type GetRuleAccountOKResponse = TypesRule;
|
|
13
|
+
export type GetRuleAccountErrorResponse = UsererrorError;
|
|
14
|
+
export interface GetRuleOrgPathParams {
|
|
15
|
+
org: string;
|
|
16
|
+
rule_id: string;
|
|
17
|
+
}
|
|
18
|
+
export interface GetRuleOrgHeaderParams {
|
|
19
|
+
'harness-account': string;
|
|
20
|
+
}
|
|
21
|
+
export type GetRuleOrgOKResponse = TypesRule;
|
|
22
|
+
export type GetRuleOrgErrorResponse = UsererrorError;
|
|
23
|
+
export interface GetRuleProjectPathParams {
|
|
24
|
+
org: string;
|
|
25
|
+
project: string;
|
|
26
|
+
rule_id: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GetRuleProjectHeaderParams {
|
|
29
|
+
'harness-account': string;
|
|
30
|
+
}
|
|
31
|
+
export type GetRuleProjectOKResponse = TypesRule;
|
|
32
|
+
export type GetRuleProjectErrorResponse = UsererrorError;
|
|
33
|
+
export type GetRuleOKResponse<T> = T extends GetRuleProjectPathParams ? ResponseWithPagination<GetRuleProjectOKResponse> : T extends GetRuleOrgPathParams ? ResponseWithPagination<GetRuleOrgOKResponse> : ResponseWithPagination<GetRuleAccountOKResponse>;
|
|
34
|
+
export type GetRuleErrorResponse<T> = T extends GetRuleProjectPathParams ? GetRuleProjectErrorResponse : T extends GetRuleOrgPathParams ? GetRuleOrgErrorResponse : GetRuleAccountErrorResponse;
|
|
35
|
+
export interface GetRuleProps extends Omit<FetcherOptions<unknown, unknown>, 'url'> {
|
|
36
|
+
pathParams: GetRuleAccountPathParams | GetRuleOrgPathParams | GetRuleProjectPathParams;
|
|
15
37
|
}
|
|
16
|
-
export declare function getRule(props:
|
|
17
|
-
|
|
18
|
-
* Get a rule by ID
|
|
19
|
-
*/
|
|
20
|
-
export declare function useGetRuleQuery(props: GetRuleProps, options?: Omit<UseQueryOptions<GetRuleOkResponse, GetRuleErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetRuleOkResponse, UsererrorError>;
|
|
38
|
+
export declare function getRule<T extends GetRuleProps = GetRuleProps>(props: T): Promise<GetRuleOKResponse<GetPathParamsType<T>>>;
|
|
39
|
+
export declare function useGetRuleQuery<T extends GetRuleProps = GetRuleProps>(props: T, options?: Omit<UseQueryOptions<GetRuleOKResponse<GetPathParamsType<T>>, GetRuleErrorResponse<GetPathParamsType<T>>>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetRuleOKResponse<GetPathParamsType<T>>, GetRuleErrorResponse<GetPathParamsType<T>>>;
|
|
@@ -3,12 +3,26 @@
|
|
|
3
3
|
// Please do not modify this code directly.
|
|
4
4
|
import { useQuery } from '@tanstack/react-query';
|
|
5
5
|
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
function isProjectPathParams(pathParams) {
|
|
7
|
+
return !!(pathParams.org && pathParams.project);
|
|
8
|
+
}
|
|
9
|
+
function isOrgPathParams(pathParams) {
|
|
10
|
+
return !!(pathParams.org && !pathParams.project);
|
|
11
|
+
}
|
|
6
12
|
export function getRule(props) {
|
|
7
|
-
|
|
13
|
+
let url = `/api/v1/rules/${props.pathParams.rule_id}`;
|
|
14
|
+
let method = 'GET';
|
|
15
|
+
if (isProjectPathParams(props.pathParams)) {
|
|
16
|
+
url = `/api/v1/orgs/${props.pathParams.org}/projects/${props.pathParams.project}/rules/${props.pathParams.rule_id}`;
|
|
17
|
+
method = 'GET';
|
|
18
|
+
}
|
|
19
|
+
else if (isOrgPathParams(props.pathParams)) {
|
|
20
|
+
url = `/api/v1/orgs/${props.pathParams.org}/rules/${props.pathParams.rule_id}`;
|
|
21
|
+
method = 'GET';
|
|
22
|
+
}
|
|
23
|
+
return fetcher(Object.assign({ url,
|
|
24
|
+
method }, props));
|
|
8
25
|
}
|
|
9
|
-
/**
|
|
10
|
-
* Get a rule by ID
|
|
11
|
-
*/
|
|
12
26
|
export function useGetRuleQuery(props, options) {
|
|
13
|
-
return useQuery(['getRule'
|
|
27
|
+
return useQuery(['getRule'], ({ signal }) => getRule(Object.assign(Object.assign({}, props), { signal })), options);
|
|
14
28
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { TypesSettingValueResponse } from '../schemas/TypesSettingValueResponse';
|
|
3
|
+
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
5
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
6
|
+
export interface GetUserSettingQueryPathParams {
|
|
7
|
+
identifier: string;
|
|
8
|
+
}
|
|
9
|
+
export interface GetUserSettingQueryHeaderParams {
|
|
10
|
+
'harness-account': string;
|
|
11
|
+
}
|
|
12
|
+
export type GetUserSettingOkResponse = ResponseWithPagination<TypesSettingValueResponse>;
|
|
13
|
+
export type GetUserSettingErrorResponse = UsererrorError;
|
|
14
|
+
export interface GetUserSettingProps extends GetUserSettingQueryPathParams, Omit<FetcherOptions<unknown, unknown, GetUserSettingQueryHeaderParams>, 'url'> {
|
|
15
|
+
}
|
|
16
|
+
export declare function getUserSetting(props: GetUserSettingProps): Promise<GetUserSettingOkResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves a specific user setting by identifier
|
|
19
|
+
*/
|
|
20
|
+
export declare function useGetUserSettingQuery(props: GetUserSettingProps, options?: Omit<UseQueryOptions<GetUserSettingOkResponse, GetUserSettingErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetUserSettingOkResponse, UsererrorError>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// This code is autogenerated using @harnessio/oats-cli.
|
|
3
|
+
// Please do not modify this code directly.
|
|
4
|
+
import { useQuery } from '@tanstack/react-query';
|
|
5
|
+
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
export function getUserSetting(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/user-settings/${props.identifier}`, method: 'GET' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves a specific user setting by identifier
|
|
11
|
+
*/
|
|
12
|
+
export function useGetUserSettingQuery(props, options) {
|
|
13
|
+
return useQuery(['getUserSetting', props.identifier], ({ signal }) => getUserSetting(Object.assign(Object.assign({}, props), { signal })), options);
|
|
14
|
+
}
|
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
2
|
import type { TypesRule } from '../schemas/TypesRule';
|
|
3
3
|
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
|
-
import type { ResponseWithPagination } from '../helpers';
|
|
4
|
+
import type { GetPathParamsType, ResponseWithPagination } from '../helpers';
|
|
5
5
|
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
6
|
-
export interface
|
|
6
|
+
export interface ListRulesAccountPathParams {
|
|
7
|
+
}
|
|
8
|
+
export interface ListRulesAccountQueryParams {
|
|
9
|
+
category?: string;
|
|
10
|
+
scope?: string;
|
|
11
|
+
status?: string;
|
|
12
|
+
source?: string;
|
|
13
|
+
page?: string;
|
|
14
|
+
limit?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ListRulesAccountHeaderParams {
|
|
17
|
+
'harness-account': string;
|
|
18
|
+
}
|
|
19
|
+
export type ListRulesAccountOKResponse = TypesRule[];
|
|
20
|
+
export type ListRulesAccountErrorResponse = UsererrorError;
|
|
21
|
+
export interface ListRulesOrgPathParams {
|
|
22
|
+
org: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ListRulesOrgQueryParams {
|
|
25
|
+
category?: string;
|
|
26
|
+
scope?: string;
|
|
27
|
+
status?: string;
|
|
28
|
+
source?: string;
|
|
29
|
+
page?: string;
|
|
30
|
+
limit?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ListRulesOrgHeaderParams {
|
|
33
|
+
'harness-account': string;
|
|
34
|
+
}
|
|
35
|
+
export type ListRulesOrgOKResponse = TypesRule[];
|
|
36
|
+
export type ListRulesOrgErrorResponse = UsererrorError;
|
|
37
|
+
export interface ListRulesProjectPathParams {
|
|
38
|
+
org: string;
|
|
39
|
+
project: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ListRulesProjectQueryParams {
|
|
7
42
|
category?: string;
|
|
8
43
|
scope?: string;
|
|
9
44
|
status?: string;
|
|
@@ -11,16 +46,15 @@ export interface ListRulesQueryQueryParams {
|
|
|
11
46
|
page?: string;
|
|
12
47
|
limit?: string;
|
|
13
48
|
}
|
|
14
|
-
export interface
|
|
49
|
+
export interface ListRulesProjectHeaderParams {
|
|
15
50
|
'harness-account': string;
|
|
16
51
|
}
|
|
17
|
-
export type
|
|
18
|
-
export type
|
|
19
|
-
export
|
|
20
|
-
|
|
52
|
+
export type ListRulesProjectOKResponse = TypesRule[];
|
|
53
|
+
export type ListRulesProjectErrorResponse = UsererrorError;
|
|
54
|
+
export type ListRulesOKResponse<T> = T extends ListRulesProjectPathParams ? ResponseWithPagination<ListRulesProjectOKResponse> : T extends ListRulesOrgPathParams ? ResponseWithPagination<ListRulesOrgOKResponse> : ResponseWithPagination<ListRulesAccountOKResponse>;
|
|
55
|
+
export type ListRulesErrorResponse<T> = T extends ListRulesProjectPathParams ? ListRulesProjectErrorResponse : T extends ListRulesOrgPathParams ? ListRulesOrgErrorResponse : ListRulesAccountErrorResponse;
|
|
56
|
+
export interface ListRulesProps extends Omit<FetcherOptions<unknown, unknown>, 'url'> {
|
|
57
|
+
pathParams: ListRulesAccountPathParams | ListRulesOrgPathParams | ListRulesProjectPathParams;
|
|
21
58
|
}
|
|
22
|
-
export declare function listRules(props:
|
|
23
|
-
|
|
24
|
-
* List rules based on filters
|
|
25
|
-
*/
|
|
26
|
-
export declare function useListRulesQuery(props: ListRulesProps, options?: Omit<UseQueryOptions<ListRulesOkResponse, ListRulesErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ListRulesOkResponse, UsererrorError>;
|
|
59
|
+
export declare function listRules<T extends ListRulesProps = ListRulesProps>(props: T): Promise<ListRulesOKResponse<GetPathParamsType<T>>>;
|
|
60
|
+
export declare function useListRulesQuery<T extends ListRulesProps = ListRulesProps>(props: T, options?: Omit<UseQueryOptions<ListRulesOKResponse<GetPathParamsType<T>>, ListRulesErrorResponse<GetPathParamsType<T>>>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ListRulesOKResponse<GetPathParamsType<T>>, ListRulesErrorResponse<GetPathParamsType<T>>>;
|
|
@@ -3,12 +3,28 @@
|
|
|
3
3
|
// Please do not modify this code directly.
|
|
4
4
|
import { useQuery } from '@tanstack/react-query';
|
|
5
5
|
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
function isProjectPathParams(pathParams) {
|
|
7
|
+
return !!(pathParams.org &&
|
|
8
|
+
pathParams.project);
|
|
9
|
+
}
|
|
10
|
+
function isOrgPathParams(pathParams) {
|
|
11
|
+
return !!(pathParams.org &&
|
|
12
|
+
!pathParams.project);
|
|
13
|
+
}
|
|
6
14
|
export function listRules(props) {
|
|
7
|
-
|
|
15
|
+
let url = `/api/v1/rules`;
|
|
16
|
+
let method = 'GET';
|
|
17
|
+
if (isProjectPathParams(props.pathParams)) {
|
|
18
|
+
url = `/api/v1/orgs/${props.pathParams.org}/projects/${props.pathParams.project}/rules`;
|
|
19
|
+
method = 'GET';
|
|
20
|
+
}
|
|
21
|
+
else if (isOrgPathParams(props.pathParams)) {
|
|
22
|
+
url = `/api/v1/orgs/${props.pathParams.org}/rules`;
|
|
23
|
+
method = 'GET';
|
|
24
|
+
}
|
|
25
|
+
return fetcher(Object.assign({ url,
|
|
26
|
+
method }, props));
|
|
8
27
|
}
|
|
9
|
-
/**
|
|
10
|
-
* List rules based on filters
|
|
11
|
-
*/
|
|
12
28
|
export function useListRulesQuery(props, options) {
|
|
13
29
|
return useQuery(['listRules', props.queryParams], ({ signal }) => listRules(Object.assign(Object.assign({}, props), { signal })), options);
|
|
14
30
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { TypesUserSettingResponse } from '../schemas/TypesUserSettingResponse';
|
|
3
|
+
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
5
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
6
|
+
export interface ListUserSettingsQueryHeaderParams {
|
|
7
|
+
'harness-account': string;
|
|
8
|
+
}
|
|
9
|
+
export type ListUserSettingsOkResponse = ResponseWithPagination<TypesUserSettingResponse[]>;
|
|
10
|
+
export type ListUserSettingsErrorResponse = UsererrorError;
|
|
11
|
+
export interface ListUserSettingsProps extends Omit<FetcherOptions<unknown, unknown, ListUserSettingsQueryHeaderParams>, 'url'> {
|
|
12
|
+
}
|
|
13
|
+
export declare function listUserSettings(props: ListUserSettingsProps): Promise<ListUserSettingsOkResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Returns all user settings for the authenticated user
|
|
16
|
+
*/
|
|
17
|
+
export declare function useListUserSettingsQuery(props: ListUserSettingsProps, options?: Omit<UseQueryOptions<ListUserSettingsOkResponse, ListUserSettingsErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<ListUserSettingsOkResponse, UsererrorError>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// This code is autogenerated using @harnessio/oats-cli.
|
|
3
|
+
// Please do not modify this code directly.
|
|
4
|
+
import { useQuery } from '@tanstack/react-query';
|
|
5
|
+
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
export function listUserSettings(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/user-settings`, method: 'GET' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns all user settings for the authenticated user
|
|
11
|
+
*/
|
|
12
|
+
export function useListUserSettingsQuery(props, options) {
|
|
13
|
+
return useQuery(['listUserSettings'], ({ signal }) => listUserSettings(Object.assign(Object.assign({}, props), { signal })), options);
|
|
14
|
+
}
|
|
@@ -2,22 +2,42 @@ import { UseMutationOptions } from '@tanstack/react-query';
|
|
|
2
2
|
import type { TypesRule } from '../schemas/TypesRule';
|
|
3
3
|
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
4
|
import type { ControllerRuleInput } from '../schemas/ControllerRuleInput';
|
|
5
|
-
import type { ResponseWithPagination } from '../helpers';
|
|
5
|
+
import type { GetPathParamsType, ResponseWithPagination } from '../helpers';
|
|
6
6
|
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
7
|
-
export interface
|
|
7
|
+
export interface UpdateRuleAccountPathParams {
|
|
8
8
|
rule_id: string;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface UpdateRuleAccountHeaderParams {
|
|
11
11
|
'harness-account': string;
|
|
12
12
|
}
|
|
13
|
-
export type
|
|
14
|
-
export type
|
|
15
|
-
export type
|
|
16
|
-
export interface
|
|
17
|
-
|
|
13
|
+
export type UpdateRuleAccountRequestBody = ControllerRuleInput;
|
|
14
|
+
export type UpdateRuleAccountOKResponse = TypesRule;
|
|
15
|
+
export type UpdateRuleAccountErrorResponse = UsererrorError;
|
|
16
|
+
export interface UpdateRuleOrgPathParams {
|
|
17
|
+
org: string;
|
|
18
|
+
rule_id: string;
|
|
19
|
+
}
|
|
20
|
+
export interface UpdateRuleOrgHeaderParams {
|
|
21
|
+
'harness-account': string;
|
|
22
|
+
}
|
|
23
|
+
export type UpdateRuleOrgRequestBody = ControllerRuleInput;
|
|
24
|
+
export type UpdateRuleOrgOKResponse = TypesRule;
|
|
25
|
+
export type UpdateRuleOrgErrorResponse = UsererrorError;
|
|
26
|
+
export interface UpdateRuleProjectPathParams {
|
|
27
|
+
org: string;
|
|
28
|
+
project: string;
|
|
29
|
+
rule_id: string;
|
|
30
|
+
}
|
|
31
|
+
export interface UpdateRuleProjectHeaderParams {
|
|
32
|
+
'harness-account': string;
|
|
33
|
+
}
|
|
34
|
+
export type UpdateRuleProjectRequestBody = ControllerRuleInput;
|
|
35
|
+
export type UpdateRuleProjectOKResponse = TypesRule;
|
|
36
|
+
export type UpdateRuleProjectErrorResponse = UsererrorError;
|
|
37
|
+
export type UpdateRuleOKResponse<T> = T extends UpdateRuleProjectPathParams ? ResponseWithPagination<UpdateRuleProjectOKResponse> : T extends UpdateRuleOrgPathParams ? ResponseWithPagination<UpdateRuleOrgOKResponse> : ResponseWithPagination<UpdateRuleAccountOKResponse>;
|
|
38
|
+
export type UpdateRuleErrorResponse<T> = T extends UpdateRuleProjectPathParams ? UpdateRuleProjectErrorResponse : T extends UpdateRuleOrgPathParams ? UpdateRuleOrgErrorResponse : UpdateRuleAccountErrorResponse;
|
|
39
|
+
export interface UpdateRuleProps extends Omit<FetcherOptions<unknown, unknown>, 'url'> {
|
|
40
|
+
pathParams: UpdateRuleAccountPathParams | UpdateRuleOrgPathParams | UpdateRuleProjectPathParams;
|
|
18
41
|
}
|
|
19
|
-
export declare function updateRule(props:
|
|
20
|
-
|
|
21
|
-
* Update an existing rule
|
|
22
|
-
*/
|
|
23
|
-
export declare function useUpdateRuleMutation(options?: Omit<UseMutationOptions<UpdateRuleOkResponse, UpdateRuleErrorResponse, UpdateRuleProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<UpdateRuleOkResponse, UsererrorError, UpdateRuleProps, unknown>;
|
|
42
|
+
export declare function updateRule<T extends UpdateRuleProps = UpdateRuleProps>(props: T): Promise<UpdateRuleOKResponse<GetPathParamsType<T>>>;
|
|
43
|
+
export declare function useUpdateRuleMutation(options?: Omit<UseMutationOptions<UpdateRuleOKResponse<unknown>, UpdateRuleErrorResponse<unknown>, UpdateRuleProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<ResponseWithPagination<TypesRule>, UsererrorError, UpdateRuleProps, unknown>;
|
|
@@ -3,12 +3,28 @@
|
|
|
3
3
|
// Please do not modify this code directly.
|
|
4
4
|
import { useMutation } from '@tanstack/react-query';
|
|
5
5
|
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
function isProjectPathParams(pathParams) {
|
|
7
|
+
return !!(pathParams.org &&
|
|
8
|
+
pathParams.project);
|
|
9
|
+
}
|
|
10
|
+
function isOrgPathParams(pathParams) {
|
|
11
|
+
return !!(pathParams.org &&
|
|
12
|
+
!pathParams.project);
|
|
13
|
+
}
|
|
6
14
|
export function updateRule(props) {
|
|
7
|
-
|
|
15
|
+
let url = `/api/v1/rules/${props.pathParams.rule_id}`;
|
|
16
|
+
let method = 'PUT';
|
|
17
|
+
if (isProjectPathParams(props.pathParams)) {
|
|
18
|
+
url = `/api/v1/orgs/${props.pathParams.org}/projects/${props.pathParams.project}/rules/${props.pathParams.rule_id}`;
|
|
19
|
+
method = 'PUT';
|
|
20
|
+
}
|
|
21
|
+
else if (isOrgPathParams(props.pathParams)) {
|
|
22
|
+
url = `/api/v1/orgs/${props.pathParams.org}/rules/${props.pathParams.rule_id}`;
|
|
23
|
+
method = 'PUT';
|
|
24
|
+
}
|
|
25
|
+
return fetcher(Object.assign({ url,
|
|
26
|
+
method }, props));
|
|
8
27
|
}
|
|
9
|
-
/**
|
|
10
|
-
* Update an existing rule
|
|
11
|
-
*/
|
|
12
28
|
export function useUpdateRuleMutation(options) {
|
|
13
29
|
return useMutation((mutateProps) => updateRule(mutateProps), options);
|
|
14
30
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UseMutationOptions } from '@tanstack/react-query';
|
|
2
|
+
import type { TypesUserSettingUpdateResponse } from '../schemas/TypesUserSettingUpdateResponse';
|
|
3
|
+
import type { UsererrorError } from '../schemas/UsererrorError';
|
|
4
|
+
import type { TypesUserSettingRequest } from '../schemas/TypesUserSettingRequest';
|
|
5
|
+
import type { ResponseWithPagination } from '../helpers';
|
|
6
|
+
import { FetcherOptions } from '../../../../fetcher/index.js';
|
|
7
|
+
export interface UpdateUserSettingsMutationHeaderParams {
|
|
8
|
+
'harness-account': string;
|
|
9
|
+
}
|
|
10
|
+
export type UpdateUserSettingsRequestBody = TypesUserSettingRequest[];
|
|
11
|
+
export type UpdateUserSettingsOkResponse = ResponseWithPagination<TypesUserSettingUpdateResponse[]>;
|
|
12
|
+
export type UpdateUserSettingsErrorResponse = UsererrorError;
|
|
13
|
+
export interface UpdateUserSettingsProps extends Omit<FetcherOptions<unknown, UpdateUserSettingsRequestBody, UpdateUserSettingsMutationHeaderParams>, 'url'> {
|
|
14
|
+
body: UpdateUserSettingsRequestBody;
|
|
15
|
+
}
|
|
16
|
+
export declare function updateUserSettings(props: UpdateUserSettingsProps): Promise<UpdateUserSettingsOkResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Updates one or more user settings for the authenticated user
|
|
19
|
+
*/
|
|
20
|
+
export declare function useUpdateUserSettingsMutation(options?: Omit<UseMutationOptions<UpdateUserSettingsOkResponse, UpdateUserSettingsErrorResponse, UpdateUserSettingsProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<UpdateUserSettingsOkResponse, UsererrorError, UpdateUserSettingsProps, unknown>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// This code is autogenerated using @harnessio/oats-cli.
|
|
3
|
+
// Please do not modify this code directly.
|
|
4
|
+
import { useMutation } from '@tanstack/react-query';
|
|
5
|
+
import { fetcher } from '../../../../fetcher/index.js';
|
|
6
|
+
export function updateUserSettings(props) {
|
|
7
|
+
return fetcher(Object.assign({ url: `/api/v1/user-settings`, method: 'PUT' }, props));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Updates one or more user settings for the authenticated user
|
|
11
|
+
*/
|
|
12
|
+
export function useUpdateUserSettingsMutation(options) {
|
|
13
|
+
return useMutation((mutateProps) => updateUserSettings(mutateProps), options);
|
|
14
|
+
}
|