fhj

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: MIT Imports: 5 Imported by: 0

README

Go-FHJ GoDoc

Example

Documentation

Overview

Example
client := fhj.New("https://api.zhconvert.org", "")
_, result, err := client.Convert(fhj.ConverterTaiwan, "什么鬼", nil)
if err != nil {
	log.Fatalln(err)
}
fmt.Println(result.Text)
Output:

什麼鬼

Index

Examples

Constants

View Source
const (
	ConverterSimplified      = "Simplified"
	ConverterTraditional     = "Traditional"
	ConverterChina           = "China"
	ConverterHongkong        = "Hongkong"
	ConverterTaiwan          = "Taiwan"
	ConverterPinyin          = "Pinyin"
	ConverterMars            = "Mars"
	ConverterWikiSimplified  = "WikiSimplified"
	ConverterWikiTraditional = "WikiTraditional"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(endPoint, apiKey string) *Client

func (Client) Convert

func (c Client) Convert(converter, text string, extraOptions map[string]string) (*RawResp, *ConvertData, error)

func (Client) ServiceInfo

func (c Client) ServiceInfo() (*RawResp, *StatusData, error)

type ConvertData

type ConvertData struct {
	Converter    string
	Text         string
	Diff         string
	TextFormat   string
	UsedModules  []string
	JPTextStyles []string
}

type ConverterDesc

type ConverterDesc struct {
	Name string
	Desc string
	Cat  string
}

type DiffTemplateDesc

type DiffTemplateDesc struct {
	Desc string
}

type ModuleDesc

type ModuleDesc struct {
	Name     string
	Desc     string
	Cat      string
	IsManual bool
}

type RawResp

type RawResp struct {
	Code      int
	Data      json.RawMessage
	Msg       string
	Revisions Revisions
	ExecTime  float64
}

type Revisions

type Revisions struct {
	Build string
	Msg   string
	Time  int
}

type StatusData

type StatusData struct {
	Converters          map[string]ConverterDesc
	Modules             map[string]ModuleDesc
	ConverterCategories map[string]string
	ModuleCategories    map[string]string
	TextFormats         map[string]string
	DiffTemplates       map[string]DiffTemplateDesc
	AllowEmptyApiKey    bool
	MaxPostBodyBytes    int
}

Jump to

Keyboard shortcuts

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