This topic was automatically generated from Slack. You can find the original thread here.
in the following code, how do i add prop so that , when i create a source to add trigger, then when i instantiateviaapi, in the payload or variables you pass the values
To add a prop that allows you to pass values when you instantiate a source via the API, you need to define the prop in the props section of your component. Since you’re looking to add a trigger and pass values during instantiation, let’s say you want to add a prop for a repository name. Here’s how you could modify your component to include a repoName prop: import { axios } from "@pipedream/platform"; export default defineComponent({ name: "Source Demo", description: "This is a demo source", props: { github: { type: "app", app: "github", }, timer: { type: "$.interface.timer", default: { intervalSeconds: 15 * 60, }, }, repoName: { // Adding a new prop for repository name type: "string", label: "Repository Name", description: "Enter the name of the GitHub repository in the format 'username/repo'", }, }, dedupe: "greatest", async run({steps, $}) { const data = await axios($, { method: "get", headers: { Authorization: `Bearer ${this.github.$auth.oauth_access_token}`, }, url: `https://api.github.com/repos/${this.repoName}/issues`, // Using the repoName prop }); data.forEach((issue) => { this.$emit(issue, { id: issue.id, summary: `ISSUE ${issue.number}: ${issue.title}`, ts: issue.created_at && +new Date(issue.created_at), }); }); }, }); In this modification: - A new prop repoName is added. This prop is of type string and allows the user to specify the GitHub repository name when they instantiate the source. - The github_token variable and hardcoded URL in the axios request are replaced with dynamic data. The Authorization header now uses the OAuth access token from the github app prop (this.github.$auth.oauth_access_token), and the URL dynamically includes the repository name from the repoName prop. When you create this source via the API, you can pass the repoName value in the payload, along with any other required props.
Based on the information provided, it seems you’re asking about a specific feature or parameter (instantiateviaApi) related to sending a payload that includes a reponame. However, without specific documentation or context regarding instantiateviaApi in the provided Pipedream documentation, I’m unable to give a direct answer or code example related to using reponame in a payload. If instantiateviaApi refers to a method or feature within a specific API or service integration on Pipedream, I would recommend checking the documentation for that specific API or service on the Pipedream platform. If it’s related to a GitHub repository or another version control system integration, the payload structure, including parameters like reponame, would typically be defined by that service’s API documentation. For more detailed assistance or to explore Pipedream’s capabilities with GitHub or other services: 1. Visit the specific app integration page on Pipedream, like GitHub for example, to see if there’s relevant information on triggering workflows or actions based on API calls. 2. Look for documentation related to the service you’re integrating with on Pipedream, which might detail how to structure your payload and what parameters are accepted. If you’re trying to trigger a Pipedream workflow or perform an action via an API call and include repository information in your payload, you might typically do this within a custom code step or by configuring a pre-built action that accepts repository details as input. Without more specific details or context, I can only provide general guidance. If you have more information or a specific scenario in mind, please share, and I’ll do my best to assist further!