MCPcopy
hub / github.com/erictik/midjourney-api / main

Function main

example/zoomout.ts:10–51  ·  view source on GitHub ↗

* * a simple example of how to use the zoomout with ws command * ``` * npx tsx example/zoomout.ts * ```

()

Source from the content-addressed store, hash-verified

8 * ```
9 */
10async function main() {
11 const client = new Midjourney({
12 ServerId: <string>process.env.SERVER_ID,
13 ChannelId: <string>process.env.CHANNEL_ID,
14 SalaiToken: <string>process.env.SALAI_TOKEN,
15 Debug: true,
16 Ws: true,
17 });
18 await client.Connect();
19 const Imagine = await client.Imagine("a cool cat, blue ears, yellow hat");
20 console.log(Imagine);
21 if (!Imagine) {
22 console.log("no message");
23 return;
24 }
25 const Upscale = await client.Upscale({
26 index: 2,
27 msgId: <string>Imagine.id,
28 hash: <string>Imagine.hash,
29 flags: Imagine.flags,
30 loading: (uri: string, progress: string) => {
31 console.log("loading", uri, "progress", progress);
32 },
33 });
34 if (!Upscale) {
35 console.log("no message");
36 return;
37 }
38 console.log(Upscale);
39 const Zoomout = await client.ZoomOut({
40 level: "2x",
41 msgId: <string>Upscale.id,
42 hash: <string>Upscale.hash,
43 flags: Upscale.flags,
44 loading: (uri: string, progress: string) => {
45 console.log("loading", uri, "progress", progress);
46 },
47 });
48 console.log(Zoomout);
49
50 client.Close();
51}
52main().catch((err) => {
53 console.error(err);
54 process.exit(1);

Callers 1

zoomout.tsFile · 0.70

Calls 6

ConnectMethod · 0.95
ImagineMethod · 0.95
UpscaleMethod · 0.95
ZoomOutMethod · 0.95
CloseMethod · 0.95
logMethod · 0.45

Tested by

no test coverage detected