From f7b1d319199a5379f9a6f9096764383950e2b417 Mon Sep 17 00:00:00 2001 From: Ahmedhossamdev Date: Thu, 12 Sep 2024 00:54:31 +0300 Subject: [PATCH] feat: Add go sdk examples --- examples/agencies-with-coverage/main.go | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 examples/agencies-with-coverage/main.go diff --git a/examples/agencies-with-coverage/main.go b/examples/agencies-with-coverage/main.go new file mode 100644 index 0000000..53f5799 --- /dev/null +++ b/examples/agencies-with-coverage/main.go @@ -0,0 +1,29 @@ +package main + +import ( + "context" + "fmt" + "log" + + onebusaway "github.com/stainless-sdks/open-transit-go" + "github.com/stainless-sdks/open-transit-go/option" +) + +func main() { + + // Create a new instance of the OneBusAway SDK with the settings + client := onebusaway.NewClient( + option.WithAPIKey("TEST"), + ) + + ctx := context.Background() + + agencies, err := client.AgenciesWithCoverage.List(ctx) + if err != nil { + log.Fatalf("Error fetching agencies: %v", err) + } + + for _, agency := range agencies.Data.List { + fmt.Println(agency.JSON.RawJSON()) + } +}