rest

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidInput required input was not found
	ErrInvalidInput = errors.New("required input was not found")

	// ErrInvalidURIExtension couldn't find a period to indicate a file extension
	ErrInvalidURIExtension = errors.New("couldn't find a period to indicate a file extension")
)

Functions

func IsUrl

func IsUrl(str string) bool

IsUrl returns true if a string is of a URL format

Types

type AccessToken

type AccessToken struct {
	AccessToken string
	NebulaToken string
	ExpiresOn   time.Time
}

AccessToken represents a Symbl platform bearer access token with expiry information.

type Client

type Client struct {
	*simple.Client
	// contains filtered or unexported fields
}

Client which extends basic client to support REST

func New

func New() *Client

New allocated a REST client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, resBody interface{}) error

Do is a generic REST API call to the platform

func (*Client) DoAppendText

func (c *Client) DoAppendText(ctx context.Context, conversationId string, text asyncinterfaces.AsyncTextRequest, resBody interface{}) error

DoAppendText appends Text to a given conversation ID

func (*Client) DoFile

func (c *Client) DoFile(ctx context.Context, filePath string, ufRequest asyncinterfaces.AsyncURLFileRequest, resBody interface{}) error

DoFile posts a file capturing a conversation to a given REST endpoint

func (*Client) DoText

func (c *Client) DoText(ctx context.Context, text asyncinterfaces.AsyncTextRequest, resBody interface{}) error

DoAppendText initializes Text for a given conversation ID

func (*Client) DoURL

func (c *Client) DoURL(ctx context.Context, ufRequest asyncinterfaces.AsyncURLFileRequest, resBody interface{}) error

DoURL performs a REST call using a URL conversation source

func (*Client) SetAuthorization

func (c *Client) SetAuthorization(auth *AccessToken)

SetAuthorization sets an authorization token to make API calls to a given platform

Jump to

Keyboard shortcuts

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