This repository has been archived on 2026-09-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

36 lines
767 B
Go
Raw Permalink Normal View History

package rudder
import (
"context"
"fmt"
"net/http"
)
type ModulesService struct {
transport *transport
}
type CallParameters struct {
Module string
Fn string
Args any
DryRun bool
}
type CallResult struct {
Result any `json:"result"`
Error string `json:"error"`
Log []any `json:"log"`
Console []string `json:"console"`
}
func (s *ModulesService) Call(ctx context.Context, parameters CallParameters) (*CallResult, error) {
var result CallResult
path := fmt.Sprintf("/modules/%s/%s", parameters.Module, parameters.Fn)
body := map[string]any{"args": parameters.Args, "dryRun": parameters.DryRun}
if err := s.transport.do(ctx, http.MethodPost, path, nil, body, &result); err != nil {
return nil, err
}
return &result, nil
}