api

package
v0.0.0-...-29377e2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ABeautifulDayFrenchID = "ec1e5bcb-5f88-4c8c-85e1-9e0b09f75b7b"
View Source
var ABeautifulDayFrenchTitle = "Une belle journée"
View Source
var ABeautifulDayID = "15752fd0-81bf-4acd-a35d-80b95f07cd59"
View Source
var DefaultAccountId = "2e771804-3900-44eb-89f7-28a8801f381c"
View Source
var DefaultDisplayName = "Test User"
View Source
var DefaultSubAccount1DisplayName = "Test User - Sub Account 1"
View Source
var DefaultSubAccount1Id = "a6084b06-487a-413c-91f2-58bc4057831f"
View Source
var DefaultSubAccount2DisplayName = "Test User - Sub Account 2"
View Source
var DefaultSubAccount2Id = "bc97b04a-7d56-46ab-b203-188cf74b47b2"
View Source
var DefaultSubAccount3DisplayName = "Test User - Sub Account 3"
View Source
var DefaultSubAccount3Id = "a49f87fd-9a28-44b0-8953-07c2063dbe0a"
View Source
var DefaultUserEmail = "test@email.com"
View Source
var DefaultUserId = "c5177e5e-1f54-48f6-aba8-9a816b1d7599"

Functions

func NewClient

func NewClient() (*mongo.Client, *context.Context, context.CancelFunc, error)

func SeedDB

func SeedDB()

Types

type Account

type Account struct {
	ID          string        `json:"id" bson:"id"`
	UserID      string        `json:"userId" bson:"userId"`
	SubAccounts []*SubAccount `json:"subAccounts" bson:"subAccounts"`
}

type AccountsList

type AccountsList struct {
	Items []*Account `json:"items"`
}

func GetStaticAccountsList

func GetStaticAccountsList() *AccountsList

func (*AccountsList) GetAccountById

func (aL *AccountsList) GetAccountById(id string) (*Account, error)

type Book

type Book struct {
	ID           string             `json:"id" bson:"id"`
	Translations []*BookTranslation `json:"translations" bson:"translations"`
}
type BookImageLink struct {
	ID    string `json:"id" bson:"id"`
	URI   string `json:"uri" bson:"uri"`
	Order int    `json:"order" bson:"order"`
}

type BookTranslation

type BookTranslation struct {
	ID      string           `json:"id" bson:"id"`
	Locale  string           `json:"locale" bson:"locale"`
	Title   string           `json:"title" bson:"title"`
	Content []*BookImageLink `json:"content" bson:"content"`
}

type BooksList

type BooksList struct {
	Items []*Book `json:"items"`
}

func GetStaticBooksList

func GetStaticBooksList() *BooksList

func (*BooksList) GetBookById

func (bL *BooksList) GetBookById(id string) (*Book, error)

func (*BooksList) GetBooksWithLocale

func (bL *BooksList) GetBooksWithLocale(locale string) *BooksList

type Constants

type Constants struct {
	APIBaseEndpoint     string
	APIVersion          string
	UsersAPIEndpoint    string
	AccountsAPIEndpoint string
	BooksAPIEndpoint    string
	LogStringFormat     string
}

type Server

type Server struct {
	EchoServer         *echo.Echo
	Constants          Constants
	MongoClient        *mongo.Client
	MongoContext       *context.Context
	MongoContextCancel context.CancelFunc
}

func NewServer

func NewServer(
	constants *Constants,
) *Server

func (*Server) GetAccount

func (s *Server) GetAccount(c echo.Context) error

func (*Server) GetBook

func (s *Server) GetBook(c echo.Context) error

func (*Server) GetUser

func (s *Server) GetUser(c echo.Context) error

func (*Server) ListAccounts

func (s *Server) ListAccounts(c echo.Context) error

func (*Server) ListBooks

func (s *Server) ListBooks(c echo.Context) error

func (*Server) ListBooksInLocale

func (s *Server) ListBooksInLocale(c echo.Context) error

func (*Server) ListUsers

func (s *Server) ListUsers(c echo.Context) error

type SubAccount

type SubAccount struct {
	ID          string `json:"id" bson:"id"`
	DisplayName string `json:"displayName" bson:"displayName"`
}

type User

type User struct {
	ID          string `json:"id" bson:"id"`
	Email       string `json:"email" bson:"email"`
	DisplayName string `json:"displayName" bson:"displayName"`
}

type UsersList

type UsersList struct {
	Items []*User `json:"items"`
}

func GetStaticUsersList

func GetStaticUsersList() *UsersList

func (*UsersList) GetUserById

func (uL *UsersList) GetUserById(id string) (*User, error)

Jump to

Keyboard shortcuts

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