Documentation
¶
Index ¶
- Constants
- Variables
- func MakeBadRequest(err error) *goa.ServiceError
- func MakeForbidden(err error) *goa.ServiceError
- func MakeNotFound(err error) *goa.ServiceError
- func MakeUnauthorized(err error) *goa.ServiceError
- func NewAcknowledgeEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewAddEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewCancelEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewCheckUserReportEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewGetContentEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewListRequestsEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
- func NewViewedModerationRequests(res *ModerationRequests, view string) *moderationviews.ModerationRequests
- type AcknowledgePayload
- type Auther
- type CancelPayload
- type CheckUserReportPayload
- type CheckUserReportResult
- type Client
- func (c *Client) Acknowledge(ctx context.Context, p *AcknowledgePayload) (res *ModerationRequest, err error)
- func (c *Client) Add(ctx context.Context, p *ModerationAddPayload) (res *ModerationRequest, err error)
- func (c *Client) Cancel(ctx context.Context, p *CancelPayload) (err error)
- func (c *Client) CheckUserReport(ctx context.Context, p *CheckUserReportPayload) (res *CheckUserReportResult, err error)
- func (c *Client) GetContent(ctx context.Context, p *GetContentPayload) (res string, err error)
- func (c *Client) ListRequests(ctx context.Context, p *ListRequestsPayload) (res *ModerationRequests, err error)
- type Endpoints
- type GetContentPayload
- type ListRequestsPayload
- type ModerationAddPayload
- type ModerationRequest
- type ModerationRequests
- type Service
- type UserInfo
Constants ¶
const APIName = "activity"
APIName is the name of the API as defined in the design.
const APIVersion = "0.0.1"
APIVersion is the version of the API as defined in the design.
const ServiceName = "moderation"
ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.
Variables ¶
var MethodNames = [6]string{"add", "cancel", "checkUserReport", "acknowledge", "listRequests", "getContent"}
MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.
Functions ¶
func MakeBadRequest ¶
func MakeBadRequest(err error) *goa.ServiceError
MakeBadRequest builds a goa.ServiceError from an error.
func MakeForbidden ¶
func MakeForbidden(err error) *goa.ServiceError
MakeForbidden builds a goa.ServiceError from an error.
func MakeNotFound ¶
func MakeNotFound(err error) *goa.ServiceError
MakeNotFound builds a goa.ServiceError from an error.
func MakeUnauthorized ¶
func MakeUnauthorized(err error) *goa.ServiceError
MakeUnauthorized builds a goa.ServiceError from an error.
func NewAcknowledgeEndpoint ¶
func NewAcknowledgeEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewAcknowledgeEndpoint returns an endpoint function that calls the method "acknowledge" of service "moderation".
func NewAddEndpoint ¶
func NewAddEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewAddEndpoint returns an endpoint function that calls the method "add" of service "moderation".
func NewCancelEndpoint ¶
func NewCancelEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewCancelEndpoint returns an endpoint function that calls the method "cancel" of service "moderation".
func NewCheckUserReportEndpoint ¶
func NewCheckUserReportEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewCheckUserReportEndpoint returns an endpoint function that calls the method "checkUserReport" of service "moderation".
func NewGetContentEndpoint ¶
func NewGetContentEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewGetContentEndpoint returns an endpoint function that calls the method "getContent" of service "moderation".
func NewListRequestsEndpoint ¶
func NewListRequestsEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint
NewListRequestsEndpoint returns an endpoint function that calls the method "listRequests" of service "moderation".
func NewViewedModerationRequests ¶
func NewViewedModerationRequests(res *ModerationRequests, view string) *moderationviews.ModerationRequests
NewViewedModerationRequests initializes viewed result type ModerationRequests from result type ModerationRequests using the given view.
Types ¶
type AcknowledgePayload ¶
type AcknowledgePayload struct {
// JWT token
Auth string
// Request ID
ID int32
// Action to take (delete/keep)
Action string
}
AcknowledgePayload is the payload type of the moderation service acknowledge method.
type Auther ¶
type Auther interface {
// JWTAuth implements the authorization logic for the JWT security scheme.
JWTAuth(ctx context.Context, token string, schema *security.JWTScheme) (context.Context, error)
}
Auther defines the authorization functions to be implemented by the service.
type CancelPayload ¶
type CancelPayload struct {
// JWT token
Auth string
// Post ID
PostID int32
// Post type
PostType string
}
CancelPayload is the payload type of the moderation service cancel method.
type CheckUserReportPayload ¶
type CheckUserReportPayload struct {
// JWT token
Auth string
// Post ID
PostID int32
// Post type
PostType string
}
CheckUserReportPayload is the payload type of the moderation service checkUserReport method.
type CheckUserReportResult ¶
CheckUserReportResult is the result type of the moderation service checkUserReport method.
type Client ¶
type Client struct {
AddEndpoint goa.Endpoint
CancelEndpoint goa.Endpoint
CheckUserReportEndpoint goa.Endpoint
AcknowledgeEndpoint goa.Endpoint
ListRequestsEndpoint goa.Endpoint
GetContentEndpoint goa.Endpoint
}
Client is the "moderation" service client.
func NewClient ¶
func NewClient(add, cancel, checkUserReport, acknowledge, listRequests, getContent goa.Endpoint) *Client
NewClient initializes a "moderation" service client given the endpoints.
func (*Client) Acknowledge ¶
func (c *Client) Acknowledge(ctx context.Context, p *AcknowledgePayload) (res *ModerationRequest, err error)
Acknowledge calls the "acknowledge" endpoint of the "moderation" service. Acknowledge may return the following errors:
- "unauthorized" (type *goa.ServiceError)
- "forbidden" (type *goa.ServiceError)
- "not-found" (type *goa.ServiceError)
- "bad-request" (type *goa.ServiceError)
- error: internal error
func (*Client) Add ¶
func (c *Client) Add(ctx context.Context, p *ModerationAddPayload) (res *ModerationRequest, err error)
Add calls the "add" endpoint of the "moderation" service. Add may return the following errors:
- "unauthorized" (type *goa.ServiceError)
- "forbidden" (type *goa.ServiceError)
- "not-found" (type *goa.ServiceError)
- "bad-request" (type *goa.ServiceError)
- error: internal error
func (*Client) Cancel ¶
func (c *Client) Cancel(ctx context.Context, p *CancelPayload) (err error)
Cancel calls the "cancel" endpoint of the "moderation" service. Cancel may return the following errors:
- "unauthorized" (type *goa.ServiceError)
- "forbidden" (type *goa.ServiceError)
- "not-found" (type *goa.ServiceError)
- "bad-request" (type *goa.ServiceError)
- error: internal error
func (*Client) CheckUserReport ¶
func (c *Client) CheckUserReport(ctx context.Context, p *CheckUserReportPayload) (res *CheckUserReportResult, err error)
CheckUserReport calls the "checkUserReport" endpoint of the "moderation" service. CheckUserReport may return the following errors:
- "unauthorized" (type *goa.ServiceError)
- "forbidden" (type *goa.ServiceError)
- "not-found" (type *goa.ServiceError)
- "bad-request" (type *goa.ServiceError)
- error: internal error
func (*Client) GetContent ¶
GetContent calls the "getContent" endpoint of the "moderation" service. GetContent may return the following errors:
- "unauthorized" (type *goa.ServiceError)
- "forbidden" (type *goa.ServiceError)
- "not-found" (type *goa.ServiceError)
- "bad-request" (type *goa.ServiceError)
- error: internal error
func (*Client) ListRequests ¶
func (c *Client) ListRequests(ctx context.Context, p *ListRequestsPayload) (res *ModerationRequests, err error)
ListRequests calls the "listRequests" endpoint of the "moderation" service. ListRequests may return the following errors:
- "unauthorized" (type *goa.ServiceError)
- "forbidden" (type *goa.ServiceError)
- "not-found" (type *goa.ServiceError)
- "bad-request" (type *goa.ServiceError)
- error: internal error
type Endpoints ¶
type Endpoints struct {
Add goa.Endpoint
Cancel goa.Endpoint
CheckUserReport goa.Endpoint
Acknowledge goa.Endpoint
ListRequests goa.Endpoint
GetContent goa.Endpoint
}
Endpoints wraps the "moderation" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "moderation" service with endpoints.
type GetContentPayload ¶
type GetContentPayload struct {
// JWT token
Auth string
// Type of post
PostType string
// ID of the post
PostID int32
}
GetContentPayload is the payload type of the moderation service getContent method.
type ListRequestsPayload ¶
type ListRequestsPayload struct {
// JWT token
Auth string
// Page number
Page int32
// Page size
PageSize int32
}
ListRequestsPayload is the payload type of the moderation service listRequests method.
type ModerationAddPayload ¶
ModerationAddPayload is the payload type of the moderation service add method.
type ModerationRequest ¶
type ModerationRequest struct {
ID int32
PostID int32
PostType string
ReportedBy int32
ReportedByName *string
ReportedAt string
AcknowledgedBy *int32
AcknowledgedByUser *UserInfo
AcknowledgedAt *string
}
ModerationRequest is the result type of the moderation service add method.
type ModerationRequests ¶
type ModerationRequests struct {
Requests []*ModerationRequest
TotalPages int
}
ModerationRequests is the result type of the moderation service listRequests method.
func NewModerationRequests ¶
func NewModerationRequests(vres *moderationviews.ModerationRequests) *ModerationRequests
NewModerationRequests initializes result type ModerationRequests from viewed result type ModerationRequests.
type Service ¶
type Service interface {
// Add implements add.
Add(context.Context, *ModerationAddPayload) (res *ModerationRequest, err error)
// Cancel a moderation request
Cancel(context.Context, *CancelPayload) (err error)
// Check if user has reported a specific post
CheckUserReport(context.Context, *CheckUserReportPayload) (res *CheckUserReportResult, err error)
// Acknowledge a moderation request with action
Acknowledge(context.Context, *AcknowledgePayload) (res *ModerationRequest, err error)
// List moderation requests
ListRequests(context.Context, *ListRequestsPayload) (res *ModerationRequests, err error)
// Get content for moderation review
GetContent(context.Context, *GetContentPayload) (res string, err error)
}
Service is the moderation service interface.