Skip to content

Commit

Permalink
enable replayedAssembly.assembly_ssl_url
Browse files Browse the repository at this point in the history
as it is now returned by the API
Also improve readme
  • Loading branch information
mifi committed Feb 4, 2021
1 parent c2b7643 commit acb5d49
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@ Removes the Assembly identified by the given `assemblyId` from the memory of the

Replays the Assembly identified by the given `assemblyId` (required argument). Optionally you can also provide a `notify_url` key inside `params` if you want to change the notification target. See [API documentation](https://transloadit.com/docs/api/#assemblies-assembly-id-replay-post) for more info about `params`.

The response from the `replayAssembly` is minimal and does not contain much information about the replayed assembly. Please call `getAssembly` or `awaitAssemblyCompletion` after replay to get more information:

```js
const replayAssemblyResponse = await transloadit.replayAssembly(failedAssemblyId)

const assembly = await transloadit.getAssembly(replayAssemblyResponse.assembly_id)
// Or
const completedAssembly = await transloadit.awaitAssemblyCompletion(replayAssemblyResponse.assembly_id)
```

#### async awaitAssemblyCompletion(assemblyId, opts)

This function will continously poll the specified Assembly `assemblyId` and resolve when it is done uploading and executing (until `result.ok` is no longer `ASSEMBLY_UPLOADING`, `ASSEMBLY_EXECUTING` or `ASSEMBLY_REPLAYING`). It resolves with the same value as `getAssembly`.
Expand Down
3 changes: 1 addition & 2 deletions test/integration/__tests__/live-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,7 @@ describe('API integration', function () {
expect(replayedAssembly.ok).toBe('ASSEMBLY_REPLAYING')
expect(replayedAssembly.assembly_id).not.toEqual(createdAssembly.assembly_id)
expect(replayedAssembly.assembly_url).toBeDefined()
// TODO bug?
// expect(replayedAssembly.assembly_ssl_url).toBeDefined()
expect(replayedAssembly.assembly_ssl_url).toBeDefined()

const result2 = await client.awaitAssemblyCompletion(replayedAssembly.assembly_id)
expect(result2.ok).toBe('ASSEMBLY_COMPLETED')
Expand Down
3 changes: 1 addition & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ export interface ReplayedAssembly {
success: boolean,
assembly_id: string,
assembly_url: string,
// TODO
// assembly_ssl_url: string,
assembly_ssl_url: string,
notify_url?: string,
}

Expand Down

0 comments on commit acb5d49

Please sign in to comment.