Documentation
¶
Index ¶
- type AppHandler
- type Backender
- type Config
- func (cfg *Config) GetHandler(r *http.Request) (rsp *Response)
- func (cfg *Config) RegisterUserHandler(r *http.Request) (rsp *Response)
- func (cfg *Config) RunHandler(r *http.Request) (rsp *Response)
- func (cfg *Config) RunSheetsHandler(r *http.Request) (rsp *Response)
- func (cfg *Config) SaveHandler(r *http.Request) (rsp *Response)
- func (cfg *Config) UpdateGoogleKeyHandler(r *http.Request) (rsp *Response)
- type PostgreSQL
- type Response
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppHandler ¶
AppHandler helps generalize http responses
func (AppHandler) ServeHTTP ¶
func (fn AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Backender ¶
type Backender interface { Setup() (err error) // contains filtered or unexported methods }
Backender outlines methods to store and retrieve saved commands
type Config ¶
type Config struct { Backender Encrypt crypto.Encryptor Decrypt crypto.Decryptor JWTSecret string Key string UserFn func(email string, commandNumber int) error }
Config holds configuration settings for the api
func (*Config) GetHandler ¶
GetHandler returns a user's commands curl 'http://127.0.0.1:8000/get?google_key=my_key'
func (*Config) RegisterUserHandler ¶
func (*Config) RunHandler ¶
RunHandler runs a single, named command curl -XPOST 'http://127.0.0.1:8000/run' -d '{"google_key":"my_key", "command_name":"curl_command", "params":["1"]}'
func (*Config) RunSheetsHandler ¶
RunSheetsHandler runs a single command (for Google Sheets) curl -XPOST 'http://127.0.0.1:8000/sheets_run' -d '{"command_number":2, "params":["123"], "email":"me@example.com", "command":{"name":"my command","filter":{"type":"jmespath","filter":{"expression":""}},"command":{"type":"direct","command":{"method":"get","url":"https://example.com"}}},"key":"1234567"}'
func (*Config) SaveHandler ¶
SaveHandler saves a user's commands curl -XPOST 'http://127.0.0.1:8000/save' -d '{"google_key":"my_key","commands":[{"name":"api_command","command":{"type":"direct","command":{"method":"get","url":"https://api.chucknorris.io/jokes/random", "headers":[{"key":"User-Agent","value":"Data Connector"}]}},"filter":{"type":"jmespath","filter":{"expression":"[[value]]"}}}]}'
type PostgreSQL ¶
PostgreSQL holds settings for a PostgreSQL database