encoding

package
v1.29.5 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	QueryTag = tagDescription{
				// contains filtered or unexported fields
	}
	QsTag     = QueryTag
	HeaderTag = tagDescription{
				// contains filtered or unexported fields
	}
	JSONTag = tagDescription{
			// contains filtered or unexported fields
	}
	CookieTag = tagDescription{
				// contains filtered or unexported fields
	}
)

Functions

func DefaultClientHttpMethod

func DefaultClientHttpMethod(rpc *meta.RPC) string

DefaultClientHttpMethod works out the default HTTP method a client should use for a given RPC. When possible we will default to POST either when no method has been specified on the API or when then is a selection of methods and POST is one of them. If POST is not allowed as a method then we will use the first specified method.

func GetConcreteStructType added in v1.8.0

func GetConcreteStructType(appDecls []*schema.Decl, typ *schema.Type, typeArgs []*schema.Type) (*schema.Struct, error)

GetConcreteStructType returns a construct Struct object for the given schema. This means any generic types in the struct will be resolved to their concrete types and there will be no generic parameters in the struct object. However, any nested structs may still contain generic types.

If a nil schema is provided, a nil struct is returned.

func GetConcreteType added in v1.8.0

func GetConcreteType(appDecls []*schema.Decl, originalType *schema.Type, typeArgs []*schema.Type) (*schema.Type, error)

GetConcreteType returns a concrete type for the given schema. This means any generic types in the top level type will be resolved to their concrete types and there will be no generic parameters in returned typ. However, any nested types may still contain generic types.

If a nil schema is provided, a nil is returned.

func IgnoreField added in v1.2.0

func IgnoreField(field *schema.Field) bool

IgnoreField returns true if the field name is "-" is any of the valid request or response tags

Types

type APIEncoding added in v1.2.0

type APIEncoding struct {
	Services      []*ServiceEncoding `json:"services"`
	Authorization *AuthEncoding      `json:"authorization"`
}

func DescribeAPI added in v1.2.0

func DescribeAPI(meta *meta.Data) *APIEncoding

type AuthEncoding

type AuthEncoding struct {
	// LegacyTokenFormat specifies whether the auth encoding uses the legacy format of
	// "just give us a token as a string". If true, the other parameters are all empty.
	LegacyTokenFormat bool

	// Contains metadata about how to marshal an HTTP parameter
	HeaderParameters []*ParameterEncoding `json:"header_parameters"`
	QueryParameters  []*ParameterEncoding `json:"query_parameters"`
	CookieParameters []*ParameterEncoding `json:"cookie_parameters"`
}

AuthEncoding expresses how a response should be encoded on the wire.

func