services

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const EstMilesPerYear = 12000.0

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressComponents

type AddressComponents struct {
	LongName  string   `json:"long_name"`
	ShortName string   `json:"short_name"`
	Types     []string `json:"types"`
}

type DataPullStatusEnum

type DataPullStatusEnum string
const (
	// PulledInfoAndValuationStatus means we pulled vin, edmunds, build and valuations
	PulledInfoAndValuationStatus DataPullStatusEnum = "PulledAll"
	// PulledValuationDrivlyStatus means we only pulled offers and pricing
	PulledValuationDrivlyStatus   DataPullStatusEnum = "PulledValuations"
	PulledValuationVincarioStatus DataPullStatusEnum = "PulledValuationVincario"
	SkippedDataPullStatus         DataPullStatusEnum = "Skipped"
	ErrorDataPullStatus           DataPullStatusEnum = "Error"
)

type DeviceDefinitionsAPIService

type DeviceDefinitionsAPIService interface {
	GetDeviceDefinitionByID(ctx context.Context, id string) (*pb.GetDeviceDefinitionItemResponse, error)
	GetDeviceStyleByExternalID(ctx context.Context, id string) (*pb.DeviceStyle, error)
	UpdateDeviceDefAttrs(ctx context.Context, deviceDef *pb.GetDeviceDefinitionItemResponse, vinInfo map[string]any) error
}

func NewDeviceDefinitionsAPIService

func NewDeviceDefinitionsAPIService(ddConn *grpc.ClientConn) DeviceDefinitionsAPIService

type DrivlyAPIService

type DrivlyAPIService interface {
	GetVINInfo(vin string) (map[string]interface{}, error)
	GetVINPricing(vin string, reqData *ValuationRequestData) (map[string]any, error)

	GetOffersByVIN(vin string, reqData *ValuationRequestData) (map[string]interface{}, error)
	GetAutocheckByVIN(vin string) (map[string]interface{}, error)
	GetBuildByVIN(vin string) (map[string]interface{}, error)
	GetCargurusByVIN(vin string) (map[string]interface{}, error)
	GetCarvanaByVIN(vin string) (map[string]interface{}, error)
	GetCarmaxByVIN(vin string) (map[string]interface{}, error)
	GetCarstoryByVIN(vin string) (map[string]interface{}, error)
	GetEdmundsByVIN(vin string) (map[string]interface{}, error)
	GetTMVByVIN(vin string) (map[string]interface{}, error)
	GetKBBByVIN(vin string) (map[string]interface{}, error)
	GetVRoomByVIN(vin string) (map[string]interface{}, error)

	GetExtendedOffersByVIN(vin string) (*DrivlyVINSummary, error)
}

func NewDrivlyAPIService

func NewDrivlyAPIService(settings *config.Settings, dbs func() *db.ReaderWriter) DrivlyAPIService

type DrivlyVINSummary

type DrivlyVINSummary struct {
	Pricing   map[string]interface{}
	Offers    map[string]interface{}
	AutoCheck map[string]interface{}
	Build     map[string]interface{}
	Cargurus  map[string]interface{}
	Carvana   map[string]interface{}
	Carmax    map[string]interface{}
	Carstory  map[string]interface{}
	Edmunds   map[string]interface{}
	TMV       map[string]interface{}
	KBB       map[string]interface{}
	VRoom     map[string]interface{}
}

type DrivlyValuationService

type DrivlyValuationService interface {
	PullValuation(ctx context.Context, userDeiceID, deviceDefinitionID, vin string) (DataPullStatusEnum, error)
	PullOffer(ctx context.Context, userDeviceID string) (DataPullStatusEnum, error)
}

type GoogleGeoAPIService

type GoogleGeoAPIService interface {
	GeoDecodeLatLong(lat, lng float64) (*MapsGeocodeResp, error)
}

func NewGoogleGeoAPIService

func NewGoogleGeoAPIService(settings *config.Settings) GoogleGeoAPIService

type MapsGeocodeResp

type MapsGeocodeResp struct {
	PostalCode   string
	StreetNumber string
	// street name
	Route string
	// eg Bergenfield
	Locality string
	// eg Bergen County
	AdminAreaLevel2 string
	// eg NJ (state)
	AdminAreaLevel1  string
	Country          string
	FormattedAddress string
}

type NATSService

type NATSService struct {
	JetStream                nats.JetStreamContext
	JetStreamName            string
	ValuationSubject         string
	OfferSubject             string
	AckTimeout               time.Duration
	ValuationDurableConsumer string
	OfferDurableConsumer     string
	// contains filtered or unexported fields
}

func NewNATSService

func NewNATSService(settings *config.Settings, log *zerolog.Logger) (*NATSService, error)

type Result

type Result struct {
	Results []struct {
		AddressComponents []AddressComponents `json:"address_components"`
	} `json:"results"`
}

type UserDeviceAPIService

type UserDeviceAPIService interface {
	GetUserDevice(ctx context.Context, userDeviceID string) (*pb.UserDevice, error)
	GetAllUserDevice(ctx context.Context, wmi string) ([]*pb.UserDevice, error)
	UpdateUserDeviceMetadata(ctx context.Context, request *pb.UpdateUserDeviceMetadataRequest) error
	GetUserDeviceOffers(ctx context.Context, userDeviceID string) (*core.DeviceOffer, error)
	GetUserDeviceValuations(ctx context.Context, userDeviceID, countryCode string) (*core.DeviceValuation, error)
}

func NewUserDeviceService

func NewUserDeviceService(
	devicesConn *grpc.ClientConn,
	dbs func() *db.ReaderWriter,
	logger *zerolog.Logger,
) UserDeviceAPIService

type UserDeviceDataAPIService

type UserDeviceDataAPIService interface {
	GetUserDeviceData(ctx context.Context, id string, ddID string) (*pb.UserDeviceDataResponse, error)
}

func NewUserDeviceDataAPIService

func NewUserDeviceDataAPIService(ddConn *grpc.ClientConn) UserDeviceDataAPIService

type ValuationRequestData

type ValuationRequestData struct {
	Mileage *float64 `json:"mileage,omitempty"`
	ZipCode *string  `json:"zipCode,omitempty"`
}

type VincarioAPIService

type VincarioAPIService interface {
	GetMarketValuation(vin string) (*VincarioMarketValueResponse, error)
}

func NewVincarioAPIService

func NewVincarioAPIService(settings *config.Settings, log *zerolog.Logger) VincarioAPIService

type VincarioMarketValueResponse

type VincarioMarketValueResponse struct {
	Vin     string `json:"vin"`
	Vehicle struct {
		Make                  string `json:"make"`
		Model                 string `json:"model"`
		ModelYear             int    `json:"model_year"`
		Transmission          string `json:"transmission"`
		EngineDisplacementCcm int    `json:"engine_displacement_ccm"`
		FuelTypePrimary       string `json:"fuel_type_primary"`
	} `json:"vehicle"`
	Period struct {
		From string `json:"from"`
		To   string `json:"to"`
	} `json:"period"`
	MarketPrice struct {
		PriceCount    int    `json:"price_count"`
		PriceCurrency string `json:"price_currency"`
		PriceBelow    int    `json:"price_below"`
		PriceMean     int    `json:"price_mean"`
		PriceAvg      int    `json:"price_avg"`
		PriceAbove    int    `json:"price_above"`
		PriceStdev    int    `json:"price_stdev"`
	} `json:"market_price"`
	MarketOdometer struct {
		OdometerCount int    `json:"odometer_count"`
		OdometerUnit  string `json:"odometer_unit"`
		OdometerBelow int    `json:"odometer_below"`
		OdometerMean  int    `json:"odometer_mean"`
		OdometerAvg   int    `json:"odometer_avg"`
		OdometerAbove int    `json:"odometer_above"`
		OdometerStdev int    `json:"odometer_stdev"`
	} `json:"market_odometer"`
}

type VincarioValuationService

type VincarioValuationService interface {
	PullValuation(ctx context.Context, userDeiceID, deviceDefinitionID, vin string) (DataPullStatusEnum, error)
}

func NewVincarioValuationService

func NewVincarioValuationService(DBS func() *db.ReaderWriter, log *zerolog.Logger, settings *config.Settings, udSvc UserDeviceAPIService) VincarioValuationService

Directories

Path Synopsis
Package mock_services is a generated GoMock package.
Package mock_services is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL