client

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package client holds the public library files for use in the client executable At the root level, this includes the setup code to keep the main namespace sparsely populated.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleDownload

func HandleDownload(do DownloadOption) error

HandleDownload is responsible for parsing the necessary download arguments and fetching the files from the BitBurner server. If there is an issue with any of the arguments or the download an error will be returned. Nil on success.

func HandleList

func HandleList(lo CommandOption) error

func HandleUpload added in v0.0.3

func HandleUpload(uo UploadOption) error

func WriteFiles

func WriteFiles(outputDir string, files []models.GBBFileData) error

Types

type CommandOption

type CommandOption interface {
	AuthToken() string
	Host() string
	Port() int
	Valid() bool
	Server() string
	AddAuth(req *http.Request) *http.Request
}

CommandOption represents the available actions on a base CommandOption

type DownloadOption

type DownloadOption interface {
	CommandOption
	Destination() string
}

DownloadOption represents the options available to the Download command.

type FileWriter

type FileWriter interface {
	WriteString(data string) (n int, err error)
	Close() error
}

type GBBClient

type GBBClient interface {
	Do(*http.Request) (*http.Response, error)
}

GBBClient is an interface to the http.Client methods used for mocking purposes

var (
	Client GBBClient = http.DefaultClient
)

type UploadOption added in v0.0.3

type UploadOption interface {
	CommandOption
	ToUpload() []models.GBBFileName
}

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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