smartcatclient

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: BSD-3-Clause Imports: 13 Imported by: 0

README

go-smartcat-client

Unofficial golang client for smartcat.com

Coverage Status Release Go Report Card Build Status

Example

package main

import (
	"fmt"
	"os"

	cli "github.com/markus621/go-smartcat-client"
)

func main() {

	conf := cli.Config{
		AccountID: os.Getenv(`SMARTCAT_ACCOUNT_ID`),
		AuthKey:   os.Getenv(`SMARTCAT_AUTH_KEY`),
		URL:       cli.HostURL,
	}

	client := cli.NewClient(conf)
	client.Debug(true, os.Stdout)

	acc, err := client.Account()
	mte, err := client.AccountMTEngines()
}

Documentation

Index

Constants

View Source
const (
	//HostURL  if you are using the European server.
	HostURL = `https://smartcat.ai`
	//USHostURL  if you are using the American server.
	USHostURL = `https://us.smartcat.ai`
	//EAHostURL  if you are using the Asian server.
	EAHostURL = `https://ea.smartcat.ai`
)

Variables

View Source
var (
	ErrUnknown = errors.New("unknown error")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	IsPersonal bool   `json:"isPersonal"`
	Type       string `json:"type"`
}

func (Account) MarshalEasyJSON

func (v Account) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Account) MarshalJSON

func (v Account) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Account) UnmarshalEasyJSON

func (v *Account) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Account) UnmarshalJSON

func (v *Account) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AccountMTEngine

type AccountMTEngine struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

func (AccountMTEngine) MarshalEasyJSON

func (v AccountMTEngine) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AccountMTEngine) MarshalJSON

func (v AccountMTEngine) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AccountMTEngine) UnmarshalEasyJSON

func (v *AccountMTEngine) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AccountMTEngine) UnmarshalJSON

func (v *AccountMTEngine) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type AccountMTEngines

type AccountMTEngines []AccountMTEngine

func (AccountMTEngines) MarshalEasyJSON

func (v AccountMTEngines) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AccountMTEngines) MarshalJSON

func (v AccountMTEngines) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AccountMTEngines) UnmarshalEasyJSON

func (v *AccountMTEngines) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AccountMTEngines) UnmarshalJSON

func (v *AccountMTEngines) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Client

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

func NewClient

func NewClient(c Config) *Client

NewClient init client

func NewCustomClient

func NewCustomClient(c Config, cli *http.Client) *Client

NewClient init client

func (*Client) Account

func (v *Client) Account() (o Account, err error)

Account Receiving the account details

func (*Client) AccountMTEngines

func (v *Client) AccountMTEngines() (o AccountMTEngines, err error)

AccountMtengines Receiving MT engines available for the account

func (*Client) Debug

func (v *Client) Debug(is bool, w io.Writer)

type Config

type Config struct {
	AccountID string
	AuthKey   string
	URL       string
}

func (Config) AuthToken

func (c Config) AuthToken() string

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"Message"`
}

ErrorResponse ...

func (ErrorResponse) Error

func (v ErrorResponse) Error() string

func (ErrorResponse) MarshalEasyJSON

func (v ErrorResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ErrorResponse) MarshalJSON

func (v ErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ErrorResponse) UnmarshalEasyJSON

func (v *ErrorResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ErrorResponse) UnmarshalJSON

func (v *ErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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