service

package
v0.0.0-...-ea6506d Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2018 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FacebookClient

type FacebookClient interface {
	GetEventInfo(ctx context.Context, ids []string) ([]json.RawMessage, error)
}

FacebookClient mocks out access to the Facebook Graph API.

type Service

type Service struct {
	DestStore  *pg.DestStore
	EventStore *pg.EventStore
	UserStore  *pg.UserStore

	FacebookClient func(oauthToken string) FacebookClient
	Time           Time

	Auth auth.Provider
}

Service is a programmatic API to the eventdb. It manages access to the Store and checks permissions.

func (*Service) DestGenerate

DestGenerate finds a new random event near the user's location and returns a DestGenerateReply that includes the new event and whether or not the search was successful.

func (*Service) DestGet

func (s *Service) DestGet(ctx context.Context, id eventdb.DestID) (eventdb.Dest, error)

DestGet retrieves a Dest from the database.

func (*Service) DestList

func (s *Service) DestList(ctx context.Context, opts eventdb.DestListRequest) ([]eventdb.Dest, error)

DestList lists a user's Dests by creation date.

func (*Service) DestUpdate

func (s *Service) DestUpdate(ctx context.Context, id eventdb.DestID, update eventdb.DestUpdate) (eventdb.Dest, error)

DestUpdate updates a Dest with the user's feedback

func (*Service) EventGet

func (s *Service) EventGet(ctx context.Context, id eventdb.EventID) (eventdb.Event, error)

EventGet retrieves an event from the database.

func (*Service) EventSearch

func (s *Service) EventSearch(ctx context.Context, req eventdb.EventSearchRequest) ([]eventdb.Event, error)

EventSearch queries the database for events matching the EventSearchRequest and returns Event objects for the matching results.

func (*Service) EventSearchFull

func (s *Service) EventSearchFull(ctx context.Context, params eventdb.EventSearchRequest) ([]json.RawMessage, error)

EventSearchFull queries the database for events matching the EventSearchRequest and returns the raw Graph API JSON data for the matching results.

func (*Service) EventSubmit

func (s *Service) EventSubmit(ctx context.Context, req eventdb.EventSubmitRequest) error

EventSubmit downloads the events using the Facebook API and saves them to the EventStore. It uses a random user's Facebook API token to fetch the event so some users must be logged in with Facebook for this method to work.

func (*Service) UserGet

func (s *Service) UserGet(ctx context.Context, id eventdb.UserID) (eventdb.User, error)

UserGet retrieves User records.

func (*Service) UserUpdate

func (s *Service) UserUpdate(ctx context.Context, id eventdb.UserID, update eventdb.UserUpdate) (*eventdb.User, error)

UserUpdate lets users update their profile data.

type Time

type Time interface {
	Now() time.Time
}

Time mocks out time.Now for testing

Jump to

Keyboard shortcuts

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