{"modulePath":"github.com/sumup/sumup-py/codegen","version":"v0.0.0-20261125101400-61c23570b779","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package builder\n\n## Types\n\n```go\ntype Builder struct {\n\t// contains filtered or unexported fields\n}\n```\nBuilder is an SDK builder. Builder works in two steps: First, it loads the OpenAPI specs and pre-processes them for code generation by transforming the specs into intermediary representation. Secondly, it generates and writes the SDK to desired destination.\n\n```go\nfunc New(cfg Config, opts ...Option) *Builder\n```\nNew creates a new [Builder](#Builder). Call \\[Build.Load] to load in OpenAPI specs and \\[Build.Build] to generate SDK based on provided config.\n\n```go\nfunc (b *Builder) Build() error\n```\nBuild the SDK and write it to designated output directory. The OpenAPI specs first need to be loaded using [Builder.Load](#Builder.Load).\n\n```go\nfunc (b *Builder) Load(spec *v3.Document) error\n```\nLoad loads OpenAPI specs into the builder. To generated the SDK, call [Builder.Build](#Builder.Build).\n\n```go\nfunc (b *Builder) Samples(sdkVersion string) (*SampleCatalog, error)\n```\nSamples builds a deterministic catalog of Python examples using the generated SDK method IR.\n\n```go\ntype ClassDeclaration struct {\n\t// Name of the type\n\tName string\n\t// Type describes the type of the type (e.g. struct, int64, string)\n\tType string\n\t// Fields holds the information for the field\n\tFields []Property\n\t// Description holds the description of the type\n\tDescription string\n\t// AdditionalPropertiesType holds the value type for additional properties if enabled.\n\tAdditionalPropertiesType string\n\t// RequestOnly marks request-only helper types that should not emit response models.\n\tRequestOnly bool\n\t// GenerateInput indicates this type needs an Input companion.\n\tGenerateInput bool\n}\n```\nClassDeclaration holds the information for generating a type. TODO: split into struct, alias, etc.\n\n```go\nfunc (c *ClassDeclaration) String() string\n```\n\n```go\nfunc (c *ClassDeclaration) TypeName() string\n```\n\n```go\ntype Config struct {\n\t// Out is the output directory that the SDK will be written to.\n\tOut string\n}\n```\nConfig is builder configuration which configures output options.\n\n```go\ntype EnumDeclaration[E cmp.Ordered] struct {\n\t// Name of the type\n\tName string\n\t// Type describes the type of the type (e.g. struct, int64, string)\n\tType string\n\t// Comment holds the description of the type\n\tComment string\n\tValues  []E\n\t// RequestOnly marks request-only helper types that should only emit input aliases.\n\tRequestOnly   bool\n\tGenerateInput bool\n}\n```\nEnumDeclaration holds the information for enum types\n\n```go\nfunc (e *EnumDeclaration[E]) String() string\n```\n\n```go\nfunc (e *EnumDeclaration[E]) TypeName() string\n```\n\n```go\ntype EventDefinition struct {\n\tRegistrationMethod string\n\tObjectKind         string\n\tClassName          string\n\tEventType          string\n\tObjectType         string\n\tDescription        string\n}\n```\nEventDefinition describes a typed event notification generated from an OpenAPI webhook operation.\n\n```go\ntype Method struct {\n\tDescription       string\n\tDeprecationNotice *string\n\tMethod            string\n\tFunctionName      string\n\tResponseType      *string\n\tPath              string\n\tPathParams        []Parameter\n\tQueryFields       []Property\n\tBodyType          string\n\tBodyFields        []Property\n\tHasBody           bool\n\tResponses         []Response\n}\n```\nMethod describes a client method. Methods map one-to-one to OpenAPI operations.\n\n```go\nfunc (mt Method) BodyInitString() string\n```\n\n```go\nfunc (mt Method) HasFlattenedBody() bool\n```\n\n```go\nfunc (mt Method) ParamsString() string\n```\n\n```go\nfunc (mt Method) QueryInitString() string\n```\n\n```go\ntype OneOfDeclaration struct {\n\tName          string\n\tOptions       []string\n\tRequestOnly   bool\n\tGenerateInput bool\n}\n```\n\n```go\nfunc (o *OneOfDeclaration) String() string\n```\n\n```go\nfunc (o *OneOfDeclaration) TypeName() string\n```\n\n```go\ntype Option func(b *Builder)\n```\n\n```go\ntype Parameter struct {\n\tName string\n\tType string\n}\n```\nParameter is a method parameter.\n\n```go\ntype Property struct {\n\t// Name of the field\n\tName string\n\t// SerializedName is the original identifier used when encoding (e.g. query parameter name).\n\tSerializedName string\n\t// Type of the field, either primitive type (e.g. string) or if the field\n\t// is a schema reference then the type of the schema.\n\tType string\n\t// Optional field. The property may be omitted from the object.\n\tOptional bool\n\t// Nullable field. The property value may be JSON null.\n\tNullable bool\n\t// Schema is the OpenAPI schema used to generate this property.\n\tSchema *base.SchemaProxy\n\n\tComment string\n}\n```\nProperty holds the information for Property of a type.\n\n```go\nfunc (p Property) BodyArgumentExpr(allowNone bool) string\n```\n\n```go\nfunc (p Property) FieldName() string\n```\n\n```go\nfunc (p Property) MethodParameterString(allowNone bool) string\n```\n\n```go\nfunc (p Property) MethodParameterType() string\n```\n\n```go\nfunc (p *Property) String() string\n```\n\n```go\nfunc (p Property) TypedDictFieldString() string\n```\n\n```go\nfunc (p Property) WireName() string\n```\n\n```go\ntype Response struct {\n\tIsErr        bool\n\tIsDefault    bool\n\tIsUnexpected bool\n\tType         string\n\t// Formats selects the parser by media type when a status has multiple formats.\n\tFormats        []errorResponseFormat\n\tCode           int\n\tErrDescription string\n}\n```\n\n```go\nfunc (response Response) ErrorStatement() string\n```\n\n```go\nfunc (response Response) ErrorType() string\n```\n\n```go\ntype SDK struct {\n\tModule  string `json:\"module\"`\n\tVersion string `json:\"version\"`\n}\n```\nSDK identifies the package used by every generated sample.\n\n```go\ntype Sample struct {\n\tID          string `json:\"id\"`\n\tOperationID string `json:\"operationId\"`\n\tExample     string `json:\"example,omitempty\"`\n\tSummary     string `json:\"summary,omitempty\"`\n\tDescription string `json:\"description,omitempty\"`\n\tHTTPMethod  string `json:\"httpMethod\"`\n\tPath        string `json:\"path\"`\n\tSource      string `json:\"sample\"`\n}\n```\nSample is a complete Python program for one OpenAPI operation example.\n\n```go\ntype SampleCatalog struct {\n\tSchemaVersion  int      `json:\"schemaVersion\"`\n\tLanguage       string   `json:\"language\"`\n\tSDK            SDK      `json:\"sdk\"`\n\tOpenAPIVersion string   `json:\"openAPIVersion\"`\n\tSamples        []Sample `json:\"samples\"`\n}\n```\nSampleCatalog is the versioned JSON contract consumed by documentation sites.\n\n```go\ntype SchemaProxyCollection []*base.SchemaProxy\n```\n\n```go\ntype Type interface {\n\tTypeName() string\n}\n```\n\n```go\ntype TypeAlias struct {\n\t// Name of the type\n\tName string\n\t// Type describes the type of the type (e.g. struct, int64, string)\n\tType string\n\t// Comment holds the description of the type\n\tComment string\n\t// RequestOnly marks request-only helper types that should only emit input aliases.\n\tRequestOnly   bool\n\tGenerateInput bool\n}\n```\n\n```go\nfunc (ta *TypeAlias) String() string\n```\n\n```go\nfunc (ta *TypeAlias) TypeName() string\n```\n\n```go\ntype Writable interface {\n\tString() string\n}\n```\n\n","path":"github.com/sumup/sumup-py/codegen/pkg/builder","name":"builder","synopsis":"","isRedistributable":true}
