@newfold/huapi-js 1.2.6 → 1.2.8-alpha.1
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/data/sites.d.ts +19 -0
- package/dist/handlers/sites/data/sites.js +178 -0
- package/dist/handlers/sites/getHostingSitesHandler.d.ts +9 -0
- package/dist/handlers/sites/getHostingSitesHandler.js +17 -0
- package/{src/msw/handlers/index.js → dist/handlers.msw.d.ts} +1 -1
- package/dist/handlers.msw.js +21 -0
- package/dist/index.d.ts +114 -0
- package/dist/index.js +146 -0
- package/dist/index.msw.d.ts +42 -0
- package/dist/index.msw.js +44 -0
- 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 +22 -0
- package/dist/models/index.js +38 -0
- 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/site.d.ts +18 -0
- package/dist/models/site.js +9 -0
- package/dist/models/siteList.d.ts +23 -0
- package/dist/models/siteList.js +2 -0
- package/dist/models/siteSso.d.ts +14 -0
- package/dist/models/siteSso.js +9 -0
- package/dist/models/sitesSso200.d.ts +10 -0
- package/dist/models/sitesSso200.js +9 -0
- package/package.json +11 -6
- package/openapi.json +0 -209
- package/orval.config.js +0 -22
- package/prettier.config.js +0 -4
- package/src/msw/handlers/sites/data/sites.js +0 -172
- package/src/msw/handlers/sites/getHostingSitesHandler.js +0 -24
- package/src/msw/sites.js +0 -153
- package/tsconfig.json +0 -101
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const getResponseByStatus: (responseKey: string, status: number) => {
|
|
2
|
+
message: string;
|
|
3
|
+
limit?: undefined;
|
|
4
|
+
n_pages?: undefined;
|
|
5
|
+
n_rows?: undefined;
|
|
6
|
+
page?: undefined;
|
|
7
|
+
rows?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
limit: number;
|
|
10
|
+
n_pages: number;
|
|
11
|
+
n_rows: number;
|
|
12
|
+
page: number;
|
|
13
|
+
rows: {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
url: string;
|
|
17
|
+
}[];
|
|
18
|
+
message?: undefined;
|
|
19
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getResponseByStatus = void 0;
|
|
4
|
+
const rows = [
|
|
5
|
+
{
|
|
6
|
+
id: '1',
|
|
7
|
+
name: 'Site 1',
|
|
8
|
+
url: 'https://site-1.com',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: '2',
|
|
12
|
+
name: 'Site 2',
|
|
13
|
+
url: 'https://site-2.com',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: '3',
|
|
17
|
+
name: 'Site 3',
|
|
18
|
+
url: 'https://site-3.com',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: '4',
|
|
22
|
+
name: 'Site 4',
|
|
23
|
+
url: 'https://site-4.com',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: '5',
|
|
27
|
+
name: 'Site 5',
|
|
28
|
+
url: 'https://site-5.com',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: '6',
|
|
32
|
+
name: 'Site 6',
|
|
33
|
+
url: 'https://site-6.com',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: '7',
|
|
37
|
+
name: 'Site 7',
|
|
38
|
+
url: 'https://site-7.com',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: '8',
|
|
42
|
+
name: 'Site 8',
|
|
43
|
+
url: 'https://site-8.com',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: '9',
|
|
47
|
+
name: 'Site 9',
|
|
48
|
+
url: 'https://site-9.com',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: '10',
|
|
52
|
+
name: 'Site 10',
|
|
53
|
+
url: 'https://site-10.com',
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
const getResponseByStatus = (responseKey, status) => {
|
|
57
|
+
switch (status) {
|
|
58
|
+
case 500 - 599:
|
|
59
|
+
return {
|
|
60
|
+
message: 'Something went wrong',
|
|
61
|
+
};
|
|
62
|
+
case 200 - 299:
|
|
63
|
+
default:
|
|
64
|
+
switch (responseKey) {
|
|
65
|
+
case '0':
|
|
66
|
+
return {
|
|
67
|
+
limit: 10,
|
|
68
|
+
n_pages: 0,
|
|
69
|
+
n_rows: 0,
|
|
70
|
+
page: 1,
|
|
71
|
+
rows: [],
|
|
72
|
+
};
|
|
73
|
+
case '1':
|
|
74
|
+
return {
|
|
75
|
+
limit: 10,
|
|
76
|
+
n_pages: 1,
|
|
77
|
+
n_rows: 1,
|
|
78
|
+
page: 1,
|
|
79
|
+
rows: [rows[0]],
|
|
80
|
+
};
|
|
81
|
+
default:
|
|
82
|
+
case 'some':
|
|
83
|
+
return {
|
|
84
|
+
limit: 10,
|
|
85
|
+
n_pages: 1,
|
|
86
|
+
n_rows: 3,
|
|
87
|
+
page: 1,
|
|
88
|
+
rows,
|
|
89
|
+
};
|
|
90
|
+
case 'many':
|
|
91
|
+
return {
|
|
92
|
+
limit: 10,
|
|
93
|
+
n_pages: 50,
|
|
94
|
+
n_rows: 3,
|
|
95
|
+
page: 1,
|
|
96
|
+
rows: [
|
|
97
|
+
...rows,
|
|
98
|
+
{
|
|
99
|
+
id: '11',
|
|
100
|
+
name: 'Site 11',
|
|
101
|
+
url: 'https://site-11.com',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: '12',
|
|
105
|
+
name: 'Site 12',
|
|
106
|
+
url: 'https://site-12.com',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: '13',
|
|
110
|
+
name: 'Site 13',
|
|
111
|
+
url: 'https://site-13.com',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: '14',
|
|
115
|
+
name: 'Site 14',
|
|
116
|
+
url: 'https://site-14.com',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: '15',
|
|
120
|
+
name: 'Site 15',
|
|
121
|
+
url: 'https://site-15.com',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: '16',
|
|
125
|
+
name: 'Site 16',
|
|
126
|
+
url: 'https://site-16.com',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: '17',
|
|
130
|
+
name: 'Site 17',
|
|
131
|
+
url: 'https://site-17.com',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: '18',
|
|
135
|
+
name: 'Site 18',
|
|
136
|
+
url: 'https://site-18.com',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: '19',
|
|
140
|
+
name: 'Site 19',
|
|
141
|
+
url: 'https://site-19.com',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: '20',
|
|
145
|
+
name: 'Site 20',
|
|
146
|
+
url: 'https://site-20.com',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: '21',
|
|
150
|
+
name: 'Site 21',
|
|
151
|
+
url: 'https://site-21.com',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: '22',
|
|
155
|
+
name: 'Site 22',
|
|
156
|
+
url: 'https://site-22.com',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: '23',
|
|
160
|
+
name: 'Site 23',
|
|
161
|
+
url: 'https://site-23.com',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: '24',
|
|
165
|
+
name: 'Site 24',
|
|
166
|
+
url: 'https://site-24.com',
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: '25',
|
|
170
|
+
name: 'Site 25',
|
|
171
|
+
url: 'https://site-25.com',
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
exports.getResponseByStatus = getResponseByStatus;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* getHostingSitesHandler
|
|
3
|
+
* @param {string} responseKey - the key of the response to return from the responses object
|
|
4
|
+
* @param {int} status - the status code to mock
|
|
5
|
+
* @param {int} delay - the delay in ms to wait before returning the response
|
|
6
|
+
* @returns - a msw handler
|
|
7
|
+
*/
|
|
8
|
+
export declare function getHostingSitesHandler(responseKey?: string, // int or string
|
|
9
|
+
status?: number, delay?: number): import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHostingSitesHandler = void 0;
|
|
4
|
+
const msw_1 = require("msw");
|
|
5
|
+
const sites_1 = require("./data/sites");
|
|
6
|
+
/**
|
|
7
|
+
* getHostingSitesHandler
|
|
8
|
+
* @param {string} responseKey - the key of the response to return from the responses object
|
|
9
|
+
* @param {int} status - the status code to mock
|
|
10
|
+
* @param {int} delay - the delay in ms to wait before returning the response
|
|
11
|
+
* @returns - a msw handler
|
|
12
|
+
*/
|
|
13
|
+
function getHostingSitesHandler(responseKey = '1', // int or string
|
|
14
|
+
status = 200, delay = 1000) {
|
|
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
|
+
}
|
|
17
|
+
exports.getHostingSitesHandler = getHostingSitesHandler;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* NOTE: this will move to @newfold/huapi-js in the future
|
|
19
|
+
* Usage: `import { getHostingSitesHandler } from '@newfold/huapi-js';`
|
|
20
|
+
*/
|
|
21
|
+
__exportStar(require("./handlers/sites/getHostingSitesHandler"), exports);
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
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 { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
|
|
9
|
+
import { UseQueryOptions, UseMutationOptions, UseQueryResult, QueryKey } from 'react-query';
|
|
10
|
+
import type { GetAddonsCodeguardWebsiteListV1200, HostingInfo200, GetHostingFtpV1200, PostHostingFtpV1200, PostHostingFtpV1Body, SitesSso200, GetSitesInfoV1200, HostingSites200 } from './models';
|
|
11
|
+
declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
12
|
+
/**
|
|
13
|
+
* Return all website records CodeGuard maintains for this user's account.
|
|
14
|
+
* @summary addons codeguard website_list
|
|
15
|
+
*/
|
|
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;
|
|
66
|
+
}, TContext> | undefined;
|
|
67
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
68
|
+
} | undefined) => import("react-query").UseMutationResult<AxiosResponse<PostHostingFtpV1200, any>, TError, {
|
|
69
|
+
hostingId: number;
|
|
70
|
+
data: PostHostingFtpV1Body;
|
|
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
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Obtain a list of sites.
|
|
102
|
+
* @summary hosting sites
|
|
103
|
+
*/
|
|
104
|
+
export declare const hostingSites: (hostingId: number, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<HostingSites200>>;
|
|
105
|
+
export declare const getHostingSitesQueryKey: (hostingId: number) => string[];
|
|
106
|
+
export declare type HostingSitesQueryResult = NonNullable<AsyncReturnType<typeof hostingSites>>;
|
|
107
|
+
export declare type HostingSitesQueryError = AxiosError<unknown>;
|
|
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;
|
|
110
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
111
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
112
|
+
queryKey: QueryKey;
|
|
113
|
+
};
|
|
114
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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
|
+
/**
|
|
8
|
+
* Generated by orval v6.7.1 🍺
|
|
9
|
+
* Do not edit manually.
|
|
10
|
+
* Hosting UAPI
|
|
11
|
+
* Hosting UAPI
|
|
12
|
+
* OpenAPI spec version: 0.0.1
|
|
13
|
+
*/
|
|
14
|
+
const axios_1 = __importDefault(require("axios"));
|
|
15
|
+
const react_query_1 = require("react-query");
|
|
16
|
+
/**
|
|
17
|
+
* Return all website records CodeGuard maintains for this user's account.
|
|
18
|
+
* @summary addons codeguard website_list
|
|
19
|
+
*/
|
|
20
|
+
const getAddonsCodeguardWebsiteListV1 = (addonId, options) => {
|
|
21
|
+
return axios_1.default.get(`/v1/addons/codeguard/${addonId}/website_list`, options);
|
|
22
|
+
};
|
|
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) => {
|
|
82
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
83
|
+
const mutationFn = (props) => {
|
|
84
|
+
const { hostingId, data } = props || {};
|
|
85
|
+
return (0, exports.postHostingFtpV1)(hostingId, data, axiosOptions);
|
|
86
|
+
};
|
|
87
|
+
return (0, react_query_1.useMutation)(mutationFn, mutationOptions);
|
|
88
|
+
};
|
|
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;
|
|
128
|
+
/**
|
|
129
|
+
* Obtain a list of sites.
|
|
130
|
+
* @summary hosting sites
|
|
131
|
+
*/
|
|
132
|
+
const hostingSites = (hostingId, options) => {
|
|
133
|
+
return axios_1.default.get(`/v1/hosting/${hostingId}/sites`, options);
|
|
134
|
+
};
|
|
135
|
+
exports.hostingSites = hostingSites;
|
|
136
|
+
const getHostingSitesQueryKey = (hostingId) => [`/v1/hosting/${hostingId}/sites`];
|
|
137
|
+
exports.getHostingSitesQueryKey = getHostingSitesQueryKey;
|
|
138
|
+
const useHostingSites = (hostingId, options) => {
|
|
139
|
+
var _a;
|
|
140
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
141
|
+
const queryKey = (_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.queryKey) !== null && _a !== void 0 ? _a : (0, exports.getHostingSitesQueryKey)(hostingId);
|
|
142
|
+
const queryFn = () => (0, exports.hostingSites)(hostingId, axiosOptions);
|
|
143
|
+
const query = (0, react_query_1.useQuery)(queryKey, queryFn, Object.assign({ enabled: !!(hostingId) }, queryOptions));
|
|
144
|
+
return Object.assign({ queryKey }, query);
|
|
145
|
+
};
|
|
146
|
+
exports.useHostingSites = useHostingSites;
|
|
@@ -0,0 +1,42 @@
|
|
|
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;
|
|
34
|
+
};
|
|
35
|
+
export declare const getHostingSitesMock: () => {
|
|
36
|
+
rows: {
|
|
37
|
+
id: string | undefined;
|
|
38
|
+
name: string | undefined;
|
|
39
|
+
url: string | undefined;
|
|
40
|
+
}[] | undefined;
|
|
41
|
+
};
|
|
42
|
+
export declare const getHostingUAPIMSW: () => import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultRequestBody>>[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHostingUAPIMSW = exports.getHostingSitesMock = exports.getGetSitesInfoV1Mock = exports.getSitesSsoMock = exports.getPostHostingFtpV1Mock = exports.getGetHostingFtpV1Mock = exports.getHostingInfoMock = exports.getGetAddonsCodeguardWebsiteListV1Mock = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generated by orval v6.7.1 🍺
|
|
6
|
+
* Do not edit manually.
|
|
7
|
+
* Hosting UAPI
|
|
8
|
+
* Hosting UAPI
|
|
9
|
+
* OpenAPI spec version: 0.0.1
|
|
10
|
+
*/
|
|
11
|
+
const msw_1 = require("msw");
|
|
12
|
+
const faker_1 = require("@faker-js/faker");
|
|
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]) });
|
|
26
|
+
exports.getHostingSitesMock = getHostingSitesMock;
|
|
27
|
+
const getHostingUAPIMSW = () => [
|
|
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) => {
|
|
41
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getHostingSitesMock)()));
|
|
42
|
+
}),
|
|
43
|
+
];
|
|
44
|
+
exports.getHostingUAPIMSW = getHostingUAPIMSW;
|
|
@@ -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
|
+
};
|