discussion

package
v0.0.0-...-b9360c4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "discussion"

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 = [5]string{"project", "data", "post message", "update message", "delete message"}

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 NewDataEndpoint

func NewDataEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewDataEndpoint returns an endpoint function that calls the method "data" of service "discussion".

func NewDeleteMessageEndpoint

func NewDeleteMessageEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewDeleteMessageEndpoint returns an endpoint function that calls the method "delete message" of service "discussion".

func NewPostMessageEndpoint

func NewPostMessageEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewPostMessageEndpoint returns an endpoint function that calls the method "post message" of service "discussion".

func NewProjectEndpoint

func NewProjectEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewProjectEndpoint returns an endpoint function that calls the method "project" of service "discussion".

func NewUpdateMessageEndpoint

func NewUpdateMessageEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewUpdateMessageEndpoint returns an endpoint function that calls the method "update message" of service "discussion".

func NewViewedDiscussion

func NewViewedDiscussion(res *Discussion, view string) *discussionviews.Discussion

NewViewedDiscussion initializes viewed result type Discussion from result type Discussion using the given view.

Types

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 AuthorPhoto

type AuthorPhoto struct {
	URL string
}

type Client

type Client struct {
	ProjectEndpoint       goa.Endpoint
	DataEndpoint          goa.Endpoint
	PostMessageEndpoint   goa.Endpoint
	UpdateMessageEndpoint goa.Endpoint
	DeleteMessageEndpoint goa.Endpoint
}

Client is the "discussion" service client.

func NewClient

func NewClient(project, data, postMessage, updateMessage, deleteMessage goa.Endpoint) *Client

NewClient initializes a "discussion" service client given the endpoints.

func (*Client) Data

func (c *Client) Data(ctx context.Context, p *DataPayload) (res *Discussion, err error)

Data calls the "data" endpoint of the "discussion" service.

func (*Client) DeleteMessage

func (c *Client) DeleteMessage(ctx context.Context, p *DeleteMessagePayload) (err error)

DeleteMessage calls the "delete message" endpoint of the "discussion" service.

func (*Client) PostMessage

func (c *Client) PostMessage(ctx context.Context, p *PostMessagePayload) (res *PostMessageResult, err error)

PostMessage calls the "post message" endpoint of the "discussion" service.

func (*Client) Project

func (c *Client) Project(ctx context.Context, p *ProjectPayload) (res *Discussion, err error)

Project calls the "project" endpoint of the "discussion" service.

func (*Client) UpdateMessage

func (c *Client) UpdateMessage(ctx context.Context, p *UpdateMessagePayload) (res *UpdateMessageResult, err error)

UpdateMessage calls the "update message" endpoint of the "discussion" service.

type DataPayload

type DataPayload struct {
	Auth     *string
	Bookmark string
}

DataPayload is the payload type of the discussion service data method.

type DeleteMessagePayload

type DeleteMessagePayload struct {
	Auth   string
	PostID int64
}

DeleteMessagePayload is the payload type of the discussion service delete message method.

type Discussion

type Discussion struct {
	Posts []*ThreadedPost
}

Discussion is the result type of the discussion service project method.

func NewDiscussion

func NewDiscussion(vres *discussionviews.Discussion) *Discussion

NewDiscussion initializes result type Discussion from viewed result type Discussion.

type Endpoints

type Endpoints struct {
	Project       goa.Endpoint
	Data          goa.Endpoint
	PostMessage   goa.Endpoint
	UpdateMessage goa.Endpoint
	DeleteMessage goa.Endpoint
}

Endpoints wraps the "discussion" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

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

func (*Endpoints) Use

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

Use applies the given middleware to all the "discussion" service endpoints.

type NewPost

type NewPost struct {
	ThreadID  *int64
	Body      string
	ProjectID *int32
	Bookmark  *string
}

type PostAuthor

type PostAuthor struct {
	ID    int32
	Name  string
	Photo *AuthorPhoto
}

type PostMessagePayload

type PostMessagePayload struct {
	Auth string
	Post *NewPost
}

PostMessagePayload is the payload type of the discussion service post message method.

type PostMessageResult

type PostMessageResult struct {
	Post *ThreadedPost
}

PostMessageResult is the result type of the discussion service post message method.

type ProjectPayload

type ProjectPayload struct {
	Auth      *string
	ProjectID int32
}

ProjectPayload is the payload type of the discussion service project method.

type Service

type Service interface {
	// Project implements project.
	Project(context.Context, *ProjectPayload) (res *Discussion, err error)
	// Data implements data.
	Data(context.Context, *DataPayload) (res *Discussion, err error)
	// PostMessage implements post message.
	PostMessage(context.Context, *PostMessagePayload) (res *PostMessageResult, err error)
	// UpdateMessage implements update message.
	UpdateMessage(context.Context, *UpdateMessagePayload) (res *UpdateMessageResult, err error)
	// DeleteMessage implements delete message.
	DeleteMessage(context.Context, *DeleteMessagePayload) (err error)
}

Service is the discussion service interface.

type ThreadedPost

type ThreadedPost struct {
	ID        int64
	CreatedAt int64
	UpdatedAt int64
	Author    *PostAuthor
	Replies   []*ThreadedPost
	Body      string
	Bookmark  *string
}

type UpdateMessagePayload

type UpdateMessagePayload struct {
	Auth   string
	PostID int64
	Body   string
}

UpdateMessagePayload is the payload type of the discussion service update message method.

type UpdateMessageResult

type UpdateMessageResult struct {
	Post *ThreadedPost
}

UpdateMessageResult is the result type of the discussion service update message method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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