moderation

package
v0.0.0-...-882aa90 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const APIName = "activity"

APIName is the name of the API as defined in the design.

View Source
const APIVersion = "0.0.1"

APIVersion is the version of the API as defined in the design.

View Source
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

View Source
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

type CheckUserReportResult struct {
	HasReported bool
	CanWithdraw bool
}

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

func (c *Client) GetContent(ctx context.Context, p *GetContentPayload) (res string, err error)

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

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "moderation" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "moderation" service 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

type ModerationAddPayload struct {
	Auth     *string
	PostID   int32
	PostType string
}

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.

type UserInfo

type UserInfo struct {
	Name string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL