handler

package
v0.0.0-...-d1236c8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2016 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteOffers

func DeleteOffers(offers db.Offers, users db.Users, sessionManager session.Manager, restaurants db.Restaurants,
	facebookPost facebook.Post, regions db.Regions) router.HandlerWithParams

DeleteOffers handles DELETE requests to /offers. It deletes the offer from the DB and deletes the related Facebook post.

func ListPagesManagedByUser

func ListPagesManagedByUser(sessionManager session.Manager, auther facebook.Authenticator, usersCollection db.Users) router.Handler

ListPagesManagedByUser returns a handler that lists all pages managed by the currently logged in user

func Logout

func Logout(sessionManager session.Manager, usersCollection db.Users) router.Handler

func OfferGroupPost

func OfferGroupPost(c db.OfferGroupPosts, sessionManager session.Manager, users db.Users, restaurants db.Restaurants) router.HandlerWithParams

OfferGroupPost handles GET requests to /restaurant/posts/:date. It returns all current day's offers for the region.

func Page

func Page(sessionManager session.Manager, auther facebook.Authenticator, usersCollection db.Users) router.HandlerWithParams

Page returns a handler that returns information about the specified page

func PostOfferGroupPost

func PostOfferGroupPost(c db.OfferGroupPosts, sessionManager session.Manager, users db.Users, restaurants db.Restaurants,
	facebookPost facebook.Post) router.HandlerWithParams

PostOfferGroupPost handles POST requests to /restaurant/posts. It stores the info in the DB and updates the post in FB.

func PostOffers

func PostOffers(offers db.Offers, users db.Users, restaurants db.Restaurants, sessionManager session.Manager,
	imageStorage storage.Images, facebookPost facebook.Post, regions db.Regions) router.HandlerWithParams

PostOffers handles POST requests to /offers. It stores the offer in the DB and sends it to Facebook to be posted on the page's wall at the requested time.

func PostRestaurants

func PostRestaurants(c db.Restaurants, sessionManager session.Manager, users db.Users, fbAuth facebook.Authenticator) router.Handler

PostRestaurants returns an handler for creating a restaurant

func ProximalOffers

func ProximalOffers(offersCollection db.Offers, imageStorage storage.Images) router.Handler

ProximalOffers handles requests that whish to know about offers near a certain location.

func PutOfferGroupPost

func PutOfferGroupPost(c db.OfferGroupPosts, sessionManager session.Manager, users db.Users, restaurants db.Restaurants,
	facebookPost facebook.Post) router.HandlerWithParams

PutOfferGroupPost handles PUT requests to /restaurant/posts/:date. It stores the info in the DB and updates the post in FB.

func PutOffers

func PutOffers(offers db.Offers, users db.Users, restaurants db.Restaurants, sessionManager session.Manager,
	imageStorage storage.Images, facebookPost facebook.Post, regions db.Regions) router.HandlerWithParams

PutOffers handles PUT requests to /offers. It updates the offer in the DB and updates the related Facebook post.

func RedirectToFBForLogin

func RedirectToFBForLogin(sessionManager session.Manager, auther facebook.Authenticator) router.Handler

RedirectToFBForLogin returns a handler that redirects the user to Facebook to log in

func RedirectToFBForRegistration

func RedirectToFBForRegistration(sessionManager session.Manager, auther facebook.Authenticator,
	tokens db.RegistrationAccessTokens) router.Handler

RedirectToFBForRegistration returns a handler that redirects the user to Facebook to log in so they could be registered in our system

func RedirectedFromFBForLogin

func RedirectedFromFBForLogin(sessionManager session.Manager, fbAuth facebook.Authenticator, users db.Users, restaurants db.Restaurants) router.Handler

RedirectedFromFBForLogin returns a handler that receives the user and page tokens for the user who has just logged in through Facebook. Updates the user and page access tokens in the DB

func RedirectedFromFBForRegistration

func RedirectedFromFBForRegistration(sessionManager session.Manager, auther facebook.Authenticator, usersCollection db.Users) router.Handler

RedirectedFromFBForRegistration provides a handler that stores the data about the current user required to continue the registration in the DB.

func RegionOffers

func RegionOffers(offersCollection db.Offers, regionsCollection db.Regions, imageStorage storage.Images) router.HandlerWithParams

RegionOffers handles GET requests to /regions/:name/offers. It returns all current day's offers for the region.

func Regions

func Regions(regionsCollection db.Regions) router.Handler

func Restaurant

func Restaurant(c db.Restaurants, sessionManager session.Manager, users db.Users) router.HandlerWithParams

Restaurant returns a router.Handler that returns the restaurant information for the specified restaurant

func RestaurantOfferSuggestions

func RestaurantOfferSuggestions(restaurants db.Restaurants, sessionManager session.Manager, users db.Users,
	offers db.Offers) router.HandlerWithParams

RestaurantOfferSuggestions handles GET requests to /restaurants/:id/offer_suggestions and expects a 'title' query parameter. It returns a list of previously used offer titles matching the one provided.

func RestaurantOffers

func RestaurantOffers(restaurants db.Restaurants, sessionManager session.Manager, users db.Users, offers db.Offers,
	imageStorage storage.Images, regions db.Regions) router.HandlerWithParams

RestaurantOffers returns all upcoming offers for the restaurant linked to the currently logged in user unless the request includes a 'title' query parameter, in which the offer with the specified title will be fetched instead.

func Tags

func Tags(tagsCollection db.Tags) router.Handler

func UserRestaurants

func UserRestaurants(restaurants db.Restaurants, sessionManager session.Manager, users db.Users) router.Handler

UserRestaurants returns a list of restaurants the user has access to

Types

type FacebookPage

type FacebookPage struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Address string `json:"address,omitempty"`
	Phone   string `json:"phone,omitempty"`
	Website string `json:"website,omitempty"`
	Email   string `json:"emails,omitempty"`
}

FacebookPage defines the response format for the Page() handler

type HandlerWithParamsWithRestaurant

type HandlerWithParamsWithRestaurant func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, user *model.User,
	restaurant *model.Restaurant) *router.HandlerError

type HandlerWithParamsWithUser

type HandlerWithParamsWithUser func(w http.ResponseWriter, r *http.Request, ps httprouter.Params, user *model.User) *router.HandlerError

type HandlerWithRegion

type HandlerWithRegion func(w http.ResponseWriter, r *http.Request, region *model.Region) *router.HandlerError

type HandlerWithRestaurant

type HandlerWithRestaurant func(w http.ResponseWriter, r *http.Request, user *model.User,
	restaurant *model.Restaurant) *router.HandlerError

type HandlerWithRestaurantAndDate

type HandlerWithRestaurantAndDate func(w http.ResponseWriter, r *http.Request, user *model.User, restaurant *model.Restaurant,
	date model.DateWithoutTime) *router.HandlerError

type HandlerWithUser

type HandlerWithUser func(w http.ResponseWriter, r *http.Request, user *model.User) *router.HandlerError

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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