@newfold/huapi-js 1.396.0 → 1.401.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.d.ts +46 -1
- package/src/index.js +25 -2
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Hosting UAPI
|
|
5
5
|
* Hosting UAPI is an API to expose Hosting, Addons, and Site functionality to a customer-facing Front End such as (Account Manager).
|
|
6
|
-
* OpenAPI spec version: 1.
|
|
6
|
+
* OpenAPI spec version: 1.401.0
|
|
7
7
|
*/
|
|
8
8
|
import axios from 'axios';
|
|
9
9
|
import type { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
|
|
@@ -591,6 +591,8 @@ export declare type HostingInfo200 = {
|
|
|
591
591
|
};
|
|
592
592
|
export declare type HostingFtp200 = {
|
|
593
593
|
status?: number;
|
|
594
|
+
/** Username */
|
|
595
|
+
user?: string;
|
|
594
596
|
};
|
|
595
597
|
export declare type HostingFtpBody = {
|
|
596
598
|
/** Username for FTP account to delete. */
|
|
@@ -602,6 +604,27 @@ export declare type HostingFtpBody = {
|
|
|
602
604
|
/** Optional: The entity that initiated the GAP call, eg. i_cluster, admin_user, script, cron, addon_$type($id) */
|
|
603
605
|
source?: string;
|
|
604
606
|
};
|
|
607
|
+
export declare type HostingFtpUpdate200 = {
|
|
608
|
+
status?: number;
|
|
609
|
+
};
|
|
610
|
+
/**
|
|
611
|
+
* Must pass either password or quota.
|
|
612
|
+
*/
|
|
613
|
+
export declare type HostingFtpUpdateBodyUserTypeSet = typeof HostingFtpUpdateBodyUserTypeSet[keyof typeof HostingFtpUpdateBodyUserTypeSet];
|
|
614
|
+
export declare const HostingFtpUpdateBodyUserTypeSet: {
|
|
615
|
+
readonly password: "password";
|
|
616
|
+
readonly quota: "quota";
|
|
617
|
+
};
|
|
618
|
+
export declare type HostingFtpUpdateBody = {
|
|
619
|
+
/** Username for FTP account. */
|
|
620
|
+
user: string;
|
|
621
|
+
/** Update quota for user. Quota value should be greater than or equal to 0. */
|
|
622
|
+
quota?: number;
|
|
623
|
+
/** Update password for user */
|
|
624
|
+
password?: string;
|
|
625
|
+
/** Must pass either password or quota. */
|
|
626
|
+
user_type_set?: HostingFtpUpdateBodyUserTypeSet;
|
|
627
|
+
};
|
|
605
628
|
export declare type HostingFtpAdd200 = {
|
|
606
629
|
user?: string;
|
|
607
630
|
pass?: string;
|
|
@@ -1383,6 +1406,24 @@ export declare const useHostingFtpAdd: <TError = AxiosError<unknown, any>, TCont
|
|
|
1383
1406
|
hostingId: number;
|
|
1384
1407
|
data: HostingFtpAddBody;
|
|
1385
1408
|
}, TContext>;
|
|
1409
|
+
/**
|
|
1410
|
+
* Update ftp account
|
|
1411
|
+
* @summary Update ftp account
|
|
1412
|
+
*/
|
|
1413
|
+
export declare const hostingFtpUpdate: (hostingId: number, hostingFtpUpdateBody: HostingFtpUpdateBody, options?: AxiosRequestConfig) => Promise<AxiosResponse<HostingFtpUpdate200>>;
|
|
1414
|
+
export declare type HostingFtpUpdateMutationResult = NonNullable<Awaited<ReturnType<typeof hostingFtpUpdate>>>;
|
|
1415
|
+
export declare type HostingFtpUpdateMutationBody = HostingFtpUpdateBody;
|
|
1416
|
+
export declare type HostingFtpUpdateMutationError = AxiosError<unknown>;
|
|
1417
|
+
export declare const useHostingFtpUpdate: <TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
|
|
1418
|
+
mutation?: UseMutationOptions<AxiosResponse<HostingFtpUpdate200, any>, TError, {
|
|
1419
|
+
hostingId: number;
|
|
1420
|
+
data: HostingFtpUpdateBody;
|
|
1421
|
+
}, TContext> | undefined;
|
|
1422
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
1423
|
+
} | undefined) => import("@tanstack/react-query").UseMutationResult<AxiosResponse<HostingFtpUpdate200, any>, TError, {
|
|
1424
|
+
hostingId: number;
|
|
1425
|
+
data: HostingFtpUpdateBody;
|
|
1426
|
+
}, TContext>;
|
|
1386
1427
|
/**
|
|
1387
1428
|
* Delete ftp account
|
|
1388
1429
|
* @summary Delete ftp account
|
|
@@ -2563,8 +2604,12 @@ export declare const getHostingFtpAddMock: () => {
|
|
|
2563
2604
|
user: string | undefined;
|
|
2564
2605
|
pass: string | undefined;
|
|
2565
2606
|
};
|
|
2607
|
+
export declare const getHostingFtpUpdateMock: () => {
|
|
2608
|
+
status: number | undefined;
|
|
2609
|
+
};
|
|
2566
2610
|
export declare const getHostingFtpMock: () => {
|
|
2567
2611
|
status: number | undefined;
|
|
2612
|
+
user: string | undefined;
|
|
2568
2613
|
};
|
|
2569
2614
|
export declare const getHostingInfoMock: () => {
|
|
2570
2615
|
ip: string | undefined;
|
package/src/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Hosting UAPI
|
|
5
5
|
* Hosting UAPI is an API to expose Hosting, Addons, and Site functionality to a customer-facing Front End such as (Account Manager).
|
|
6
|
-
* OpenAPI spec version: 1.
|
|
6
|
+
* OpenAPI spec version: 1.401.0
|
|
7
7
|
*/
|
|
8
8
|
import axios from 'axios';
|
|
9
9
|
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
@@ -72,6 +72,11 @@ export const HostingMigrationsEventBodyEventName = {
|
|
|
72
72
|
failedCreate: 'failedCreate',
|
|
73
73
|
};
|
|
74
74
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
75
|
+
export const HostingFtpUpdateBodyUserTypeSet = {
|
|
76
|
+
password: 'password',
|
|
77
|
+
quota: 'quota',
|
|
78
|
+
};
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
75
80
|
export const DomainsType = {
|
|
76
81
|
addon: 'addon',
|
|
77
82
|
main: 'main',
|
|
@@ -565,6 +570,21 @@ export const useHostingFtpAdd = (options) => {
|
|
|
565
570
|
};
|
|
566
571
|
return useMutation(mutationFn, mutationOptions);
|
|
567
572
|
};
|
|
573
|
+
/**
|
|
574
|
+
* Update ftp account
|
|
575
|
+
* @summary Update ftp account
|
|
576
|
+
*/
|
|
577
|
+
export const hostingFtpUpdate = (hostingId, hostingFtpUpdateBody, options) => {
|
|
578
|
+
return axios.put(`/v1/hosting/${hostingId}/ftp`, hostingFtpUpdateBody, options);
|
|
579
|
+
};
|
|
580
|
+
export const useHostingFtpUpdate = (options) => {
|
|
581
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options !== null && options !== void 0 ? options : {};
|
|
582
|
+
const mutationFn = (props) => {
|
|
583
|
+
const { hostingId, data } = props !== null && props !== void 0 ? props : {};
|
|
584
|
+
return hostingFtpUpdate(hostingId, data, axiosOptions);
|
|
585
|
+
};
|
|
586
|
+
return useMutation(mutationFn, mutationOptions);
|
|
587
|
+
};
|
|
568
588
|
/**
|
|
569
589
|
* Delete ftp account
|
|
570
590
|
* @summary Delete ftp account
|
|
@@ -1636,7 +1656,8 @@ export const getAddonCloudflareMock = () => ({ status: faker.helpers.arrayElemen
|
|
|
1636
1656
|
export const getDomainsMock = () => ({ domains: Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ docroot: faker.random.word(), domain: faker.random.word(), type: faker.random.word(), id: faker.datatype.number({ min: undefined, max: undefined }) })) });
|
|
1637
1657
|
export const getHostingFtpListMock = () => ({ ftp_accounts: faker.helpers.arrayElement([Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ user: faker.helpers.arrayElement([faker.random.word(), undefined]), homedir: faker.helpers.arrayElement([faker.random.word(), undefined]), type: faker.helpers.arrayElement([faker.random.word(), undefined]) })), undefined]), special_ftp_accounts: faker.helpers.arrayElement([Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ user: faker.helpers.arrayElement([faker.random.word(), undefined]), homedir: faker.helpers.arrayElement([faker.random.word(), undefined]), type: faker.helpers.arrayElement([faker.random.word(), undefined]) })), undefined]) });
|
|
1638
1658
|
export const getHostingFtpAddMock = () => ({ user: faker.helpers.arrayElement([faker.random.word(), undefined]), pass: faker.helpers.arrayElement([faker.random.word(), undefined]) });
|
|
1639
|
-
export const
|
|
1659
|
+
export const getHostingFtpUpdateMock = () => ({ status: faker.helpers.arrayElement([faker.datatype.number({ min: undefined, max: undefined }), undefined]) });
|
|
1660
|
+
export const getHostingFtpMock = () => ({ status: faker.helpers.arrayElement([faker.datatype.number({ min: undefined, max: undefined }), undefined]), user: faker.helpers.arrayElement([faker.random.word(), undefined]) });
|
|
1640
1661
|
export const getHostingInfoMock = () => ({ ip: faker.helpers.arrayElement([faker.random.word(), undefined]) });
|
|
1641
1662
|
export const getHostingInfoDiskUsageMock = () => ({ diskused: faker.helpers.arrayElement([faker.random.word(), undefined]), disklimit: faker.helpers.arrayElement([faker.random.word(), undefined]) });
|
|
1642
1663
|
export const getHostingMigrationStatusMock = () => ({ rows: faker.helpers.arrayElement([Array.from({ length: faker.datatype.number({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ id: faker.helpers.arrayElement([faker.random.word(), undefined]), type: faker.helpers.arrayElement([faker.random.word(), undefined]), subtype: faker.helpers.arrayElement([faker.random.word(), undefined]), status: faker.helpers.arrayElement([faker.random.word(), undefined]) })), undefined]) });
|
|
@@ -1761,6 +1782,8 @@ export const getHostingUAPIMSW = () => [
|
|
|
1761
1782
|
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json(getHostingFtpListMock()));
|
|
1762
1783
|
}), rest.post('*/v1/hosting/:hostingId/ftp', (_req, res, ctx) => {
|
|
1763
1784
|
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json(getHostingFtpAddMock()));
|
|
1785
|
+
}), rest.put('*/v1/hosting/:hostingId/ftp', (_req, res, ctx) => {
|
|
1786
|
+
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json(getHostingFtpUpdateMock()));
|
|
1764
1787
|
}), rest.delete('*/v1/hosting/:hostingId/ftp', (_req, res, ctx) => {
|
|
1765
1788
|
return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json(getHostingFtpMock()));
|
|
1766
1789
|
}), rest.get('*/v1/hosting/:hostingId/info', (_req, res, ctx) => {
|