tryiton 1.1.1 → 2.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 +3 -3
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/index.ts +3 -3
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ import { TryItOn } from "tryiton";
|
|
|
27
27
|
const client = new TryItOn({ apiKey: process.env.TRYITON_API_KEY });
|
|
28
28
|
|
|
29
29
|
// Submit a clothing try-on
|
|
30
|
-
const jobId = await client.
|
|
30
|
+
const jobId = await client.tryOnFashion({
|
|
31
31
|
modelImage: "https://example.com/model.jpg",
|
|
32
32
|
garmentImage: "https://example.com/tshirt.jpg",
|
|
33
33
|
category: "clothing",
|
|
@@ -43,7 +43,7 @@ Image inputs accept a public URL or a base64 data URL (`data:image/png;base64,..
|
|
|
43
43
|
|
|
44
44
|
## Core parameters
|
|
45
45
|
|
|
46
|
-
`
|
|
46
|
+
`tryOnFashion` covers clothing and accessory try-on. The most important parameters:
|
|
47
47
|
|
|
48
48
|
| Parameter | Type | Required | Description |
|
|
49
49
|
| --------- | ---- | -------- | ----------- |
|
|
@@ -78,7 +78,7 @@ All failures throw `TryItOnError`, which carries the HTTP status code and the AP
|
|
|
78
78
|
import { TryItOn, TryItOnError } from "tryiton";
|
|
79
79
|
|
|
80
80
|
try {
|
|
81
|
-
await client.
|
|
81
|
+
await client.tryOnFashion({ /* ... */ });
|
|
82
82
|
} catch (err) {
|
|
83
83
|
if (err instanceof TryItOnError) {
|
|
84
84
|
console.error(err.status, err.errorName, err.message); // e.g. 429, "OutOfCredits"
|
package/dist/index.cjs
CHANGED
|
@@ -102,7 +102,7 @@ var TryItOn = class {
|
|
|
102
102
|
this.fetchImpl = f;
|
|
103
103
|
}
|
|
104
104
|
/** Put a garment or accessory on a person. Returns the job id. */
|
|
105
|
-
async
|
|
105
|
+
async tryOnFashion(params) {
|
|
106
106
|
const body = {
|
|
107
107
|
model_image: params.modelImage,
|
|
108
108
|
garment_image: params.garmentImage,
|
|
@@ -113,7 +113,7 @@ var TryItOn = class {
|
|
|
113
113
|
output_format: params.outputFormat,
|
|
114
114
|
moderation_level: params.moderationLevel
|
|
115
115
|
};
|
|
116
|
-
const res = await this.request("POST", "/tryon/
|
|
116
|
+
const res = await this.request("POST", "/tryon/fashion", body);
|
|
117
117
|
return res.jobId;
|
|
118
118
|
}
|
|
119
119
|
/** Restyle a person's hair. Returns the job id. */
|
package/dist/index.d.cts
CHANGED
|
@@ -38,7 +38,7 @@ type Category = "auto" | "clothing" | "eyewear" | "footwear" | "headwear" | "jew
|
|
|
38
38
|
type Mode = "performance" | "balanced" | "quality";
|
|
39
39
|
type OutputFormat = "png" | "jpeg";
|
|
40
40
|
type ModerationLevel = "conservative" | "permissive" | "none";
|
|
41
|
-
interface
|
|
41
|
+
interface TryOnFashionParams {
|
|
42
42
|
/** URL or base64 data URL of the person. */
|
|
43
43
|
modelImage: string;
|
|
44
44
|
/** URL or base64 data URL of the garment/accessory. */
|
|
@@ -131,7 +131,7 @@ declare class TryItOn {
|
|
|
131
131
|
private readonly fetchImpl;
|
|
132
132
|
constructor(options: TryItOnOptions);
|
|
133
133
|
/** Put a garment or accessory on a person. Returns the job id. */
|
|
134
|
-
|
|
134
|
+
tryOnFashion(params: TryOnFashionParams): Promise<string>;
|
|
135
135
|
/** Restyle a person's hair. Returns the job id. */
|
|
136
136
|
tryOnHairstyle(params: TryOnHairstyleParams): Promise<string>;
|
|
137
137
|
/** Ink a design onto skin. Returns the job id. */
|
|
@@ -148,4 +148,4 @@ declare class TryItOn {
|
|
|
148
148
|
private request;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, type StatusResponse, type TattooRegion, TryItOn, TryItOnError, type TryItOnOptions, type
|
|
151
|
+
export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, type StatusResponse, type TattooRegion, TryItOn, TryItOnError, type TryItOnOptions, type TryOnFashionParams, type TryOnHairstyleParams, type TryOnTattooParams, type WaitOptions, TryItOn as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ type Category = "auto" | "clothing" | "eyewear" | "footwear" | "headwear" | "jew
|
|
|
38
38
|
type Mode = "performance" | "balanced" | "quality";
|
|
39
39
|
type OutputFormat = "png" | "jpeg";
|
|
40
40
|
type ModerationLevel = "conservative" | "permissive" | "none";
|
|
41
|
-
interface
|
|
41
|
+
interface TryOnFashionParams {
|
|
42
42
|
/** URL or base64 data URL of the person. */
|
|
43
43
|
modelImage: string;
|
|
44
44
|
/** URL or base64 data URL of the garment/accessory. */
|
|
@@ -131,7 +131,7 @@ declare class TryItOn {
|
|
|
131
131
|
private readonly fetchImpl;
|
|
132
132
|
constructor(options: TryItOnOptions);
|
|
133
133
|
/** Put a garment or accessory on a person. Returns the job id. */
|
|
134
|
-
|
|
134
|
+
tryOnFashion(params: TryOnFashionParams): Promise<string>;
|
|
135
135
|
/** Restyle a person's hair. Returns the job id. */
|
|
136
136
|
tryOnHairstyle(params: TryOnHairstyleParams): Promise<string>;
|
|
137
137
|
/** Ink a design onto skin. Returns the job id. */
|
|
@@ -148,4 +148,4 @@ declare class TryItOn {
|
|
|
148
148
|
private request;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, type StatusResponse, type TattooRegion, TryItOn, TryItOnError, type TryItOnOptions, type
|
|
151
|
+
export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, type StatusResponse, type TattooRegion, TryItOn, TryItOnError, type TryItOnOptions, type TryOnFashionParams, type TryOnHairstyleParams, type TryOnTattooParams, type WaitOptions, TryItOn as default };
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ var TryItOn = class {
|
|
|
75
75
|
this.fetchImpl = f;
|
|
76
76
|
}
|
|
77
77
|
/** Put a garment or accessory on a person. Returns the job id. */
|
|
78
|
-
async
|
|
78
|
+
async tryOnFashion(params) {
|
|
79
79
|
const body = {
|
|
80
80
|
model_image: params.modelImage,
|
|
81
81
|
garment_image: params.garmentImage,
|
|
@@ -86,7 +86,7 @@ var TryItOn = class {
|
|
|
86
86
|
output_format: params.outputFormat,
|
|
87
87
|
moderation_level: params.moderationLevel
|
|
88
88
|
};
|
|
89
|
-
const res = await this.request("POST", "/tryon/
|
|
89
|
+
const res = await this.request("POST", "/tryon/fashion", body);
|
|
90
90
|
return res.jobId;
|
|
91
91
|
}
|
|
92
92
|
/** Restyle a person's hair. Returns the job id. */
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -59,7 +59,7 @@ export type OutputFormat = "png" | "jpeg";
|
|
|
59
59
|
|
|
60
60
|
export type ModerationLevel = "conservative" | "permissive" | "none";
|
|
61
61
|
|
|
62
|
-
export interface
|
|
62
|
+
export interface TryOnFashionParams {
|
|
63
63
|
/** URL or base64 data URL of the person. */
|
|
64
64
|
modelImage: string;
|
|
65
65
|
/** URL or base64 data URL of the garment/accessory. */
|
|
@@ -200,7 +200,7 @@ export class TryItOn {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
/** Put a garment or accessory on a person. Returns the job id. */
|
|
203
|
-
async
|
|
203
|
+
async tryOnFashion(params: TryOnFashionParams): Promise<string> {
|
|
204
204
|
const body = {
|
|
205
205
|
model_image: params.modelImage,
|
|
206
206
|
garment_image: params.garmentImage,
|
|
@@ -211,7 +211,7 @@ export class TryItOn {
|
|
|
211
211
|
output_format: params.outputFormat,
|
|
212
212
|
moderation_level: params.moderationLevel,
|
|
213
213
|
};
|
|
214
|
-
const res = await this.request<{ jobId: string }>("POST", "/tryon/
|
|
214
|
+
const res = await this.request<{ jobId: string }>("POST", "/tryon/fashion", body);
|
|
215
215
|
return res.jobId;
|
|
216
216
|
}
|
|
217
217
|
|