Skip to content

Commit

Permalink
feat: Add template reference method to Inferable class (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
nadeesha authored Oct 27, 2024
1 parent aea9b78 commit 44c6d75
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sdk-node/src/Inferable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,19 @@ export class Inferable {
};
}

/**
* Creates a template reference. This can be used to trigger runs of a template that was previously registered via the UI.
* @param id The ID of the template to reference.
* @returns A referenced template instance.
*/
public async templateReference(id: string) {
return {
id,
run: (input: TemplateRunInput) =>
this.run({ ...input, template: { id, input: input.input } }),
};
}

/**
* Creates a run.
* @param input The run definition.
Expand Down

0 comments on commit 44c6d75

Please sign in to comment.