Add SDK parity and Go CLI release readiness
This commit is contained in:
36
examples/proofstream/main.go
Normal file
36
examples/proofstream/main.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
attesto "git.rotz.ai/rotzmediagroup/attesto-v1/sdk/go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ctx := context.Background()
|
||||
client, err := attesto.NewClient(os.Getenv("ATTESTO_API_KEY"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
stream, err := client.CreateStream(ctx, attesto.StreamCreateInput{
|
||||
UseCase: "ai-governance",
|
||||
PolicyID: "policy-main",
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
receipt, err := client.LogEvent(ctx, stream.StreamID, attesto.EventInput{
|
||||
SourceRef: "example-decision",
|
||||
Payload: attesto.M{
|
||||
"decision": "approved",
|
||||
"reason": "policy-threshold-met",
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("%s %s\n", receipt.StreamEventID, receipt.EventHash)
|
||||
}
|
||||
Reference in New Issue
Block a user