Documentation
¶
Index ¶
Constants ¶
View Source
const ( // V1 is the initial API version (current default) V1 Version = 1 // V2 is reserved for future breaking changes V2 Version = 2 // LatestVersion points to the most recent stable API version LatestVersion = V1 // DefaultVersion is used when client doesn't specify a version DefaultVersion = V1 )
Variables ¶
This section is empty.
Functions ¶
func Negotiation ¶
Negotiation handles API version negotiation via Accept header Supports:
- Accept: application/vnd.cedros.v2+json (vendor-specific version)
- Accept: application/json; version=2 (version parameter)
- X-API-Version: 2 (explicit header)
- Default: v1 if not specified
Types ¶
type DeprecationWarning ¶
type DeprecationWarning struct {
// contains filtered or unexported fields
}
DeprecationWarning adds deprecation headers to responses for old API versions This gives clients advance notice before breaking changes
func NewDeprecationWarning ¶
func NewDeprecationWarning(version Version, sunsetDate, message string) *DeprecationWarning
NewDeprecationWarning creates a deprecation warning for a specific API version
func (*DeprecationWarning) Middleware ¶
func (d *DeprecationWarning) Middleware(next http.Handler) http.Handler
Middleware returns a middleware that adds deprecation warnings to responses
type Version ¶
type Version int
Version represents an API version
func FromContext ¶
FromContext retrieves the API version from the request context
Click to show internal directories.
Click to hide internal directories.