eia-api-go/cmd/eia-client/internal/util/util_reflect.go
Ryan McGuire 7431eb94f1
All checks were successful
Build and Publish / build (push) Successful in 46s
Build and Publish / publish (push) Successful in 5s
Move to public repo
2024-12-17 16:02:58 -05:00

44 lines
1.2 KiB
Go

package util
import (
"github.com/spf13/cobra"
eiaapi "gitea.libretechconsulting.com/rmcguire/eia-api-go/api"
"gitea.libretechconsulting.com/rmcguire/eia-api-go/pkg/eia"
)
func GetRouteType(cmd *cobra.Command, route string) (eia.RouteType, error) {
client, err := Client(cmd)
if err != nil {
return eia.RouteTypeError, err
}
return client.GetRouteType(cmd.Context(), route, eia.DefaultMethodSubs(cmd.Context()))
}
func GetRoute(cmd *cobra.Command, route string) (*eiaapi.FinalRoute, *eiaapi.Routes, error) {
client, err := Client(cmd)
if err != nil {
return nil, nil, err
}
return client.GetRoutesOrFinalRoute(cmd.Context(), route, eia.DefaultMethodSubs(cmd.Context()))
}
func GetFacet(cmd *cobra.Command, route string, facet string) (*eiaapi.FacetDetails, error) {
client, err := Client(cmd)
if err != nil {
return nil, err
}
return client.GetFacet(cmd.Context(), route, facet, eia.DefaultMethodSubs(cmd.Context()))
}
func GetFacets(cmd *cobra.Command, route string) (*eiaapi.FacetOptionList, error) {
client, err := Client(cmd)
if err != nil {
return nil, err
}
return client.GetFacets(cmd.Context(), route, eia.DefaultMethodSubs(cmd.Context()))
}