Documentation ¶
Index ¶
- func NewHttpServer(ctx context.Context, endpoints Endpoints) http.Handler
- type BatchError
- type CreateRedirectRequest
- type CreateRedirectResponse
- type CreateRedirectsRequest
- type CreateRedirectsResponse
- type Endpoints
- type GetRedirectRequest
- type GetRedirectResponse
- type LoggingMiddleware
- type QueryRedirectsRequest
- type QueryRedirectsResponse
- type ServerError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BatchError ¶
type CreateRedirectRequest ¶
type CreateRedirectRequest struct {
Url string `json:"url,omitempty"`
}
type CreateRedirectResponse ¶
type CreateRedirectResponse struct {
Code string `json:"code,omitempty"`
}
type CreateRedirectsRequest ¶
type CreateRedirectsRequest struct {
Urls []string `json:"urls"`
}
type CreateRedirectsResponse ¶
type CreateRedirectsResponse struct { Successful []t.Redirect `json:"successful"` Failed []BatchError `json:"failed"` }
type Endpoints ¶
type Endpoints struct { // Create a Batch of Redirects CreateRedirects endpoint.Endpoint // Query a Batch of Codes QueryRedirects endpoint.Endpoint // Resolve a Single Code GetRedirect endpoint.Endpoint // Shorten a Single URL CreateRedirect endpoint.Endpoint }
func MakeEndpoints ¶
func MakeEndpoints(s shortener.RedirectService) Endpoints
type GetRedirectRequest ¶
type GetRedirectRequest struct {
Code string `json:"code,omitempty"`
}
type GetRedirectResponse ¶
type GetRedirectResponse struct {
Url string `json:"url,omitempty"`
}
type LoggingMiddleware ¶
type LoggingMiddleware struct { Logger log.Logger Next shortener.RedirectService }
type QueryRedirectsRequest ¶
type QueryRedirectsRequest struct {
Codes []string `json:"codes"`
}
type QueryRedirectsResponse ¶
type QueryRedirectsResponse struct { Successful []t.Redirect `json:"successful"` Failed []BatchError `json:"failed"` }
type ServerError ¶
type ServerError struct {
// contains filtered or unexported fields
}
func (ServerError) Error ¶
func (err ServerError) Error() string
func (ServerError) StatusCode ¶
func (err ServerError) StatusCode() int
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
repository
|
|
Package types provides primitives to interact with the openapi HTTP API.
|
Package types provides primitives to interact with the openapi HTTP API. |
Click to show internal directories.
Click to hide internal directories.