util

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("timeout")

Functions

func BrowserFlow

func BrowserFlow(opts BrowserFlowOptions) error

BrowserFlow will open a browser and wait for the user to finish the flow. It will return an error if the flow times out with an ErrTimeout error. It will return an error if the callback fails or any other error occurs.

func CopyDir

func CopyDir(src string, dst string) error

CopyDir will copy all files recursively from src to dst

func CopyFile

func CopyFile(src, dst string) (int64, error)

CopyFile will copy src to dst

func Exists

func Exists(fn string) bool

Exists returns true if the filename or directory specified by fn exists.

func ListDir

func ListDir(dir string) ([]string, error)

ListDir will return an array of files recursively walking into sub directories

func RandStringBytes

func RandStringBytes(n int) string

RandStringBytes will generate a random string of length n using the alphaNumChars string.

func ZipDir

func ZipDir(dir string, outfilename string, opts ...ZipDirCallbackMatcher) error

ZipDir will zip up a directory into the outfilename and return an error if it fails

Types

type APIClient

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

func NewAPIClient

func NewAPIClient(baseURL, token string) *APIClient

func (*APIClient) Do

func (c *APIClient) Do(method, path string, payload interface{}, response interface{}) error

type BrowserFlowOptions

type BrowserFlowOptions struct {
	Logger      logger.Logger
	BaseUrl     string
	StartPath   string
	WaitMessage string
	AuthToken   string
	Query       map[string]string
	Callback    browserCallback
}

type ZipDirCallbackMatcher

type ZipDirCallbackMatcher func(fn string, fi os.FileInfo) bool

ZipDirCallbackMatcher is a function that returns true if the file should be included in the zip

Jump to

Keyboard shortcuts

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