Documentation
¶
Overview ¶
Package backend exposes a REST API to manage posts stored in the Google Cloud Datastore using the Cloud Endpoints feature of App Engine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddRequest ¶
AddRequest contains all the fields needed to create a new Post.
type Post ¶
type Post struct { UID *datastore.Key `json:"uid" datastore:"-"` Text string `json:"text"` Username string `json:"username"` Avatar string `json:"avatar"` Favorite bool `json:"favorite"` }
A Post contains all the information related to a post.
type Posts ¶
type Posts struct {
Posts []Post `json:"posts"`
}
Posts contains a slice of posts. This type is needed because go-endpoints only supports pointers to structs as input and output types.
type PostsAPI ¶
type PostsAPI struct{}
PostsAPI defines all the endpoints of the posts API.
func (PostsAPI) Add ¶
Add creates a new post given the fields in AddRequest, stores it in the datastore, and returns it.
func (PostsAPI) SetFavorite ¶
func (PostsAPI) SetFavorite(c context.Context, r *SetFavoriteRequest) error
SetFavorite changes the favorite status of a post given its UID.
type SetFavoriteRequest ¶
SetFavoriteRequest contains the information needed to change the favorite status of a post.