@newfold/huapi-js 1.0.2 → 1.1.3

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/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @newfold/huapi-js
2
+
3
+ > A JavaScript Client Library for HUAPI
4
+
5
+ ## Installation
6
+
7
+ TODO
8
+
9
+ ## Usage
10
+
11
+ ### React Hooks
12
+
13
+ ```js
14
+ import React from "react";
15
+
16
+ import { useGetHostingSites } from "@newfold/huapi-js";
17
+
18
+ const MyComponent = () => {
19
+ const hostingId = "2";
20
+ const { isLoading, data } = useGetHostingSites(hostingId);
21
+
22
+ if (isLoading) return <h1>Loading...</h1>;
23
+
24
+ return (
25
+ <div>
26
+ {data?.data?.rows?.map((site) => {
27
+ <div key={site.id}>{site.name}</div>;
28
+ })}
29
+ </div>
30
+ );
31
+ };
32
+ ```
package/openapi.json CHANGED
@@ -1,7 +1,122 @@
1
1
  {
2
2
  "openapi": "3.0.0",
3
- "info": { "title": "Hosting UAPI", "version": "0.1.0" },
3
+ "info": {
4
+ "version": "0.1.0",
5
+ "title": "Hosting UAPI",
6
+ "description": "Hosting UAPI"
7
+ },
4
8
  "components": {
9
+ "schemas": {
10
+ "Site": {
11
+ "type": "object",
12
+ "description": "A site",
13
+ "properties": {
14
+ "id": {
15
+ "type": "integer",
16
+ "description": "TODO",
17
+ "example": 1
18
+ },
19
+ "name": {
20
+ "type": "string",
21
+ "description": "TODO",
22
+ "example": "Example Site 1"
23
+ },
24
+ "url": {
25
+ "type": "string",
26
+ "description": "TODO",
27
+ "example": "https://example.com"
28
+ }
29
+ },
30
+ "example": {
31
+ "id": 1,
32
+ "name": "Example Site 1",
33
+ "url": "https://example.com"
34
+ },
35
+ "required": ["id", "name", "url"]
36
+ },
37
+ "SiteList": {
38
+ "description": "List of sites",
39
+ "type": "object",
40
+ "properties": {
41
+ "limit": {
42
+ "type": "integer",
43
+ "description": "Max number of sites included in response",
44
+ "example": 10
45
+ },
46
+ "n_pages": {
47
+ "type": "integer",
48
+ "description": "TODO",
49
+ "example": 1
50
+ },
51
+ "n_rows": {
52
+ "type": "integer",
53
+ "description": "TODO",
54
+ "example": 1
55
+ },
56
+ "page": {
57
+ "type": "integer",
58
+ "description": "TODO",
59
+ "example": 1
60
+ },
61
+ "rows": {
62
+ "type": "array",
63
+ "description": "TODO",
64
+ "items": {
65
+ "type": "array",
66
+ "$ref": "#/components/schemas/Site"
67
+ },
68
+ "example": [
69
+ {
70
+ "id": 1,
71
+ "name": "Example Site 1",
72
+ "url": "https://example.com"
73
+ },
74
+ {
75
+ "id": 2,
76
+ "name": "Example Site 2",
77
+ "url": "https://example2.com"
78
+ }
79
+ ]
80
+ }
81
+ },
82
+ "example": {
83
+ "limit": 10,
84
+ "n_pages": 1,
85
+ "n_rows": 1,
86
+ "page": 1,
87
+ "rows": [
88
+ [
89
+ {
90
+ "id": 1,
91
+ "name": "Example Site 1",
92
+ "url": "https://example.com"
93
+ },
94
+ {
95
+ "id": 2,
96
+ "name": "Example Site 2",
97
+ "url": "https://example2.com"
98
+ }
99
+ ]
100
+ ]
101
+ },
102
+ "required": ["limit", "n_pages", "n_rows", "page", "rows"]
103
+ },
104
+ "SiteSso": {
105
+ "description": "SSO token or login URL",
106
+ "type": "object",
107
+ "properties": {
108
+ "sso": {
109
+ "type": "string",
110
+ "example": "$randomUrl",
111
+ "description": "TODO"
112
+ }
113
+ },
114
+ "example": {
115
+ "sso": "$randomUrl"
116
+ },
117
+ "required": ["sso"]
118
+ }
119
+ },
5
120
  "securitySchemes": {
6
121
  "bearerAuth": {
7
122
  "type": "http",
@@ -13,15 +128,25 @@
13
128
  "paths": {
14
129
  "/sites/{site_id}/sso": {
15
130
  "post": {
16
- "security": [{ "bearerAuth": [] }],
17
- "summary": "site_sso",
18
- "description": "Return an SSO token or login URL for this site (if supported).",
131
+ "summary": "Get SSO token",
132
+ "operationId": "site_sso",
133
+ "description": "TODO",
134
+ "tags": ["sites"],
135
+ "security": [
136
+ {
137
+ "bearerAuth": []
138
+ }
139
+ ],
19
140
  "parameters": [
20
141
  {
21
142
  "name": "site_id",
143
+ "description": "Specify the site id to get the SSO token for.",
22
144
  "in": "path",
23
145
  "required": true,
24
- "schema": { "type": "integer" }
146
+ "schema": {
147
+ "type": "integer",
148
+ "description": "Specify the site id to get the SSO token for."
149
+ }
25
150
  }
26
151
  ],
27
152
  "responses": {
@@ -30,11 +155,7 @@
30
155
  "content": {
31
156
  "application/json": {
32
157
  "schema": {
33
- "type": "object",
34
- "properties": {
35
- "sso": { "type": "string", "example": "$randomUrl" }
36
- },
37
- "required": ["sso"]
158
+ "$ref": "#/components/schemas/SiteSso"
38
159
  }
39
160
  }
40
161
  }
@@ -44,15 +165,20 @@
44
165
  },
45
166
  "/hosting/{hosting_id}/sites": {
46
167
  "get": {
168
+ "operationId": "get_hosting_sites",
169
+ "tags": ["sites"],
47
170
  "security": [{ "bearerAuth": [] }],
48
- "summary": "site_list",
171
+ "summary": "Get sites for a hosting id",
49
172
  "description": "Obtain a list of sites.",
50
173
  "parameters": [
51
174
  {
52
175
  "name": "hosting_id",
53
176
  "in": "path",
54
177
  "required": true,
55
- "schema": { "type": "integer" }
178
+ "schema": {
179
+ "type": "integer",
180
+ "description": "Specify the hosting id to get sites for."
181
+ }
56
182
  }
57
183
  ],
58
184
  "responses": {
@@ -61,26 +187,7 @@
61
187
  "content": {
62
188
  "application/json": {
63
189
  "schema": {
64
- "type": "object",
65
- "properties": {
66
- "limit": { "type": "string" },
67
- "n_pages": { "type": "string" },
68
- "n_rows": { "type": "string" },
69
- "page": { "type": "string" },
70
- "rows": {
71
- "type": "array",
72
- "items": {
73
- "type": "object",
74
- "properties": {
75
- "id": { "type": "string" },
76
- "name": { "type": "string" },
77
- "url": { "type": "string" }
78
- },
79
- "required": ["id", "name", "url"]
80
- }
81
- }
82
- },
83
- "required": ["limit", "n_pages", "n_rows", "page", "rows"]
190
+ "$ref": "#/components/schemas/SiteList"
84
191
  }
85
192
  }
86
193
  }
@@ -88,5 +195,15 @@
88
195
  }
89
196
  }
90
197
  }
91
- }
198
+ },
199
+ "servers": [
200
+ {
201
+ "url": "https://api.example.com/v1",
202
+ "description": "Production server (uses live data)"
203
+ },
204
+ {
205
+ "url": "https://sandbox-api.example.com:8443/v1",
206
+ "description": "Sandbox server (uses test data)"
207
+ }
208
+ ]
92
209
  }
package/orval.config.js CHANGED
@@ -10,6 +10,7 @@ module.exports = {
10
10
  // schemas: "src/model",
11
11
  client: "react-query",
12
12
  mock: true,
13
+ clean: true,
13
14
  },
14
15
  },
15
16
  };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@newfold/huapi-js",
3
- "version": "1.0.2",
3
+ "version": "1.1.3",
4
4
  "main": "src/huapi.js",
5
5
  "license": "MIT",
6
- "dependencies": {
6
+ "devDependencies": {
7
7
  "@faker-js/faker": "^6.1.2",
8
8
  "axios": "^0.26.1",
9
9
  "msw": "^0.39.2",
@@ -12,10 +12,17 @@
12
12
  "react-query": "^3.34.19",
13
13
  "typescript": "^4.6.3"
14
14
  },
15
+ "peerDependencies": {
16
+ "@faker-js/faker": "^6.1.2",
17
+ "axios": "^0.26.1",
18
+ "msw": "^0.39.2",
19
+ "orval": "^6.7.1",
20
+ "react": "^17.0.2",
21
+ "react-query": "^3.34.19"
22
+ },
15
23
  "scripts": {
16
- "clean": "rm -rf ./src",
17
24
  "orval": "orval",
18
25
  "tsToJs": "npx tsc ./src/*",
19
- "build": "yarn clean && yarn orval && yarn tsToJs"
26
+ "build": "yarn orval && yarn tsToJs"
20
27
  }
21
28
  }
package/src/huapi.js CHANGED
@@ -20,11 +20,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
20
20
  return to.concat(ar || Array.prototype.slice.call(from));
21
21
  };
22
22
  exports.__esModule = true;
23
- exports.getHostingUAPIMSW = exports.getGetHostingHostingIdSitesMock = exports.getPostSitesSiteIdSsoMock = exports.useGetHostingHostingIdSites = exports.getGetHostingHostingIdSitesQueryKey = exports.getHostingHostingIdSites = exports.usePostSitesSiteIdSso = exports.postSitesSiteIdSso = void 0;
23
+ exports.getHostingUAPIMSW = exports.getGetHostingSitesMock = exports.getSiteSsoMock = exports.useGetHostingSites = exports.getGetHostingSitesQueryKey = exports.getHostingSites = exports.useSiteSso = exports.siteSso = void 0;
24
24
  /**
25
25
  * Generated by orval v6.7.1 🍺
26
26
  * Do not edit manually.
27
27
  * Hosting UAPI
28
+ * Hosting UAPI
28
29
  * OpenAPI spec version: 0.1.0
29
30
  */
30
31
  var axios_1 = require("axios");
@@ -32,50 +33,50 @@ var react_query_1 = require("react-query");
32
33
  var msw_1 = require("msw");
33
34
  var faker_1 = require("@faker-js/faker");
34
35
  /**
35
- * Return an SSO token or login URL for this site (if supported).
36
- * @summary site_sso
36
+ * TODO
37
+ * @summary Get SSO token
37
38
  */
38
- var postSitesSiteIdSso = function (siteId, options) {
39
+ var siteSso = function (siteId, options) {
39
40
  return axios_1["default"].post("/sites/".concat(siteId, "/sso"), undefined, options);
40
41
  };
41
- exports.postSitesSiteIdSso = postSitesSiteIdSso;
42
- var usePostSitesSiteIdSso = function (options) {
42
+ exports.siteSso = siteSso;
43
+ var useSiteSso = function (options) {
43
44
  var _a = options || {}, mutationOptions = _a.mutation, axiosOptions = _a.axios;
44
45
  var mutationFn = function (props) {
45
46
  var siteId = (props || {}).siteId;
46
- return (0, exports.postSitesSiteIdSso)(siteId, axiosOptions);
47
+ return (0, exports.siteSso)(siteId, axiosOptions);
47
48
  };
48
49
  return (0, react_query_1.useMutation)(mutationFn, mutationOptions);
49
50
  };
50
- exports.usePostSitesSiteIdSso = usePostSitesSiteIdSso;
51
+ exports.useSiteSso = useSiteSso;
51
52
  /**
52
53
  * Obtain a list of sites.
53
- * @summary site_list
54
+ * @summary Get sites for a hosting id
54
55
  */
55
- var getHostingHostingIdSites = function (hostingId, options) {
56
+ var getHostingSites = function (hostingId, options) {
56
57
  return axios_1["default"].get("/hosting/".concat(hostingId, "/sites"), options);
57
58
  };
58
- exports.getHostingHostingIdSites = getHostingHostingIdSites;
59
- var getGetHostingHostingIdSitesQueryKey = function (hostingId) { return ["/hosting/".concat(hostingId, "/sites")]; };
60
- exports.getGetHostingHostingIdSitesQueryKey = getGetHostingHostingIdSitesQueryKey;
61
- var useGetHostingHostingIdSites = function (hostingId, options) {
59
+ exports.getHostingSites = getHostingSites;
60
+ var getGetHostingSitesQueryKey = function (hostingId) { return ["/hosting/".concat(hostingId, "/sites")]; };
61
+ exports.getGetHostingSitesQueryKey = getGetHostingSitesQueryKey;
62
+ var useGetHostingSites = function (hostingId, options) {
62
63
  var _a;
63
64
  var _b = options || {}, queryOptions = _b.query, axiosOptions = _b.axios;
64
- var queryKey = (_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.queryKey) !== null && _a !== void 0 ? _a : (0, exports.getGetHostingHostingIdSitesQueryKey)(hostingId);
65
- var queryFn = function () { return (0, exports.getHostingHostingIdSites)(hostingId, axiosOptions); };
65
+ var queryKey = (_a = queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.queryKey) !== null && _a !== void 0 ? _a : (0, exports.getGetHostingSitesQueryKey)(hostingId);
66
+ var queryFn = function () { return (0, exports.getHostingSites)(hostingId, axiosOptions); };
66
67
  var query = (0, react_query_1.useQuery)(queryKey, queryFn, __assign({ enabled: !!(hostingId) }, queryOptions));
67
68
  return __assign({ queryKey: queryKey }, query);
68
69
  };
69
- exports.useGetHostingHostingIdSites = useGetHostingHostingIdSites;
70
- var getPostSitesSiteIdSsoMock = function () { return ({ sso: faker_1.faker.random.word() }); };
71
- exports.getPostSitesSiteIdSsoMock = getPostSitesSiteIdSsoMock;
72
- var getGetHostingHostingIdSitesMock = function () { return ({ limit: faker_1.faker.random.word(), n_pages: faker_1.faker.random.word(), n_rows: faker_1.faker.random.word(), page: faker_1.faker.random.word(), rows: __spreadArray([], Array(faker_1.faker.datatype.number({ min: 1, max: 10 })), true).map(function () { return ({ id: faker_1.faker.random.word(), name: faker_1.faker.random.word(), url: faker_1.faker.random.word() }); }) }); };
73
- exports.getGetHostingHostingIdSitesMock = getGetHostingHostingIdSitesMock;
70
+ exports.useGetHostingSites = useGetHostingSites;
71
+ var getSiteSsoMock = function () { return ({ sso: faker_1.faker.random.word() }); };
72
+ exports.getSiteSsoMock = getSiteSsoMock;
73
+ var getGetHostingSitesMock = function () { return ({ limit: faker_1.faker.datatype.number(), n_pages: faker_1.faker.datatype.number(), n_rows: faker_1.faker.datatype.number(), page: faker_1.faker.datatype.number(), rows: __spreadArray([], Array(faker_1.faker.datatype.number({ min: 1, max: 10 })), true).map(function () { return ({ id: faker_1.faker.datatype.number(), name: faker_1.faker.random.word(), url: faker_1.faker.random.word() }); }) }); };
74
+ exports.getGetHostingSitesMock = getGetHostingSitesMock;
74
75
  var getHostingUAPIMSW = function () { return [
75
76
  msw_1.rest.post('*/sites/:siteid/sso', function (_req, res, ctx) {
76
- return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getPostSitesSiteIdSsoMock)()));
77
+ return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getSiteSsoMock)()));
77
78
  }), msw_1.rest.get('*/hosting/:hostingid/sites', function (_req, res, ctx) {
78
- return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getGetHostingHostingIdSitesMock)()));
79
+ return res(ctx.delay(1000), ctx.status(200, 'Mocked status'), ctx.json((0, exports.getGetHostingSitesMock)()));
79
80
  }),
80
81
  ]; };
81
82
  exports.getHostingUAPIMSW = getHostingUAPIMSW;
package/src/huapi.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * Generated by orval v6.7.1 🍺
3
3
  * Do not edit manually.
4
4
  * Hosting UAPI
5
+ * Hosting UAPI
5
6
  * OpenAPI spec version: 0.1.0
6
7
  */
7
8
  import axios,{
@@ -25,23 +26,41 @@ import {
25
26
  import {
26
27
  faker
27
28
  } from '@faker-js/faker'
28
- export type GetHostingHostingIdSites200RowsItem = {
29
- id: string;
29
+ /**
30
+ * SSO token or login URL
31
+ */
32
+ export interface SiteSso {
33
+ /** TODO */
34
+ sso: string;
35
+ }
36
+
37
+ /**
38
+ * A site
39
+ */
40
+ export interface Site {
41
+ /** TODO */
42
+ id: number;
43
+ /** TODO */
30
44
  name: string;
45
+ /** TODO */
31
46
  url: string;
32
- };
33
-
34
- export type GetHostingHostingIdSites200 = {
35
- limit: string;
36
- n_pages: string;
37
- n_rows: string;
38
- page: string;
39
- rows: GetHostingHostingIdSites200RowsItem[];
40
- };
47
+ }
41
48
 
42
- export type PostSitesSiteIdSso200 = {
43
- sso: string;
44
- };
49
+ /**
50
+ * List of sites
51
+ */
52
+ export interface SiteList {
53
+ /** Max number of sites included in response */
54
+ limit: number;
55
+ /** TODO */
56
+ n_pages: number;
57
+ /** TODO */
58
+ n_rows: number;
59
+ /** TODO */
60
+ page: number;
61
+ /** TODO */
62
+ rows: Site[];
63
+ }
45
64
 
46
65
 
47
66
 
@@ -52,12 +71,12 @@ T extends (...args: any) => Promise<any>
52
71
 
53
72
 
54
73
  /**
55
- * Return an SSO token or login URL for this site (if supported).
56
- * @summary site_sso
74
+ * TODO
75
+ * @summary Get SSO token
57
76
  */
58
- export const postSitesSiteIdSso = (
77
+ export const siteSso = (
59
78
  siteId: number, options?: AxiosRequestConfig
60
- ): Promise<AxiosResponse<PostSitesSiteIdSso200>> => {
79
+ ): Promise<AxiosResponse<SiteSso>> => {
61
80
  return axios.post(
62
81
  `/sites/${siteId}/sso`,undefined,options
63
82
  );
@@ -65,61 +84,61 @@ export const postSitesSiteIdSso = (
65
84
 
66
85
 
67
86
 
68
- export type PostSitesSiteIdSsoMutationResult = NonNullable<AsyncReturnType<typeof postSitesSiteIdSso>>
87
+ export type SiteSsoMutationResult = NonNullable<AsyncReturnType<typeof siteSso>>
69
88
 
70
- export type PostSitesSiteIdSsoMutationError = AxiosError<unknown>
89
+ export type SiteSsoMutationError = AxiosError<unknown>
71
90
 
72
- export const usePostSitesSiteIdSso = <TError = AxiosError<unknown>,
91
+ export const useSiteSso = <TError = AxiosError<unknown>,
73
92
 
74
- TContext = unknown>(options?: { mutation?:UseMutationOptions<AsyncReturnType<typeof postSitesSiteIdSso>, TError,{siteId: number}, TContext>, axios?: AxiosRequestConfig}
93
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<AsyncReturnType<typeof siteSso>, TError,{siteId: number}, TContext>, axios?: AxiosRequestConfig}
75
94
  ) => {
76
95
  const {mutation: mutationOptions, axios: axiosOptions} = options || {}
77
96
 
78
97
 
79
98
 
80
99
 
81
- const mutationFn: MutationFunction<AsyncReturnType<typeof postSitesSiteIdSso>, {siteId: number}> = (props) => {
100
+ const mutationFn: MutationFunction<AsyncReturnType<typeof siteSso>, {siteId: number}> = (props) => {
82
101
  const {siteId} = props || {};
83
102
 
84
- return postSitesSiteIdSso(siteId,axiosOptions)
103
+ return siteSso(siteId,axiosOptions)
85
104
  }
86
105
 
87
- return useMutation<AsyncReturnType<typeof postSitesSiteIdSso>, TError, {siteId: number}, TContext>(mutationFn, mutationOptions)
106
+ return useMutation<AsyncReturnType<typeof siteSso>, TError, {siteId: number}, TContext>(mutationFn, mutationOptions)
88
107
  }
89
108
 
90
109
  /**
91
110
  * Obtain a list of sites.
92
- * @summary site_list
111
+ * @summary Get sites for a hosting id
93
112
  */
94
- export const getHostingHostingIdSites = (
113
+ export const getHostingSites = (
95
114
  hostingId: number, options?: AxiosRequestConfig
96
- ): Promise<AxiosResponse<GetHostingHostingIdSites200>> => {
115
+ ): Promise<AxiosResponse<SiteList>> => {
97
116
  return axios.get(
98
117
  `/hosting/${hostingId}/sites`,options
99
118
  );
100
119
  }
101
120
 
102
121
 
103
- export const getGetHostingHostingIdSitesQueryKey = (hostingId: number,) => [`/hosting/${hostingId}/sites`];
122
+ export const getGetHostingSitesQueryKey = (hostingId: number,) => [`/hosting/${hostingId}/sites`];
104
123
 
105
124
 
106
- export type GetHostingHostingIdSitesQueryResult = NonNullable<AsyncReturnType<typeof getHostingHostingIdSites>>
107
- export type GetHostingHostingIdSitesQueryError = AxiosError<unknown>
125
+ export type GetHostingSitesQueryResult = NonNullable<AsyncReturnType<typeof getHostingSites>>
126
+ export type GetHostingSitesQueryError = AxiosError<unknown>
108
127
 
109
- export const useGetHostingHostingIdSites = <TData = AsyncReturnType<typeof getHostingHostingIdSites>, TError = AxiosError<unknown>>(
110
- hostingId: number, options?: { query?:UseQueryOptions<AsyncReturnType<typeof getHostingHostingIdSites>, TError, TData>, axios?: AxiosRequestConfig}
128
+ export const useGetHostingSites = <TData = AsyncReturnType<typeof getHostingSites>, TError = AxiosError<unknown>>(
129
+ hostingId: number, options?: { query?:UseQueryOptions<AsyncReturnType<typeof getHostingSites>, TError, TData>, axios?: AxiosRequestConfig}
111
130
 
112
131
  ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
113
132
 
114
133
  const {query: queryOptions, axios: axiosOptions} = options || {}
115
134
 
116
- const queryKey = queryOptions?.queryKey ?? getGetHostingHostingIdSitesQueryKey(hostingId);
135
+ const queryKey = queryOptions?.queryKey ?? getGetHostingSitesQueryKey(hostingId);
117
136
 
118
137
 
119
138
 
120
- const queryFn: QueryFunction<AsyncReturnType<typeof getHostingHostingIdSites>> = () => getHostingHostingIdSites(hostingId, axiosOptions);
139
+ const queryFn: QueryFunction<AsyncReturnType<typeof getHostingSites>> = () => getHostingSites(hostingId, axiosOptions);
121
140
 
122
- const query = useQuery<AsyncReturnType<typeof getHostingHostingIdSites>, TError, TData>(queryKey, queryFn, {enabled: !!(hostingId), ...queryOptions})
141
+ const query = useQuery<AsyncReturnType<typeof getHostingSites>, TError, TData>(queryKey, queryFn, {enabled: !!(hostingId), ...queryOptions})
123
142
 
124
143
  return {
125
144
  queryKey,
@@ -130,21 +149,21 @@ export const useGetHostingHostingIdSites = <TData = AsyncReturnType<typeof getHo
130
149
 
131
150
 
132
151
 
133
- export const getPostSitesSiteIdSsoMock = () => ({sso: faker.random.word()})
152
+ export const getSiteSsoMock = () => ({sso: faker.random.word()})
134
153
 
135
- export const getGetHostingHostingIdSitesMock = () => ({limit: faker.random.word(), n_pages: faker.random.word(), n_rows: faker.random.word(), page: faker.random.word(), rows: [...Array(faker.datatype.number({min: 1, max: 10}))].map(() => ({id: faker.random.word(), name: faker.random.word(), url: faker.random.word()}))})
154
+ export const getGetHostingSitesMock = () => ({limit: faker.datatype.number(), n_pages: faker.datatype.number(), n_rows: faker.datatype.number(), page: faker.datatype.number(), rows: [...Array(faker.datatype.number({min: 1, max: 10}))].map(() => ({id: faker.datatype.number(), name: faker.random.word(), url: faker.random.word()}))})
136
155
 
137
156
  export const getHostingUAPIMSW = () => [
138
157
  rest.post('*/sites/:siteid/sso', (_req, res, ctx) => {
139
158
  return res(
140
159
  ctx.delay(1000),
141
160
  ctx.status(200, 'Mocked status'),
142
- ctx.json(getPostSitesSiteIdSsoMock()),
161
+ ctx.json(getSiteSsoMock()),
143
162
  )
144
163
  }),rest.get('*/hosting/:hostingid/sites', (_req, res, ctx) => {
145
164
  return res(
146
165
  ctx.delay(1000),
147
166
  ctx.status(200, 'Mocked status'),
148
- ctx.json(getGetHostingHostingIdSitesMock()),
167
+ ctx.json(getGetHostingSitesMock()),
149
168
  )
150
169
  }),]