clients

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiKey = ""

ApiKey of mailgun

View Source
var ErrBadStatus = errors.New("status is not 1")

ErrBadStatus is a error status for dnspod

View Source
var Keys = []string{}

Keys is api token for word

View Source
var PubKey = ""

PubKey of mailgun

Functions

func DetailWord

func DetailWord(word, k string) (string, error)

DetailWord get word detail

func GetCreditCode

func GetCreditCode()

GetCreditCode get code in a file

func Go

func Go(name string) error

Go is to go download

func InitMail

func InitMail(api, pub string)

InitMail set api and pub key

func Loop

func Loop() error

Loop read words from file

func ReadInput

func ReadInput() error

ReadInput read files

func SendMail

func SendMail(to, title, content string) error

SendMail send an email

func WriteInfo

func WriteInfo(i, j int, name, ct string) error

WriteInfo write word info to file

Types

type AliKeyValuePair

type AliKeyValuePair struct {
	Key   string
	Value string
}

AliKeyValuePair to sort arguments

type AliResponse

type AliResponse struct {
	RequestId string `json:"RequestId"` // always return
	RecordId  string `json:"RecordId"`  // returned when ok
	HostId    string `json:"HostId"`    // returned when error
	Code      string `json:"Code"`      // returned when error
	Message   string `json:"Message"`   // returned when error
}

type AliyunClient

type AliyunClient struct {
	KeyId     string
	KeySecret string
}

AliyunClient defines a client

func NewAliyunClient

func NewAliyunClient(id, secret string) *AliyunClient

NewAliyunClient returns a new client

func (*AliyunClient) ModifyRecord

func (ali *AliyunClient) ModifyRecord(subDomain, domain, value, recordId string) error

type ByKey

type ByKey []AliKeyValuePair

ByKey implements sort.Sort

func (ByKey) Len

func (a ByKey) Len() int

func (ByKey) Less

func (a ByKey) Less(i, j int) bool

func (ByKey) Swap

func (a ByKey) Swap(i, j int)

type DWRPronunce

type DWRPronunce struct {
	All string `json:"all"`
}

type DWRResults

type DWRResults struct {
	Result []DWResult
}

type DWRSyllable

type DWRSyllable struct {
	Count int      `json:"count"`
	List  []string `json:"list"`
}

DWRSyllable

type DWResult

type DWResult struct {
	Def    string   `json:"definition"`
	PoS    string   `json:"partOfSpeech"`
	Syno   []string `json:"synonyms"`
	To     []string `json:"typeOf"`
	Derive []string `json:"derivation"`
}

type DetailWordResults

type DetailWordResults struct {
	Results  []DWResult  `json:"results"`
	Syllable DWRSyllable `json:"syllables"`
	Pronunce DWRPronunce `json:"pronunciation"`
}

DetailWordResults holds result and pronucncation of word

type DnspodClient

type DnspodClient struct {
	Token string
}

DnspodClient defines a client

func NewDnspodClient

func NewDnspodClient(token string) *DnspodClient

NewDnspodClient returns a new client

func (*DnspodClient) ModifyRecord

func (d *DnspodClient) ModifyRecord(sub, domain, nip string) error

ModifyRecord is a demo

type Result

type Result struct {
	Msg    string       `json:"message"`
	Status int          `json:"status"`
	Result []ResultData `json:"results"`
}

Result is response json

type ResultData

type ResultData struct {
	Ent  string `json:"entname"`
	Code string `json:"creditCode"`
}

ResultData is response json

type Status

type Status struct {
	Code string `json:"code"`
}

Status we just need to known it's status

Jump to

Keyboard shortcuts

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