balaboba

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: MIT Imports: 9 Imported by: 1

README

GoLang Balaboba API.

Library for interaction with Yandex Balaboba API.

There is no official documentation for the api, so you can only use methods found in Balaboba requests.

Install

As a library

go get github.com/rprtr258/balaboba

As a binary

go install github.com/rprtr258/balaboba/cmd/balaboba@latest

What is a Balaboba?

Russian

English

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Standart = Style{
				// contains filtered or unexported fields
	}
	ShortStories = Style{
					// contains filtered or unexported fields
	}
	WikipediaSipmlified = Style{
						// contains filtered or unexported fields
	}
	MovieSynopses = Style{
					// contains filtered or unexported fields
	}
	FolkWisdom = Style{
				// contains filtered or unexported fields
	}
	UserManual = Style{
				// contains filtered or unexported fields
	}
	Recipes = Style{
			// contains filtered or unexported fields
	}
	Football = Style{
				// contains filtered or unexported fields
	}

	StylesByID = map[int]Style{
		Standart.id:            Standart,
		ShortStories.id:        ShortStories,
		WikipediaSipmlified.id: WikipediaSipmlified,
		MovieSynopses.id:       MovieSynopses,
		FolkWisdom.id:          FolkWisdom,
		UserManual.id:          UserManual,
		Recipes.id:             Recipes,
		Football.id:            Football,
	}
)

Functions

This section is empty.

Types

type Client

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

Client is Yandex Balaboba service client

func New

func New(config ClientConfig) *Client

New makes new balaboba api client.

func (*Client) Generate

func (c *Client) Generate(ctx context.Context, query string, style Style) (*Response, error)

Generate generates text with passed parameters

func (*Client) Styles

func (c *Client) Styles(ctx context.Context) ([]Style, error)

Styles gets list of available generating styles

type ClientConfig

type ClientConfig struct {
	// Lang is language used for text generation.
	// If not specified, Russian is used.
	Lang Lang
	// HTTP is http.Client api to make requests.
	// If not specified, http.DefaultClient is used.
	HTTP *http.Client
}

type Lang

type Lang int

Lang represents balaboba language.

const (
	Rus Lang = iota
	Eng
)

available languages.

type Response

type Response struct {
	// Text generated
	Text     string
	BadQuery bool
}

Response contains generated text.

type Style

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

Style of generating text.

func (*Style) Set

func (s *Style) Set(value string) error

TODO: remove from public interface

func (*Style) String

func (style *Style) String() string

func (*Style) UnmarshalJSON

func (style *Style) UnmarshalJSON(b []byte) error

UnmarshalJSON is json.Unmarshaler interface implementation.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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