methods

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Contenttypes = map[string]string{
	"html":  "text/html",
	"js":    "application/json",
	"xml":   "application/xml",
	"plain": "text/plain",
}

Contenttypes are used in Place for ctypes for sending requests

Functions

func BasicRequestWithBody added in v0.0.5

func BasicRequestWithBody(c *cli.Context, method string) (string, error)

BasicRequestWithBody sends put|patch|post|delete requests

func GenerateDocs added in v0.0.7

func GenerateDocs(c *cli.Context) error

GenerateDocs generates the Documentation site from the hoppscotch-collection.json

func Getbasic

func Getbasic(c *cli.Context) (string, error)

Getbasic sends a simple GET request to the url with any potential parameters like Tokens or Basic Auth

func ProcessCollection added in v0.0.7

func ProcessCollection(jsonArr []Collection) (string, error)

ProcessCollection parses the Collection struct and execute the said requests

Types

type BodyParams added in v0.0.7

type BodyParams struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

BodyParams include the Body Parameters

type Collection added in v0.0.7

type Collection struct {
	// Name of the Whole Collection
	Name string `json:"name"`
	// Folders JSON Type
	Folders []Folders `json:"folders"`
	// Requests inside the Collection
	Requests []Requests `json:"requests"`
}

Collection hold the structure of the basic `postwoman-collection.json`

func ReadCollection

func ReadCollection(filename string) ([]Collection, error)

ReadCollection reads the `hoppScotch-collection.json` File and returns a the Loaded Collection Struct

type FileTrunk added in v0.0.7

type FileTrunk struct{ bytes.Buffer }

FileTrunk handles the buffer for generated README.md File

func (*FileTrunk) IsDir added in v0.0.7

func (f *FileTrunk) IsDir() bool

IsDir checks if True

func (*FileTrunk) ModTime added in v0.0.7

func (f *FileTrunk) ModTime() time.Time

ModTime holds creation time of File

func (*FileTrunk) Mode added in v0.0.7

func (f *FileTrunk) Mode() os.FileMode

Mode holds the file Mode

func (*FileTrunk) Name added in v0.0.7

func (f *FileTrunk) Name() string

Name holds the FileName, here README.md

func (*FileTrunk) Size added in v0.0.7

func (f *FileTrunk) Size() int64

Size holds the size of the File

func (*FileTrunk) Sys added in v0.0.7

func (f *FileTrunk) Sys() interface{}

Sys - I have no idea

type Folders added in v0.0.7

type Folders struct {
	// Folder name
	Name string `json:"name"`
	// Requests inside the Folder
	Requests []Requests `json:"requests"`
}

Folders can be organized to Folders

type Headers added in v0.0.7

type Headers struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Headers are the Request Headers

type Requests added in v0.0.7

type Requests struct {
	// Base URL of the Request
	URL string `json:"url"`
	// Path is the enpoint path
	// URL+PATH = Full URL
	Path string `json:"path"`
	// Request Method - GET,POST,PUT,PATCH,DELETE
	Method string `json:"method"`
	// Authentication Type - Bearer Token or Basic Auth
	Auth string `json:"auth"`
	// Username for Basic Auth
	User string `json:"httpUser"`
	// Password for Basic Auth
	Pass              string `json:"httpPassword"`
	PasswordFieldType string `json:"passwordFieldType"`
	// Bearer token
	Token string `json:"bearerToken"`
	// Request Headers if any- Key,Value pairs
	Headers []Headers `json:"headers"`
	// Params for Get Requests
	Params []interface{} `json:"params"`
	// Body Params for POST requests and forth
	Bparams []interface{} `json:"bodyParams"`
	// Raw Input. Not Formatted JSON
	RawParams string `json:"rawParams"`
	// If RawInputs are used or Not
	RawInput bool `json:"rawInput"`
	// Content Type of Request
	Ctype            string `json:"contentType"`
	RequestType      string `json:"requestType"`
	PreRequestScript string `json:"preRequestScript"`
	TestScript       string `json:"testScript"`
	// Label of Collection
	Label string `json:"label"`
	// Name of the Request
	Name string `json:"name"`
	// Number of Collection
	Collection int `json:"collection"`
}

Requests are the Request Model in JSON

Jump to

Keyboard shortcuts

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