Documentation
¶
Overview ¶
Package typescript generates a typed TypeScript client SDK from an AuthSome OpenAPI spec.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeneratedFile ¶
GeneratedFile represents a single generated file.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator produces TypeScript SDK code from an OpenAPI spec.
func NewGenerator ¶
func NewGenerator(cfg GeneratorConfig) *Generator
NewGenerator creates a TypeScript SDK generator.
type GeneratorConfig ¶
type GeneratorConfig struct {
// PackageName is the npm package name (default: "@authsome/client").
PackageName string
// PackageVersion is the npm package version (default: "0.5.0").
PackageVersion string
// OutputMode controls what files are generated.
// "standalone" (default) — full npm package (types, client, index, package.json, tsconfig).
// "embedded" — only api-types.ts and api-client.ts for embedding in another package.
OutputMode string
// MethodOverrides maps operationID to a custom method name.
// e.g., {"refreshSession": "refresh", "deleteAccount": "deleteMe"}
MethodOverrides map[string]string
}
GeneratorConfig configures the TypeScript SDK generator.
type OperationDef ¶
type OperationDef struct {
Name string
Method string
Path string
Summary string
HasBody bool
FormBody bool
BodyType string
ResponseType string
AuthRequired bool
Tags []string
PathParams []PathParamDef
QueryParams []QueryParamDef
NeedsRequestAlias bool // true when the request type alias differs from an existing schema type
}
OperationDef represents a generated client method.
type PathParamDef ¶
type PathParamDef struct {
Name string // Original name from the spec (e.g., "orgId")
TSName string // TypeScript parameter name (e.g., "orgId")
}
PathParamDef represents a path parameter in an operation.
type QueryParamDef ¶
type QueryParamDef struct {
Name string // Original name from the spec (e.g., "limit")
TSName string // TypeScript parameter name (e.g., "limit")
Type string // TypeScript type (e.g., "number", "string[]")
Required bool
// Repeated marks an array-typed query parameter, which is sent once per
// value rather than once in total. Query parameters default to style form
// with explode true, so an array in the document means exactly that.
Repeated bool
}
QueryParamDef represents a query parameter in an operation.
type TemplateData ¶
type TemplateData struct {
PackageName string
PackageVersion string
OutputMode string
Types []TypeDef
Operations []OperationDef
RequestTypeImports []string // Additional request type names to import (not already in Types)
HasSocial bool
HasMagicLink bool
HasMFA bool
}
TemplateData holds all data passed to templates.
Click to show internal directories.
Click to hide internal directories.