smartcatclient

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: BSD-3-Clause Imports: 17 Imported by: 0

README

go-smartcat-client

Unofficial golang client for smartcat.com

Coverage Status Release Go Report Card Build Status

Official documentation

Swagger 2.0 + Swagger UI

Example

Create project and upload documents
package main

import (
	"fmt"
	"os"

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

//nolint: errcheck
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)

	project, err := client.CreateProject(cli.NewProject{
		Name:                     "TS-10",
		Description:              "Перевод с русского на английский",
		SourceLanguage:           "en-US",
		TargetLanguages:          []string{"ru", "id"},
		AssignToVendor:           false,
		UseMT:                    false,
		Pretranslate:             false,
		UseTranslationMemory:     false,
		AutoPropagateRepetitions: false,
		WorkflowStages:           []string{"translation"},
		IsForTesting:             false,
	})
	if err != nil {
		panic(err)
	}

	form := cli.NewForm()
	form.AddFile("base1.json", []byte(`{"main":"hello world"}`))
	form.AddFile("base2.json", []byte(`{"main2":"hello my world"}`))

	docs, err := client.CreateDocument(project.ID, form)
	if err != nil {
		panic(err)
	}

	fmt.Println("Create new docs")
	for _, doc := range docs {
		fmt.Println(doc.Status, doc.Name)
		for _, ws := range doc.WorkflowStages {
			fmt.Println(ws.Status, ws.Progress)
		}
	}

	fmt.Println("Get status all docs")
	project, err = client.GetProject(project.ID)
	if err != nil {
		panic(err)
	}

	for _, doc := range project.Documents {
		fmt.Println(doc.Status, doc.Name)
		for _, ws := range doc.WorkflowStages {
			fmt.Println(ws.Status, ws.Progress)
		}
	}

}

Get all documents and export
import (
	"archive/zip"
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
	"time"

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

//nolint: errcheck
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)

	list, err := client.ListProject()
	if err != nil {
		panic(err)
	}

	ids := make([]string, 0)
	for _, project := range list {
		fmt.Println(project.ID, project.Name, project.Status)
		for _, doc := range project.Documents {
			fmt.Println(doc.ID, doc.Name, doc.Status, doc.SourceLanguage, doc.TargetLanguage, doc.WorkflowStages[0].Progress)

			if doc.WorkflowStages[0].Progress == 100 {
				ids = append(ids, doc.ID)
			}
		}
	}

	task, err := client.ExportDocument(ids)
	if err != nil {
		panic(err)
	}

	<-time.After(3 * time.Second)

	data, err := client.ExportDocumentByTaskID(task.ID)
	if err != nil {
		panic(err)
	}

	// as text file if one document
	if len(ids) == 1 {
		fmt.Println(string(data))
		os.Exit(0)
	}

	// as zip file if many documents
	z, err := zip.NewReader(bytes.NewReader(data), int64(len(data)))
	if err != nil {
		panic(err)
	}
	for _, f := range z.File {
		reader, err := f.Open()
		if err != nil {
			panic(err)
		}
		b, err := ioutil.ReadAll(reader)
		fmt.Println(f.Name, string(b), err)
	}
}

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 unknown error
	ErrUnknown = errors.New("unknown error")
	//ErrEmptyRequest empty request error
	ErrEmptyRequest = errors.New("request is empty")
)

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"`
}

Account information about your current account.

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"`
}

AccountMTEngine information about the machine translation engine

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

AccountMTEngines list of available machine translation engines

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 AdditionalHeader added in v0.0.2

type AdditionalHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

AdditionalHeader additional headers for transmission with a callback

func (AdditionalHeader) MarshalEasyJSON added in v0.0.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (AdditionalHeader) MarshalJSON added in v0.0.2

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

MarshalJSON supports json.Marshaler interface

func (*AdditionalHeader) UnmarshalEasyJSON added in v0.0.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AdditionalHeader) UnmarshalJSON added in v0.0.2

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

UnmarshalJSON supports json.Unmarshaler interface

type Callback added in v0.0.2

type Callback struct {
	URL               string             `json:"url"`
	AdditionalHeaders []AdditionalHeader `json:"additionalHeaders"`
}

Callback callback settings

func (Callback) MarshalEasyJSON added in v0.0.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (Callback) MarshalJSON added in v0.0.2

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

MarshalJSON supports json.Marshaler interface

func (*Callback) UnmarshalEasyJSON added in v0.0.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Callback) UnmarshalJSON added in v0.0.2

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

UnmarshalJSON supports json.Unmarshaler interface

type Client

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

Client client connecting to the server

func NewClient

func NewClient(c Config) *Client

NewClient init client

func NewCustomClient

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

NewCustomClient init client

func (*Client) CancelProject added in v0.0.4

func (c *Client) CancelProject(id string) (err error)

CancelProject Cancel the project

func (*Client) CompleteProject added in v0.0.4

func (c *Client) CompleteProject(id string) (err error)

CompleteProject Complete the project

func (*Client) CreateDocument added in v1.0.0

func (c *Client) CreateDocument(projectID string, form *Form) (out DocumentList, err error)

CreateDocument Create new document in project

func (*Client) CreateProject added in v1.0.0

func (c *Client) CreateProject(in NewProject) (out Project, err error)

CreateProject Create new project

func (*Client) Debug

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

Debug enable logging of responses

func (*Client) DelCallback added in v0.0.2

func (c *Client) DelCallback() (err error)

DelCallback Resetting the configuration of notifications reception

func (*Client) DelProject added in v0.0.3

func (c *Client) DelProject(id string) (err error)

DelProject Delete the project

func (*Client) ExportDocument added in v1.0.0

func (c *Client) ExportDocument(ids []string) (out ExportTask, err error)

ExportDocument Creating a document export task

func (*Client) ExportDocumentByTaskID added in v1.0.0

func (c *Client) ExportDocumentByTaskID(id string) (out []byte, err error)

ExportDocumentByTaskID Downloading files by task number for export

func (*Client) GetAccount added in v0.0.2

func (c *Client) GetAccount() (out Account, err error)

GetAccount Receiving the account details

func (*Client) GetAccountMTEngines added in v0.0.2

func (c *Client) GetAccountMTEngines() (out AccountMTEngines, err error)

GetAccountMTEngines Receiving MT engines available for the account

func (*Client) GetCallback added in v0.0.2

func (c *Client) GetCallback() (out Callback, err error)

GetCallback Reading configurations of notifications reception of the account

func (*Client) GetCallbackLastErrors added in v0.0.2

func (c *Client) GetCallbackLastErrors(limit int) (out LastErrors, err error)

GetCallbackLastErrors Reading the recent sending errors

func (*Client) GetProject added in v0.0.3

func (c *Client) GetProject(id string) (out Project, err error)

GetProject Receive the project model

func (*Client) GetProjectCompletedWorkStatistics added in v0.0.4

func (c *Client) GetProjectCompletedWorkStatistics(id string) (out CompletedWorkStatisticsList, err error)

GetProjectCompletedWorkStatistics Receiving statistics for the completed parts of the project

func (*Client) GetProjectStatistics added in v0.0.4

func (c *Client) GetProjectStatistics(id string) (out StatisticsList, err error)

GetProjectStatistics Receive statistics

func (*Client) GetProjectTranslationMemories added in v0.0.4

func (c *Client) GetProjectTranslationMemories(id string) (out TranslationMemories, err error)

GetProjectTranslationMemories Receiving a list of the TMs plugged into the project

func (*Client) ListProject added in v0.0.3

func (c *Client) ListProject() (out ProjectsList, err error)

ListProject List all projects

func (*Client) RestoreProject added in v0.0.4

func (c *Client) RestoreProject(id string) (err error)

RestoreProject Restore the project

func (*Client) SetCallback added in v0.0.2

func (c *Client) SetCallback(in Callback) (out Callback, err error)

SetCallback Setting configurations of notifications reception of the account

func (*Client) SetProject added in v0.0.3

func (c *Client) SetProject(id string, in PatchProject) (out Project, err error)

SetProject Change the project model

func (*Client) SetProjectTranslationMemories added in v0.0.4

func (c *Client) SetProjectTranslationMemories(id string, in TranslationMemories) (err error)

SetProjectTranslationMemories Receiving a list of the TMs plugged into the project

type CompletedWorkStatistics added in v0.0.4

type CompletedWorkStatistics struct {
	Executive struct {
		ID           string `json:"id"`
		SupplierType string `json:"supplierType"`
	} `json:"executive"`
	StageType      string                    `json:"stageType"`
	StageNumber    int                       `json:"stageNumber"`
	TargetLanguage string                    `json:"targetLanguage"`
	Total          []StatisticsItem          `json:"total"`
	Documents      []StatisticsDocumentsItem `json:"documents"`
}

CompletedWorkStatistics model

func (CompletedWorkStatistics) MarshalEasyJSON added in v0.0.4

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (CompletedWorkStatistics) MarshalJSON added in v0.0.4

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

MarshalJSON supports json.Marshaler interface

func (*CompletedWorkStatistics) UnmarshalEasyJSON added in v0.0.4

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CompletedWorkStatistics) UnmarshalJSON added in v0.0.4

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

UnmarshalJSON supports json.Unmarshaler interface

type CompletedWorkStatisticsList added in v0.0.4

type CompletedWorkStatisticsList []CompletedWorkStatistics

CompletedWorkStatisticsList model

func (CompletedWorkStatisticsList) MarshalEasyJSON added in v0.0.4

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (CompletedWorkStatisticsList) MarshalJSON added in v0.0.4

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

MarshalJSON supports json.Marshaler interface

func (*CompletedWorkStatisticsList) UnmarshalEasyJSON added in v0.0.4

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CompletedWorkStatisticsList) UnmarshalJSON added in v0.0.4

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

UnmarshalJSON supports json.Unmarshaler interface

type Config

type Config struct {
	AccountID string
	AuthKey   string
	URL       string
}

Config client settings for connecting to the server

func (Config) AuthToken

func (c Config) AuthToken() string

AuthToken generating an authorization token

type Cost added in v0.0.3

type Cost struct {
	Value           float64 `json:"value"`
	Currency        string  `json:"currency"`
	AccuracyDegree  string  `json:"accuracyDegree"`
	DetailsFileName string  `json:"detailsFileName"`
	PaymentStatus   string  `json:"paymentStatus"`
}

Cost model

func (Cost) MarshalEasyJSON added in v0.0.3

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (Cost) MarshalJSON added in v0.0.3

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

MarshalJSON supports json.Marshaler interface

func (*Cost) UnmarshalEasyJSON added in v0.0.3

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Cost) UnmarshalJSON added in v0.0.3

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

UnmarshalJSON supports json.Unmarshaler interface

type Document added in v0.0.3

type Document struct {
	ID                     string                  `json:"id"`
	Name                   string                  `json:"name"`
	CreationDate           time.Time               `json:"creationDate"`
	Deadline               time.Time               `json:"deadline"`
	SourceLanguage         string                  `json:"sourceLanguage"`
	DisassemblingStatus    string                  `json:"documentDisassemblingStatus"`
	TargetLanguage         string                  `json:"targetLanguage"`
	Status                 string                  `json:"status"`
	WordsCount             uint64                  `json:"wordsCount"`
	StatusModificationDate time.Time               `json:"statusModificationDate"`
	PretranslateCompleted  bool                    `json:"pretranslateCompleted"`
	WorkflowStages         []DocumentWorkflowStage `json:"workflowStages"`
	ExternalID             string                  `json:"externalId"`
	MetaInfo               string                  `json:"metaInfo"`
	PlaceholdersAreEnabled bool                    `json:"placeholdersAreEnabled"`
}

Document model

func (Document) MarshalEasyJSON added in v0.0.3

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (Document) MarshalJSON added in v0.0.3

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

MarshalJSON supports json.Marshaler interface

func (*Document) UnmarshalEasyJSON added in v0.0.3

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Document) UnmarshalJSON added in v0.0.3

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

UnmarshalJSON supports json.Unmarshaler interface

type DocumentList added in v1.0.0

type DocumentList []Document

DocumentList model

func (DocumentList) MarshalEasyJSON added in v1.0.0

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (DocumentList) MarshalJSON added in v1.0.0

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

MarshalJSON supports json.Marshaler interface

func (*DocumentList) UnmarshalEasyJSON added in v1.0.0

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DocumentList) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON supports json.Unmarshaler interface

type DocumentWorkflowStage added in v0.0.3

type DocumentWorkflowStage struct {
	Progress             float64     `json:"progress"`
	WordsTranslated      uint64      `json:"wordsTranslated"`
	UnassignedWordsCount uint64      `json:"unassignedWordsCount"`
	Status               string      `json:"status"`
	Executives           []Executive `json:"executives"`
}

DocumentWorkflowStage model

func (DocumentWorkflowStage) MarshalEasyJSON added in v0.0.3

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (DocumentWorkflowStage) MarshalJSON added in v0.0.3

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

MarshalJSON supports json.Marshaler interface

func (*DocumentWorkflowStage) UnmarshalEasyJSON added in v0.0.3

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DocumentWorkflowStage) UnmarshalJSON added in v0.0.3

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

UnmarshalJSON supports json.Unmarshaler interface

type ErrorResponse

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

ErrorResponse model error response from the server

func (ErrorResponse) Error

func (v ErrorResponse) Error() string

Error error interface

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

type Executive added in v0.0.3

type Executive struct {
	ID                 string `json:"id"`
	AssignedWordsCount uint64 `json:"assignedWordsCount"`
	Progress           uint   `json:"progress"`
	SupplierType       string `json:"supplierType"`
}

Executive model

func (Executive) MarshalEasyJSON added in v0.0.3

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (Executive) MarshalJSON added in v0.0.3

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

MarshalJSON supports json.Marshaler interface

func (*Executive) UnmarshalEasyJSON added in v0.0.3

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Executive) UnmarshalJSON added in v0.0.3

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

UnmarshalJSON supports json.Unmarshaler interface

type ExportTask added in v1.0.0

type ExportTask struct {
	ID          string   `json:"id"`
	DocumentIds []string `json:"documentIds"`
}

ExportTask model

func (ExportTask) MarshalEasyJSON added in v1.0.0

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (ExportTask) MarshalJSON added in v1.0.0

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

MarshalJSON supports json.Marshaler interface

func (*ExportTask) UnmarshalEasyJSON added in v1.0.0

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ExportTask) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON supports json.Unmarshaler interface

type Form added in v1.0.0

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

Form fields map for upload form

func NewForm added in v1.0.0

func NewForm() *Form

NewForm init new form fields

func (*Form) Add added in v1.0.0

func (f *Form) Add(name string, value []byte)

Add field to form

func (*Form) AddFile added in v1.0.0

func (f *Form) AddFile(name string, value []byte)

AddFile add text as file

func (*Form) AddJSON added in v1.0.0

func (f *Form) AddJSON(name string, value interface{}) error

AddJSON convert object to json and add as field

func (*Form) Bytes added in v1.0.0

func (f *Form) Bytes() (r []byte)

Bytes close form, read, and reset

func (*Form) GetContentType added in v1.0.0

func (f *Form) GetContentType() string

GetContentType getting content type for form

func (*Form) LoadFile added in v1.0.0

func (f *Form) LoadFile(path string) error

LoadFile read file to form

type LastError added in v0.0.2

type LastError struct {
	Created   string   `json:"created"`
	URL       string   `json:"url"`
	Reason    string   `json:"reason"`
	Code      int      `json:"code"`
	Content   string   `json:"content"`
	SourceIds []string `json:"sourceIds"`
}

LastError information about callback errors

func (LastError) MarshalEasyJSON added in v0.0.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (LastError) MarshalJSON added in v0.0.2

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

MarshalJSON supports json.Marshaler interface

func (*LastError) UnmarshalEasyJSON added in v0.0.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LastError) UnmarshalJSON added in v0.0.2

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

UnmarshalJSON supports json.Unmarshaler interface

type LastErrors added in v0.0.2

type LastErrors []LastError

LastErrors error list

func (LastErrors) MarshalEasyJSON added in v0.0.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (LastErrors) MarshalJSON added in v0.0.2

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

MarshalJSON supports json.Marshaler interface

func (*LastErrors) UnmarshalEasyJSON added in v0.0.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LastErrors) UnmarshalJSON added in v0.0.2

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

UnmarshalJSON supports json.Unmarshaler interface

type NewProject added in v1.0.0

type NewProject struct {
	Name                     string   `json:"name"`
	Description              string   `json:"description"`
	SourceLanguage           string   `json:"sourceLanguage"`
	TargetLanguages          []string `json:"targetLanguages"`
	AssignToVendor           bool     `json:"assignToVendor"`
	UseMT                    bool     `json:"useMT"`
	Pretranslate             bool     `json:"pretranslate"`
	UseTranslationMemory     bool     `json:"useTranslationMemory"`
	AutoPropagateRepetitions bool     `json:"autoPropagateRepetitions"`
	WorkflowStages           []string `json:"workflowStages"`
	IsForTesting             bool     `json:"isForTesting"`
}

NewProject model

func (NewProject) MarshalEasyJSON added in v1.0.0

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (NewProject) MarshalJSON added in v1.0.0

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

MarshalJSON supports json.Marshaler interface

func (*NewProject) UnmarshalEasyJSON added in v1.0.0

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*NewProject) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON supports json.Unmarshaler interface

type PatchProject added in v0.0.3

type PatchProject struct {
	Name             string    `json:"name"`
	Description      string    `json:"description"`
	Deadline         time.Time `json:"deadline"`
	ClientID         string    `json:"clientId"`
	DomainID         uint64    `json:"domainId"`
	VendorAccountIDs []string  `json:"vendorAccountIds"`
	ExternalTag      string    `json:"externalTag"`
	Specializations  []string  `json:"specializations"`
	WorkflowStages   []string  `json:"workflowStages"`
}

PatchProject model

func (PatchProject) MarshalEasyJSON added in v0.0.3

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (PatchProject) MarshalJSON added in v0.0.3

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

MarshalJSON supports json.Marshaler interface

func (*PatchProject) UnmarshalEasyJSON added in v0.0.3

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PatchProject) UnmarshalJSON added in v0.0.3

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

UnmarshalJSON supports json.Unmarshaler interface

type Project added in v0.0.3

type Project struct {
	ID                     string          `json:"id"`
	AccountID              string          `json:"accountId"`
	Name                   string          `json:"name"`
	Description            string          `json:"description"`
	Deadline               time.Time       `json:"deadline"`
	CreationDate           time.Time       `json:"creationDate"`
	CreatedByUserID        string          `json:"createdByUserId"`
	CreatedByUserEmail     string          `json:"createdByUserEmail"`
	ModificationDate       time.Time       `json:"modificationDate"`
	SourceLanguageID       uint64          `json:"sourceLanguageId"`
	SourceLanguage         string          `json:"sourceLanguage"`
	TargetLanguages        []string        `json:"targetLanguages"`
	Status                 string          `json:"status"`
	StatusModificationDate time.Time       `json:"statusModificationDate"`
	DomainID               uint64          `json:"domainId"`
	ClientID               uint64          `json:"clientId"`
	Vendors                []Vendor        `json:"vendors"`
	WorkflowStages         []WorkflowStage `json:"workflowStages"`
	Documents              []Document      `json:"documents"`
	ExternalTag            string          `json:"externalTag"`
	Specializations        []string        `json:"specializations"`
	Managers               []string        `json:"managers"`
	Number                 []string        `json:"number"`
}

Project model

func (Project) MarshalEasyJSON added in v0.0.3

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (Project) MarshalJSON added in v0.0.3

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

MarshalJSON supports json.Marshaler interface

func (*Project) UnmarshalEasyJSON added in v0.0.3

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Project) UnmarshalJSON added in v0.0.3

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

UnmarshalJSON supports json.Unmarshaler interface

type ProjectsList added in v0.0.3

type ProjectsList []Project

ProjectsList model

func (ProjectsList) MarshalEasyJSON added in v0.0.3

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProjectsList) MarshalJSON added in v0.0.3

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

MarshalJSON supports json.Marshaler interface

func (*ProjectsList) UnmarshalEasyJSON added in v0.0.3

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProjectsList) UnmarshalJSON added in v0.0.3

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

UnmarshalJSON supports json.Unmarshaler interface

type Statistics added in v0.0.4

type Statistics struct {
	Language   string                    `json:"language"`
	Statistics []StatisticsItem          `json:"statistics"`
	Documents  []StatisticsDocumentsItem `json:"documents"`
}

Statistics model

func (Statistics) MarshalEasyJSON added in v0.0.4

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (Statistics) MarshalJSON added in v0.0.4

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

MarshalJSON supports json.Marshaler interface

func (*Statistics) UnmarshalEasyJSON added in v0.0.4

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Statistics) UnmarshalJSON added in v0.0.4

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

UnmarshalJSON supports json.Unmarshaler interface

type StatisticsDocumentsItem added in v0.0.4

type StatisticsDocumentsItem struct {
	Name       string           `json:"name"`
	Statistics []StatisticsItem `json:"statistics"`
}

StatisticsDocumentsItem model

func (StatisticsDocumentsItem) MarshalEasyJSON added in v0.0.4

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (StatisticsDocumentsItem) MarshalJSON added in v0.0.4

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

MarshalJSON supports json.Marshaler interface

func (*StatisticsDocumentsItem) UnmarshalEasyJSON added in v0.0.4

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*StatisticsDocumentsItem) UnmarshalJSON added in v0.0.4

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

UnmarshalJSON supports json.Unmarshaler interface

type StatisticsItem added in v0.0.4

type StatisticsItem struct {
	Name                     string  `json:"name"`
	Words                    uint64  `json:"words"`
	Percent                  uint    `json:"percent"`
	Segments                 uint16  `json:"segments"`
	Pages                    float64 `json:"pages"`
	CharsWithoutSpaces       uint64  `json:"charsWithoutSpaces"`
	CharsWithSpaces          uint64  `json:"charsWithSpaces"`
	EffectiveWordsForBilling uint64  `json:"effectiveWordsForBilling"`
}

StatisticsItem model

func (StatisticsItem) MarshalEasyJSON added in v0.0.4

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (StatisticsItem) MarshalJSON added in v0.0.4

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

MarshalJSON supports json.Marshaler interface

func (*StatisticsItem) UnmarshalEasyJSON added in v0.0.4

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*StatisticsItem) UnmarshalJSON added in v0.0.4

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

UnmarshalJSON supports json.Unmarshaler interface

type StatisticsList added in v0.0.4

type StatisticsList []Statistics

StatisticsList model

func (StatisticsList) MarshalEasyJSON added in v0.0.4

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (StatisticsList) MarshalJSON added in v0.0.4

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

MarshalJSON supports json.Marshaler interface

func (*StatisticsList) UnmarshalEasyJSON added in v0.0.4

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*StatisticsList) UnmarshalJSON added in v0.0.4

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

UnmarshalJSON supports json.Unmarshaler interface

type TranslationMemories added in v0.0.4

type TranslationMemories []struct {
	ID             string `json:"id"`
	MatchThreshold int    `json:"matchThreshold"`
	IsWritable     bool   `json:"isWritable"`
}

TranslationMemories model

func (TranslationMemories) MarshalEasyJSON added in v0.0.4

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (TranslationMemories) MarshalJSON added in v0.0.4

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

MarshalJSON supports json.Marshaler interface

func (*TranslationMemories) UnmarshalEasyJSON added in v0.0.4

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TranslationMemories) UnmarshalJSON added in v0.0.4

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

UnmarshalJSON supports json.Unmarshaler interface

type Vendor added in v0.0.3

type Vendor struct {
	VendorAccountID    string `json:"vendorAccountId"`
	RemovedFromProject bool   `json:"removedFromProject"`
	Cost               Cost   `json:"cost"`
	CostDetailsFileID  string `json:"costDetailsFileId"`
}

Vendor model

func (Vendor) MarshalEasyJSON added in v0.0.3

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (Vendor) MarshalJSON added in v0.0.3

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

MarshalJSON supports json.Marshaler interface

func (*Vendor) UnmarshalEasyJSON added in v0.0.3

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Vendor) UnmarshalJSON added in v0.0.3

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

UnmarshalJSON supports json.Unmarshaler interface

type WorkflowStage added in v0.0.3

type WorkflowStage struct {
	Progress  float64 `json:"progress"`
	StageType string  `json:"stageType"`
}

WorkflowStage model

func (WorkflowStage) MarshalEasyJSON added in v0.0.3

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (WorkflowStage) MarshalJSON added in v0.0.3

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

MarshalJSON supports json.Marshaler interface

func (*WorkflowStage) UnmarshalEasyJSON added in v0.0.3

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WorkflowStage) UnmarshalJSON added in v0.0.3

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

UnmarshalJSON supports json.Unmarshaler interface

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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