forked from triggerdotdev/trigger.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollections.ts
More file actions
37 lines (33 loc) · 952 Bytes
/
Copy pathcollections.ts
File metadata and controls
37 lines (33 loc) · 952 Bytes
1
2
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
import { IntegrationTaskKey } from "@trigger.dev/sdk";
import { Page, Collection } from "replicate";
import { ReplicateRunTask } from "./index";
import { ReplicateReturnType } from "./types";
export class Collections {
constructor(private runTask: ReplicateRunTask) {}
/** Fetch a model collection. */
get(key: IntegrationTaskKey, params: { slug: string }): ReplicateReturnType<Collection> {
return this.runTask(
key,
(client) => {
return client.collections.get(params.slug);
},
{
name: "Get Collection",
params,
properties: [{ label: "Collection Slug", text: params.slug }],
}
);
}
/** Fetch a list of model collections. */
list(key: IntegrationTaskKey): ReplicateReturnType<Page<Collection>> {
return this.runTask(
key,
(client) => {
return client.collections.list();
},
{
name: "List Collections",
}
);
}
}