Skip to content

Refactor: Simplified Action Template #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kareemamin
Copy link
Contributor

… readme for more information, simplfiied the sample code

Clubhouse Story
https://app.clubhouse.io/clay-run/story/2915/simplify-action-template

Summary (What)

Simplify the action template so there are fewer things to change when adapting it to your own code.

Motivation (Why)

Get started faster with less help and find the README for more information.

Implementation Details (How)

folder structure:
/index.js
/actions
/actions/reddit-posts
action-definition.js
reddit-posts.js
output-sample.js
output-schema.js
test-inputs.js

Testing

N/A

### Known Issues / Remaining Work Items
[What issues are you already aware of or remaining work items that we don't need to test]

Couple of questions:

1. combine actionInputs, and context? or keep them seperate?
2. context vs ctx
3. name the action file - index.js ?
4. combine the action-definition and the action-code into 1 file?


### Screenshots / Loom Video

n/a

// See README.MD for an in-depth explanation of each parameter.
module.exports = {
name: "get-top-reddit-posts",
function: require('./get-top-reddit-posts.js'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not use the reserverd keyword function.

Let's use actionCode:

@@ -1,4 +1,6 @@
module.exports = [ // the action function must return an object with the following parameters
// These are used to help Clay's interface provide ways to extract data from the output of this action into the table
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just generate this in the deploy endpoint automatically unless it's provided.

description: "The number of posts to fetch"
}
],
outputParameterSchema: require('./output_parameter_schema.js'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is optional, maybe i remove it

],
outputParameterSchema: require('./output_parameter_schema.js'),
inputSample: require('./test-inputs').goodSample,
outputSample: require('./output_sample.js'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just generate this automatically based on the input sample?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants