Make a request to the Replicate API.
(
key: IntegrationTaskKey,
params: {
route: string | URL;
options: Parameters<ReplicateClient["request"]>[1];
}
)
| 151 | |
| 152 | /** Make a request to the Replicate API. */ |
| 153 | request<T = any>( |
| 154 | key: IntegrationTaskKey, |
| 155 | params: { |
| 156 | route: string | URL; |
| 157 | options: Parameters<ReplicateClient["request"]>[1]; |
| 158 | } |
| 159 | ): ReplicateReturnType<T> { |
| 160 | return this.runTask( |
| 161 | key, |
| 162 | async (client) => { |
| 163 | const response = await client.request(params.route, params.options); |
| 164 | |
| 165 | return response.json(); |
| 166 | }, |
| 167 | { |
| 168 | name: "Send Request", |
| 169 | params, |
| 170 | properties: [ |
| 171 | { label: "Route", text: params.route.toString() }, |
| 172 | ...(params.options.method ? [{ label: "Method", text: params.options.method }] : []), |
| 173 | ], |
| 174 | callback: { enabled: true }, |
| 175 | } |
| 176 | ); |
| 177 | } |
| 178 | |
| 179 | /** Run a model and await the result. */ |
| 180 | run( |
no test coverage detected