Documentation
¶
Overview ¶
Package dto provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.
Index ¶
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- type ChiServerOptions
- type CreateSubscriptionJSONRequestBody
- type Error
- type GetTotalCostParams
- type InvalidParamFormatError
- type ListSubscriptionsParams
- type MiddlewareFunc
- type NewSubscription
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) CreateSubscription(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteSubscription(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetSubscriptionById(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetTotalCost(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ListSubscriptions(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdateSubscription(w http.ResponseWriter, r *http.Request)
- type Subscription
- type TooManyValuesForParamError
- type TotalCost
- type UnescapedCookieParamError
- type Unimplemented
- func (_ Unimplemented) CreateSubscription(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) DeleteSubscription(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
- func (_ Unimplemented) GetSubscriptionById(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
- func (_ Unimplemented) GetTotalCost(w http.ResponseWriter, r *http.Request, params GetTotalCostParams)
- func (_ Unimplemented) ListSubscriptions(w http.ResponseWriter, r *http.Request, params ListSubscriptionsParams)
- func (_ Unimplemented) UpdateSubscription(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
- type UnmarshalingParamError
- type UpdateSubscription
- type UpdateSubscriptionJSONRequestBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type ChiServerOptions ¶
type ChiServerOptions struct {
BaseURL string
BaseRouter chi.Router
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type CreateSubscriptionJSONRequestBody ¶
type CreateSubscriptionJSONRequestBody = NewSubscription
CreateSubscriptionJSONRequestBody defines body for CreateSubscription for application/json ContentType.
type GetTotalCostParams ¶
type GetTotalCostParams struct {
// UserId ID of the user
UserId openapi_types.UUID `form:"user_id" json:"user_id"`
// ServiceName Name of the service
ServiceName *string `form:"service_name,omitempty" json:"service_name,omitempty"`
// Start Start of the period (MM-YYYY)
Start *string `form:"start,omitempty" json:"start,omitempty"`
// End End of the period (MM-YYYY)
End *string `form:"end,omitempty" json:"end,omitempty"`
}
GetTotalCostParams defines parameters for GetTotalCost.
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type ListSubscriptionsParams ¶
type ListSubscriptionsParams struct {
// UserId Filter by user ID
UserId *openapi_types.UUID `form:"user_id,omitempty" json:"user_id,omitempty"`
// ServiceName Filter by service name
ServiceName *string `form:"service_name,omitempty" json:"service_name,omitempty"`
// Page Page number for pagination
Page *int `form:"page,omitempty" json:"page,omitempty"`
// PageSize Number of items per page
PageSize *int `form:"page_size,omitempty" json:"page_size,omitempty"`
}
ListSubscriptionsParams defines parameters for ListSubscriptions.
type NewSubscription ¶
type NewSubscription struct {
// EndDate End month and year (MM-YYYY)
EndDate *string `json:"end_date,omitempty"`
MonthlyCost int `json:"monthly_cost"`
ServiceName string `json:"service_name"`
// StartDate Start month and year (MM-YYYY)
StartDate string `json:"start_date"`
UserId openapi_types.UUID `json:"user_id"`
}
NewSubscription defines model for NewSubscription.
type RequiredHeaderError ¶
func (*RequiredHeaderError) Error ¶
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶
func (e *RequiredParamError) Error() string
type ServerInterface ¶
type ServerInterface interface {
// List subscriptions
// (GET /subscriptions)
ListSubscriptions(w http.ResponseWriter, r *http.Request, params ListSubscriptionsParams)
// Create a subscription
// (POST /subscriptions)
CreateSubscription(w http.ResponseWriter, r *http.Request)
// Calculate total subscription cost
// (GET /subscriptions/total_cost)
GetTotalCost(w http.ResponseWriter, r *http.Request, params GetTotalCostParams)
// Delete a subscription
// (DELETE /subscriptions/{id})
DeleteSubscription(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
// Get a subscription by ID
// (GET /subscriptions/{id})
GetSubscriptionById(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
// Update a subscription
// (PUT /subscriptions/{id})
UpdateSubscription(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) CreateSubscription ¶
func (siw *ServerInterfaceWrapper) CreateSubscription(w http.ResponseWriter, r *http.Request)
CreateSubscription operation middleware
func (*ServerInterfaceWrapper) DeleteSubscription ¶
func (siw *ServerInterfaceWrapper) DeleteSubscription(w http.ResponseWriter, r *http.Request)
DeleteSubscription operation middleware
func (*ServerInterfaceWrapper) GetSubscriptionById ¶
func (siw *ServerInterfaceWrapper) GetSubscriptionById(w http.ResponseWriter, r *http.Request)
GetSubscriptionById operation middleware
func (*ServerInterfaceWrapper) GetTotalCost ¶
func (siw *ServerInterfaceWrapper) GetTotalCost(w http.ResponseWriter, r *http.Request)
GetTotalCost operation middleware
func (*ServerInterfaceWrapper) ListSubscriptions ¶
func (siw *ServerInterfaceWrapper) ListSubscriptions(w http.ResponseWriter, r *http.Request)
ListSubscriptions operation middleware
func (*ServerInterfaceWrapper) UpdateSubscription ¶
func (siw *ServerInterfaceWrapper) UpdateSubscription(w http.ResponseWriter, r *http.Request)
UpdateSubscription operation middleware
type Subscription ¶
type Subscription struct {
// EndDate Subscription end date (MM-YYYY), optional.
EndDate *string `json:"end_date"`
// Id Unique identifier for the subscription.
Id openapi_types.UUID `json:"id"`
// MonthlyCost Monthly cost in rubles.
MonthlyCost int `json:"monthly_cost"`
// ServiceName Name of the service.
ServiceName string `json:"service_name"`
// StartDate Subscription start date (MM-YYYY).
StartDate string `json:"start_date"`
// UserId ID of the user.
UserId openapi_types.UUID `json:"user_id"`
}
Subscription defines model for Subscription.
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type TotalCost ¶
type TotalCost struct {
// TotalCost Total cost of subscriptions
TotalCost *int `json:"total_cost,omitempty"`
}
TotalCost defines model for TotalCost.
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type Unimplemented ¶
type Unimplemented struct{}
func (Unimplemented) CreateSubscription ¶
func (_ Unimplemented) CreateSubscription(w http.ResponseWriter, r *http.Request)
Create a subscription (POST /subscriptions)
func (Unimplemented) DeleteSubscription ¶
func (_ Unimplemented) DeleteSubscription(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
Delete a subscription (DELETE /subscriptions/{id})
func (Unimplemented) GetSubscriptionById ¶
func (_ Unimplemented) GetSubscriptionById(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
Get a subscription by ID (GET /subscriptions/{id})
func (Unimplemented) GetTotalCost ¶
func (_ Unimplemented) GetTotalCost(w http.ResponseWriter, r *http.Request, params GetTotalCostParams)
Calculate total subscription cost (GET /subscriptions/total_cost)
func (Unimplemented) ListSubscriptions ¶
func (_ Unimplemented) ListSubscriptions(w http.ResponseWriter, r *http.Request, params ListSubscriptionsParams)
List subscriptions (GET /subscriptions)
func (Unimplemented) UpdateSubscription ¶
func (_ Unimplemented) UpdateSubscription(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
Update a subscription (PUT /subscriptions/{id})
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error
type UpdateSubscription ¶
type UpdateSubscription struct {
// EndDate New end month and year (MM-YYYY). Use null to remove the end date.
EndDate *string `json:"end_date"`
// MonthlyCost New monthly cost in rubles.
MonthlyCost *int `json:"monthly_cost,omitempty"`
// ServiceName New name of the service.
ServiceName *string `json:"service_name,omitempty"`
}
UpdateSubscription defines model for UpdateSubscription.
type UpdateSubscriptionJSONRequestBody ¶
type UpdateSubscriptionJSONRequestBody = UpdateSubscription
UpdateSubscriptionJSONRequestBody defines body for UpdateSubscription for application/json ContentType.