Skip to content

Add example in the project. #13

Open

Description

@tzzed

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))
}

Activity

  1. zarelit commented on Jul 12, 2022

    @zarelit
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions