api

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddWordRequest

type AddWordRequest struct {
	Word        string `url:"word"`
	Translation string `url:"tword"`
}

AddWordRequest is a request for AddWord

type AddWordWithContextRequest added in v0.0.2

type AddWordWithContextRequest struct {
	Word        string `url:"word"`
	Translation string `url:"tword"`
	Context     string `url:"context"`
}

AddWordWithContextRequest is a request for AddWordWithContext

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an API client

func NewClient

func NewClient(email string, password string) ([]error, Client)

NewClient returns new instance of the API client

func (Client) AddWord

func (c Client) AddWord(word, translation string) ([]error, Word)

AddWord posts new word to the API

func (Client) AddWordWithContext added in v0.0.2

func (c Client) AddWordWithContext(word, translation string, context string) ([]error, Word)

AddWordWithContext add a word with a context ToDo: Rewrite the method to combine it with an AddWord call

func (Client) DownloadPicture added in v0.0.2

func (c Client) DownloadPicture(url string, translateID string) []error

DownloadPicture posts a picture to the translation

func (Client) GetTranslations

func (c Client) GetTranslations(word string) ([]error, Word)

GetTranslations returns translations for a word

type LoginRequest

type LoginRequest struct {
	Email    string `url:"email"`
	Password string `url:"password"`
}

LoginRequest is a request for Login

type LoginResponse

type LoginResponse struct {
	User UserDataResponse `json:"user"`
	// contains filtered or unexported fields
}

LoginResponse is an entity which represents LoginResponse

type TranslationRequest

type TranslationRequest struct {
	Word string `url:"word"`
}

TranslationRequest is a request for Translation

type UserDataResponse

type UserDataResponse struct {
	Username string `json:"nickname"`
	ID       int    `json:"user_id"`
	Key      string `json:"autologin_key"`
}

UserDataResponse is an entity which represents UserDataResponse

type UserDict added in v0.0.2

type UserDict struct {
	Name  string `json:"name"`
	Count uint   `json:"count"`
	Words []Word `json:"words"`
}

UserDict is an entity which represents UserDict

type UserTranslate

type UserTranslate struct {
	Value      string `json:"value"`
	PictureURL string `json:"pic_url"`
}

UserTranslate is an entity which represents UserTranslate

type Word

type Word struct {
	ID         uint   `json:"word_id"`
	Value      string `json:"word_value"`
	Transcript string `json:"transcription"`
	//	Created     time.Time       `json:"created_at"`
	//	LastUpdated time.Time       `json:"last_updated_at"`
	Translations []UserTranslate `json:"translate"`
	TranslateID  int             `json:"translate_id"`
	SoundURL     string          `json:"sound_url"`
	PictureURL   string          `json:"pic_url"`
	// contains filtered or unexported fields
}

Word is a word representation

Jump to

Keyboard shortcuts

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