@cympotek/3d-transfer-sdk 1.0.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/README.md ADDED
@@ -0,0 +1,345 @@
1
+ # @cympotek/3d-transfer-sdk
2
+
3
+ TypeScript SDK for Mobius 3D Transfer API - Convert images to 3D models using AI-powered style transfer.
4
+
5
+ ## Features
6
+
7
+ - Full TypeScript support with auto-generated types
8
+ - Support for multiple frameworks (Vite, Next.js, Expo, Node.js)
9
+ - Environment variable based configuration
10
+ - Axios-based HTTP client
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @cympotek/3d-transfer-sdk
16
+ # or
17
+ yarn add @cympotek/3d-transfer-sdk
18
+ # or
19
+ pnpm add @cympotek/3d-transfer-sdk
20
+ ```
21
+
22
+ ## Environment Variables
23
+
24
+ Configure the SDK using environment variables based on your framework:
25
+
26
+ | Variable | Framework | Description |
27
+ |----------|-----------|-------------|
28
+ | `VITE_TRANSFER_3D_API_URL` | Vite | API base URL |
29
+ | `VITE_TRANSFER_3D_API_TOKEN` | Vite | API authentication token |
30
+ | `NEXT_PUBLIC_TRANSFER_3D_API_URL` | Next.js | API base URL |
31
+ | `NEXT_PUBLIC_TRANSFER_3D_API_TOKEN` | Next.js | API authentication token |
32
+ | `EXPO_PUBLIC_TRANSFER_3D_API_URL` | Expo | API base URL |
33
+ | `EXPO_PUBLIC_TRANSFER_3D_API_TOKEN` | Expo | API authentication token |
34
+ | `TRANSFER_3D_API_URL` | Node.js | API base URL |
35
+ | `TRANSFER_3D_API_TOKEN` | Node.js | API authentication token |
36
+
37
+ ### Example .env file
38
+
39
+ ```bash
40
+ # For Vite projects
41
+ VITE_TRANSFER_3D_API_URL=https://api.example.com/api
42
+ VITE_TRANSFER_3D_API_TOKEN=your-api-token-here
43
+
44
+ # For Next.js projects
45
+ NEXT_PUBLIC_TRANSFER_3D_API_URL=https://api.example.com/api
46
+ NEXT_PUBLIC_TRANSFER_3D_API_TOKEN=your-api-token-here
47
+
48
+ # For Node.js/backend projects
49
+ TRANSFER_3D_API_URL=https://api.example.com/api
50
+ TRANSFER_3D_API_TOKEN=your-api-token-here
51
+ ```
52
+
53
+ ## Quick Start
54
+
55
+ ### Basic Usage
56
+
57
+ ```typescript
58
+ import {
59
+ createTransfer3DClient,
60
+ getTransfer3dStyles,
61
+ initiateTransfer3dConversion,
62
+ getTransfer3dStatus,
63
+ } from '@cympotek/3d-transfer-sdk';
64
+
65
+ // Initialize client (uses environment variables by default)
66
+ const client = createTransfer3DClient();
67
+
68
+ // Or with explicit configuration
69
+ const client = createTransfer3DClient({
70
+ baseURL: 'https://api.example.com/api',
71
+ token: 'your-api-token',
72
+ });
73
+ ```
74
+
75
+ ### Complete Workflow Example
76
+
77
+ ```typescript
78
+ import {
79
+ createTransfer3DClient,
80
+ getTransfer3dStyles,
81
+ initiateTransfer3dConversion,
82
+ getTransfer3dStatus,
83
+ } from '@cympotek/3d-transfer-sdk';
84
+
85
+ async function convertImageTo3D(imageFile: File) {
86
+ // 1. Initialize client
87
+ const client = createTransfer3DClient({
88
+ token: 'your-api-token',
89
+ });
90
+
91
+ // 2. Get available styles
92
+ const stylesResponse = await getTransfer3dStyles({ client });
93
+ console.log('Available styles:', stylesResponse.data);
94
+ // Output: [{ mode_key: 'smart', mode_name: 'Q版公仔', ... }]
95
+
96
+ // 3. Upload image and start conversion
97
+ const conversionResponse = await initiateTransfer3dConversion({
98
+ client,
99
+ body: {
100
+ image: imageFile,
101
+ style: 'smart', // Use a style from step 2
102
+ },
103
+ });
104
+
105
+ const requestId = conversionResponse.data.data.request_id;
106
+ console.log('Conversion started:', requestId);
107
+
108
+ // 4. Poll for status until completed
109
+ let status = 'PENDING';
110
+ let result = null;
111
+
112
+ while (status !== 'COMPLETED' && status !== 'FAILED') {
113
+ await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait 2 seconds
114
+
115
+ const statusResponse = await getTransfer3dStatus({
116
+ client,
117
+ path: { requestId },
118
+ });
119
+
120
+ status = statusResponse.data.data.status;
121
+ console.log('Status:', status);
122
+
123
+ if (status === 'COMPLETED') {
124
+ result = statusResponse.data.data.result;
125
+ }
126
+ }
127
+
128
+ if (result) {
129
+ console.log('3D Model URL:', result.model_3d_url);
130
+ console.log('GLB File URL:', result.glb_url);
131
+ console.log('2D Preview URL:', result.preview_2d_url);
132
+ }
133
+
134
+ return result;
135
+ }
136
+ ```
137
+
138
+ ### React/Next.js Example
139
+
140
+ ```tsx
141
+ import { useState } from 'react';
142
+ import {
143
+ createTransfer3DClient,
144
+ getTransfer3dStyles,
145
+ initiateTransfer3dConversion,
146
+ getTransfer3dStatus,
147
+ } from '@cympotek/3d-transfer-sdk';
148
+
149
+ export function ImageTo3DConverter() {
150
+ const [status, setStatus] = useState<string>('idle');
151
+ const [modelUrl, setModelUrl] = useState<string | null>(null);
152
+
153
+ const handleConvert = async (file: File, style: string) => {
154
+ const client = createTransfer3DClient();
155
+
156
+ setStatus('uploading');
157
+ const { data } = await initiateTransfer3dConversion({
158
+ client,
159
+ body: { image: file, style },
160
+ });
161
+
162
+ const requestId = data.data.request_id;
163
+ setStatus('processing');
164
+
165
+ // Poll for completion
166
+ const pollStatus = async () => {
167
+ const { data: statusData } = await getTransfer3dStatus({
168
+ client,
169
+ path: { requestId },
170
+ });
171
+
172
+ if (statusData.data.status === 'COMPLETED') {
173
+ setModelUrl(statusData.data.result.model_3d_url);
174
+ setStatus('completed');
175
+ } else if (statusData.data.status === 'FAILED') {
176
+ setStatus('failed');
177
+ } else {
178
+ setTimeout(pollStatus, 2000);
179
+ }
180
+ };
181
+
182
+ pollStatus();
183
+ };
184
+
185
+ return (
186
+ <div>
187
+ <p>Status: {status}</p>
188
+ {modelUrl && <a href={modelUrl}>Download 3D Model</a>}
189
+ </div>
190
+ );
191
+ }
192
+ ```
193
+
194
+ ## API Reference
195
+
196
+ ### `createTransfer3DClient(config?)`
197
+
198
+ Create a configured API client instance.
199
+
200
+ **Parameters:**
201
+ - `config.baseURL` (optional): API base URL
202
+ - `config.token` (optional): Bearer authentication token
203
+ - `config.timeout` (optional): Request timeout in ms (default: 30000)
204
+
205
+ **Returns:** Configured axios client
206
+
207
+ ---
208
+
209
+ ### `getTransfer3dStyles(options)`
210
+
211
+ Get available 3D transfer styles.
212
+
213
+ **Returns:**
214
+ ```typescript
215
+ {
216
+ success: true,
217
+ data: Array<{
218
+ mode_key: string; // Style identifier (e.g., 'smart')
219
+ mode_name: string; // Display name (e.g., 'Q版公仔')
220
+ mode_description: string;
221
+ preview_image_url: string | null;
222
+ }>
223
+ }
224
+ ```
225
+
226
+ ---
227
+
228
+ ### `initiateTransfer3dConversion(options)`
229
+
230
+ Upload an image and start the 3D conversion process.
231
+
232
+ **Parameters:**
233
+ - `body.image`: File - Image to convert (max 10MB, supported: jpg, png, webp)
234
+ - `body.style`: string - Style key from `getTransfer3dStyles()`
235
+
236
+ **Returns:**
237
+ ```typescript
238
+ {
239
+ success: true,
240
+ data: {
241
+ request_id: string; // UUID for status polling
242
+ status: 'PENDING';
243
+ message: string;
244
+ }
245
+ }
246
+ ```
247
+
248
+ ---
249
+
250
+ ### `getTransfer3dStatus(options)`
251
+
252
+ Get the status of a conversion request.
253
+
254
+ **Parameters:**
255
+ - `path.requestId`: string - Request ID from conversion response
256
+
257
+ **Returns:**
258
+ ```typescript
259
+ {
260
+ success: true,
261
+ data: {
262
+ request_id: string;
263
+ status: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
264
+ phase: '2d_style_transfer' | '3d_generation';
265
+ progress: number; // 0-100
266
+ result?: {
267
+ preview_2d_url: string;
268
+ model_3d_url: string;
269
+ glb_url: string;
270
+ };
271
+ error?: string; // Present if status is FAILED
272
+ }
273
+ }
274
+ ```
275
+
276
+ ## Status Values
277
+
278
+ | Status | Description |
279
+ |--------|-------------|
280
+ | `PENDING` | Conversion request queued |
281
+ | `IN_PROGRESS` | Currently processing |
282
+ | `COMPLETED` | Conversion finished successfully |
283
+ | `FAILED` | An error occurred |
284
+
285
+ ## TypeScript Types
286
+
287
+ ```typescript
288
+ import type {
289
+ // Request/Response types (auto-generated)
290
+ GetTransfer3dStylesResponse,
291
+ InitiateTransfer3dConversionData,
292
+ InitiateTransfer3dConversionResponse,
293
+ GetTransfer3dStatusData,
294
+ GetTransfer3dStatusResponse,
295
+ } from '@cympotek/3d-transfer-sdk';
296
+ ```
297
+
298
+ ## Error Handling
299
+
300
+ ```typescript
301
+ import { AxiosError } from 'axios';
302
+
303
+ try {
304
+ const response = await initiateTransfer3dConversion({
305
+ client,
306
+ body: { image: file, style: 'smart' },
307
+ });
308
+ } catch (error) {
309
+ if (error instanceof AxiosError) {
310
+ if (error.response?.status === 401) {
311
+ console.error('Authentication failed. Check your API token.');
312
+ } else if (error.response?.status === 422) {
313
+ console.error('Validation error:', error.response.data.errors);
314
+ } else if (error.response?.status === 429) {
315
+ console.error('Rate limit exceeded. Please try again later.');
316
+ }
317
+ }
318
+ throw error;
319
+ }
320
+ ```
321
+
322
+ ## Regenerating the SDK
323
+
324
+ This SDK is auto-generated from the OpenAPI specification. To regenerate:
325
+
326
+ ```bash
327
+ # In the mobius-frontier project root
328
+ make sdk-3d-transfer
329
+ ```
330
+
331
+ ## OpenAPI Specification
332
+
333
+ The OpenAPI spec is included in this package at `openapi.json`. You can use it to:
334
+ - Generate clients for other languages
335
+ - Import into API testing tools (Postman, Insomnia)
336
+ - Generate documentation
337
+
338
+ ## Support
339
+
340
+ - [API Documentation](https://api.localhost/docs/api)
341
+ - [GitHub Issues](https://github.com/cympotek/mobius-frontier/issues)
342
+
343
+ ---
344
+
345
+ *This SDK is auto-generated from the Mobius Frontier OpenAPI specification using [@hey-api/openapi-ts](https://heyapi.vercel.app/)*
@@ -0,0 +1,3 @@
1
+ export * from './sdk.gen';
2
+ export * from './types.gen';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ export * from './sdk.gen';
3
+ export * from './types.gen';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { type OptionsLegacyParser } from '@hey-api/client-axios';
2
+ import type { GetTransfer3dStylesError, InitiateTransfer3dConversionData, InitiateTransfer3dConversionError, GetTransfer3dStatusData, GetTransfer3dStatusError, ProxyTransfer3dModelData, ProxyTransfer3dModelError } from './types.gen';
3
+ export declare const client: import("@hey-api/client-axios").Client;
4
+ /**
5
+ * Get available 3D transfer styles
6
+ * Returns a list of available 3D transfer styles with their configurations.
7
+ */
8
+ export declare const getTransfer3dStyles: <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<unknown, ThrowOnError>) => import("@hey-api/client-axios").RequestResult<200, GetTransfer3dStylesError, ThrowOnError>;
9
+ /**
10
+ * Upload image and initiate 3D conversion
11
+ * Upload an image and start the 3D conversion process. The image will first
12
+ * be processed through 2D style transfer, then converted to a 3D model.
13
+ */
14
+ export declare const initiateTransfer3dConversion: <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<InitiateTransfer3dConversionData, ThrowOnError>) => import("@hey-api/client-axios").RequestResult<200, InitiateTransfer3dConversionError, ThrowOnError>;
15
+ /**
16
+ * Get conversion status
17
+ * Query the status of a conversion request. Returns the current phase,
18
+ * progress, and result URLs when available.
19
+ */
20
+ export declare const getTransfer3dStatus: <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetTransfer3dStatusData, ThrowOnError>) => import("@hey-api/client-axios").RequestResult<200, GetTransfer3dStatusError, ThrowOnError>;
21
+ /**
22
+ * Proxy GLB model file
23
+ * Proxies the GLB model file to avoid CORS issues when loading from external domains.
24
+ */
25
+ export declare const proxyTransfer3dModel: <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<ProxyTransfer3dModelData, ThrowOnError>) => import("@hey-api/client-axios").RequestResult<200, ProxyTransfer3dModelError, ThrowOnError>;
26
+ //# sourceMappingURL=sdk.gen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.gen.d.ts","sourceRoot":"","sources":["../src/sdk.gen.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8B,KAAK,mBAAmB,EAA0B,MAAM,uBAAuB,CAAC;AACrH,OAAO,KAAK,EAAE,wBAAwB,EAA+B,gCAAgC,EAAE,iCAAiC,EAAwC,uBAAuB,EAAE,wBAAwB,EAA+B,wBAAwB,EAAE,yBAAyB,EAAgC,MAAM,aAAa,CAAC;AAEvW,eAAO,MAAM,MAAM,wCAA+B,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,UAAU,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,+FAK7H,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,SAAS,mBAAmB,CAAC,gCAAgC,EAAE,YAAY,CAAC,wGAU9J,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,SAAS,mBAAmB,CAAC,uBAAuB,EAAE,YAAY,CAAC,+FAK5I,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,YAAY,SAAS,OAAO,GAAG,KAAK,EAAE,SAAS,mBAAmB,CAAC,wBAAwB,EAAE,YAAY,CAAC,gGAK9I,CAAC"}
@@ -0,0 +1,51 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ import { createClient, createConfig, formDataBodySerializer } from '@hey-api/client-axios';
3
+ export const client = createClient(createConfig());
4
+ /**
5
+ * Get available 3D transfer styles
6
+ * Returns a list of available 3D transfer styles with their configurations.
7
+ */
8
+ export const getTransfer3dStyles = (options) => {
9
+ return (options?.client ?? client).get({
10
+ ...options,
11
+ url: '/3d-transfer/styles'
12
+ });
13
+ };
14
+ /**
15
+ * Upload image and initiate 3D conversion
16
+ * Upload an image and start the 3D conversion process. The image will first
17
+ * be processed through 2D style transfer, then converted to a 3D model.
18
+ */
19
+ export const initiateTransfer3dConversion = (options) => {
20
+ return (options?.client ?? client).post({
21
+ ...options,
22
+ ...formDataBodySerializer,
23
+ headers: {
24
+ 'Content-Type': null,
25
+ ...options?.headers
26
+ },
27
+ url: '/3d-transfer/convert'
28
+ });
29
+ };
30
+ /**
31
+ * Get conversion status
32
+ * Query the status of a conversion request. Returns the current phase,
33
+ * progress, and result URLs when available.
34
+ */
35
+ export const getTransfer3dStatus = (options) => {
36
+ return (options?.client ?? client).get({
37
+ ...options,
38
+ url: '/3d-transfer/{requestId}/status'
39
+ });
40
+ };
41
+ /**
42
+ * Proxy GLB model file
43
+ * Proxies the GLB model file to avoid CORS issues when loading from external domains.
44
+ */
45
+ export const proxyTransfer3dModel = (options) => {
46
+ return (options?.client ?? client).get({
47
+ ...options,
48
+ url: '/3d-transfer/{requestId}/model.glb'
49
+ });
50
+ };
51
+ //# sourceMappingURL=sdk.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.gen.js","sourceRoot":"","sources":["../src/sdk.gen.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,EAAE,YAAY,EAAE,YAAY,EAA4B,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAGrH,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAuC,OAAoD,EAAE,EAAE;IAC9H,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC,GAAG,CAAsE;QACxG,GAAG,OAAO;QACV,GAAG,EAAE,qBAAqB;KAC7B,CAAC,CAAC;AACP,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAuC,OAA4E,EAAE,EAAE;IAC/J,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC,IAAI,CAAwF;QAC3H,GAAG,OAAO;QACV,GAAG,sBAAsB;QACzB,OAAO,EAAE;YACL,cAAc,EAAE,IAAI;YACpB,GAAG,OAAO,EAAE,OAAO;SACtB;QACD,GAAG,EAAE,sBAAsB;KAC9B,CAAC,CAAC;AACP,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAuC,OAAmE,EAAE,EAAE;IAC7I,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC,GAAG,CAAsE;QACxG,GAAG,OAAO;QACV,GAAG,EAAE,iCAAiC;KACzC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAuC,OAAoE,EAAE,EAAE;IAC/I,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC,GAAG,CAAwE;QAC1G,GAAG,OAAO;QACV,GAAG,EAAE,oCAAoC;KAC5C,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,56 @@
1
+ export type GetTransfer3dStylesResponse = (200);
2
+ export type GetTransfer3dStylesError = ({
3
+ /**
4
+ * Error overview.
5
+ */
6
+ message: string;
7
+ });
8
+ export type InitiateTransfer3dConversionData = {
9
+ body: {
10
+ image: (Blob | File);
11
+ style: '';
12
+ };
13
+ };
14
+ export type InitiateTransfer3dConversionResponse = (200);
15
+ export type InitiateTransfer3dConversionError = ({
16
+ /**
17
+ * Error overview.
18
+ */
19
+ message: string;
20
+ } | {
21
+ /**
22
+ * Errors overview.
23
+ */
24
+ message: string;
25
+ /**
26
+ * A detailed description of each field that failed validation.
27
+ */
28
+ errors: {
29
+ [key: string]: Array<(string)>;
30
+ };
31
+ });
32
+ export type GetTransfer3dStatusData = {
33
+ path: {
34
+ requestId: string;
35
+ };
36
+ };
37
+ export type GetTransfer3dStatusResponse = (200);
38
+ export type GetTransfer3dStatusError = ({
39
+ /**
40
+ * Error overview.
41
+ */
42
+ message: string;
43
+ });
44
+ export type ProxyTransfer3dModelData = {
45
+ path: {
46
+ requestId: string;
47
+ };
48
+ };
49
+ export type ProxyTransfer3dModelResponse = (200);
50
+ export type ProxyTransfer3dModelError = ({
51
+ /**
52
+ * Error overview.
53
+ */
54
+ message: string;
55
+ });
56
+ //# sourceMappingURL=types.gen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.gen.d.ts","sourceRoot":"","sources":["../src/types.gen.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,2BAA2B,GAAG,CAAC,GAAG,CAAC,CAAC;AAEhD,MAAM,MAAM,wBAAwB,GAAG,CAAC;IACpC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,MAAM,gCAAgC,GAAG;IAC3C,IAAI,EAAE;QACF,KAAK,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;QACrB,KAAK,EAAE,EAAE,CAAC;KACb,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEzD,MAAM,MAAM,iCAAiC,GAAG,CAAC;IAC7C;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB,GAAG;IACA;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE;QACJ,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;KAClC,CAAC;CACL,CAAC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG;IAClC,IAAI,EAAE;QACF,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,CAAC,GAAG,CAAC,CAAC;AAEhD,MAAM,MAAM,wBAAwB,GAAG,CAAC;IACpC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG;IACnC,IAAI,EAAE;QACF,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,MAAM,yBAAyB,GAAG,CAAC;IACrC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ export {};
3
+ //# sourceMappingURL=types.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.gen.js","sourceRoot":"","sources":["../src/types.gen.ts"],"names":[],"mappings":"AAAA,qDAAqD"}
package/openapi.json ADDED
@@ -0,0 +1,240 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "Mobius 3D Transfer API",
5
+ "version": "1.0.0",
6
+ "description": "3D Transfer API for converting images to 3D models.\n\n## Overview\n\nThis API provides endpoints for:\n- Getting available 3D transfer styles\n- Uploading images and initiating 3D conversion\n- Checking conversion status and retrieving results\n\n## Authentication\n\nAll endpoints require Bearer token authentication:\n```\nAuthorization: Bearer <your-api-token>\n```\n\n## Workflow\n\n1. Call `GET /3d-transfer/styles` to get available styles\n2. Call `POST /3d-transfer/convert` with an image and style\n3. Poll `GET /3d-transfer/{requestId}/status` until status is COMPLETED\n4. Retrieve the 3D model URL from the response"
7
+ },
8
+ "servers": [
9
+ {
10
+ "url": "http://www.localhost/api"
11
+ }
12
+ ],
13
+ "security": [
14
+ {
15
+ "http": []
16
+ }
17
+ ],
18
+ "paths": {
19
+ "/3d-transfer/styles": {
20
+ "get": {
21
+ "operationId": "getTransfer3DStyles",
22
+ "description": "Returns a list of available 3D transfer styles with their configurations.",
23
+ "summary": "Get available 3D transfer styles",
24
+ "tags": [
25
+ "3D Transfer",
26
+ "Transfer3D"
27
+ ],
28
+ "responses": {
29
+ "200": {
30
+ "description": "",
31
+ "content": {
32
+ "application/json": {
33
+ "schema": {
34
+ "type": "integer",
35
+ "enum": [
36
+ 200
37
+ ]
38
+ }
39
+ }
40
+ }
41
+ },
42
+ "401": {
43
+ "$ref": "#/components/responses/AuthenticationException"
44
+ }
45
+ }
46
+ }
47
+ },
48
+ "/3d-transfer/convert": {
49
+ "post": {
50
+ "operationId": "initiateTransfer3DConversion",
51
+ "description": "Upload an image and start the 3D conversion process. The image will first\nbe processed through 2D style transfer, then converted to a 3D model.",
52
+ "summary": "Upload image and initiate 3D conversion",
53
+ "tags": [
54
+ "3D Transfer",
55
+ "Transfer3D"
56
+ ],
57
+ "requestBody": {
58
+ "required": true,
59
+ "content": {
60
+ "multipart/form-data": {
61
+ "schema": {
62
+ "type": "object",
63
+ "properties": {
64
+ "image": {
65
+ "type": "string",
66
+ "format": "binary",
67
+ "contentMediaType": "application/octet-stream",
68
+ "maxLength": 10240
69
+ },
70
+ "style": {
71
+ "type": "string",
72
+ "enum": [
73
+ ""
74
+ ]
75
+ }
76
+ },
77
+ "required": [
78
+ "image",
79
+ "style"
80
+ ]
81
+ }
82
+ }
83
+ }
84
+ },
85
+ "responses": {
86
+ "200": {
87
+ "description": "",
88
+ "content": {
89
+ "application/json": {
90
+ "schema": {
91
+ "type": "integer",
92
+ "enum": [
93
+ 200
94
+ ]
95
+ }
96
+ }
97
+ }
98
+ },
99
+ "401": {
100
+ "$ref": "#/components/responses/AuthenticationException"
101
+ },
102
+ "422": {
103
+ "$ref": "#/components/responses/ValidationException"
104
+ }
105
+ }
106
+ }
107
+ },
108
+ "/3d-transfer/{requestId}/status": {
109
+ "get": {
110
+ "operationId": "getTransfer3DStatus",
111
+ "description": "Query the status of a conversion request. Returns the current phase,\nprogress, and result URLs when available.",
112
+ "summary": "Get conversion status",
113
+ "tags": [
114
+ "3D Transfer",
115
+ "Transfer3D"
116
+ ],
117
+ "parameters": [
118
+ {
119
+ "name": "requestId",
120
+ "in": "path",
121
+ "required": true,
122
+ "schema": {
123
+ "type": "string"
124
+ }
125
+ }
126
+ ],
127
+ "responses": {
128
+ "200": {
129
+ "description": "",
130
+ "content": {
131
+ "application/json": {
132
+ "schema": {
133
+ "type": "integer",
134
+ "enum": [
135
+ 200
136
+ ]
137
+ }
138
+ }
139
+ }
140
+ },
141
+ "401": {
142
+ "$ref": "#/components/responses/AuthenticationException"
143
+ }
144
+ }
145
+ }
146
+ },
147
+ "/3d-transfer/{requestId}/model.glb": {
148
+ "get": {
149
+ "operationId": "proxyTransfer3DModel",
150
+ "description": "Proxies the GLB model file to avoid CORS issues when loading from external domains.",
151
+ "summary": "Proxy GLB model file",
152
+ "tags": [
153
+ "3D Transfer",
154
+ "Transfer3D"
155
+ ],
156
+ "parameters": [
157
+ {
158
+ "name": "requestId",
159
+ "in": "path",
160
+ "required": true,
161
+ "schema": {
162
+ "type": "string"
163
+ }
164
+ }
165
+ ],
166
+ "responses": {
167
+ "200": {
168
+ "description": "",
169
+ "content": {
170
+ "application/json": {
171
+ "schema": {
172
+ "type": "integer",
173
+ "enum": [
174
+ 200
175
+ ]
176
+ }
177
+ }
178
+ }
179
+ },
180
+ "401": {
181
+ "$ref": "#/components/responses/AuthenticationException"
182
+ }
183
+ }
184
+ }
185
+ }
186
+ },
187
+ "components": {
188
+ "responses": {
189
+ "AuthenticationException": {
190
+ "description": "Unauthenticated",
191
+ "content": {
192
+ "application/json": {
193
+ "schema": {
194
+ "type": "object",
195
+ "properties": {
196
+ "message": {
197
+ "type": "string",
198
+ "description": "Error overview."
199
+ }
200
+ },
201
+ "required": [
202
+ "message"
203
+ ]
204
+ }
205
+ }
206
+ }
207
+ },
208
+ "ValidationException": {
209
+ "description": "Validation error",
210
+ "content": {
211
+ "application/json": {
212
+ "schema": {
213
+ "type": "object",
214
+ "properties": {
215
+ "message": {
216
+ "type": "string",
217
+ "description": "Errors overview."
218
+ },
219
+ "errors": {
220
+ "type": "object",
221
+ "description": "A detailed description of each field that failed validation.",
222
+ "additionalProperties": {
223
+ "type": "array",
224
+ "items": {
225
+ "type": "string"
226
+ }
227
+ }
228
+ }
229
+ },
230
+ "required": [
231
+ "message",
232
+ "errors"
233
+ ]
234
+ }
235
+ }
236
+ }
237
+ }
238
+ }
239
+ }
240
+ }
package/package.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "@cympotek/3d-transfer-sdk",
3
+ "version": "1.0.0",
4
+ "description": "TypeScript SDK for Mobius 3D Transfer API - Convert images to 3D models",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ },
22
+ "./react": {
23
+ "import": {
24
+ "types": "./dist/react/index.d.ts",
25
+ "default": "./dist/react/index.js"
26
+ },
27
+ "require": {
28
+ "types": "./dist/react/index.d.ts",
29
+ "default": "./dist/react/index.js"
30
+ },
31
+ "types": "./dist/react/index.d.ts",
32
+ "default": "./dist/react/index.js"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "README.md",
38
+ "openapi.json"
39
+ ],
40
+ "scripts": {
41
+ "generate": "openapi-ts --input ./openapi.json --output ./src --client @hey-api/client-axios",
42
+ "build": "tsc && tsc -p tsconfig.esm.json",
43
+ "clean": "rm -rf dist src/*.gen.ts",
44
+ "prepublishOnly": "npm run clean && npm run generate && npm run build"
45
+ },
46
+ "dependencies": {
47
+ "@hey-api/client-axios": "^0.3.4",
48
+ "axios": "^1.6.0"
49
+ },
50
+ "devDependencies": {
51
+ "@hey-api/openapi-ts": "^0.60.1",
52
+ "@types/react": "^18.0.0",
53
+ "@types/react-dom": "^18.0.0",
54
+ "typescript": "^5.0.0"
55
+ },
56
+ "peerDependencies": {
57
+ "axios": ">=1.0.0",
58
+ "react": ">=17.0.0",
59
+ "react-dom": ">=17.0.0"
60
+ },
61
+ "peerDependenciesMeta": {
62
+ "react": {
63
+ "optional": true
64
+ },
65
+ "react-dom": {
66
+ "optional": true
67
+ }
68
+ },
69
+ "keywords": [
70
+ "3d",
71
+ "transfer",
72
+ "api",
73
+ "sdk",
74
+ "mobius",
75
+ "ai",
76
+ "image-to-3d",
77
+ "typescript",
78
+ "openapi"
79
+ ],
80
+ "author": "Cympotek",
81
+ "license": "UNLICENSED",
82
+ "repository": {
83
+ "type": "git",
84
+ "url": "https://github.com/cympotek/mobius-frontier"
85
+ },
86
+ "homepage": "https://github.com/cympotek/mobius-frontier#readme",
87
+ "bugs": {
88
+ "url": "https://github.com/cympotek/mobius-frontier/issues"
89
+ },
90
+ "engines": {
91
+ "node": ">=18.0.0"
92
+ },
93
+ "publishConfig": {
94
+ "access": "public"
95
+ }
96
+ }