@swan-admin/swan-ai-measurements 1.1.21 → 1.1.23
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 +33 -33
- package/dist/constants.js +2 -2
- package/dist/esm/constants.js +2 -2
- package/dist/esm/fileUpload.js +206 -162
- package/dist/esm/tryOn.d.ts +1 -1
- package/dist/esm/tryOn.js +23 -41
- package/dist/fileUpload.js +10 -8
- package/dist/tryOn.d.ts +1 -1
- package/dist/tryOn.js +15 -32
- package/package.json +58 -58
- package/src/auth.ts +116 -116
- package/src/constants.ts +64 -64
- package/src/custom.ts +57 -57
- package/src/fileUpload.ts +183 -175
- package/src/index.ts +30 -30
- package/src/measurement.ts +209 -209
- package/src/poseDetection.ts +70 -70
- package/src/tryOn.ts +256 -277
- package/src/utils.ts +114 -114
- package/tsconfig.json +17 -17
package/src/custom.ts
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import axios, { AxiosResponse } from "axios";
|
|
2
|
-
import { API_ENDPOINTS, APP_AUTH_BASE_URL, REQUIRED_MESSAGE } from "./constants.js";
|
|
3
|
-
import { checkParameters, getUrl } from "./utils.js";
|
|
4
|
-
|
|
5
|
-
interface CreateCustomer {
|
|
6
|
-
name: string;
|
|
7
|
-
storeUrl: string;
|
|
8
|
-
location: string;
|
|
9
|
-
email: string;
|
|
10
|
-
emailsTier_1?: string;
|
|
11
|
-
emailsTier_2?: string;
|
|
12
|
-
}
|
|
13
|
-
class Custom {
|
|
14
|
-
#accessKey: string;
|
|
15
|
-
#stagingUrl: boolean;
|
|
16
|
-
constructor(accessKey: string, stagingUrl = false) {
|
|
17
|
-
this.#accessKey = accessKey;
|
|
18
|
-
this.#stagingUrl = stagingUrl;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
createCustomer(payload: CreateCustomer): Promise<AxiosResponse<any>> {
|
|
22
|
-
if (checkParameters(payload.name, payload.storeUrl, payload.email, payload.location) === false) {
|
|
23
|
-
throw new Error(REQUIRED_MESSAGE);
|
|
24
|
-
}
|
|
25
|
-
return axios.post(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.CREATE_CUSTOMER}`, {
|
|
26
|
-
...payload,
|
|
27
|
-
headers: { "X-Api-Key": this.#accessKey },
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getCustomCustomerConfig: (store_url: string) => Promise<AxiosResponse<any>> = (store_url: string) => {
|
|
32
|
-
if (checkParameters(store_url) === false) {
|
|
33
|
-
throw new Error(REQUIRED_MESSAGE);
|
|
34
|
-
}
|
|
35
|
-
return axios.get(
|
|
36
|
-
`${getUrl({
|
|
37
|
-
urlName: APP_AUTH_BASE_URL,
|
|
38
|
-
stagingUrl: this.#stagingUrl,
|
|
39
|
-
})}${API_ENDPOINTS.CUSTOM_CUSTOMER}`,
|
|
40
|
-
{
|
|
41
|
-
params: { store_url },
|
|
42
|
-
headers: { "X-Api-Key": this.#accessKey },
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
getModelUrl: (id: string) => Promise<AxiosResponse<any>> = (id: string) => {
|
|
48
|
-
if (checkParameters(id) === false) {
|
|
49
|
-
throw new Error(REQUIRED_MESSAGE);
|
|
50
|
-
}
|
|
51
|
-
return axios.get(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.MODEL}/${id}`, {
|
|
52
|
-
headers: { "X-Api-Key": this.#accessKey },
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default Custom;
|
|
1
|
+
import axios, { AxiosResponse } from "axios";
|
|
2
|
+
import { API_ENDPOINTS, APP_AUTH_BASE_URL, REQUIRED_MESSAGE } from "./constants.js";
|
|
3
|
+
import { checkParameters, getUrl } from "./utils.js";
|
|
4
|
+
|
|
5
|
+
interface CreateCustomer {
|
|
6
|
+
name: string;
|
|
7
|
+
storeUrl: string;
|
|
8
|
+
location: string;
|
|
9
|
+
email: string;
|
|
10
|
+
emailsTier_1?: string;
|
|
11
|
+
emailsTier_2?: string;
|
|
12
|
+
}
|
|
13
|
+
class Custom {
|
|
14
|
+
#accessKey: string;
|
|
15
|
+
#stagingUrl: boolean;
|
|
16
|
+
constructor(accessKey: string, stagingUrl = false) {
|
|
17
|
+
this.#accessKey = accessKey;
|
|
18
|
+
this.#stagingUrl = stagingUrl;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
createCustomer(payload: CreateCustomer): Promise<AxiosResponse<any>> {
|
|
22
|
+
if (checkParameters(payload.name, payload.storeUrl, payload.email, payload.location) === false) {
|
|
23
|
+
throw new Error(REQUIRED_MESSAGE);
|
|
24
|
+
}
|
|
25
|
+
return axios.post(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.CREATE_CUSTOMER}`, {
|
|
26
|
+
...payload,
|
|
27
|
+
headers: { "X-Api-Key": this.#accessKey },
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getCustomCustomerConfig: (store_url: string) => Promise<AxiosResponse<any>> = (store_url: string) => {
|
|
32
|
+
if (checkParameters(store_url) === false) {
|
|
33
|
+
throw new Error(REQUIRED_MESSAGE);
|
|
34
|
+
}
|
|
35
|
+
return axios.get(
|
|
36
|
+
`${getUrl({
|
|
37
|
+
urlName: APP_AUTH_BASE_URL,
|
|
38
|
+
stagingUrl: this.#stagingUrl,
|
|
39
|
+
})}${API_ENDPOINTS.CUSTOM_CUSTOMER}`,
|
|
40
|
+
{
|
|
41
|
+
params: { store_url },
|
|
42
|
+
headers: { "X-Api-Key": this.#accessKey },
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
getModelUrl: (id: string) => Promise<AxiosResponse<any>> = (id: string) => {
|
|
48
|
+
if (checkParameters(id) === false) {
|
|
49
|
+
throw new Error(REQUIRED_MESSAGE);
|
|
50
|
+
}
|
|
51
|
+
return axios.get(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${API_ENDPOINTS.MODEL}/${id}`, {
|
|
52
|
+
headers: { "X-Api-Key": this.#accessKey },
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default Custom;
|
package/src/fileUpload.ts
CHANGED
|
@@ -1,175 +1,183 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
this.#uppyIns.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import {
|
|
3
|
+
REQUIRED_MESSAGE,
|
|
4
|
+
REQUIRED_MESSAGE_FOR_META_DATA,
|
|
5
|
+
FILE_UPLOAD_ENDPOINT,
|
|
6
|
+
APP_AUTH_BASE_URL,
|
|
7
|
+
REQUIRED_ERROR_MESSAGE_INVALID_EMAIL,
|
|
8
|
+
} from "./constants.js";
|
|
9
|
+
import { addScanType, checkMetaDataValue, checkParameters, fetchData, getFileChunks, getUrl, isValidEmail } from "./utils.js";
|
|
10
|
+
const Uppy = require("fix-esm").require("@uppy/core");
|
|
11
|
+
const AwsS3Multipart = require("fix-esm").require("@uppy/aws-s3-multipart");
|
|
12
|
+
interface ObjMetaData {
|
|
13
|
+
gender: string;
|
|
14
|
+
scan_id?: string;
|
|
15
|
+
email: string;
|
|
16
|
+
focal_length: string;
|
|
17
|
+
height: string;
|
|
18
|
+
customer_store_url: string;
|
|
19
|
+
clothes_fit: string;
|
|
20
|
+
scan_type?: string;
|
|
21
|
+
callback_url: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface UploadOptions {
|
|
25
|
+
file: File;
|
|
26
|
+
arrayMetaData: Partial<ObjMetaData>[];
|
|
27
|
+
scanId: string;
|
|
28
|
+
email: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default class FileUpload {
|
|
32
|
+
#uppyIns: any;
|
|
33
|
+
#accessKey: string;
|
|
34
|
+
#stagingUrl: boolean;
|
|
35
|
+
|
|
36
|
+
constructor(accessKey: string, stagingUrl = false) {
|
|
37
|
+
this.#accessKey = accessKey;
|
|
38
|
+
this.#stagingUrl = stagingUrl;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async uploadFileFrontend({ file, arrayMetaData, scanId, email }: UploadOptions) {
|
|
42
|
+
email = email.trim();
|
|
43
|
+
if (!checkParameters(file, arrayMetaData, scanId, email)) {
|
|
44
|
+
throw new Error(REQUIRED_MESSAGE);
|
|
45
|
+
}
|
|
46
|
+
if (!isValidEmail(email)) {
|
|
47
|
+
throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
|
|
48
|
+
}
|
|
49
|
+
if (!checkMetaDataValue(arrayMetaData)) {
|
|
50
|
+
throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
|
|
51
|
+
}
|
|
52
|
+
arrayMetaData = addScanType(arrayMetaData, scanId, email);
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
if (this.#uppyIns) {
|
|
55
|
+
this.#uppyIns.close();
|
|
56
|
+
}
|
|
57
|
+
this.#uppyIns = new Uppy.default({ autoProceed: true });
|
|
58
|
+
this.#uppyIns.use(AwsS3Multipart.default, {
|
|
59
|
+
limit: 10,
|
|
60
|
+
retryDelays: [0, 1000, 3000, 5000],
|
|
61
|
+
companionUrl: getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl }),
|
|
62
|
+
getChunkSize: () => 5 * 1024 * 1024,
|
|
63
|
+
createMultipartUpload: (file: any) => {
|
|
64
|
+
const objectKey = `${scanId}.${file.extension}`;
|
|
65
|
+
return fetchData({
|
|
66
|
+
path: FILE_UPLOAD_ENDPOINT.UPLOAD_START,
|
|
67
|
+
apiKey: this.#accessKey,
|
|
68
|
+
stagingUrl: this.#stagingUrl,
|
|
69
|
+
body: {
|
|
70
|
+
objectKey,
|
|
71
|
+
contentType: file.type,
|
|
72
|
+
objectMetadata: arrayMetaData,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
completeMultipartUpload: (file: any, { uploadId, key, parts }: { uploadId: string | number; key: string | number; parts: any }) =>
|
|
77
|
+
fetchData({
|
|
78
|
+
path: FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
|
|
79
|
+
apiKey: this.#accessKey,
|
|
80
|
+
stagingUrl: this.#stagingUrl,
|
|
81
|
+
body: {
|
|
82
|
+
uploadId,
|
|
83
|
+
objectKey: key,
|
|
84
|
+
parts,
|
|
85
|
+
originalFileName: file.name,
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
|
|
89
|
+
signPart: (file: any, partData: any) =>
|
|
90
|
+
fetchData({
|
|
91
|
+
path: FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
|
|
92
|
+
stagingUrl: this.#stagingUrl,
|
|
93
|
+
apiKey: this.#accessKey,
|
|
94
|
+
body: {
|
|
95
|
+
objectKey: partData.key,
|
|
96
|
+
uploadId: partData.uploadId,
|
|
97
|
+
partNumber: partData.partNumber,
|
|
98
|
+
},
|
|
99
|
+
}),
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
this.#uppyIns.addFile({
|
|
103
|
+
source: "manual",
|
|
104
|
+
name: file.name,
|
|
105
|
+
type: file.type,
|
|
106
|
+
data: file,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
this.#uppyIns.on("upload-error", (file: any, error: any, response: any) => {
|
|
110
|
+
reject(error);
|
|
111
|
+
});
|
|
112
|
+
this.#uppyIns.on("upload-success", () => {
|
|
113
|
+
resolve({ message: "file uploaded successfully" });
|
|
114
|
+
});
|
|
115
|
+
this.#uppyIns.on("complete", (result: any) => {
|
|
116
|
+
if (this.#uppyIns) {
|
|
117
|
+
this.#uppyIns.close();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async uploadFile({ file, arrayMetaData, scanId, email }: UploadOptions) {
|
|
124
|
+
email = email.trim();
|
|
125
|
+
if (!checkParameters(file, arrayMetaData, scanId, email)) {
|
|
126
|
+
throw new Error(REQUIRED_MESSAGE);
|
|
127
|
+
}
|
|
128
|
+
if (!isValidEmail(email)) {
|
|
129
|
+
throw new Error(REQUIRED_ERROR_MESSAGE_INVALID_EMAIL);
|
|
130
|
+
}
|
|
131
|
+
if (!checkMetaDataValue(arrayMetaData)) {
|
|
132
|
+
throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
|
|
133
|
+
}
|
|
134
|
+
arrayMetaData = addScanType(arrayMetaData, scanId, email);
|
|
135
|
+
return new Promise(async (resolve, reject) => {
|
|
136
|
+
try {
|
|
137
|
+
const res: { key: string; uploadId: string } = await fetchData({
|
|
138
|
+
path: FILE_UPLOAD_ENDPOINT.UPLOAD_START,
|
|
139
|
+
apiKey: this.#accessKey,
|
|
140
|
+
stagingUrl: this.#stagingUrl,
|
|
141
|
+
body: {
|
|
142
|
+
objectKey: file.name,
|
|
143
|
+
contentType: file.type,
|
|
144
|
+
objectMetadata: arrayMetaData,
|
|
145
|
+
},
|
|
146
|
+
throwError: true,
|
|
147
|
+
});
|
|
148
|
+
const totalChunks = getFileChunks(file);
|
|
149
|
+
const parts = [];
|
|
150
|
+
for (let i = 0; i < totalChunks.length; i++) {
|
|
151
|
+
const data: { url: string } = await fetchData({
|
|
152
|
+
path: FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
|
|
153
|
+
apiKey: this.#accessKey,
|
|
154
|
+
stagingUrl: this.#stagingUrl,
|
|
155
|
+
body: {
|
|
156
|
+
objectKey: res?.key,
|
|
157
|
+
uploadId: res?.uploadId,
|
|
158
|
+
partNumber: i + 1,
|
|
159
|
+
},
|
|
160
|
+
throwError: true,
|
|
161
|
+
});
|
|
162
|
+
const val = await axios.put(data?.url, totalChunks[i], { headers: { "Content-Type": file.type, "X-Api-Key": this.#accessKey } });
|
|
163
|
+
parts.push({ PartNumber: i + 1, ETag: val?.headers?.etag });
|
|
164
|
+
}
|
|
165
|
+
const completeValue = await fetchData({
|
|
166
|
+
path: FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
|
|
167
|
+
apiKey: this.#accessKey,
|
|
168
|
+
stagingUrl: this.#stagingUrl,
|
|
169
|
+
body: {
|
|
170
|
+
uploadId: res?.uploadId,
|
|
171
|
+
objectKey: res?.key,
|
|
172
|
+
parts,
|
|
173
|
+
originalFileName: file.name,
|
|
174
|
+
},
|
|
175
|
+
throwError: true,
|
|
176
|
+
});
|
|
177
|
+
resolve({ message: "successfully uploaded", data: completeValue });
|
|
178
|
+
} catch (error: any) {
|
|
179
|
+
reject(error);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import Auth from "./auth.js";
|
|
2
|
-
import Custom from "./custom.js";
|
|
3
|
-
import FileUpload from "./fileUpload.js";
|
|
4
|
-
import Measurement from "./measurement.js";
|
|
5
|
-
import PoseDetection from "./poseDetection.js";
|
|
6
|
-
import TryOn from "./tryOn.js";
|
|
7
|
-
|
|
8
|
-
class Swan {
|
|
9
|
-
#accessKey: string;
|
|
10
|
-
#stagingUrl: boolean;
|
|
11
|
-
auth: Auth;
|
|
12
|
-
custom: Custom;
|
|
13
|
-
fileUpload: FileUpload;
|
|
14
|
-
measurement: Measurement;
|
|
15
|
-
poseDetection: PoseDetection;
|
|
16
|
-
tryOn: TryOn;
|
|
17
|
-
|
|
18
|
-
constructor(accessKey: string, stagingUrl = false) {
|
|
19
|
-
this.#accessKey = accessKey;
|
|
20
|
-
this.#stagingUrl = stagingUrl;
|
|
21
|
-
this.auth = new Auth(this.#accessKey, this.#stagingUrl);
|
|
22
|
-
this.custom = new Custom(this.#accessKey, this.#stagingUrl);
|
|
23
|
-
this.fileUpload = new FileUpload(this.#accessKey, this.#stagingUrl);
|
|
24
|
-
this.measurement = new Measurement(this.#accessKey, this.#stagingUrl);
|
|
25
|
-
this.poseDetection = new PoseDetection(this.#accessKey, this.#stagingUrl);
|
|
26
|
-
this.tryOn = new TryOn(this.#accessKey, this.#stagingUrl);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default Swan;
|
|
1
|
+
import Auth from "./auth.js";
|
|
2
|
+
import Custom from "./custom.js";
|
|
3
|
+
import FileUpload from "./fileUpload.js";
|
|
4
|
+
import Measurement from "./measurement.js";
|
|
5
|
+
import PoseDetection from "./poseDetection.js";
|
|
6
|
+
import TryOn from "./tryOn.js";
|
|
7
|
+
|
|
8
|
+
class Swan {
|
|
9
|
+
#accessKey: string;
|
|
10
|
+
#stagingUrl: boolean;
|
|
11
|
+
auth: Auth;
|
|
12
|
+
custom: Custom;
|
|
13
|
+
fileUpload: FileUpload;
|
|
14
|
+
measurement: Measurement;
|
|
15
|
+
poseDetection: PoseDetection;
|
|
16
|
+
tryOn: TryOn;
|
|
17
|
+
|
|
18
|
+
constructor(accessKey: string, stagingUrl = false) {
|
|
19
|
+
this.#accessKey = accessKey;
|
|
20
|
+
this.#stagingUrl = stagingUrl;
|
|
21
|
+
this.auth = new Auth(this.#accessKey, this.#stagingUrl);
|
|
22
|
+
this.custom = new Custom(this.#accessKey, this.#stagingUrl);
|
|
23
|
+
this.fileUpload = new FileUpload(this.#accessKey, this.#stagingUrl);
|
|
24
|
+
this.measurement = new Measurement(this.#accessKey, this.#stagingUrl);
|
|
25
|
+
this.poseDetection = new PoseDetection(this.#accessKey, this.#stagingUrl);
|
|
26
|
+
this.tryOn = new TryOn(this.#accessKey, this.#stagingUrl);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default Swan;
|