# MySubaru!GO Is a simple API client to interact with My Subaru service (https://www.mysubaru.com/) via HTTP, written in Go ## News * v0.0.0-dev First public release on April 11, 2023 ## Features * Simple and chainable methods for settings and request ## Installation ```bash # Go Modules go get git.savin.nyc/alex/mysubaru ``` ## Usage The following samples will assist you to become as comfortable as possible with mysubaru library. ```go // Import hassky into your code and refer it as `mysubaru`. import "git.savin.nyc/alex/mysubaru" ``` #### Create a new MySubaru API Client ```go // Create a MySubaru Client msc, err := mysubaru.New(cfg) if err != nil { cfg.Logger.Error("cannot create MySubaru client", "error", err) os.Exit(1) } ``` #### Get a car by VIN ```go outback, err := msc.GetVehicleByVIN("1HGCM82633A004352") if err != nil { cfg.Logger.Error("cannot get a vehicle by VIN", "error", err) os.Exit(1) } ``` #### Start/Stop Lights request ```go // Execute a LightsStart command events, err := outback.LightsStart() if err != nil { cfg.Logger.Error("cannot execute LightsStart command", "error", err) os.Exit(1) } for event := range events { fmt.Printf("Lights Start Event: %+v\n", event) } // Wait for a while to see the lights on time.Sleep(20 * time.Second) // Execute a LightsStop command events, err = outback.LightsStop() if err != nil { cfg.Logger.Error("cannot execute LightsStop command", "error", err) os.Exit(1) } for event := range events { fmt.Printf("Lights Stop Event: %+v\n", event) } ```