api

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2016 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer

type Answer struct {
	Key    *datastore.Key `json:"id" datastore:"-"`
	Answer string         `json:"answer" datastore:",noindex"`
	CTime  time.Time      `json:"created"`
	User   UserCard       `json:"user" datastore:",noindex"`
	Score  int            `json:"score"`
}

func GetAnswer

func GetAnswer(ctx context.Context, answerKey *datastore.Key) (*Answer, error)

func GetAnswers

func GetAnswers(ctx context.Context, questionKey *datastore.Key) ([]*Answer, error)

func (Answer) Card

func (a Answer) Card() AnswerCard

func (*Answer) Create

func (a *Answer) Create(ctx context.Context, questionKey *datastore.Key) error

func (Answer) OK

func (a Answer) OK() error

func (*Answer) Put

func (a *Answer) Put(ctx context.Context) error

type AnswerCard

type AnswerCard struct {
	Key    *datastore.Key `json:"id"`
	Answer string         `json:"answer"`
	User   UserCard       `json:"user"`
}

type Question

type Question struct {
	Key          *datastore.Key `json:"id" datastore:"-"`
	CTime        time.Time      `json:"created"`
	Question     string         `json:"question" datastore:",noindex"`
	User         UserCard       `json:"user" datastore:",noindex"`
	AnswersCount int            `json:"answers_count"`
}

func GetQuestion

func GetQuestion(ctx context.Context, key *datastore.Key) (*Question, error)

func TopQuestions

func TopQuestions(ctx context.Context) ([]*Question, error)

func (Question) Card

func (q Question) Card() QuestionCard

func (*Question) Create

func (q *Question) Create(ctx context.Context) error

func (Question) OK

func (q Question) OK() error

func (*Question) Update

func (q *Question) Update(ctx context.Context) error

type QuestionCard

type QuestionCard struct {
	Key      *datastore.Key `json:"id" datastore:",noindex"`
	Question string         `json:"question" datastore:",noindex"`
	User     UserCard       `json:"user" datastore:",noindex"`
}

type User

type User struct {
	Key         *datastore.Key `json:"id" datastore:"-"`
	UserID      string         `json:"-" datastore:",noindex"`
	DisplayName string         `json:"display_name" datastore:",noindex"`
	AvatarURL   string         `json:"avatar_url" datastore:",noindex"`
	Score       int            `json:"score" datastore:",noindex"`
}

func UserFromAEUser

func UserFromAEUser(ctx context.Context) (*User, error)

UserFromAEUser gets or creates a User from the currently logged in user.

func (User) Card

func (u User) Card() UserCard

type UserCard

type UserCard struct {
	Key         *datastore.Key `json:"id" datastore:",noindex"`
	DisplayName string         `json:"display_name" datastore:",noindex"`
	AvatarURL   string         `json:"avatar_url" datastore:",noindex"`
}

type Vote

type Vote struct {
	Key      *datastore.Key `json:"id" datastore:"-"`
	MTime    time.Time      `json:"last_modified" datastore:",noindex"`
	Question QuestionCard   `json:"question" datastore:",noindex"`
	Answer   AnswerCard     `json:"answer" datastore:",noindex"`
	User     UserCard       `json:"user" datastore:",noindex"`
	Score    int            `json:"score" datastore:",noindex"`
}

func CastVote

func CastVote(ctx context.Context, answerKey *datastore.Key, score int) (*Vote, error)

func (*Vote) Put

func (v *Vote) Put(ctx context.Context) error

Jump to

Keyboard shortcuts

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