Documentation ¶
Index ¶
- Variables
- func CheckHTTPResponse(httpResponse *http.Response) error
- func GetTheFirstNumberFromString(stringContainsNumber string) string
- func StructToString(v interface{}) (string, error)
- type AnswerCardRequest
- type AnswerCardService
- type CheckInInfoResponse
- type CheckInRequest
- type CheckInResponse
- type CheckInService
- type EudicClient
- type LastBodyResponse
- type LastBookRequest
- type LastBookService
- type LoginRequest
- type LoginResponse
- type LoginService
- type ReciteResponse
- type RequestTokenBody
- type Response
- type StartReciteRequest
- type StartReciteService
- type SyncReciteRequest
- type SyncReciteService
- type UserInfo
- type UserInfoService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BaseURL = "https://api.frdic.com" UserAgent = "/eusoft_eudic_en_mac/4.0.0/A4:83:E7:90:13:D5/explain/" )
Functions ¶
func CheckHTTPResponse ¶
func GetTheFirstNumberFromString ¶
获取字符串参数中的首个数字
func StructToString ¶
Types ¶
type AnswerCardRequest ¶
type AnswerCardRequest struct { AnswerEase int64 `json:"answer_ease"` BookID string `json:"book_id"` BookName string `json:"book_name"` BookUUID string `json:"book_uuid"` CardID int64 `json:"card_id"` Cookie string `json:"cookie"` DailyCount int64 `json:"daily_count"` EudicTimezone int64 `json:"eudic_timezone"` Lang string `json:"lang"` ListType int64 `json:"list_type"` Meta string `json:"meta"` Token string `json:"token"` UseReciteUa bool `json:"use_recite_ua"` Userid string `json:"userid"` }
type AnswerCardService ¶
type AnswerCardService struct {
// contains filtered or unexported fields
}
func (*AnswerCardService) AnswerCard ¶
func (service *AnswerCardService) AnswerCard(bookId, bookName string, cardId, answerEase int64) (*ReciteResponse, error)
type CheckInInfoResponse ¶
type CheckInRequest ¶ added in v0.1.0
type CheckInResponse ¶ added in v0.1.0
type CheckInService ¶ added in v0.1.0
type CheckInService struct {
// contains filtered or unexported fields
}
func (*CheckInService) CheckIn ¶ added in v0.1.0
func (service *CheckInService) CheckIn() (*CheckInResponse, error)
func (*CheckInService) GetCheckInInfo ¶ added in v0.1.0
func (service *CheckInService) GetCheckInInfo() (*CheckInInfoResponse, *string, error)
type EudicClient ¶
type EudicClient struct { BaseURL string UserAgent string UserId string Token string Response *Response LoginService *LoginService UserInfoService *UserInfoService CheckInService *CheckInService LastBookService *LastBookService SyncReciteService *SyncReciteService StartReciteService *StartReciteService AnswerCardService *AnswerCardService // contains filtered or unexported fields }
func NewEudicClient ¶
func NewEudicClient(userId, token string) *EudicClient
func NewEudicClientByPassword ¶
func NewEudicClientByPassword(username, password string) (*EudicClient, error)
func (*EudicClient) Do ¶
func (eudic *EudicClient) Do(req *http.Request, v interface{}) (*Response, error)
v: response
func (*EudicClient) NewRequest ¶
type LastBodyResponse ¶
type LastBodyResponse struct { BookName string `json:"bookName"` Meta struct { Bookid string `json:"bookid"` Lang string `json:"lang"` Meta string `json:"meta"` Timestamp string `json:"timestamp"` Userid string `json:"userid"` Version string `json:"version"` } `json:"meta"` StatisticData struct { AverageDailyLearningCardCount float64 `json:"averageDailyLearningCardCount"` DailyHistory []struct { Day int64 `json:"day"` LevelDifference int64 `json:"levelDifference"` NewCount int64 `json:"newCount"` Progress float64 `json:"progress"` ReciteCount int64 `json:"reciteCount"` ReciteDuration int64 `json:"reciteDuration"` } `json:"dailyHistory"` LearningCardCount int64 `json:"learningCardCount"` MatureCardCount int64 `json:"matureCardCount"` NewCardCount int64 `json:"newCardCount"` Progress float64 `json:"progress"` TotalCardCount int64 `json:"totalCardCount"` } `json:"statisticData"` TodayProgress struct { PendingDueCardCount int64 `json:"pendingDueCardCount"` PendingNewCardCount int64 `json:"pendingNewCardCount"` TodayFinishedCount int64 `json:"todayFinishedCount"` TodayTouchedCount int64 `json:"todayTouchedCount"` } `json:"todayProgress"` }
type LastBookRequest ¶
type LastBookService ¶
type LastBookService struct {
// contains filtered or unexported fields
}
func (*LastBookService) GetLastBook ¶
func (service *LastBookService) GetLastBook() (*LastBodyResponse, *string, error)
type LoginRequest ¶
type LoginResponse ¶
type LoginResponse struct { CreationDate string `json:"creation_date"` Expirein int64 `json:"expirein"` HasOldPassword bool `json:"has_old_password"` LastPasswordChangedDate interface{} `json:"last_password_changed_date"` OpenidDesc interface{} `json:"openid_desc"` OpenidType interface{} `json:"openid_type"` Profile struct { Email string `json:"email"` Gender string `json:"gender"` Nickname string `json:"nickname"` Password interface{} `json:"password"` Vocabularies struct{} `json:"vocabularies"` } `json:"profile"` RedirectURL interface{} `json:"redirect_url"` Roles interface{} `json:"roles"` Token string `json:"token"` Userid string `json:"userid"` Username string `json:"username"` }
type LoginService ¶
type LoginService struct {
// contains filtered or unexported fields
}
func (*LoginService) Login ¶
func (service *LoginService) Login(username, password string) (*LoginResponse, error)
type ReciteResponse ¶
type ReciteResponse struct { Card struct { AddTime int64 `json:"addTime"` Answer string `json:"answer"` AnswerHistory []struct { DueTimeInterval int64 `json:"dueTimeInterval"` EaseFactor float64 `json:"easeFactor"` EaseLevel int64 `json:"easeLevel"` Level int64 `json:"level"` Meta string `json:"meta"` ReciteDuration int64 `json:"reciteDuration"` ReciteTime int64 `json:"reciteTime"` } `json:"answerHistory"` CandidateExplains []struct { Answer string `json:"answer"` Question string `json:"question"` } `json:"candidateExplains"` CardID int64 `json:"card_id"` CurrentReciteEndTime int64 `json:"currentReciteEndTime"` CurrentReciteStartTime int64 `json:"currentReciteStartTime"` DueTime int64 `json:"dueTime"` EaseFactor float64 `json:"easeFactor"` FirstReciteTime int64 `json:"firstReciteTime"` LastDueTime int64 `json:"lastDueTime"` LastEaseFactor float64 `json:"lastEaseFactor"` Level int64 `json:"level"` LocalTimestamp int64 `json:"local_timestamp"` LocalUpdate bool `json:"local_update"` Question string `json:"question"` Rating int64 `json:"rating"` ResInfo interface{} `json:"resInfo"` Status int64 `json:"status"` Timezone int64 `json:"timezone"` Tombstone bool `json:"tombstone"` TotalBrowseTime int64 `json:"totalBrowseTime"` TotalReciteTime int64 `json:"totalReciteTime"` Unit int64 `json:"unit"` } `json:"card"` Explain struct { Phonukurl string `json:"phonukurl"` Phonusurl string `json:"phonusurl"` Word string `json:"word"` } `json:"explain"` StatisticData struct { AverageDailyLearningCardCount float64 `json:"averageDailyLearningCardCount"` DailyHistory []struct { Day int64 `json:"day"` LevelDifference int64 `json:"levelDifference"` NewCount int64 `json:"newCount"` Progress float64 `json:"progress"` ReciteCount int64 `json:"reciteCount"` ReciteDuration int64 `json:"reciteDuration"` } `json:"dailyHistory"` LearningCardCount int64 `json:"learningCardCount"` MatureCardCount int64 `json:"matureCardCount"` NewCardCount int64 `json:"newCardCount"` Progress float64 `json:"progress"` TotalCardCount int64 `json:"totalCardCount"` } `json:"statisticData"` TaskFinished bool `json:"taskFinished"` TaskInfo string `json:"taskInfo"` TodayProgress struct { PendingDueCardCount int64 `json:"pendingDueCardCount"` PendingNewCardCount int64 `json:"pendingNewCardCount"` TodayFinishedCount int64 `json:"todayFinishedCount"` TodayTouchedCount int64 `json:"todayTouchedCount"` } `json:"todayProgress"` }
type RequestTokenBody ¶
type StartReciteRequest ¶
type StartReciteRequest struct { BookID string `json:"book_id"` BookName string `json:"book_name"` BookUUID string `json:"book_uuid"` Cookie string `json:"cookie"` DailyCount int64 `json:"daily_count"` EudicTimezone int64 `json:"eudic_timezone"` Lang string `json:"lang"` ListType int64 `json:"list_type"` Meta string `json:"meta"` Token string `json:"token"` UseReciteUa bool `json:"use_recite_ua"` Userid string `json:"userid"` }
type StartReciteService ¶
type StartReciteService struct {
// contains filtered or unexported fields
}
func (*StartReciteService) StartRecite ¶
func (service *StartReciteService) StartRecite(bookId, bookName string) (*ReciteResponse, error)
开始背诵词汇,bookId 为纯数字字符串, 并非 LastBook 返回的 Meta.BookId, 调用时正则取其中的数字,参考测试
type SyncReciteRequest ¶
type SyncReciteRequest struct { BookID string `json:"book_id"` BookName string `json:"book_name"` BookUUID string `json:"book_uuid"` Cookie string `json:"cookie"` Lang string `json:"lang"` ListType int64 `json:"list_type"` Token string `json:"token"` UseReciteUa bool `json:"use_recite_ua"` Userid string `json:"userid"` }
type SyncReciteService ¶
type SyncReciteService struct {
// contains filtered or unexported fields
}
func (*SyncReciteService) SyncRecite ¶
func (service *SyncReciteService) SyncRecite(bookId, bookName string) (bool, error)
Sync the learning records
type UserInfo ¶
type UserInfo struct { CreationDate string `json:"creation_date"` Expirein int64 `json:"expirein"` HasOldPassword bool `json:"has_old_password"` LastPasswordChangedDate interface{} `json:"last_password_changed_date"` OpenidDesc interface{} `json:"openid_desc"` OpenidType interface{} `json:"openid_type"` Profile struct { Email string `json:"email"` Gender string `json:"gender"` Nickname string `json:"nickname"` Password interface{} `json:"password"` Vocabularies struct{} `json:"vocabularies"` } `json:"profile"` RedirectURL interface{} `json:"redirect_url"` Roles interface{} `json:"roles"` Token string `json:"token"` Userid string `json:"userid"` Username string `json:"username"` }
type UserInfoService ¶
type UserInfoService struct {
// contains filtered or unexported fields
}
func (*UserInfoService) GetUserInfo ¶
func (service *UserInfoService) GetUserInfo() (*UserInfo, *string, error)
Click to show internal directories.
Click to hide internal directories.