@newfold/huapi-js 1.2.7 → 1.2.8
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/handlers/sites/getHostingSitesHandler.js +1 -1
- package/dist/index.d.ts +89 -16
- package/dist/index.js +109 -14
- package/dist/index.msw.d.ts +37 -10
- package/dist/index.msw.js +28 -8
- package/dist/models/getAddonsCodeguardWebsiteListV1200.d.ts +11 -0
- package/dist/models/getAddonsCodeguardWebsiteListV1200.js +2 -0
- package/dist/models/getAddonsCodeguardWebsiteListV1200WebsiteListItem.d.ts +11 -0
- package/dist/models/getAddonsCodeguardWebsiteListV1200WebsiteListItem.js +2 -0
- package/dist/models/getAddonsCodeguardWebsiteListV1200WebsiteListItemWebsite.d.ts +10 -0
- package/dist/models/getAddonsCodeguardWebsiteListV1200WebsiteListItemWebsite.js +9 -0
- package/dist/models/getAddonsCodeguardWebsitesV1200.d.ts +9 -0
- package/dist/models/getAddonsCodeguardWebsitesV1200.js +2 -0
- package/dist/models/getAddonsCodeguardWebsitesV1200WebsiteListItem.d.ts +9 -0
- package/dist/models/getAddonsCodeguardWebsitesV1200WebsiteListItem.js +2 -0
- package/dist/models/getAddonsCodeguardWebsitesV1200WebsiteListItemWebsite.d.ts +9 -0
- package/dist/models/getAddonsCodeguardWebsitesV1200WebsiteListItemWebsite.js +7 -0
- package/dist/models/getHostingFtpV1200.d.ts +11 -0
- package/dist/models/getHostingFtpV1200.js +2 -0
- package/dist/models/getHostingFtpV1200FtpAccountItem.d.ts +11 -0
- package/dist/models/getHostingFtpV1200FtpAccountItem.js +9 -0
- package/dist/models/getHostingInfoV1200.d.ts +8 -0
- package/dist/models/getHostingInfoV1200.js +7 -0
- package/dist/models/getHostingSitesV1200.d.ts +9 -0
- package/dist/models/getHostingSitesV1200.js +2 -0
- package/dist/models/getHostingSitesV1200RowsItem.d.ts +10 -0
- package/dist/models/getHostingSitesV1200RowsItem.js +7 -0
- package/dist/models/getSitesInfoV1200.d.ts +18 -0
- package/dist/models/getSitesInfoV1200.js +9 -0
- package/dist/models/getSitesSsoV1200.d.ts +8 -0
- package/dist/models/getSitesSsoV1200.js +7 -0
- package/dist/models/hostingInfo200.d.ts +10 -0
- package/dist/models/hostingInfo200.js +9 -0
- package/dist/models/hostingSites200.d.ts +11 -0
- package/dist/models/hostingSites200.js +2 -0
- package/dist/models/hostingSites200RowsItem.d.ts +12 -0
- package/dist/models/hostingSites200RowsItem.js +9 -0
- package/dist/models/index.d.ts +20 -1
- package/dist/models/index.js +20 -1
- package/dist/models/postHostingFtpV1200.d.ts +11 -0
- package/dist/models/postHostingFtpV1200.js +9 -0
- package/dist/models/postHostingFtpV1Body.d.ts +11 -0
- package/dist/models/postHostingFtpV1Body.js +9 -0
- package/dist/models/sitesSso200.d.ts +10 -0
- package/dist/models/sitesSso200.js +9 -0
- package/package.json +5 -3
|
@@ -12,6 +12,6 @@ const sites_1 = require("./data/sites");
|
|
|
12
12
|
*/
|
|
13
13
|
function getHostingSitesHandler(responseKey = '1', // int or string
|
|
14
14
|
status = 200, delay = 1000) {
|
|
15
|
-
return msw_1.rest.get('*/hosting/:hostingId/sites', (req, res, ctx) => res(ctx.delay(delay), ctx.status(status, 'Mocked status'), ctx.json((0, sites_1.getResponseByStatus)(responseKey, status))));
|
|
15
|
+
return msw_1.rest.get('*/v1/hosting/:hostingId/sites', (req, res, ctx) => res(ctx.delay(delay), ctx.status(status, 'Mocked status'), ctx.json((0, sites_1.getResponseByStatus)(responseKey, status))));
|
|
16
16
|
}
|
|
17
17
|
exports.getHostingSitesHandler = getHostingSitesHandler;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,37 +3,110 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Hosting UAPI
|
|
5
5
|
* Hosting UAPI
|
|
6
|
-
* OpenAPI spec version: 0.1
|
|
6
|
+
* OpenAPI spec version: 0.0.1
|
|
7
7
|
*/
|
|
8
8
|
import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
|
|
9
9
|
import { UseQueryOptions, UseMutationOptions, UseQueryResult, QueryKey } from 'react-query';
|
|
10
|
-
import type {
|
|
10
|
+
import type { GetAddonsCodeguardWebsiteListV1200, HostingInfo200, GetHostingFtpV1200, PostHostingFtpV1200, PostHostingFtpV1Body, SitesSso200, GetSitesInfoV1200, HostingSites200 } from './models';
|
|
11
11
|
declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @summary
|
|
13
|
+
* Return all website records CodeGuard maintains for this user's account.
|
|
14
|
+
* @summary addons codeguard website_list
|
|
15
15
|
*/
|
|
16
|
-
export declare const
|
|
17
|
-
export declare
|
|
18
|
-
export declare type
|
|
19
|
-
export declare
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
export declare const getAddonsCodeguardWebsiteListV1: (addonId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<GetAddonsCodeguardWebsiteListV1200>>;
|
|
17
|
+
export declare const getGetAddonsCodeguardWebsiteListV1QueryKey: (addonId: number) => string[];
|
|
18
|
+
export declare type GetAddonsCodeguardWebsiteListV1QueryResult = NonNullable<AsyncReturnType<typeof getAddonsCodeguardWebsiteListV1>>;
|
|
19
|
+
export declare type GetAddonsCodeguardWebsiteListV1QueryError = AxiosError<unknown>;
|
|
20
|
+
export declare const useGetAddonsCodeguardWebsiteListV1: <TData = AxiosResponse<GetAddonsCodeguardWebsiteListV1200, any>, TError = AxiosError<unknown, any>>(addonId: number, options?: {
|
|
21
|
+
query?: UseQueryOptions<AxiosResponse<GetAddonsCodeguardWebsiteListV1200, any>, TError, TData, QueryKey> | undefined;
|
|
22
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
23
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
24
|
+
queryKey: QueryKey;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Return info about a specific account
|
|
28
|
+
* @summary hosting info
|
|
29
|
+
*/
|
|
30
|
+
export declare const hostingInfo: (hostingId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<HostingInfo200>>;
|
|
31
|
+
export declare const getHostingInfoQueryKey: (hostingId: number) => string[];
|
|
32
|
+
export declare type HostingInfoQueryResult = NonNullable<AsyncReturnType<typeof hostingInfo>>;
|
|
33
|
+
export declare type HostingInfoQueryError = AxiosError<unknown>;
|
|
34
|
+
export declare const useHostingInfo: <TData = AxiosResponse<HostingInfo200, any>, TError = AxiosError<unknown, any>>(hostingId: number, options?: {
|
|
35
|
+
query?: UseQueryOptions<AxiosResponse<HostingInfo200, any>, TError, TData, QueryKey> | undefined;
|
|
36
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
37
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
38
|
+
queryKey: QueryKey;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* List FTP accounts.
|
|
42
|
+
* @summary hosting ftp
|
|
43
|
+
*/
|
|
44
|
+
export declare const getHostingFtpV1: (hostingId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<GetHostingFtpV1200>>;
|
|
45
|
+
export declare const getGetHostingFtpV1QueryKey: (hostingId: number) => string[];
|
|
46
|
+
export declare type GetHostingFtpV1QueryResult = NonNullable<AsyncReturnType<typeof getHostingFtpV1>>;
|
|
47
|
+
export declare type GetHostingFtpV1QueryError = AxiosError<unknown>;
|
|
48
|
+
export declare const useGetHostingFtpV1: <TData = AxiosResponse<GetHostingFtpV1200, any>, TError = AxiosError<unknown, any>>(hostingId: number, options?: {
|
|
49
|
+
query?: UseQueryOptions<AxiosResponse<GetHostingFtpV1200, any>, TError, TData, QueryKey> | undefined;
|
|
50
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
51
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
52
|
+
queryKey: QueryKey;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Makes a FTP account and returns login credentials for it.
|
|
56
|
+
* @summary hosting ftp
|
|
57
|
+
*/
|
|
58
|
+
export declare const postHostingFtpV1: (hostingId: number, postHostingFtpV1Body: PostHostingFtpV1Body, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<PostHostingFtpV1200>>;
|
|
59
|
+
export declare type PostHostingFtpV1MutationResult = NonNullable<AsyncReturnType<typeof postHostingFtpV1>>;
|
|
60
|
+
export declare type PostHostingFtpV1MutationBody = PostHostingFtpV1Body;
|
|
61
|
+
export declare type PostHostingFtpV1MutationError = AxiosError<unknown>;
|
|
62
|
+
export declare const usePostHostingFtpV1: <TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
|
|
63
|
+
mutation?: UseMutationOptions<AxiosResponse<PostHostingFtpV1200, any>, TError, {
|
|
64
|
+
hostingId: number;
|
|
65
|
+
data: PostHostingFtpV1Body;
|
|
22
66
|
}, TContext> | undefined;
|
|
23
67
|
axios?: AxiosRequestConfig<any> | undefined;
|
|
24
|
-
} | undefined) => import("react-query").UseMutationResult<AxiosResponse<
|
|
25
|
-
|
|
68
|
+
} | undefined) => import("react-query").UseMutationResult<AxiosResponse<PostHostingFtpV1200, any>, TError, {
|
|
69
|
+
hostingId: number;
|
|
70
|
+
data: PostHostingFtpV1Body;
|
|
26
71
|
}, TContext>;
|
|
72
|
+
/**
|
|
73
|
+
* Return an SSO token or login URL for this site (if supported).
|
|
74
|
+
* @summary sites sso
|
|
75
|
+
*/
|
|
76
|
+
export declare const sitesSso: (siteId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<SitesSso200>>;
|
|
77
|
+
export declare const getSitesSsoQueryKey: (siteId: number) => string[];
|
|
78
|
+
export declare type SitesSsoQueryResult = NonNullable<AsyncReturnType<typeof sitesSso>>;
|
|
79
|
+
export declare type SitesSsoQueryError = AxiosError<unknown>;
|
|
80
|
+
export declare const useSitesSso: <TData = AxiosResponse<SitesSso200, any>, TError = AxiosError<unknown, any>>(siteId: number, options?: {
|
|
81
|
+
query?: UseQueryOptions<AxiosResponse<SitesSso200, any>, TError, TData, QueryKey> | undefined;
|
|
82
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
83
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
84
|
+
queryKey: QueryKey;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Return info about a specific site
|
|
88
|
+
* @summary sites info
|
|
89
|
+
*/
|
|
90
|
+
export declare const getSitesInfoV1: (siteId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<GetSitesInfoV1200>>;
|
|
91
|
+
export declare const getGetSitesInfoV1QueryKey: (siteId: number) => string[];
|
|
92
|
+
export declare type GetSitesInfoV1QueryResult = NonNullable<AsyncReturnType<typeof getSitesInfoV1>>;
|
|
93
|
+
export declare type GetSitesInfoV1QueryError = AxiosError<unknown>;
|
|
94
|
+
export declare const useGetSitesInfoV1: <TData = AxiosResponse<GetSitesInfoV1200, any>, TError = AxiosError<unknown, any>>(siteId: number, options?: {
|
|
95
|
+
query?: UseQueryOptions<AxiosResponse<GetSitesInfoV1200, any>, TError, TData, QueryKey> | undefined;
|
|
96
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
97
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
98
|
+
queryKey: QueryKey;
|
|
99
|
+
};
|
|
27
100
|
/**
|
|
28
101
|
* Obtain a list of sites.
|
|
29
|
-
* @summary
|
|
102
|
+
* @summary hosting sites
|
|
30
103
|
*/
|
|
31
|
-
export declare const hostingSites: (hostingId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<
|
|
104
|
+
export declare const hostingSites: (hostingId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<HostingSites200>>;
|
|
32
105
|
export declare const getHostingSitesQueryKey: (hostingId: number) => string[];
|
|
33
106
|
export declare type HostingSitesQueryResult = NonNullable<AsyncReturnType<typeof hostingSites>>;
|
|
34
107
|
export declare type HostingSitesQueryError = AxiosError<unknown>;
|
|
35
|
-
export declare const useHostingSites: <TData = AxiosResponse<
|
|
36
|
-
query?: UseQueryOptions<AxiosResponse<
|
|
108
|
+
export declare const useHostingSites: <TData = AxiosResponse<HostingSites200, any>, TError = AxiosError<unknown, any>>(hostingId: number, options?: {
|
|
109
|
+
query?: UseQueryOptions<AxiosResponse<HostingSites200, any>, TError, TData, QueryKey> | undefined;
|
|
37
110
|
axios?: AxiosRequestConfig<any> | undefined;
|
|
38
111
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
39
112
|
queryKey: QueryKey;
|
package/dist/index.js
CHANGED
|
@@ -3,42 +3,137 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useHostingSites = exports.getHostingSitesQueryKey = exports.hostingSites = exports.
|
|
6
|
+
exports.useHostingSites = exports.getHostingSitesQueryKey = exports.hostingSites = exports.useGetSitesInfoV1 = exports.getGetSitesInfoV1QueryKey = exports.getSitesInfoV1 = exports.useSitesSso = exports.getSitesSsoQueryKey = exports.sitesSso = exports.usePostHostingFtpV1 = exports.postHostingFtpV1 = exports.useGetHostingFtpV1 = exports.getGetHostingFtpV1QueryKey = exports.getHostingFtpV1 = exports.useHostingInfo = exports.getHostingInfoQueryKey = exports.hostingInfo = exports.useGetAddonsCodeguardWebsiteListV1 = exports.getGetAddonsCodeguardWebsiteListV1QueryKey = exports.getAddonsCodeguardWebsiteListV1 = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* Generated by orval v6.7.1 🍺
|
|
9
9
|
* Do not edit manually.
|
|
10
10
|
* Hosting UAPI
|
|
11
11
|
* Hosting UAPI
|
|
12
|
-
* OpenAPI spec version: 0.1
|
|
12
|
+
* OpenAPI spec version: 0.0.1
|
|
13
13
|
*/
|
|
14
14
|
const axios_1 = __importDefault(require("axios"));
|
|
15
15
|
const react_query_1 = require("react-query");
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @summary
|
|
17
|
+
* Return all website records CodeGuard maintains for this user's account.
|
|
18
|
+
* @summary addons codeguard website_list
|
|
19
19
|
*/
|
|
20
|
-
const
|
|
21
|
-
return axios_1.default.
|
|
20
|
+
const getAddonsCodeguardWebsiteListV1 = (addonId, options) => {
|
|
21
|
+
return axios_1.default.get(`/v1/addons/codeguard/${addonId}/website_list`, options);
|
|
22
22
|
};
|
|
23
|
-
exports.
|
|
24
|
-
const
|
|
23
|
+
exports.getAddonsCodeguardWebsiteListV1 = getAddonsCodeguardWebsiteListV1;
|
|
24
|
+
const getGetAddonsCodeguardWebsiteListV1QueryKey = (addonId) => [`/v1/addons/codeguard/${addonId}/website_list`];
|
|
25
|
+
exports.getGetAddonsCodeguardWebsiteListV1QueryKey = getGetAddonsCodeguardWebsiteListV1QueryKey;
|
|
26
|
+
const useGetAddonsCodeguardWebsiteListV1 = (addonId, options) => {
|
|
27
|
+
var _a;
|
|
28
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
29
|
+
const queryKey = (_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.queryKey) !== null && _a !== void 0 ? _a : (0, exports.getGetAddonsCodeguardWebsiteListV1QueryKey)(addonId);
|
|
30
|
+
const queryFn = () => (0, exports.getAddonsCodeguardWebsiteListV1)(addonId, axiosOptions);
|
|
31
|
+
const query = (0, react_query_1.useQuery)(queryKey, queryFn, Object.assign({ enabled: !!(addonId) }, queryOptions));
|
|
32
|
+
return Object.assign({ queryKey }, query);
|
|
33
|
+
};
|
|
34
|
+
exports.useGetAddonsCodeguardWebsiteListV1 = useGetAddonsCodeguardWebsiteListV1;
|
|
35
|
+
/**
|
|
36
|
+
* Return info about a specific account
|
|
37
|
+
* @summary hosting info
|
|
38
|
+
*/
|
|
39
|
+
const hostingInfo = (hostingId, options) => {
|
|
40
|
+
return axios_1.default.get(`/v1/hosting/${hostingId}/info`, options);
|
|
41
|
+
};
|
|
42
|
+
exports.hostingInfo = hostingInfo;
|
|
43
|
+
const getHostingInfoQueryKey = (hostingId) => [`/v1/hosting/${hostingId}/info`];
|
|
44
|
+
exports.getHostingInfoQueryKey = getHostingInfoQueryKey;
|
|
45
|
+
const useHostingInfo = (hostingId, options) => {
|
|
46
|
+
var _a;
|
|
47
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
48
|
+
const queryKey = (_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.queryKey) !== null && _a !== void 0 ? _a : (0, exports.getHostingInfoQueryKey)(hostingId);
|
|
49
|
+
const queryFn = () => (0, exports.hostingInfo)(hostingId, axiosOptions);
|
|
50
|
+
const query = (0, react_query_1.useQuery)(queryKey, queryFn, Object.assign({ enabled: !!(hostingId) }, queryOptions));
|
|
51
|
+
return Object.assign({ queryKey }, query);
|
|
52
|
+
};
|
|
53
|
+
exports.useHostingInfo = useHostingInfo;
|
|
54
|
+
/**
|
|
55
|
+
* List FTP accounts.
|
|
56
|
+
* @summary hosting ftp
|
|
57
|
+
*/
|
|
58
|
+
const getHostingFtpV1 = (hostingId, options) => {
|
|
59
|
+
return axios_1.default.get(`/v1/hosting/${hostingId}/ftp`, options);
|
|
60
|
+
};
|
|
61
|
+
exports.getHostingFtpV1 = getHostingFtpV1;
|
|
62
|
+
const getGetHostingFtpV1QueryKey = (hostingId) => [`/v1/hosting/${hostingId}/ftp`];
|
|
63
|
+
exports.getGetHostingFtpV1QueryKey = getGetHostingFtpV1QueryKey;
|
|
64
|
+
const useGetHostingFtpV1 = (hostingId, options) => {
|
|
65
|
+
var _a;
|
|
66
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
67
|
+
const queryKey = (_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.queryKey) !== null && _a !== void 0 ? _a : (0, exports.getGetHostingFtpV1QueryKey)(hostingId);
|
|
68
|
+
const queryFn = () => (0, exports.getHostingFtpV1)(hostingId, axiosOptions);
|
|
69
|
+
const query = (0, react_query_1.useQuery)(queryKey, queryFn, Object.assign({ enabled: !!(hostingId) }, queryOptions));
|
|
70
|
+
return Object.assign({ queryKey }, query);
|
|
71
|
+
};
|
|
72
|
+
exports.useGetHostingFtpV1 = useGetHostingFtpV1;
|
|
73
|
+
/**
|
|
74
|
+
* Makes a FTP account and returns login credentials for it.
|
|
75
|
+
* @summary hosting ftp
|
|
76
|
+
*/
|
|
77
|
+
const postHostingFtpV1 = (hostingId, postHostingFtpV1Body, options) => {
|
|
78
|
+
return axios_1.default.post(`/v1/hosting/${hostingId}/ftp`, postHostingFtpV1Body, options);
|
|
79
|
+
};
|
|
80
|
+
exports.postHostingFtpV1 = postHostingFtpV1;
|
|
81
|
+
const usePostHostingFtpV1 = (options) => {
|
|
25
82
|
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
26
83
|
const mutationFn = (props) => {
|
|
27
|
-
const {
|
|
28
|
-
return (0, exports.
|
|
84
|
+
const { hostingId, data } = props || {};
|
|
85
|
+
return (0, exports.postHostingFtpV1)(hostingId, data, axiosOptions);
|
|
29
86
|
};
|
|
30
87
|
return (0, react_query_1.useMutation)(mutationFn, mutationOptions);
|
|
31
88
|
};
|
|
32
|
-
exports.
|
|
89
|
+
exports.usePostHostingFtpV1 = usePostHostingFtpV1;
|
|
90
|
+
/**
|
|
91
|
+
* Return an SSO token or login URL for this site (if supported).
|
|
92
|
+
* @summary sites sso
|
|
93
|
+
*/
|
|
94
|
+
const sitesSso = (siteId, options) => {
|
|
95
|
+
return axios_1.default.get(`/v1/sites/${siteId}/sso`, options);
|
|
96
|
+
};
|
|
97
|
+
exports.sitesSso = sitesSso;
|
|
98
|
+
const getSitesSsoQueryKey = (siteId) => [`/v1/sites/${siteId}/sso`];
|
|
99
|
+
exports.getSitesSsoQueryKey = getSitesSsoQueryKey;
|
|
100
|
+
const useSitesSso = (siteId, options) => {
|
|
101
|
+
var _a;
|
|
102
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
103
|
+
const queryKey = (_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.queryKey) !== null && _a !== void 0 ? _a : (0, exports.getSitesSsoQueryKey)(siteId);
|
|
104
|
+
const queryFn = () => (0, exports.sitesSso)(siteId, axiosOptions);
|
|
105
|
+
const query = (0, react_query_1.useQuery)(queryKey, queryFn, Object.assign({ enabled: !!(siteId) }, queryOptions));
|
|
106
|
+
return Object.assign({ queryKey }, query);
|
|
107
|
+
};
|
|
108
|
+
exports.useSitesSso = useSitesSso;
|
|
109
|
+
/**
|
|
110
|
+
* Return info about a specific site
|
|
111
|
+
* @summary sites info
|
|
112
|
+
*/
|
|
113
|
+
const getSitesInfoV1 = (siteId, options) => {
|
|
114
|
+
return axios_1.default.get(`/v1/sites/${siteId}/info`, options);
|
|
115
|
+
};
|
|
116
|
+
exports.getSitesInfoV1 = getSitesInfoV1;
|
|
117
|
+
const getGetSitesInfoV1QueryKey = (siteId) => [`/v1/sites/${siteId}/info`];
|
|
118
|
+
exports.getGetSitesInfoV1QueryKey = getGetSitesInfoV1QueryKey;
|
|
119
|
+
const useGetSitesInfoV1 = (siteId, options) => {
|
|
120
|
+
var _a;
|
|
121
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
122
|
+
const queryKey = (_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.queryKey) !== null && _a !== void 0 ? _a : (0, exports.getGetSitesInfoV1QueryKey)(siteId);
|
|
123
|
+
const queryFn = () => (0, exports.getSitesInfoV1)(siteId, axiosOptions);
|
|
124
|
+
const query = (0, react_query_1.useQuery)(queryKey, queryFn, Object.assign({ enabled: !!(siteId) }, queryOptions));
|
|
125
|
+
return Object.assign({ queryKey }, query);
|
|
126
|
+
};
|
|
127
|
+
exports.useGetSitesInfoV1 = useGetSitesInfoV1;
|
|
33
128
|
/**
|
|
34
129
|
* Obtain a list of sites.
|
|
35
|
-
* @summary
|
|
130
|
+
* @summary hosting sites
|
|
36
131
|
*/
|
|
37
132
|
const hostingSites = (hostingId, options) => {
|
|
38
|
-
return axios_1.default.get(`/hosting/${hostingId}/sites`, options);
|
|
133
|
+
return axios_1.default.get(`/v1/hosting/${hostingId}/sites`, options);
|
|
39
134
|
};
|
|
40
135
|
exports.hostingSites = hostingSites;
|
|
41
|
-
const getHostingSitesQueryKey = (hostingId) => [`/hosting/${hostingId}/sites`];
|
|
136
|
+
const getHostingSitesQueryKey = (hostingId) => [`/v1/hosting/${hostingId}/sites`];
|
|
42
137
|
exports.getHostingSitesQueryKey = getHostingSitesQueryKey;
|
|
43
138
|
const useHostingSites = (hostingId, options) => {
|
|
44
139
|
var _a;
|
package/dist/index.msw.d.ts
CHANGED
|
@@ -1,15 +1,42 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
1
|
+
export declare const getGetAddonsCodeguardWebsiteListV1Mock: () => {
|
|
2
|
+
website_list: {
|
|
3
|
+
website: {
|
|
4
|
+
url: string | undefined;
|
|
5
|
+
} | undefined;
|
|
6
|
+
}[] | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare const getHostingInfoMock: () => {
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const getGetHostingFtpV1Mock: () => {
|
|
12
|
+
ftp_account: {
|
|
13
|
+
user: string | undefined;
|
|
14
|
+
homedir: string | undefined;
|
|
15
|
+
}[] | undefined;
|
|
16
|
+
};
|
|
17
|
+
export declare const getPostHostingFtpV1Mock: () => {
|
|
18
|
+
user: string | undefined;
|
|
19
|
+
pass: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
export declare const getSitesSsoMock: () => {
|
|
22
|
+
sso: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
export declare const getGetSitesInfoV1Mock: () => {
|
|
25
|
+
docroot: string;
|
|
26
|
+
uuid: string;
|
|
27
|
+
date_added: string;
|
|
28
|
+
date_modified: string;
|
|
29
|
+
type: string;
|
|
30
|
+
subtype: string;
|
|
31
|
+
status: string;
|
|
32
|
+
url: string;
|
|
33
|
+
name: string;
|
|
3
34
|
};
|
|
4
35
|
export declare const getHostingSitesMock: () => {
|
|
5
|
-
limit: number;
|
|
6
|
-
n_pages: number;
|
|
7
|
-
n_rows: number;
|
|
8
|
-
page: number;
|
|
9
36
|
rows: {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
url: string;
|
|
13
|
-
}[];
|
|
37
|
+
id: string | undefined;
|
|
38
|
+
name: string | undefined;
|
|
39
|
+
url: string | undefined;
|
|
40
|
+
}[] | undefined;
|
|
14
41
|
};
|
|
15
42
|
export declare const getHostingUAPIMSW: () => import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>[];
|
package/dist/index.msw.js
CHANGED
|
@@ -1,23 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHostingUAPIMSW = exports.getHostingSitesMock = exports.
|
|
3
|
+
exports.getHostingUAPIMSW = exports.getHostingSitesMock = exports.getGetSitesInfoV1Mock = exports.getSitesSsoMock = exports.getPostHostingFtpV1Mock = exports.getGetHostingFtpV1Mock = exports.getHostingInfoMock = exports.getGetAddonsCodeguardWebsiteListV1Mock = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Generated by orval v6.7.1 🍺
|
|
6
6
|
* Do not edit manually.
|
|
7
7
|
* Hosting UAPI
|
|
8
8
|
* Hosting UAPI
|
|
9
|
-
* OpenAPI spec version: 0.1
|
|
9
|
+
* OpenAPI spec version: 0.0.1
|
|
10
10
|
*/
|
|
11
11
|
const msw_1 = require("msw");
|
|
12
12
|
const faker_1 = require("@faker-js/faker");
|
|
13
|
-
const
|
|
14
|
-
exports.
|
|
15
|
-
const
|
|
13
|
+
const getGetAddonsCodeguardWebsiteListV1Mock = () => ({ website_list: faker_1.faker.helpers.randomize([[...Array(faker_1.faker.datatype.number({ min: 1, max: 10 }))].map(() => ({ website: faker_1.faker.helpers.randomize([{ url: faker_1.faker.helpers.randomize([faker_1.faker.random.word(), undefined]) }, undefined]) })), undefined]) });
|
|
14
|
+
exports.getGetAddonsCodeguardWebsiteListV1Mock = getGetAddonsCodeguardWebsiteListV1Mock;
|
|
15
|
+
const getHostingInfoMock = () => ({ id: faker_1.faker.random.word() });
|
|
16
|
+
exports.getHostingInfoMock = getHostingInfoMock;
|
|
17
|
+
const getGetHostingFtpV1Mock = () => ({ ftp_account: faker_1.faker.helpers.randomize([[...Array(faker_1.faker.datatype.number({ min: 1, max: 10 }))].map(() => ({ user: faker_1.faker.helpers.randomize([faker_1.faker.random.word(), undefined]), homedir: faker_1.faker.helpers.randomize([faker_1.faker.random.word(), undefined]) })), undefined]) });
|
|
18
|
+
exports.getGetHostingFtpV1Mock = getGetHostingFtpV1Mock;
|
|
19
|
+
const getPostHostingFtpV1Mock = () => ({ user: faker_1.faker.helpers.randomize([faker_1.faker.random.word(), undefined]), pass: faker_1.faker.helpers.randomize([faker_1.faker.random.word(), undefined]) });
|
|
20
|
+
exports.getPostHostingFtpV1Mock = getPostHostingFtpV1Mock;
|
|
21
|
+
const getSitesSsoMock = () => ({ sso: faker_1.faker.helpers.randomize([faker_1.faker.random.word(), undefined]) });
|
|
22
|
+
exports.getSitesSsoMock = getSitesSsoMock;
|
|
23
|
+
const getGetSitesInfoV1Mock = () => ({ docroot: faker_1.faker.random.word(), uuid: faker_1.faker.random.word(), date_added: faker_1.faker.random.word(), date_modified: faker_1.faker.random.word(), type: faker_1.faker.random.word(), subtype: faker_1.faker.random.word(), status: faker_1.faker.random.word(), url: faker_1.faker.random.word(), name: faker_1.faker.random.word() });
|
|
24
|
+
exports.getGetSitesInfoV1Mock = getGetSitesInfoV1Mock;
|
|
25
|
+
const getHostingSitesMock = () => ({ rows: faker_1.faker.helpers.randomize([[...Array(faker_1.faker.datatype.number({ min: 1, max: 10 }))].map(() => ({ id: faker_1.faker.helpers.randomize([faker_1.faker.random.word(), undefined]), name: faker_1.faker.helpers.randomize([faker_1.faker.random.word(), undefined]), url: faker_1.faker.helpers.randomize([faker_1.faker.random.word(), undefined]) })), undefined]) });
|
|
16
26
|
exports.getHostingSitesMock = getHostingSitesMock;
|
|
17
27
|
const getHostingUAPIMSW = () => [
|
|
18
|
-
msw_1.rest.
|
|
19
|
-
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.
|
|
20
|
-
}), msw_1.rest.get('*/hosting/:hostingid/
|
|
28
|
+
msw_1.rest.get('*/v1/addons/codeguard/:addonid/website_list', (_req, res, ctx) => {
|
|
29
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getGetAddonsCodeguardWebsiteListV1Mock)()));
|
|
30
|
+
}), msw_1.rest.get('*/v1/hosting/:hostingid/info', (_req, res, ctx) => {
|
|
31
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getHostingInfoMock)()));
|
|
32
|
+
}), msw_1.rest.get('*/v1/hosting/:hostingid/ftp', (_req, res, ctx) => {
|
|
33
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getGetHostingFtpV1Mock)()));
|
|
34
|
+
}), msw_1.rest.post('*/v1/hosting/:hostingid/ftp', (_req, res, ctx) => {
|
|
35
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getPostHostingFtpV1Mock)()));
|
|
36
|
+
}), msw_1.rest.get('*/v1/sites/:siteid/sso', (_req, res, ctx) => {
|
|
37
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getSitesSsoMock)()));
|
|
38
|
+
}), msw_1.rest.get('*/v1/sites/:siteid/info', (_req, res, ctx) => {
|
|
39
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getGetSitesInfoV1Mock)()));
|
|
40
|
+
}), msw_1.rest.get('*/v1/hosting/:hostingid/sites', (_req, res, ctx) => {
|
|
21
41
|
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getHostingSitesMock)()));
|
|
22
42
|
}),
|
|
23
43
|
];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hosting UAPI
|
|
5
|
+
* Hosting UAPI
|
|
6
|
+
* OpenAPI spec version: 0.0.1
|
|
7
|
+
*/
|
|
8
|
+
import type { GetAddonsCodeguardWebsiteListV1200WebsiteListItem } from './getAddonsCodeguardWebsiteListV1200WebsiteListItem';
|
|
9
|
+
export declare type GetAddonsCodeguardWebsiteListV1200 = {
|
|
10
|
+
website_list?: GetAddonsCodeguardWebsiteListV1200WebsiteListItem[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hosting UAPI
|
|
5
|
+
* Hosting UAPI
|
|
6
|
+
* OpenAPI spec version: 0.0.1
|
|
7
|
+
*/
|
|
8
|
+
import type { GetAddonsCodeguardWebsiteListV1200WebsiteListItemWebsite } from './getAddonsCodeguardWebsiteListV1200WebsiteListItemWebsite';
|
|
9
|
+
export declare type GetAddonsCodeguardWebsiteListV1200WebsiteListItem = {
|
|
10
|
+
website?: GetAddonsCodeguardWebsiteListV1200WebsiteListItemWebsite;
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hosting UAPI
|
|
5
|
+
*/
|
|
6
|
+
import type { GetAddonsCodeguardWebsitesV1200WebsiteListItem } from './getAddonsCodeguardWebsitesV1200WebsiteListItem';
|
|
7
|
+
export declare type GetAddonsCodeguardWebsitesV1200 = {
|
|
8
|
+
website_list?: GetAddonsCodeguardWebsitesV1200WebsiteListItem[];
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hosting UAPI
|
|
5
|
+
*/
|
|
6
|
+
import type { GetAddonsCodeguardWebsitesV1200WebsiteListItemWebsite } from './getAddonsCodeguardWebsitesV1200WebsiteListItemWebsite';
|
|
7
|
+
export declare type GetAddonsCodeguardWebsitesV1200WebsiteListItem = {
|
|
8
|
+
website?: GetAddonsCodeguardWebsitesV1200WebsiteListItemWebsite;
|
|
9
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hosting UAPI
|
|
5
|
+
* Hosting UAPI
|
|
6
|
+
* OpenAPI spec version: 0.0.1
|
|
7
|
+
*/
|
|
8
|
+
import type { GetHostingFtpV1200FtpAccountItem } from './getHostingFtpV1200FtpAccountItem';
|
|
9
|
+
export declare type GetHostingFtpV1200 = {
|
|
10
|
+
ftp_account?: GetHostingFtpV1200FtpAccountItem[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hosting UAPI
|
|
5
|
+
* Hosting UAPI
|
|
6
|
+
* OpenAPI spec version: 0.0.1
|
|
7
|
+
*/
|
|
8
|
+
export declare type GetSitesInfoV1200 = {
|
|
9
|
+
docroot: string;
|
|
10
|
+
uuid: string;
|
|
11
|
+
date_added: string;
|
|
12
|
+
date_modified: string;
|
|
13
|
+
type: string;
|
|
14
|
+
subtype: string;
|
|
15
|
+
status: string;
|
|
16
|
+
url: string;
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hosting UAPI
|
|
5
|
+
* Hosting UAPI
|
|
6
|
+
* OpenAPI spec version: 0.0.1
|
|
7
|
+
*/
|
|
8
|
+
import type { HostingSites200RowsItem } from './hostingSites200RowsItem';
|
|
9
|
+
export declare type HostingSites200 = {
|
|
10
|
+
rows?: HostingSites200RowsItem[];
|
|
11
|
+
};
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
export * from './siteList';
|
|
2
1
|
export * from './site';
|
|
2
|
+
export * from './siteList';
|
|
3
3
|
export * from './siteSso';
|
|
4
|
+
export * from './getAddonsCodeguardWebsitesV1200WebsiteListItem';
|
|
5
|
+
export * from './getAddonsCodeguardWebsitesV1200WebsiteListItemWebsite';
|
|
6
|
+
export * from './getAddonsCodeguardWebsitesV1200';
|
|
7
|
+
export * from './getHostingFtpV1200FtpAccountItem';
|
|
8
|
+
export * from './postHostingFtpV1Body';
|
|
9
|
+
export * from './getHostingFtpV1200';
|
|
10
|
+
export * from './getHostingInfoV1200';
|
|
11
|
+
export * from './getSitesSsoV1200';
|
|
12
|
+
export * from './postHostingFtpV1200';
|
|
13
|
+
export * from './getHostingSitesV1200RowsItem';
|
|
14
|
+
export * from './getHostingSitesV1200';
|
|
15
|
+
export * from './getAddonsCodeguardWebsiteListV1200WebsiteListItem';
|
|
16
|
+
export * from './getAddonsCodeguardWebsiteListV1200';
|
|
17
|
+
export * from './getAddonsCodeguardWebsiteListV1200WebsiteListItemWebsite';
|
|
18
|
+
export * from './getSitesInfoV1200';
|
|
19
|
+
export * from './hostingInfo200';
|
|
20
|
+
export * from './sitesSso200';
|
|
21
|
+
export * from './hostingSites200';
|
|
22
|
+
export * from './hostingSites200RowsItem';
|
package/dist/models/index.js
CHANGED
|
@@ -14,6 +14,25 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./siteList"), exports);
|
|
18
17
|
__exportStar(require("./site"), exports);
|
|
18
|
+
__exportStar(require("./siteList"), exports);
|
|
19
19
|
__exportStar(require("./siteSso"), exports);
|
|
20
|
+
__exportStar(require("./getAddonsCodeguardWebsitesV1200WebsiteListItem"), exports);
|
|
21
|
+
__exportStar(require("./getAddonsCodeguardWebsitesV1200WebsiteListItemWebsite"), exports);
|
|
22
|
+
__exportStar(require("./getAddonsCodeguardWebsitesV1200"), exports);
|
|
23
|
+
__exportStar(require("./getHostingFtpV1200FtpAccountItem"), exports);
|
|
24
|
+
__exportStar(require("./postHostingFtpV1Body"), exports);
|
|
25
|
+
__exportStar(require("./getHostingFtpV1200"), exports);
|
|
26
|
+
__exportStar(require("./getHostingInfoV1200"), exports);
|
|
27
|
+
__exportStar(require("./getSitesSsoV1200"), exports);
|
|
28
|
+
__exportStar(require("./postHostingFtpV1200"), exports);
|
|
29
|
+
__exportStar(require("./getHostingSitesV1200RowsItem"), exports);
|
|
30
|
+
__exportStar(require("./getHostingSitesV1200"), exports);
|
|
31
|
+
__exportStar(require("./getAddonsCodeguardWebsiteListV1200WebsiteListItem"), exports);
|
|
32
|
+
__exportStar(require("./getAddonsCodeguardWebsiteListV1200"), exports);
|
|
33
|
+
__exportStar(require("./getAddonsCodeguardWebsiteListV1200WebsiteListItemWebsite"), exports);
|
|
34
|
+
__exportStar(require("./getSitesInfoV1200"), exports);
|
|
35
|
+
__exportStar(require("./hostingInfo200"), exports);
|
|
36
|
+
__exportStar(require("./sitesSso200"), exports);
|
|
37
|
+
__exportStar(require("./hostingSites200"), exports);
|
|
38
|
+
__exportStar(require("./hostingSites200RowsItem"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hosting UAPI
|
|
5
|
+
* Hosting UAPI
|
|
6
|
+
* OpenAPI spec version: 0.0.1
|
|
7
|
+
*/
|
|
8
|
+
export declare type PostHostingFtpV1Body = {
|
|
9
|
+
/** Optional username. If not included then type is required and will generate a random username. Good for temp ftp user. Do not append domain. */
|
|
10
|
+
user?: string;
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newfold/huapi-js",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,8 +22,10 @@
|
|
|
22
22
|
"react": "^17.0.0 || ^18.0.0"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
+
"get-schema": "curl -O https://beta-hosting-uapi.apps.provo1.endurancemb.com/openapi.json",
|
|
26
|
+
"clean": "rm -rf ./dist",
|
|
25
27
|
"orval": "orval",
|
|
26
|
-
"
|
|
27
|
-
"build": "yarn orval && yarn
|
|
28
|
+
"typescript": "npx tsc",
|
|
29
|
+
"build": "yarn clean && yarn get-schema && yarn orval && yarn typescript"
|
|
28
30
|
}
|
|
29
31
|
}
|