api

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2019 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDB

func InitDB() *mgo.Collection

func ModifyAnkieta added in v0.2.0

func ModifyAnkieta(c echo.Context, a *mgo.Collection) error

func PlusAnkieta added in v0.2.0

func PlusAnkieta(c echo.Context, a *mgo.Collection) (string, error)

func PostOdpowiedzi

func PostOdpowiedzi(c echo.Context, a *mgo.Collection, aid string, ro []ROdpowiedz) error

func RealnaAnkieta

func RealnaAnkieta(c echo.Context, a *mgo.Collection)

Types

type Ankieta

type Ankieta struct {
	ID         bson.ObjectId  `bson:"_id,omitempty" json:"id"`
	AID        string         `json:"aid"`
	AuthorID   string         `json:"authorid"`
	Dane       Dane           `json:"dane"`
	Odpowiedzi [][]ROdpowiedz `json:"odpowiedzi"`
}

type AnkietaZListy added in v0.2.0

type AnkietaZListy struct {
	AID        string `json:"aid"`
	Naglowek   string `json:"naglowek"`
	IloscPytan int    `json:"iloscpytan"`
}

func ListAnkiety added in v0.2.0

func ListAnkiety(c echo.Context, a *mgo.Collection) ([]AnkietaZListy, error)

type CaptchaResponse

type CaptchaResponse struct {
	Success  bool    `json:"success"`
	Hostname string  `json:"hostname"`
	Score    float32 `json:"score"`
}

type Config

type Config struct {
	CaptchaSite    string `json:"captchaSite"`
	CaptchaSecret  string `json:"captchaSecret"`
	GoogleClientID string `json:"googleClientID"`
	GoogleSecret   string `json:"googleSecret"`
}

func GetConfigJson added in v0.2.0

func GetConfigJson() Config

type Dane

type Dane struct {
	Naglowek    string    `json:"naglowek"`
	Podnaglowek string    `json:"podnaglowek"`
	Pozegnalna  string    `json:"pozegnalna"`
	Pytanka     []Pytanie `json:"pytanka"`
}

[ [{id: 1, odp: "Coś"}, {id: 2, odp:"dalej"}], [] ]

func GetPytanka

func GetPytanka(c echo.Context, a *mgo.Collection, aid string) (Dane, error)

type GetPytankaResponse

type GetPytankaResponse struct {
	GG      Dane   `json:"gg"`
	Captcha string `json:"captcha"`
}

type GoogleData

type GoogleData struct {
	ID            string `json:"id"`
	Email         string `json:"email"`
	VerifiedEmail bool   `json:"verified_email"`
	Name          string `json:"name"`
	Pic           string `json:"picture"`
}

func GetUserData

func GetUserData(c echo.Context) (GoogleData, error)

type Pytanie

type Pytanie struct {
	ID          int      `json:"id"`
	Pytanie     string   `json:"pytanie"`
	Type        string   `json:"type"`
	Placeholder string   `json:"placeholder"`
	Wybor       []string `json:"wybor"`
	Odpowiedz   string   `json:"odpowiedz"`
}

type PytankaResponse

type PytankaResponse struct {
	Ro           []ROdpowiedz `json:"ro"`
	CaptchaToken string       `json:"captchatoken"`
}

type QA added in v0.2.0

type QA struct {
	Dane       Dane           `json:"dane"`
	Odpowiedzi [][]ROdpowiedz `json:"odpowiedzi"`
}

func GetAnkieta added in v0.2.0

func GetAnkieta(c echo.Context, a *mgo.Collection, aid string) (QA, error)

type ROdpowiedz

type ROdpowiedz struct {
	ID  int    `json:"id"`
	Odp string `json:"odp"`
}

Jump to

Keyboard shortcuts

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