Skip to content

Latest commit

 

History

History
executable file
·
118 lines (86 loc) · 5.49 KB

README.md

File metadata and controls

executable file
·
118 lines (86 loc) · 5.49 KB

Chevrolet

Available Operations

  • GetChargeTime - Retrieve charging completion time for a Chevrolet.
  • GetVoltage - Retrieve charging voltmeter time for a Chevrolet.

GetChargeTime

Description

When the vehicle is charging, this endpoint returns the date and time the vehicle expects to complete this charging session. When the vehicle is not charging, this endpoint results in a vehicle state error.

Example Usage

package main

import(
	"context"
	"log"
	gosdkv2 "github.com/smartcar/go-sdk-v2"
	"github.com/smartcar/go-sdk-v2/pkg/models/shared"
	"github.com/smartcar/go-sdk-v2/pkg/models/operations"
)

func main() {
    s := gosdkv2.New(
        gosdkv2.WithSecurity(shared.Security{
            BasicAuth: &shared.SchemeBasicAuth{
                Password: "",
                Username: "",
            },
        }),
    )

    ctx := context.Background()
    res, err := s.Chevrolet.GetChargeTime(ctx, operations.GetChevroletChargeTimeRequest{
        VehicleID: "distinctio",
    })
    if err != nil {
        log.Fatal(err)
    }

    if res.ChargeTime != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.GetChevroletChargeTimeRequest ✔️ The request object to use for the request.

Response

*operations.GetChevroletChargeTimeResponse, error

GetVoltage

Description

When the vehicle is plugged in, this endpoint returns the voltage of the charger measured by the vehicle. When the vehicle is not plugged in, this endpoint results in a vehicle state error.

Example Usage

package main

import(
	"context"
	"log"
	gosdkv2 "github.com/smartcar/go-sdk-v2"
	"github.com/smartcar/go-sdk-v2/pkg/models/shared"
	"github.com/smartcar/go-sdk-v2/pkg/models/operations"
)

func main() {
    s := gosdkv2.New(
        gosdkv2.WithSecurity(shared.Security{
            BasicAuth: &shared.SchemeBasicAuth{
                Password: "",
                Username: "",
            },
        }),
    )

    ctx := context.Background()
    res, err := s.Chevrolet.GetVoltage(ctx, operations.GetChevroletVoltageRequest{
        VehicleID: "quibusdam",
    })
    if err != nil {
        log.Fatal(err)
    }

    if res.ChargeVoltage != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.GetChevroletVoltageRequest ✔️ The request object to use for the request.

Response

*operations.GetChevroletVoltageResponse, error