(
key: IntegrationTaskKey,
callback: (
client: ReturnType<Shopify["createClient"]>,
task: IOTask,
io: IO,
session: Session
) => Promise<TResult>,
options?: RunTaskOptions,
errorCallback?: RunTaskErrorCallback
)
| 166 | } |
| 167 | |
| 168 | runTask<T, TResult extends Json<T> | void>( |
| 169 | key: IntegrationTaskKey, |
| 170 | callback: ( |
| 171 | client: ReturnType<Shopify["createClient"]>, |
| 172 | task: IOTask, |
| 173 | io: IO, |
| 174 | session: Session |
| 175 | ) => Promise<TResult>, |
| 176 | options?: RunTaskOptions, |
| 177 | errorCallback?: RunTaskErrorCallback |
| 178 | ): Promise<TResult> { |
| 179 | if (!this._io) throw new Error("No IO"); |
| 180 | if (!this._connectionKey) throw new Error("No connection key"); |
| 181 | |
| 182 | return this._io.runTask<TResult>( |
| 183 | key, |
| 184 | (task, io) => { |
| 185 | if (!this._client) throw new Error("No client"); |
| 186 | if (!this._session) throw new Error("No session"); |
| 187 | return callback(this._client, task, io, this._session); |
| 188 | }, |
| 189 | { |
| 190 | icon: "shopify", |
| 191 | retry: retry.standardBackoff, |
| 192 | ...(options ?? {}), |
| 193 | connectionKey: this._connectionKey, |
| 194 | }, |
| 195 | errorCallback ?? onError |
| 196 | ); |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Creates a webhook trigger. |
no outgoing calls
no test coverage detected