@harnessio/react-intelligence-service-client 0.13.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.
Files changed (50) hide show
  1. package/dist/intelligence-service/src/services/hooks/useCreateRuleMutation.d.ts +40 -0
  2. package/dist/intelligence-service/src/services/hooks/useCreateRuleMutation.js +30 -0
  3. package/dist/intelligence-service/src/services/hooks/useDeleteRuleMutation.d.ts +30 -11
  4. package/dist/intelligence-service/src/services/hooks/useDeleteRuleMutation.js +20 -4
  5. package/dist/intelligence-service/src/services/hooks/useGetRuleQuery.d.ts +30 -11
  6. package/dist/intelligence-service/src/services/hooks/useGetRuleQuery.js +19 -5
  7. package/dist/intelligence-service/src/services/hooks/useGetUserSettingQuery.d.ts +20 -0
  8. package/dist/intelligence-service/src/services/hooks/useGetUserSettingQuery.js +14 -0
  9. package/dist/intelligence-service/src/services/hooks/useListChatSessionsQuery.d.ts +1 -0
  10. package/dist/intelligence-service/src/services/hooks/useListRulesQuery.d.ts +46 -12
  11. package/dist/intelligence-service/src/services/hooks/useListRulesQuery.js +20 -4
  12. package/dist/intelligence-service/src/services/hooks/useListUserSettingsQuery.d.ts +17 -0
  13. package/dist/intelligence-service/src/services/hooks/useListUserSettingsQuery.js +14 -0
  14. package/dist/intelligence-service/src/services/hooks/useUpdateRuleMutation.d.ts +33 -13
  15. package/dist/intelligence-service/src/services/hooks/useUpdateRuleMutation.js +20 -4
  16. package/dist/intelligence-service/src/services/hooks/useUpdateUserSettingsMutation.d.ts +20 -0
  17. package/dist/intelligence-service/src/services/hooks/useUpdateUserSettingsMutation.js +14 -0
  18. package/dist/intelligence-service/src/services/index.d.ts +16 -26
  19. package/dist/intelligence-service/src/services/index.js +4 -11
  20. package/dist/intelligence-service/src/services/schemas/TypesSettingValueResponse.d.ts +4 -0
  21. package/dist/intelligence-service/src/services/schemas/TypesSettingValueResponse.js +4 -0
  22. package/dist/intelligence-service/src/services/schemas/TypesUserSettingRequest.d.ts +6 -0
  23. package/dist/intelligence-service/src/services/schemas/TypesUserSettingRequest.js +4 -0
  24. package/dist/intelligence-service/src/services/schemas/TypesUserSettingResponse.d.ts +8 -0
  25. package/dist/intelligence-service/src/services/schemas/TypesUserSettingResponse.js +4 -0
  26. package/dist/intelligence-service/src/services/schemas/TypesUserSettingUpdateResponse.d.ts +5 -0
  27. package/dist/intelligence-service/src/services/schemas/TypesUserSettingUpdateResponse.js +4 -0
  28. package/package.json +1 -1
  29. package/dist/intelligence-service/src/services/hooks/useCreateAccountRuleMutation.d.ts +0 -20
  30. package/dist/intelligence-service/src/services/hooks/useCreateAccountRuleMutation.js +0 -14
  31. package/dist/intelligence-service/src/services/hooks/useCreateOrgRuleMutation.d.ts +0 -23
  32. package/dist/intelligence-service/src/services/hooks/useCreateOrgRuleMutation.js +0 -14
  33. package/dist/intelligence-service/src/services/hooks/useCreateProjectRuleMutation.d.ts +0 -24
  34. package/dist/intelligence-service/src/services/hooks/useCreateProjectRuleMutation.js +0 -14
  35. package/dist/intelligence-service/src/services/hooks/useDeleteOrgRuleMutation.d.ts +0 -20
  36. package/dist/intelligence-service/src/services/hooks/useDeleteOrgRuleMutation.js +0 -14
  37. package/dist/intelligence-service/src/services/hooks/useDeleteProjectRuleMutation.d.ts +0 -21
  38. package/dist/intelligence-service/src/services/hooks/useDeleteProjectRuleMutation.js +0 -14
  39. package/dist/intelligence-service/src/services/hooks/useGetOrgRuleQuery.d.ts +0 -21
  40. package/dist/intelligence-service/src/services/hooks/useGetOrgRuleQuery.js +0 -14
  41. package/dist/intelligence-service/src/services/hooks/useGetProjectRuleQuery.d.ts +0 -22
  42. package/dist/intelligence-service/src/services/hooks/useGetProjectRuleQuery.js +0 -14
  43. package/dist/intelligence-service/src/services/hooks/useListOrgRulesQuery.d.ts +0 -29
  44. package/dist/intelligence-service/src/services/hooks/useListOrgRulesQuery.js +0 -14
  45. package/dist/intelligence-service/src/services/hooks/useListProjectRulesQuery.d.ts +0 -30
  46. package/dist/intelligence-service/src/services/hooks/useListProjectRulesQuery.js +0 -14
  47. package/dist/intelligence-service/src/services/hooks/useUpdateOrgRuleMutation.d.ts +0 -24
  48. package/dist/intelligence-service/src/services/hooks/useUpdateOrgRuleMutation.js +0 -14
  49. package/dist/intelligence-service/src/services/hooks/useUpdateProjectRuleMutation.d.ts +0 -25
  50. 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 DeleteRuleMutationPathParams {
5
+ export interface DeleteRuleAccountPathParams {
6
6
  rule_id: string;
7
7
  }
8
- export interface DeleteRuleMutationHeaderParams {
8
+ export interface DeleteRuleAccountHeaderParams {
9
9
  'harness-account': string;
10
10
  }
11
- export type DeleteRuleOkResponse = ResponseWithPagination<unknown>;
12
- export type DeleteRuleErrorResponse = UsererrorError;
13
- export interface DeleteRuleProps extends DeleteRuleMutationPathParams, Omit<FetcherOptions<unknown, unknown, DeleteRuleMutationHeaderParams>, 'url'> {
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: DeleteRuleProps): Promise<DeleteRuleOkResponse>;
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
- return fetcher(Object.assign({ url: `/api/v1/rules/${props.rule_id}`, method: 'DELETE' }, props));
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 GetRuleQueryPathParams {
6
+ export interface GetRuleAccountPathParams {
7
7
  rule_id: string;
8
8
  }
9
- export interface GetRuleQueryHeaderParams {
9
+ export interface GetRuleAccountHeaderParams {
10
10
  'harness-account': string;
11
11
  }
12
- export type GetRuleOkResponse = ResponseWithPagination<TypesRule>;
13
- export type GetRuleErrorResponse = UsererrorError;
14
- export interface GetRuleProps extends GetRuleQueryPathParams, Omit<FetcherOptions<unknown, unknown, GetRuleQueryHeaderParams>, 'url'> {
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: GetRuleProps): Promise<GetRuleOkResponse>;
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
- return fetcher(Object.assign({ url: `/api/v1/rules/${props.rule_id}`, method: 'GET' }, props));
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', props.rule_id], ({ signal }) => getRule(Object.assign(Object.assign({}, props), { signal })), options);
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
+ }
@@ -15,6 +15,7 @@ export interface ListChatSessionsQueryQueryParams {
15
15
  * @default 20
16
16
  */
17
17
  size?: number;
18
+ includev2messages?: boolean;
18
19
  }
19
20
  export interface ListChatSessionsQueryHeaderParams {
20
21
  'harness-account': string;
@@ -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 ListRulesQueryQueryParams {
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 ListRulesQueryHeaderParams {
49
+ export interface ListRulesProjectHeaderParams {
15
50
  'harness-account': string;
16
51
  }
17
- export type ListRulesOkResponse = ResponseWithPagination<TypesRule[]>;
18
- export type ListRulesErrorResponse = UsererrorError;
19
- export interface ListRulesProps extends Omit<FetcherOptions<ListRulesQueryQueryParams, unknown, ListRulesQueryHeaderParams>, 'url'> {
20
- queryParams: ListRulesQueryQueryParams;
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: ListRulesProps): Promise<ListRulesOkResponse>;
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
- return fetcher(Object.assign({ url: `/api/v1/rules`, method: 'GET' }, props));
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 UpdateRuleMutationPathParams {
7
+ export interface UpdateRuleAccountPathParams {
8
8
  rule_id: string;
9
9
  }
10
- export interface UpdateRuleMutationHeaderParams {
10
+ export interface UpdateRuleAccountHeaderParams {
11
11
  'harness-account': string;
12
12
  }
13
- export type UpdateRuleRequestBody = ControllerRuleInput;
14
- export type UpdateRuleOkResponse = ResponseWithPagination<TypesRule>;
15
- export type UpdateRuleErrorResponse = UsererrorError;
16
- export interface UpdateRuleProps extends UpdateRuleMutationPathParams, Omit<FetcherOptions<unknown, UpdateRuleRequestBody, UpdateRuleMutationHeaderParams>, 'url'> {
17
- body: UpdateRuleRequestBody;
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: UpdateRuleProps): Promise<UpdateRuleOkResponse>;
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
- return fetcher(Object.assign({ url: `/api/v1/rules/${props.rule_id}`, method: 'PUT' }, props));
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
+ }