Documentation ¶
Overview ¶
THIS FILE IS AUTO GENERATED BY GK-CLI DO NOT EDIT!!
Index ¶
- func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
- func LoggingMiddleware(logger log.Logger) endpoint.Middleware
- func MakeCreatePostEndpoint(s service.BlogService) endpoint.Endpoint
- func MakeCreateTagEndpoint(s service.BlogService) endpoint.Endpoint
- func MakeDeletePostEndpoint(s service.BlogService) endpoint.Endpoint
- func MakeDeleteTagEndpoint(s service.BlogService) endpoint.Endpoint
- func MakeGetPostEndpoint(s service.BlogService) endpoint.Endpoint
- func MakeGetTagEndpoint(s service.BlogService) endpoint.Endpoint
- func MakeUpdatePostEndpoint(s service.BlogService) endpoint.Endpoint
- func MakeUpdateTagEndpoint(s service.BlogService) endpoint.Endpoint
- func MakeUploadEndpoint(s service.BlogService) endpoint.Endpoint
- type CreatePostRequest
- type CreatePostResponse
- type CreateTagRequest
- type CreateTagResponse
- type DeletePostRequest
- type DeletePostResponse
- type DeleteTagRequest
- type DeleteTagResponse
- type Endpoints
- func (e Endpoints) CreatePost(ctx context.Context, title string, slug string, description string, ...) (message string, status string, err error)
- func (e Endpoints) CreateTag(ctx context.Context, name string, token string) (message string, status string, err error)
- func (e Endpoints) DeletePost(ctx context.Context, filter []*model.Query, token string) (message string, status string, err error)
- func (e Endpoints) DeleteTag(ctx context.Context, name string, token string) (message string, status string, err error)
- func (e Endpoints) GetPost(ctx context.Context, must []*model.Query, should []*model.Query, ...) (posts []model.Post, message string, status string, err error)
- func (e Endpoints) GetTag(ctx context.Context, filter []*model.Query, token string) (tags []*model.Tag, message string, status string, err error)
- func (e Endpoints) UpdatePost(ctx context.Context, title string, slug string, description string, ...) (message string, status string, err error)
- func (e Endpoints) UpdateTag(ctx context.Context, oldName string, newName string, token string) (message string, status string, err error)
- func (e Endpoints) Upload(ctx context.Context, title string, description string, fileType string, ...) (message string, status string, err error)
- type Failure
- type GetPostRequest
- type GetPostResponse
- type GetTagRequest
- type GetTagResponse
- type UpdatePostRequest
- type UpdatePostResponse
- type UpdateTagRequest
- type UpdateTagResponse
- type UploadRequest
- type UploadResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstrumentingMiddleware ¶
func InstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
InstrumentingMiddleware returns an endpoint middleware that records the duration of each invocation to the passed histogram. The middleware adds a single field: "success", which is "true" if no error is returned, and "false" otherwise.
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) endpoint.Middleware
LoggingMiddleware returns an endpoint middleware that logs the duration of each invocation, and the resulting error, if any.
func MakeCreatePostEndpoint ¶
func MakeCreatePostEndpoint(s service.BlogService) endpoint.Endpoint
MakeCreatePostEndpoint returns an endpoint that invokes CreatePost on the service.
func MakeCreateTagEndpoint ¶
func MakeCreateTagEndpoint(s service.BlogService) endpoint.Endpoint
MakeCreateTagEndpoint returns an endpoint that invokes CreateTag on the service.
func MakeDeletePostEndpoint ¶
func MakeDeletePostEndpoint(s service.BlogService) endpoint.Endpoint
MakeDeletePostEndpoint returns an endpoint that invokes DeletePost on the service.
func MakeDeleteTagEndpoint ¶
func MakeDeleteTagEndpoint(s service.BlogService) endpoint.Endpoint
MakeDeleteTagEndpoint returns an endpoint that invokes DeleteTag on the service.
func MakeGetPostEndpoint ¶
func MakeGetPostEndpoint(s service.BlogService) endpoint.Endpoint
MakeGetPostEndpoint returns an endpoint that invokes GetPost on the service.
func MakeGetTagEndpoint ¶
func MakeGetTagEndpoint(s service.BlogService) endpoint.Endpoint
MakeGetTagEndpoint returns an endpoint that invokes GetTag on the service.
func MakeUpdatePostEndpoint ¶
func MakeUpdatePostEndpoint(s service.BlogService) endpoint.Endpoint
MakeUpdatePostEndpoint returns an endpoint that invokes UpdatePost on the service.
func MakeUpdateTagEndpoint ¶
func MakeUpdateTagEndpoint(s service.BlogService) endpoint.Endpoint
MakeUpdateTagEndpoint returns an endpoint that invokes UpdateTag on the service.
func MakeUploadEndpoint ¶
func MakeUploadEndpoint(s service.BlogService) endpoint.Endpoint
MakeUploadEndpoint returns an endpoint that invokes Upload on the service.
Types ¶
type CreatePostRequest ¶
type CreatePostRequest struct { Title string `json:"title"` Slug string `json:"slug"` Description string `json:"description"` Text string `json:"text"` Params []*model.Query `json:"params"` Medias []uint64 `json:"medias"` Tags []uint64 `json:"tags"` Status model.StatusPost `json:"status"` Token string `json:"token"` }
CreatePostRequest collects the request parameters for the CreatePost method.
type CreatePostResponse ¶
type CreatePostResponse struct { Message string `json:"message"` Status string `json:"status"` Err error `json:"err"` }
CreatePostResponse collects the response parameters for the CreatePost method.
func (CreatePostResponse) Failed ¶
func (r CreatePostResponse) Failed() error
Failed implements Failer.
type CreateTagRequest ¶
CreateTagRequest collects the request parameters for the CreateTag method.
type CreateTagResponse ¶
type CreateTagResponse struct { Message string `json:"message"` Status string `json:"status"` Err error `json:"err"` }
CreateTagResponse collects the response parameters for the CreateTag method.
func (CreateTagResponse) Failed ¶
func (r CreateTagResponse) Failed() error
Failed implements Failer.
type DeletePostRequest ¶
DeletePostRequest collects the request parameters for the DeletePost method.
type DeletePostResponse ¶
type DeletePostResponse struct { Message string `json:"message"` Status string `json:"status"` Err error `json:"err"` }
DeletePostResponse collects the response parameters for the DeletePost method.
func (DeletePostResponse) Failed ¶
func (r DeletePostResponse) Failed() error
Failed implements Failer.
type DeleteTagRequest ¶
DeleteTagRequest collects the request parameters for the DeleteTag method.
type DeleteTagResponse ¶
type DeleteTagResponse struct { Message string `json:"message"` Status string `json:"status"` Err error `json:"err"` }
DeleteTagResponse collects the response parameters for the DeleteTag method.
func (DeleteTagResponse) Failed ¶
func (r DeleteTagResponse) Failed() error
Failed implements Failer.
type Endpoints ¶
type Endpoints struct { CreatePostEndpoint endpoint.Endpoint UpdatePostEndpoint endpoint.Endpoint GetPostEndpoint endpoint.Endpoint DeletePostEndpoint endpoint.Endpoint CreateTagEndpoint endpoint.Endpoint GetTagEndpoint endpoint.Endpoint UpdateTagEndpoint endpoint.Endpoint DeleteTagEndpoint endpoint.Endpoint UploadEndpoint endpoint.Endpoint }
Endpoints collects all of the endpoints that compose a profile service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.
func New ¶
func New(s service.BlogService, mdw map[string][]endpoint.Middleware) Endpoints
New returns a Endpoints struct that wraps the provided service, and wires in all of the expected endpoint middlewares
func (Endpoints) CreatePost ¶
func (e Endpoints) CreatePost(ctx context.Context, title string, slug string, description string, text string, params []*model.Query, medias []uint64, Tags []uint64, Status model.StatusPost, token string) (message string, status string, err error)
CreatePost implements Service. Primarily useful in a client.
func (Endpoints) CreateTag ¶
func (e Endpoints) CreateTag(ctx context.Context, name string, token string) (message string, status string, err error)
CreateTag implements Service. Primarily useful in a client.
func (Endpoints) DeletePost ¶
func (e Endpoints) DeletePost(ctx context.Context, filter []*model.Query, token string) (message string, status string, err error)
DeletePost implements Service. Primarily useful in a client.
func (Endpoints) DeleteTag ¶
func (e Endpoints) DeleteTag(ctx context.Context, name string, token string) (message string, status string, err error)
DeleteTag implements Service. Primarily useful in a client.
func (Endpoints) GetPost ¶
func (e Endpoints) GetPost(ctx context.Context, must []*model.Query, should []*model.Query, not []*model.Query, filter []*model.Query, token string) (posts []model.Post, message string, status string, err error)
GetPost implements Service. Primarily useful in a client.
func (Endpoints) GetTag ¶
func (e Endpoints) GetTag(ctx context.Context, filter []*model.Query, token string) (tags []*model.Tag, message string, status string, err error)
GetTag implements Service. Primarily useful in a client.
func (Endpoints) UpdatePost ¶
func (e Endpoints) UpdatePost(ctx context.Context, title string, slug string, description string, text string, params []*model.Query, medias []uint64, Tags []uint64, Status model.StatusPost, token string) (message string, status string, err error)
UpdatePost implements Service. Primarily useful in a client.
type Failure ¶
type Failure interface {
Failed() error
}
Failure is an interface that should be implemented by response types. Response encoders can check if responses are Failer, and if so they've failed, and if so encode them using a separate write path based on the error.
type GetPostRequest ¶
type GetPostRequest struct { Must []*model.Query `json:"must"` Should []*model.Query `json:"should"` Not []*model.Query `json:"not"` Filter []*model.Query `json:"filter"` Token string `json:"token"` }
GetPostRequest collects the request parameters for the GetPost method.
type GetPostResponse ¶
type GetPostResponse struct { Posts []model.Post `json:"posts"` Message string `json:"message"` Status string `json:"status"` Err error `json:"err"` }
GetPostResponse collects the response parameters for the GetPost method.
type GetTagRequest ¶
GetTagRequest collects the request parameters for the GetTag method.
type GetTagResponse ¶
type GetTagResponse struct { Tags []*model.Tag `json:"tags"` Message string `json:"message"` Status string `json:"status"` Err error `json:"err"` }
GetTagResponse collects the response parameters for the GetTag method.
type UpdatePostRequest ¶
type UpdatePostRequest struct { Title string `json:"title"` Slug string `json:"slug"` Description string `json:"description"` Text string `json:"text"` Params []*model.Query `json:"params"` Medias []uint64 `json:"medias"` Tags []uint64 `json:"tags"` Status model.StatusPost `json:"status"` Token string `json:"token"` }
UpdatePostRequest collects the request parameters for the UpdatePost method.
type UpdatePostResponse ¶
type UpdatePostResponse struct { Message string `json:"message"` Status string `json:"status"` Err error `json:"err"` }
UpdatePostResponse collects the response parameters for the UpdatePost method.
func (UpdatePostResponse) Failed ¶
func (r UpdatePostResponse) Failed() error
Failed implements Failer.
type UpdateTagRequest ¶
type UpdateTagRequest struct { OldName string `json:"old_name"` NewName string `json:"new_name"` Token string `json:"token"` }
UpdateTagRequest collects the request parameters for the UpdateTag method.
type UpdateTagResponse ¶
type UpdateTagResponse struct { Message string `json:"message"` Status string `json:"status"` Err error `json:"err"` }
UpdateTagResponse collects the response parameters for the UpdateTag method.
func (UpdateTagResponse) Failed ¶
func (r UpdateTagResponse) Failed() error
Failed implements Failer.
type UploadRequest ¶
type UploadRequest struct { Title string `json:"title"` Description string `json:"description"` FileType string `json:"file_type"` File bytes.Buffer `json:"file"` Token string `json:"token"` }
UploadRequest collects the request parameters for the Upload method.
type UploadResponse ¶
type UploadResponse struct { Message string `json:"message"` Status string `json:"status"` Err error `json:"err"` }
UploadResponse collects the response parameters for the Upload method.