Example #1
0
func FindThings(c gossamer.Client) {
	ol, e := c.FindThings()
	if e != nil {
		log.Fatal(e)
	}

	for _, v := range ol {
		o, err := c.GetThing(v.GetId())
		if err != nil {
			log.Fatal(err)
		} else {
			log.Println("Got Things Entity ", o.GetId())
		}
	}
}
Example #2
0
func DeleteThings(c gossamer.Client) {
	ol, e := c.FindThings()
	if e != nil {
		log.Fatal(e)
	}

	for _, v := range ol {
		o, err := c.GetThing(v.GetId())
		if err != nil {
			log.Fatal(err)
		} else {
			// Delete Observation
			e := c.DeleteThing(o.GetId())
			if e != nil {
				log.Fatal(err)
			} else {
				log.Println("Deleted Thing ", o.GetId())
			}
		}
	}
}