following

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 = "following"

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 = [3]string{"follow", "unfollow", "followers"}

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 NewFollowEndpoint

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

NewFollowEndpoint returns an endpoint function that calls the method "follow" of service "following".

func NewFollowersEndpoint

func NewFollowersEndpoint(s Service) goa.Endpoint

NewFollowersEndpoint returns an endpoint function that calls the method "followers" of service "following".

func NewUnfollowEndpoint

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

NewUnfollowEndpoint returns an endpoint function that calls the method "unfollow" of service "following".

func NewViewedFollowersPage

func NewViewedFollowersPage(res *FollowersPage, view string) *followingviews.FollowersPage

NewViewedFollowersPage initializes viewed result type FollowersPage from result type FollowersPage 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 Avatar

type Avatar struct {
	URL string
}

type Client

type Client struct {
	FollowEndpoint    goa.Endpoint
	UnfollowEndpoint  goa.Endpoint
	FollowersEndpoint goa.Endpoint
}

Client is the "following" service client.

func NewClient

func NewClient(follow, unfollow, followers goa.Endpoint) *Client

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

func (*Client) Follow

func (c *Client) Follow(ctx context.Context, p *FollowPayload) (err error)

Follow calls the "follow" endpoint of the "following" service.

func (*Client) Followers

func (c *Client) Followers(ctx context.Context, p *FollowersPayload) (res *FollowersPage, err error)

Followers calls the "followers" endpoint of the "following" service.

func (*Client) Unfollow

func (c *Client) Unfollow(ctx context.Context, p *UnfollowPayload) (err error)

Unfollow calls the "unfollow" endpoint of the "following" service.

type Endpoints

type Endpoints struct {
	Follow    goa.Endpoint
	Unfollow  goa.Endpoint
	Followers goa.Endpoint
}

Endpoints wraps the "following" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

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

func (*Endpoints) Use

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

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

type FollowPayload

type FollowPayload struct {
	Auth *string
	ID   *int64
}

FollowPayload is the payload type of the following service follow method.

type Follower

type Follower struct {
	ID     int64
	Name   string
	Avatar *Avatar
}

type FollowerCollection

type FollowerCollection []*Follower

type FollowersPage

type FollowersPage struct {
	Followers FollowerCollection
	Total     int32
	Page      int32
}

FollowersPage is the result type of the following service followers method.

func NewFollowersPage

func NewFollowersPage(vres *followingviews.FollowersPage) *FollowersPage

NewFollowersPage initializes result type FollowersPage from viewed result type FollowersPage.

type FollowersPayload

type FollowersPayload struct {
	ID   *int64
	Page *int64
}

FollowersPayload is the payload type of the following service followers method.

type Service

type Service interface {
	// Follow implements follow.
	Follow(context.Context, *FollowPayload) (err error)
	// Unfollow implements unfollow.
	Unfollow(context.Context, *UnfollowPayload) (err error)
	// Followers implements followers.
	Followers(context.Context, *FollowersPayload) (res *FollowersPage, err error)
}

Service is the following service interface.

type UnfollowPayload

type UnfollowPayload struct {
	Auth *string
	ID   *int64
}

UnfollowPayload is the payload type of the following service unfollow method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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