@harnessio/react-har-service-client 0.0.2

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 (110) hide show
  1. package/README.md +39 -0
  2. package/dist/fetcher/index.d.ts +17 -0
  3. package/dist/fetcher/index.js +65 -0
  4. package/dist/har-service/src/index.d.ts +6 -0
  5. package/dist/har-service/src/index.js +10 -0
  6. package/dist/har-service/src/services/helpers.d.ts +14 -0
  7. package/dist/har-service/src/services/helpers.js +1 -0
  8. package/dist/har-service/src/services/hooks/useCreateRepositoryMutation.d.ts +27 -0
  9. package/dist/har-service/src/services/hooks/useCreateRepositoryMutation.js +14 -0
  10. package/dist/har-service/src/services/hooks/useCreateUpstreamProxyMutation.d.ts +27 -0
  11. package/dist/har-service/src/services/hooks/useCreateUpstreamProxyMutation.js +14 -0
  12. package/dist/har-service/src/services/hooks/useDeleteRepositoryMutation.d.ts +28 -0
  13. package/dist/har-service/src/services/hooks/useDeleteRepositoryMutation.js +14 -0
  14. package/dist/har-service/src/services/hooks/useDeleteUpstreamProxyMutation.d.ts +28 -0
  15. package/dist/har-service/src/services/hooks/useDeleteUpstreamProxyMutation.js +14 -0
  16. package/dist/har-service/src/services/hooks/useGetAllArtifactsForRepositoryQuery.d.ts +32 -0
  17. package/dist/har-service/src/services/hooks/useGetAllArtifactsForRepositoryQuery.js +14 -0
  18. package/dist/har-service/src/services/hooks/useGetAllArtifactsQuery.d.ts +29 -0
  19. package/dist/har-service/src/services/hooks/useGetAllArtifactsQuery.js +14 -0
  20. package/dist/har-service/src/services/hooks/useGetAllRepositoriesQuery.d.ts +29 -0
  21. package/dist/har-service/src/services/hooks/useGetAllRepositoriesQuery.js +14 -0
  22. package/dist/har-service/src/services/hooks/useGetAllUpstreamProxiesQuery.d.ts +29 -0
  23. package/dist/har-service/src/services/hooks/useGetAllUpstreamProxiesQuery.js +14 -0
  24. package/dist/har-service/src/services/hooks/useGetAllVersionsForArtifactQuery.d.ts +27 -0
  25. package/dist/har-service/src/services/hooks/useGetAllVersionsForArtifactQuery.js +14 -0
  26. package/dist/har-service/src/services/hooks/useGetRepositoryQuery.d.ts +28 -0
  27. package/dist/har-service/src/services/hooks/useGetRepositoryQuery.js +14 -0
  28. package/dist/har-service/src/services/hooks/useGetUpstreamProxyQuery.d.ts +28 -0
  29. package/dist/har-service/src/services/hooks/useGetUpstreamProxyQuery.js +14 -0
  30. package/dist/har-service/src/services/hooks/useModifyRepositoryMutation.d.ts +32 -0
  31. package/dist/har-service/src/services/hooks/useModifyRepositoryMutation.js +14 -0
  32. package/dist/har-service/src/services/hooks/useModifyUpstreamProxyMutation.d.ts +32 -0
  33. package/dist/har-service/src/services/hooks/useModifyUpstreamProxyMutation.js +14 -0
  34. package/dist/har-service/src/services/index.d.ts +64 -0
  35. package/dist/har-service/src/services/index.js +13 -0
  36. package/dist/har-service/src/services/requestBodies/RepositoryRequestRequestBody.d.ts +2 -0
  37. package/dist/har-service/src/services/requestBodies/RepositoryRequestRequestBody.js +1 -0
  38. package/dist/har-service/src/services/requestBodies/UpstreamProxyRequestRequestBody.d.ts +2 -0
  39. package/dist/har-service/src/services/requestBodies/UpstreamProxyRequestRequestBody.js +1 -0
  40. package/dist/har-service/src/services/responses/BadRequestResponse.d.ts +2 -0
  41. package/dist/har-service/src/services/responses/BadRequestResponse.js +1 -0
  42. package/dist/har-service/src/services/responses/InternalServerErrorResponse.d.ts +2 -0
  43. package/dist/har-service/src/services/responses/InternalServerErrorResponse.js +1 -0
  44. package/dist/har-service/src/services/responses/ListArtifactResponseResponse.d.ts +6 -0
  45. package/dist/har-service/src/services/responses/ListArtifactResponseResponse.js +1 -0
  46. package/dist/har-service/src/services/responses/ListArtifactVersionResponseResponse.d.ts +6 -0
  47. package/dist/har-service/src/services/responses/ListArtifactVersionResponseResponse.js +1 -0
  48. package/dist/har-service/src/services/responses/ListRepositoryResponseResponse.d.ts +6 -0
  49. package/dist/har-service/src/services/responses/ListRepositoryResponseResponse.js +1 -0
  50. package/dist/har-service/src/services/responses/ListUpstreamProxyResponseResponse.d.ts +6 -0
  51. package/dist/har-service/src/services/responses/ListUpstreamProxyResponseResponse.js +1 -0
  52. package/dist/har-service/src/services/responses/NotFoundResponse.d.ts +2 -0
  53. package/dist/har-service/src/services/responses/NotFoundResponse.js +1 -0
  54. package/dist/har-service/src/services/responses/RepositoryResponseResponse.d.ts +6 -0
  55. package/dist/har-service/src/services/responses/RepositoryResponseResponse.js +1 -0
  56. package/dist/har-service/src/services/responses/SuccessResponse.d.ts +4 -0
  57. package/dist/har-service/src/services/responses/SuccessResponse.js +1 -0
  58. package/dist/har-service/src/services/responses/UnauthenticatedResponse.d.ts +2 -0
  59. package/dist/har-service/src/services/responses/UnauthenticatedResponse.js +1 -0
  60. package/dist/har-service/src/services/responses/UnauthorizedResponse.d.ts +2 -0
  61. package/dist/har-service/src/services/responses/UnauthorizedResponse.js +1 -0
  62. package/dist/har-service/src/services/responses/UpstreamProxyResponseResponse.d.ts +6 -0
  63. package/dist/har-service/src/services/responses/UpstreamProxyResponseResponse.js +1 -0
  64. package/dist/har-service/src/services/schemas/Anonymous.d.ts +2 -0
  65. package/dist/har-service/src/services/schemas/Anonymous.js +4 -0
  66. package/dist/har-service/src/services/schemas/ArtifactMetadata.d.ts +11 -0
  67. package/dist/har-service/src/services/schemas/ArtifactMetadata.js +4 -0
  68. package/dist/har-service/src/services/schemas/ArtifactVersionMetadata.d.ts +14 -0
  69. package/dist/har-service/src/services/schemas/ArtifactVersionMetadata.js +4 -0
  70. package/dist/har-service/src/services/schemas/AuthType.d.ts +4 -0
  71. package/dist/har-service/src/services/schemas/AuthType.js +4 -0
  72. package/dist/har-service/src/services/schemas/Error.d.ts +17 -0
  73. package/dist/har-service/src/services/schemas/Error.js +4 -0
  74. package/dist/har-service/src/services/schemas/Label.d.ts +6 -0
  75. package/dist/har-service/src/services/schemas/Label.js +4 -0
  76. package/dist/har-service/src/services/schemas/ListArtifact.d.ts +30 -0
  77. package/dist/har-service/src/services/schemas/ListArtifact.js +1 -0
  78. package/dist/har-service/src/services/schemas/ListArtifactVersion.d.ts +30 -0
  79. package/dist/har-service/src/services/schemas/ListArtifactVersion.js +1 -0
  80. package/dist/har-service/src/services/schemas/ListRepository.d.ts +30 -0
  81. package/dist/har-service/src/services/schemas/ListRepository.js +1 -0
  82. package/dist/har-service/src/services/schemas/ListUpstreamProxy.d.ts +30 -0
  83. package/dist/har-service/src/services/schemas/ListUpstreamProxy.js +1 -0
  84. package/dist/har-service/src/services/schemas/PackageType.d.ts +4 -0
  85. package/dist/har-service/src/services/schemas/PackageType.js +4 -0
  86. package/dist/har-service/src/services/schemas/Repository.d.ts +20 -0
  87. package/dist/har-service/src/services/schemas/Repository.js +1 -0
  88. package/dist/har-service/src/services/schemas/RepositoryCleanupPolicy.d.ts +8 -0
  89. package/dist/har-service/src/services/schemas/RepositoryCleanupPolicy.js +4 -0
  90. package/dist/har-service/src/services/schemas/RepositoryConfig.d.ts +9 -0
  91. package/dist/har-service/src/services/schemas/RepositoryConfig.js +1 -0
  92. package/dist/har-service/src/services/schemas/RepositoryMetadata.d.ts +18 -0
  93. package/dist/har-service/src/services/schemas/RepositoryMetadata.js +1 -0
  94. package/dist/har-service/src/services/schemas/RepositoryRequest.d.ts +14 -0
  95. package/dist/har-service/src/services/schemas/RepositoryRequest.js +1 -0
  96. package/dist/har-service/src/services/schemas/Status.d.ts +4 -0
  97. package/dist/har-service/src/services/schemas/Status.js +4 -0
  98. package/dist/har-service/src/services/schemas/Type.d.ts +4 -0
  99. package/dist/har-service/src/services/schemas/Type.js +4 -0
  100. package/dist/har-service/src/services/schemas/UpstreamProxy.d.ts +15 -0
  101. package/dist/har-service/src/services/schemas/UpstreamProxy.js +1 -0
  102. package/dist/har-service/src/services/schemas/UpstreamProxyConfig.d.ts +10 -0
  103. package/dist/har-service/src/services/schemas/UpstreamProxyConfig.js +1 -0
  104. package/dist/har-service/src/services/schemas/UpstreamProxyMetadata.d.ts +10 -0
  105. package/dist/har-service/src/services/schemas/UpstreamProxyMetadata.js +1 -0
  106. package/dist/har-service/src/services/schemas/UpstreamProxyRequest.d.ts +10 -0
  107. package/dist/har-service/src/services/schemas/UpstreamProxyRequest.js +1 -0
  108. package/dist/har-service/src/services/schemas/UserPassword.d.ts +4 -0
  109. package/dist/har-service/src/services/schemas/UserPassword.js +4 -0
  110. package/package.json +31 -0
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # React HAR Service Client(WIP)
2
+
3
+ **OpenAPI -> OA**
4
+
5
+ **TypeScript -> TS**
6
+
7
+ **OpenAPI + TypeScript -> OATS**
8
+
9
+ This React API client will store a collection of Harness SSCA Service APIs and Interfaces contracts generated from Open API Spec using `OATS CLI` internally.
10
+ APIs are using hooks from `@tanstack/react-query`
11
+
12
+ ## Steps To Generate API Client build as dist folder
13
+
14
+ ```
15
+ yarn build
16
+ ```
17
+
18
+ ## For NextGen UI adoption : HARServiceAPIClient should be initialized
19
+
20
+ Before using API Client, it must be initilaized with required `ClientCallbacks`.
21
+
22
+ Example:
23
+
24
+ ```
25
+ new HARServiceAPIClient({
26
+ getHeaders: () => {
27
+ return { token: SessionToken.getToken(), 'Harness-Account': accountId }
28
+ }}
29
+ ```
30
+
31
+ ## Versioning
32
+
33
+ ![@harnessio/react-ssca-manager-client](https://img.shields.io/npm/v/@harnessio/react-ssca-manager-client.svg?style=flat-square)
34
+
35
+ Once development phase is completed, this repo will have changes and versioning driven by API spec only.
36
+
37
+ ## License
38
+
39
+ [MIT](./LICENSE.md). Copyright(c) [Harness Inc](https://harness.io)
@@ -0,0 +1,17 @@
1
+ import type { IStringifyOptions } from 'qs';
2
+ export interface FetcherOptions<TQueryParams = never, TBody = never, THeaderParams = HeadersInit> extends Omit<RequestInit, 'body' | 'headers'> {
3
+ url: string;
4
+ queryParams?: TQueryParams extends never ? undefined : TQueryParams;
5
+ body?: TBody extends never ? undefined : TBody;
6
+ stringifyQueryParamsOptions?: IStringifyOptions;
7
+ headers?: THeaderParams;
8
+ }
9
+ export interface ClientCallbacks {
10
+ responseInterceptor?: (response: Response) => Response;
11
+ requestInterceptor?: (request: Request) => Request;
12
+ urlInterceptor?: (url: string) => string;
13
+ getRequestHeaders?: () => Record<string, any>;
14
+ }
15
+ export declare function setupClient(callbacks: ClientCallbacks): void;
16
+ export declare const updateClientHeaders: (headers: Record<string, any>) => void;
17
+ export declare function fetcher<TResponse = unknown, TQueryParams = never, TBody = never, THeaderParams = HeadersInit>(options: FetcherOptions<TQueryParams, TBody, THeaderParams>): Promise<TResponse>;
@@ -0,0 +1,65 @@
1
+ import { __awaiter, __rest } from "tslib";
2
+ import { stringify } from 'qs';
3
+ const JSON_CONTENT_TYPES = ['application/json'];
4
+ let APIClientInitialized = false;
5
+ let fetcherCallbacks;
6
+ let customHeaders = {
7
+ 'Content-Type': JSON_CONTENT_TYPES[0],
8
+ };
9
+ export function setupClient(callbacks) {
10
+ fetcherCallbacks = callbacks;
11
+ customHeaders = Object.assign(Object.assign({}, customHeaders), ((fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.getRequestHeaders) ? fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.getRequestHeaders() : {}));
12
+ APIClientInitialized = true;
13
+ }
14
+ export const updateClientHeaders = (headers) => {
15
+ customHeaders = Object.assign(Object.assign({}, customHeaders), headers);
16
+ };
17
+ export function fetcher(options) {
18
+ var _a, _b;
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ // If not initialized throw error even without making request
21
+ if (!APIClientInitialized) {
22
+ throw { reason: 'HarnessReactAPIClient has not been initialized' };
23
+ }
24
+ const { stringifyQueryParamsOptions, headers, body, url, queryParams = { account: customHeaders['Harness-Account'] } } = options, rest = __rest(options, ["stringifyQueryParamsOptions", "headers", "body", "url", "queryParams"]);
25
+ const token = customHeaders.token;
26
+ let finalUrl = url;
27
+ if (queryParams) {
28
+ finalUrl += stringify(queryParams, Object.assign(Object.assign({}, stringifyQueryParamsOptions), { addQueryPrefix: true }));
29
+ }
30
+ if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.urlInterceptor) {
31
+ finalUrl = (_a = fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.urlInterceptor) === null || _a === void 0 ? void 0 : _a.call(fetcherCallbacks, finalUrl);
32
+ }
33
+ let request = new Request(finalUrl, Object.assign({ headers: Object.assign(Object.assign({ Authorization: `Bearer ${token}` }, headers), customHeaders), body: body ? JSON.stringify(body) : undefined }, rest));
34
+ if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.requestInterceptor) {
35
+ request = fetcherCallbacks.requestInterceptor(request.clone());
36
+ }
37
+ let response = yield fetch(request);
38
+ if (fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.responseInterceptor) {
39
+ response = (_b = fetcherCallbacks === null || fetcherCallbacks === void 0 ? void 0 : fetcherCallbacks.responseInterceptor) === null || _b === void 0 ? void 0 : _b.call(fetcherCallbacks, response.clone());
40
+ }
41
+ const contentType = response.headers.get('Content-Type');
42
+ let total, pageSize, pageNumber, pageCount, pagination;
43
+ try {
44
+ total = response.headers.get('x-total-elements');
45
+ pageSize = response.headers.get('x-page-size');
46
+ pageNumber = response.headers.get('x-page-number');
47
+ pagination = total || pageSize || pageNumber;
48
+ if (pagination) {
49
+ total = Number(total);
50
+ pageSize = Number(pageSize);
51
+ pageCount = Math.ceil(total / pageSize);
52
+ pageNumber = Number(pageNumber);
53
+ }
54
+ }
55
+ catch (e) {
56
+ throw new Error('HarnessReactAPIClient: An error occurred while parsing pagination headers. ' + e);
57
+ }
58
+ const asJson = contentType && JSON_CONTENT_TYPES.some((h) => contentType.startsWith(h));
59
+ const data = yield (asJson ? response.json() : response.text());
60
+ if (response.ok) {
61
+ return Object.assign({ content: data }, (pagination ? { pagination: { total, pageCount, pageSize, pageNumber } } : {}));
62
+ }
63
+ throw data;
64
+ });
65
+ }
@@ -0,0 +1,6 @@
1
+ import { ClientCallbacks } from '../../fetcher';
2
+ export * from './services/index';
3
+ export declare class HARServiceAPIClient {
4
+ updateHeaders: (headers: Record<string, any>) => void;
5
+ constructor(callbacks: ClientCallbacks);
6
+ }
@@ -0,0 +1,10 @@
1
+ import { setupClient, updateClientHeaders } from '../../fetcher';
2
+ export * from './services/index';
3
+ export class HARServiceAPIClient {
4
+ constructor(callbacks) {
5
+ setupClient(callbacks);
6
+ this.updateHeaders = (headers) => {
7
+ updateClientHeaders(headers);
8
+ };
9
+ }
10
+ }
@@ -0,0 +1,14 @@
1
+ export type GetPathParamsType<T> = T extends {
2
+ pathParams: infer R;
3
+ } ? R : never;
4
+ export interface ResponseWithPagination<T> {
5
+ content: T;
6
+ pagination?: {
7
+ total?: number;
8
+ pageSize?: number;
9
+ pageCount?: number;
10
+ pageNumber?: number;
11
+ };
12
+ }
13
+ export type WithOptional<TInput, Tkeys extends keyof TInput> = Omit<TInput, Tkeys> & Partial<Pick<TInput, Tkeys>>;
14
+ export type PickPartial<TInput, Tkeys extends keyof TInput> = Pick<Partial<TInput>, Tkeys>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ import { UseMutationOptions } from '@tanstack/react-query';
2
+ import type { RepositoryResponseResponse } from '../responses/RepositoryResponseResponse';
3
+ import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
4
+ import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
5
+ import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
6
+ import type { RepositoryRequestRequestBody } from '../requestBodies/RepositoryRequestRequestBody';
7
+ import type { ResponseWithPagination } from '../helpers';
8
+ import { FetcherOptions } from '../../../../fetcher/index.js';
9
+ export interface CreateRepositoryMutationQueryParams {
10
+ org?: string;
11
+ project?: string;
12
+ }
13
+ export interface CreateRepositoryMutationHeaderParams {
14
+ 'Harness-Account'?: string;
15
+ }
16
+ export type CreateRepositoryRequestBody = RepositoryRequestRequestBody;
17
+ export type CreateRepositoryOkResponse = ResponseWithPagination<RepositoryResponseResponse>;
18
+ export type CreateRepositoryErrorResponse = UnauthenticatedResponse | UnauthorizedResponse | InternalServerErrorResponse;
19
+ export interface CreateRepositoryProps extends Omit<FetcherOptions<CreateRepositoryMutationQueryParams, CreateRepositoryRequestBody, CreateRepositoryMutationHeaderParams>, 'url'> {
20
+ queryParams: CreateRepositoryMutationQueryParams;
21
+ body: CreateRepositoryRequestBody;
22
+ }
23
+ export declare function createRepository(props: CreateRepositoryProps): Promise<CreateRepositoryOkResponse>;
24
+ /**
25
+ * Create a Repository.
26
+ */
27
+ export declare function useCreateRepositoryMutation(options?: Omit<UseMutationOptions<CreateRepositoryOkResponse, CreateRepositoryErrorResponse, CreateRepositoryProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<CreateRepositoryOkResponse, import("..").Error, CreateRepositoryProps, 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 createRepository(props) {
7
+ return fetcher(Object.assign({ url: `/repos`, method: 'POST' }, props));
8
+ }
9
+ /**
10
+ * Create a Repository.
11
+ */
12
+ export function useCreateRepositoryMutation(options) {
13
+ return useMutation((mutateProps) => createRepository(mutateProps), options);
14
+ }
@@ -0,0 +1,27 @@
1
+ import { UseMutationOptions } from '@tanstack/react-query';
2
+ import type { UpstreamProxyResponseResponse } from '../responses/UpstreamProxyResponseResponse';
3
+ import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
4
+ import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
5
+ import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
6
+ import type { UpstreamProxyRequestRequestBody } from '../requestBodies/UpstreamProxyRequestRequestBody';
7
+ import type { ResponseWithPagination } from '../helpers';
8
+ import { FetcherOptions } from '../../../../fetcher/index.js';
9
+ export interface CreateUpstreamProxyMutationQueryParams {
10
+ org?: string;
11
+ project?: string;
12
+ }
13
+ export interface CreateUpstreamProxyMutationHeaderParams {
14
+ 'Harness-Account'?: string;
15
+ }
16
+ export type CreateUpstreamProxyRequestBody = UpstreamProxyRequestRequestBody;
17
+ export type CreateUpstreamProxyOkResponse = ResponseWithPagination<UpstreamProxyResponseResponse>;
18
+ export type CreateUpstreamProxyErrorResponse = UnauthenticatedResponse | UnauthorizedResponse | InternalServerErrorResponse;
19
+ export interface CreateUpstreamProxyProps extends Omit<FetcherOptions<CreateUpstreamProxyMutationQueryParams, CreateUpstreamProxyRequestBody, CreateUpstreamProxyMutationHeaderParams>, 'url'> {
20
+ queryParams: CreateUpstreamProxyMutationQueryParams;
21
+ body: CreateUpstreamProxyRequestBody;
22
+ }
23
+ export declare function createUpstreamProxy(props: CreateUpstreamProxyProps): Promise<CreateUpstreamProxyOkResponse>;
24
+ /**
25
+ * Create a UpstreamProxy.
26
+ */
27
+ export declare function useCreateUpstreamProxyMutation(options?: Omit<UseMutationOptions<CreateUpstreamProxyOkResponse, CreateUpstreamProxyErrorResponse, CreateUpstreamProxyProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<CreateUpstreamProxyOkResponse, import("..").Error, CreateUpstreamProxyProps, 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 createUpstreamProxy(props) {
7
+ return fetcher(Object.assign({ url: `/upstreamproxies`, method: 'POST' }, props));
8
+ }
9
+ /**
10
+ * Create a UpstreamProxy.
11
+ */
12
+ export function useCreateUpstreamProxyMutation(options) {
13
+ return useMutation((mutateProps) => createUpstreamProxy(mutateProps), options);
14
+ }
@@ -0,0 +1,28 @@
1
+ import { UseMutationOptions } from '@tanstack/react-query';
2
+ import type { SuccessResponse } from '../responses/SuccessResponse';
3
+ import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
4
+ import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
5
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
6
+ import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
7
+ import type { ResponseWithPagination } from '../helpers';
8
+ import { FetcherOptions } from '../../../../fetcher/index.js';
9
+ export interface DeleteRepositoryMutationPathParams {
10
+ repokey: string;
11
+ }
12
+ export interface DeleteRepositoryMutationQueryParams {
13
+ org?: string;
14
+ project?: string;
15
+ }
16
+ export interface DeleteRepositoryMutationHeaderParams {
17
+ 'Harness-Account'?: string;
18
+ }
19
+ export type DeleteRepositoryOkResponse = ResponseWithPagination<SuccessResponse>;
20
+ export type DeleteRepositoryErrorResponse = UnauthenticatedResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
21
+ export interface DeleteRepositoryProps extends DeleteRepositoryMutationPathParams, Omit<FetcherOptions<DeleteRepositoryMutationQueryParams, unknown, DeleteRepositoryMutationHeaderParams>, 'url'> {
22
+ queryParams: DeleteRepositoryMutationQueryParams;
23
+ }
24
+ export declare function deleteRepository(props: DeleteRepositoryProps): Promise<DeleteRepositoryOkResponse>;
25
+ /**
26
+ * Delete a Repository in the account for the given key
27
+ */
28
+ export declare function useDeleteRepositoryMutation(options?: Omit<UseMutationOptions<DeleteRepositoryOkResponse, DeleteRepositoryErrorResponse, DeleteRepositoryProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<DeleteRepositoryOkResponse, import("..").Error, DeleteRepositoryProps, 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 deleteRepository(props) {
7
+ return fetcher(Object.assign({ url: `/repos/${props.repokey}`, method: 'DELETE' }, props));
8
+ }
9
+ /**
10
+ * Delete a Repository in the account for the given key
11
+ */
12
+ export function useDeleteRepositoryMutation(options) {
13
+ return useMutation((mutateProps) => deleteRepository(mutateProps), options);
14
+ }
@@ -0,0 +1,28 @@
1
+ import { UseMutationOptions } from '@tanstack/react-query';
2
+ import type { SuccessResponse } from '../responses/SuccessResponse';
3
+ import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
4
+ import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
5
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
6
+ import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
7
+ import type { ResponseWithPagination } from '../helpers';
8
+ import { FetcherOptions } from '../../../../fetcher/index.js';
9
+ export interface DeleteUpstreamProxyMutationPathParams {
10
+ repokey: string;
11
+ }
12
+ export interface DeleteUpstreamProxyMutationQueryParams {
13
+ org?: string;
14
+ project?: string;
15
+ }
16
+ export interface DeleteUpstreamProxyMutationHeaderParams {
17
+ 'Harness-Account'?: string;
18
+ }
19
+ export type DeleteUpstreamProxyOkResponse = ResponseWithPagination<SuccessResponse>;
20
+ export type DeleteUpstreamProxyErrorResponse = UnauthenticatedResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
21
+ export interface DeleteUpstreamProxyProps extends DeleteUpstreamProxyMutationPathParams, Omit<FetcherOptions<DeleteUpstreamProxyMutationQueryParams, unknown, DeleteUpstreamProxyMutationHeaderParams>, 'url'> {
22
+ queryParams: DeleteUpstreamProxyMutationQueryParams;
23
+ }
24
+ export declare function deleteUpstreamProxy(props: DeleteUpstreamProxyProps): Promise<DeleteUpstreamProxyOkResponse>;
25
+ /**
26
+ * Delete a UpstreamProxy in the account for the given key
27
+ */
28
+ export declare function useDeleteUpstreamProxyMutation(options?: Omit<UseMutationOptions<DeleteUpstreamProxyOkResponse, DeleteUpstreamProxyErrorResponse, DeleteUpstreamProxyProps>, 'mutationKey' | 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<DeleteUpstreamProxyOkResponse, import("..").Error, DeleteUpstreamProxyProps, 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 deleteUpstreamProxy(props) {
7
+ return fetcher(Object.assign({ url: `/upstreamproxies/${props.repokey}`, method: 'DELETE' }, props));
8
+ }
9
+ /**
10
+ * Delete a UpstreamProxy in the account for the given key
11
+ */
12
+ export function useDeleteUpstreamProxyMutation(options) {
13
+ return useMutation((mutateProps) => deleteUpstreamProxy(mutateProps), options);
14
+ }
@@ -0,0 +1,32 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { ListArtifactResponseResponse } from '../responses/ListArtifactResponseResponse';
3
+ import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
4
+ import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
5
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
6
+ import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
7
+ import type { ResponseWithPagination } from '../helpers';
8
+ import { FetcherOptions } from '../../../../fetcher/index.js';
9
+ export interface GetAllArtifactsForRepositoryQueryPathParams {
10
+ repokey: string;
11
+ }
12
+ export interface GetAllArtifactsForRepositoryQueryQueryParams {
13
+ org?: string;
14
+ project?: string;
15
+ packageType?: string[];
16
+ page?: number;
17
+ size?: number;
18
+ sort?: string[];
19
+ }
20
+ export interface GetAllArtifactsForRepositoryQueryHeaderParams {
21
+ 'Harness-Account'?: string;
22
+ }
23
+ export type GetAllArtifactsForRepositoryOkResponse = ResponseWithPagination<ListArtifactResponseResponse>;
24
+ export type GetAllArtifactsForRepositoryErrorResponse = UnauthenticatedResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
25
+ export interface GetAllArtifactsForRepositoryProps extends GetAllArtifactsForRepositoryQueryPathParams, Omit<FetcherOptions<GetAllArtifactsForRepositoryQueryQueryParams, unknown, GetAllArtifactsForRepositoryQueryHeaderParams>, 'url'> {
26
+ queryParams: GetAllArtifactsForRepositoryQueryQueryParams;
27
+ }
28
+ export declare function getAllArtifactsForRepository(props: GetAllArtifactsForRepositoryProps): Promise<GetAllArtifactsForRepositoryOkResponse>;
29
+ /**
30
+ * Lists all the Artifacts for Repository.
31
+ */
32
+ export declare function useGetAllArtifactsForRepositoryQuery(props: GetAllArtifactsForRepositoryProps, options?: Omit<UseQueryOptions<GetAllArtifactsForRepositoryOkResponse, GetAllArtifactsForRepositoryErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetAllArtifactsForRepositoryOkResponse, import("..").Error>;
@@ -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 getAllArtifactsForRepository(props) {
7
+ return fetcher(Object.assign({ url: `/repos/${props.repokey}/artifacts`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Lists all the Artifacts for Repository.
11
+ */
12
+ export function useGetAllArtifactsForRepositoryQuery(props, options) {
13
+ return useQuery(['GetAllArtifactsForRepository', props.repokey, props.queryParams], ({ signal }) => getAllArtifactsForRepository(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,29 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { ListArtifactResponseResponse } from '../responses/ListArtifactResponseResponse';
3
+ import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
4
+ import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
5
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
6
+ import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
7
+ import type { ResponseWithPagination } from '../helpers';
8
+ import { FetcherOptions } from '../../../../fetcher/index.js';
9
+ export interface GetAllArtifactsQueryQueryParams {
10
+ org?: string;
11
+ project?: string;
12
+ packageType?: string[];
13
+ page?: number;
14
+ size?: number;
15
+ sort?: string[];
16
+ }
17
+ export interface GetAllArtifactsQueryHeaderParams {
18
+ 'Harness-Account'?: string;
19
+ }
20
+ export type GetAllArtifactsOkResponse = ResponseWithPagination<ListArtifactResponseResponse>;
21
+ export type GetAllArtifactsErrorResponse = UnauthenticatedResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
22
+ export interface GetAllArtifactsProps extends Omit<FetcherOptions<GetAllArtifactsQueryQueryParams, unknown, GetAllArtifactsQueryHeaderParams>, 'url'> {
23
+ queryParams: GetAllArtifactsQueryQueryParams;
24
+ }
25
+ export declare function getAllArtifacts(props: GetAllArtifactsProps): Promise<GetAllArtifactsOkResponse>;
26
+ /**
27
+ * Lists all the Artifacts.
28
+ */
29
+ export declare function useGetAllArtifactsQuery(props: GetAllArtifactsProps, options?: Omit<UseQueryOptions<GetAllArtifactsOkResponse, GetAllArtifactsErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetAllArtifactsOkResponse, import("..").Error>;
@@ -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 getAllArtifacts(props) {
7
+ return fetcher(Object.assign({ url: `/artifacts`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Lists all the Artifacts.
11
+ */
12
+ export function useGetAllArtifactsQuery(props, options) {
13
+ return useQuery(['GetAllArtifacts', props.queryParams], ({ signal }) => getAllArtifacts(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,29 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { ListRepositoryResponseResponse } from '../responses/ListRepositoryResponseResponse';
3
+ import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
4
+ import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
5
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
6
+ import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
7
+ import type { ResponseWithPagination } from '../helpers';
8
+ import { FetcherOptions } from '../../../../fetcher/index.js';
9
+ export interface GetAllRepositoriesQueryQueryParams {
10
+ org?: string;
11
+ project?: string;
12
+ packageType?: string[];
13
+ page?: number;
14
+ size?: number;
15
+ sort?: string[];
16
+ }
17
+ export interface GetAllRepositoriesQueryHeaderParams {
18
+ 'Harness-Account'?: string;
19
+ }
20
+ export type GetAllRepositoriesOkResponse = ResponseWithPagination<ListRepositoryResponseResponse>;
21
+ export type GetAllRepositoriesErrorResponse = UnauthenticatedResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
22
+ export interface GetAllRepositoriesProps extends Omit<FetcherOptions<GetAllRepositoriesQueryQueryParams, unknown, GetAllRepositoriesQueryHeaderParams>, 'url'> {
23
+ queryParams: GetAllRepositoriesQueryQueryParams;
24
+ }
25
+ export declare function getAllRepositories(props: GetAllRepositoriesProps): Promise<GetAllRepositoriesOkResponse>;
26
+ /**
27
+ * Lists all the Repositories.
28
+ */
29
+ export declare function useGetAllRepositoriesQuery(props: GetAllRepositoriesProps, options?: Omit<UseQueryOptions<GetAllRepositoriesOkResponse, GetAllRepositoriesErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetAllRepositoriesOkResponse, import("..").Error>;
@@ -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 getAllRepositories(props) {
7
+ return fetcher(Object.assign({ url: `/repos`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Lists all the Repositories.
11
+ */
12
+ export function useGetAllRepositoriesQuery(props, options) {
13
+ return useQuery(['GetAllRepositories', props.queryParams], ({ signal }) => getAllRepositories(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,29 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { ListUpstreamProxyResponseResponse } from '../responses/ListUpstreamProxyResponseResponse';
3
+ import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
4
+ import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
5
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
6
+ import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
7
+ import type { ResponseWithPagination } from '../helpers';
8
+ import { FetcherOptions } from '../../../../fetcher/index.js';
9
+ export interface GetAllUpstreamProxiesQueryQueryParams {
10
+ org?: string;
11
+ project?: string;
12
+ packageType?: string[];
13
+ page?: number;
14
+ size?: number;
15
+ sort?: string[];
16
+ }
17
+ export interface GetAllUpstreamProxiesQueryHeaderParams {
18
+ 'Harness-Account'?: string;
19
+ }
20
+ export type GetAllUpstreamProxiesOkResponse = ResponseWithPagination<ListUpstreamProxyResponseResponse>;
21
+ export type GetAllUpstreamProxiesErrorResponse = UnauthenticatedResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
22
+ export interface GetAllUpstreamProxiesProps extends Omit<FetcherOptions<GetAllUpstreamProxiesQueryQueryParams, unknown, GetAllUpstreamProxiesQueryHeaderParams>, 'url'> {
23
+ queryParams: GetAllUpstreamProxiesQueryQueryParams;
24
+ }
25
+ export declare function getAllUpstreamProxies(props: GetAllUpstreamProxiesProps): Promise<GetAllUpstreamProxiesOkResponse>;
26
+ /**
27
+ * Lists all the UpstreamProxies.
28
+ */
29
+ export declare function useGetAllUpstreamProxiesQuery(props: GetAllUpstreamProxiesProps, options?: Omit<UseQueryOptions<GetAllUpstreamProxiesOkResponse, GetAllUpstreamProxiesErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetAllUpstreamProxiesOkResponse, import("..").Error>;
@@ -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 getAllUpstreamProxies(props) {
7
+ return fetcher(Object.assign({ url: `/upstreamproxies`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Lists all the UpstreamProxies.
11
+ */
12
+ export function useGetAllUpstreamProxiesQuery(props, options) {
13
+ return useQuery(['GetAllUpstreamProxies', props.queryParams], ({ signal }) => getAllUpstreamProxies(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,27 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { ListArtifactVersionResponseResponse } from '../responses/ListArtifactVersionResponseResponse';
3
+ import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
4
+ import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
5
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
6
+ import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
7
+ import type { ResponseWithPagination } from '../helpers';
8
+ import { FetcherOptions } from '../../../../fetcher/index.js';
9
+ export interface GetAllVersionsForArtifactQueryQueryParams {
10
+ repokey: string;
11
+ page?: number;
12
+ size?: number;
13
+ sort?: string[];
14
+ }
15
+ export interface GetAllVersionsForArtifactQueryHeaderParams {
16
+ 'Harness-Account'?: string;
17
+ }
18
+ export type GetAllVersionsForArtifactOkResponse = ResponseWithPagination<ListArtifactVersionResponseResponse>;
19
+ export type GetAllVersionsForArtifactErrorResponse = UnauthenticatedResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
20
+ export interface GetAllVersionsForArtifactProps extends Omit<FetcherOptions<GetAllVersionsForArtifactQueryQueryParams, unknown, GetAllVersionsForArtifactQueryHeaderParams>, 'url'> {
21
+ queryParams: GetAllVersionsForArtifactQueryQueryParams;
22
+ }
23
+ export declare function getAllVersionsForArtifact(props: GetAllVersionsForArtifactProps): Promise<GetAllVersionsForArtifactOkResponse>;
24
+ /**
25
+ * Lists all the Versions for Artifact.
26
+ */
27
+ export declare function useGetAllVersionsForArtifactQuery(props: GetAllVersionsForArtifactProps, options?: Omit<UseQueryOptions<GetAllVersionsForArtifactOkResponse, GetAllVersionsForArtifactErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetAllVersionsForArtifactOkResponse, import("..").Error>;
@@ -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 getAllVersionsForArtifact(props) {
7
+ return fetcher(Object.assign({ url: `/artifacts/versions`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Lists all the Versions for Artifact.
11
+ */
12
+ export function useGetAllVersionsForArtifactQuery(props, options) {
13
+ return useQuery(['GetAllVersionsForArtifact', props.queryParams], ({ signal }) => getAllVersionsForArtifact(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }
@@ -0,0 +1,28 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import type { RepositoryResponseResponse } from '../responses/RepositoryResponseResponse';
3
+ import type { UnauthenticatedResponse } from '../responses/UnauthenticatedResponse';
4
+ import type { UnauthorizedResponse } from '../responses/UnauthorizedResponse';
5
+ import type { NotFoundResponse } from '../responses/NotFoundResponse';
6
+ import type { InternalServerErrorResponse } from '../responses/InternalServerErrorResponse';
7
+ import type { ResponseWithPagination } from '../helpers';
8
+ import { FetcherOptions } from '../../../../fetcher/index.js';
9
+ export interface GetRepositoryQueryPathParams {
10
+ repokey: string;
11
+ }
12
+ export interface GetRepositoryQueryQueryParams {
13
+ org?: string;
14
+ project?: string;
15
+ }
16
+ export interface GetRepositoryQueryHeaderParams {
17
+ 'Harness-Account'?: string;
18
+ }
19
+ export type GetRepositoryOkResponse = ResponseWithPagination<RepositoryResponseResponse>;
20
+ export type GetRepositoryErrorResponse = UnauthenticatedResponse | UnauthorizedResponse | NotFoundResponse | InternalServerErrorResponse;
21
+ export interface GetRepositoryProps extends GetRepositoryQueryPathParams, Omit<FetcherOptions<GetRepositoryQueryQueryParams, unknown, GetRepositoryQueryHeaderParams>, 'url'> {
22
+ queryParams: GetRepositoryQueryQueryParams;
23
+ }
24
+ export declare function getRepository(props: GetRepositoryProps): Promise<GetRepositoryOkResponse>;
25
+ /**
26
+ * Returns Repository Details in the account for the given key
27
+ */
28
+ export declare function useGetRepositoryQuery(props: GetRepositoryProps, options?: Omit<UseQueryOptions<GetRepositoryOkResponse, GetRepositoryErrorResponse>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<GetRepositoryOkResponse, import("..").Error>;
@@ -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 getRepository(props) {
7
+ return fetcher(Object.assign({ url: `/repos/${props.repokey}`, method: 'GET' }, props));
8
+ }
9
+ /**
10
+ * Returns Repository Details in the account for the given key
11
+ */
12
+ export function useGetRepositoryQuery(props, options) {
13
+ return useQuery(['GetRepository', props.repokey, props.queryParams], ({ signal }) => getRepository(Object.assign(Object.assign({}, props), { signal })), options);
14
+ }