lib

package
v0.0.0-...-a1b3fe6 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright © 2023 Thomas von Dein

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const Maxwidth = 12

Variables

This section is empty.

Functions

func CreateForm

func CreateForm(w io.Writer, c *cfg.Config) error

*** Forms stuff ***

func Delete

func Delete(w io.Writer, c *cfg.Config, args []string, typ int) error

func Describe

func Describe(w io.Writer, c *cfg.Config, args []string, typ int) error

func Download

func Download(w io.Writer, c *cfg.Config, args []string) error

func FormsRespondTable

func FormsRespondTable(w io.Writer, resp *req.Response) error

turn the Forms{} struct into a table and print it

func GatherFiles

func GatherFiles(rq *Request, args []string) error

Iterate over args, considering the elements are filenames, and add them to the request.

func GetResponse

func GetResponse(resp *req.Response) (*common.Response, error)

extract an common.Response{} struct from json response

func HandleResponse

func HandleResponse(c *cfg.Config, resp *req.Response) error

Check HTTP Response Code and validate JSON status output, if any. Turns'em into a regular error

func List

func List(w io.Writer, c *cfg.Config, args []string, typ int) error

func Modify

func Modify(w io.Writer, c *cfg.Config, args []string, typ int) error

func RespondExtended

func RespondExtended(w io.Writer, resp *req.Response) error

turn the Uploads{} struct into xtnd output and print it

func UploadFiles

func UploadFiles(w io.Writer, c *cfg.Config, args []string) error

func UploadsRespondTable

func UploadsRespondTable(w io.Writer, resp *req.Response) error

turn the Uploads{} struct into a table and print it

func WriteExtended

func WriteExtended(w io.Writer, response *common.Response)

Print output like psql \x

Prints  all  Uploads  and  Forms which  exist  in  common.Response,
however, we expect only one kind  of them to be actually filled, so
the function can be used for forms and uploads.

func WriteTable

func WriteTable(w io.Writer, headers []string, data [][]string)

generic table writer

Types

type ListParams

type ListParams struct {
	Apicontext string `json:"apicontext"`
	Query      string `json:"query"`
}

type Request

type Request struct {
	R   *req.Request
	Url string
}

func Setup

func Setup(c *cfg.Config, path string) *Request

Create a new request object for outgoing queries

type Response

type Response struct {
	Code    int    `json:"code"`
	Success bool   `json:"success"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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