All URIs are relative to https://.o.numary.cloud/ledger
Method | HTTP request | Description |
---|---|---|
RunScript | Post /{ledger}/script | Execute a Numscript. |
ScriptResult RunScript(ctx, ledger).Script(script).Preview(preview).Execute()
Execute a Numscript.
package main
import (
"context"
"fmt"
"os"
client "github.com/numary/numary-go"
)
func main() {
ledger := "ledger001" // string | Name of the ledger.
script := *client.NewScript("vars {
account $user
}
send [COIN 10] (
source = @world
destination = $user
)
") // Script |
preview := true // bool | Set the preview mode. Preview mode doesn't add the logs to the database or publish a message to the message broker. (optional)
configuration := client.NewConfiguration()
api_client := client.NewAPIClient(configuration)
resp, r, err := api_client.ScriptApi.RunScript(context.Background(), ledger).Script(script).Preview(preview).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ScriptApi.RunScript``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `RunScript`: ScriptResult
fmt.Fprintf(os.Stdout, "Response from `ScriptApi.RunScript`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
ledger | string | Name of the ledger. |
Other parameters are passed through a pointer to a apiRunScriptRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
script | Script | | preview | bool | Set the preview mode. Preview mode doesn't add the logs to the database or publish a message to the message broker. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]