methods

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 24 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

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

BasicRequestWithBody sends put|patch|post|delete requests

func GenerateDocs

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

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

ProcessCollection parses the Collection struct and execute the said requests

Types

type BodyParams

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

BodyParams include the Body Parameters

type Collection

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

type FileTrunk struct{ bytes.Buffer }

FileTrunk handles the buffer for generated README.md File

func (*FileTrunk) IsDir

func (f *FileTrunk) IsDir() bool

IsDir checks if True

func (*FileTrunk) ModTime

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

ModTime holds creation time of File

func (*FileTrunk) Mode

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

Mode holds the file Mode

func (*FileTrunk) Name

func (f *FileTrunk) Name() string

Name holds the FileName, here README.md

func (*FileTrunk) Size

func (f *FileTrunk) Size() int64

Size holds the size of the File

func (*FileTrunk) Sys

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

Sys - I have no idea

type Folders

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

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

Headers are the Request Headers

type Requests

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