// ExampleInputTrigger demonstrates a simple input using the TRIGGER mechanism.
func Example_inputTrigger() {
	// Create and run the input.
	i, err := thingiverseio.NewInput(descriptor)
	if err != nil {
		log.Fatal(err)
	}
	i.Run()

	// Start listen to the SyHello function and get a channel to receive results.
	i.StartListen("SayHello")
	c := i.ListenResults().AsChan()

	// Wait until an output connects.
	i.Connected().WaitUntilComplete()

	// Create the request parameter.
	p := SayHelloInput{"Greetings, this is a CALL example"}

	// Do the trigger.
	c := i.Trigger("SayHello", p)

	// Receive the result.
	result := <-c

	// Decode and print the result.
	var out SayHelloOutput
	result.Decode(&out)

	log.Println("Received an answer:", out.Answer)
}
// ExampleInputCall demonstrates a simple input using the CALL mechanism.
func Example_inputCall() {
	// Create and run the input.
	i, err := thingiverseio.NewInput(descriptor)
	if err != nil {
		log.Fatal(err)
	}

	i.Run()

	// Create the request parameter.
	p := SayHelloInput{"Greetings, this is a CALL example"}

	// Do the call and get a channel for receiving the result
	c := i.Call("SayHello", p).AsChan()

	// Receive the result.
	result := <-c

	// Decode and print the result.
	var out SayHelloOutput
	result.Decode(&out)

	log.Println("Received an answer:", out.Answer)
}