Documentation
¶
Index ¶
- func Generate(routes []types.APIRoute, typeDefs []types.TypeDefinition, ...) error
- func GenerateAPIClient(routes []types.APIRoute, typeDefs []types.TypeDefinition, ...) error
- func GenerateRouteManifest(routes []types.APIRoute) error
- func GenerateTypeScriptTypes(typeDefs []types.TypeDefinition) error
- func GetSupportedGenerators() []string
- func ShouldGenerateTypeScriptTypes(generatorType string) bool
- func ValidateGeneratorType(generatorType string) error
- type ClientTemplateData
- type MethodTemplateData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶ added in v0.1.8
func Generate(routes []types.APIRoute, typeDefs []types.TypeDefinition, config *config.APIClientConfig) error
Generate generates all API client artifacts based on configuration This is the main entry point for the type generation system
func GenerateAPIClient ¶
func GenerateAPIClient(routes []types.APIRoute, typeDefs []types.TypeDefinition, config *config.APIClientConfig) error
GenerateAPIClient generates the API client based on configuration
func GenerateRouteManifest ¶
GenerateRouteManifest generates a JSON manifest of all routes
func GenerateTypeScriptTypes ¶
func GenerateTypeScriptTypes(typeDefs []types.TypeDefinition) error
GenerateTypeScriptTypes generates TypeScript type definitions
func GetSupportedGenerators ¶ added in v0.1.8
func GetSupportedGenerators() []string
GetSupportedGenerators returns a list of supported generator types
func ShouldGenerateTypeScriptTypes ¶ added in v0.1.8
ShouldGenerateTypeScriptTypes returns true if TypeScript types should be generated for the given generator
func ValidateGeneratorType ¶ added in v0.1.8
ValidateGeneratorType validates if the generator type is supported
Types ¶
type ClientTemplateData ¶ added in v0.1.8
type ClientTemplateData struct {
UsedTypes []string
TypesImport string
APIObject string
ReactQueryEnabled bool
QueryKeysEnabled bool
QueryKeys string
}
ClientTemplateData contains data for client template generation
type MethodTemplateData ¶ added in v0.1.8
type MethodTemplateData struct {
Description string
Method string
MethodLower string
ParameterSignature string
ParameterSignatureJS string // JavaScript parameter signature with destructuring
QueryParameterSignature string
QueryOptionsParameterSignature string
ResponseType string
RequestPath string
RequestPathForMutation string // For React Query mutations with different variable substitution
HasIDParam bool
HasBodyData bool
DataParameter string
QueryKey string
MutationVariableType string
ReactQueryEnabled bool
}
MethodTemplateData contains data for individual method templates