Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example in the project. #13

Open
tzzed opened this issue Mar 13, 2022 · 1 comment
Open

Add example in the project. #13

tzzed opened this issue Mar 13, 2022 · 1 comment

Comments

@tzzed
Copy link
Contributor

tzzed commented Mar 13, 2022

Hi Guys congrats again.

I suggest to add a package with an example and mentionne it in the README file. something like this.

import (
	"fmt"
	"log"
	"os"

	"github.com/phoops/ngsiv2/client"
)

func main() {
	url := os.Getenv("ORION_BROKER")
	cli, err := client.NewNgsiV2Client(client.SetUrl(url))
	if err != nil {
		log.Fatalln(err)
	}

	e, err := cli.RetrieveEntity("urn:ngsi-ld:Product:001", client.RetrieveEntitySetType("Product"))
	if err != nil {
		log.Fatalln(err)
	}
	
	b, _ := e.MarshalJSON()
	fmt.Println(string(b))
}
@zarelit
Copy link
Member

zarelit commented Jul 12, 2022

This is a very welcomed suggestion, I think we should have examples of interactions using client and also how to move around entities, set and read attributes, in particular with custom types and geolocation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants