Skip to content
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

API / Bot communication #109

Open
mrWh1te opened this issue Mar 7, 2021 · 2 comments
Open

API / Bot communication #109

mrWh1te opened this issue Mar 7, 2021 · 2 comments

Comments

@mrWh1te
Copy link
Owner

mrWh1te commented Mar 7, 2021

Is your feature request related to a problem? Please describe.
Bot communication

Describe the solution you'd like
bot publishes an API for other bots/servers to submit requests too

maybe a router declared via tuples?

api(config?: apiConfig)(
    ['GET /report/latest', chain(... botactions)], // so maps maybe 1 BotAction to the request then dev assembles?
     ['PUT /like/post', chain(... botactions)]
)

Then whatever the final value returned by the BotAction is returned with success 200. Otherwise, you can return a HTTPResponseSignal that has response headers, status code, etc for configuring the response in detail

Additional context
Hold this until v2, when the page BotAction param is replaced as an injectable

@mrWh1te mrWh1te changed the title Bot communication API / Bot communication Mar 7, 2021
@mrWh1te
Copy link
Owner Author

mrWh1te commented Mar 7, 2021

how about API middleware? ie auth token requirement

perhaps optional 3rd param in array?

@mrWh1te
Copy link
Owner Author

mrWh1te commented Mar 7, 2021

plan is to build on a framework like Express, Fastify or something similar, which in that case, this will be separated into its own auxiliary package and have its function name focused to the framework in choice ie expressAPI()(), fastifyAPI()() etc that uses their types for configuration, middleware, etc

in the future, might be worth consolidating like code with a more general api auxiliary package that abstracts the common units of functionality for all focused API auxiliary packages to implement

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

No branches or pull requests

1 participant