Documentation ¶
Index ¶
- Variables
- func BasicRequestWithBody(c *cli.Context, method string) (string, error)
- func GenerateDocs(output string, exportPathfile string, servePort int, isOpenBrowser bool, ...) error
- func Getbasic(c *cli.Context) (string, error)
- func ProcessCollection(jsonArr []Collection) (string, error)
- type AuthType
- type Body
- type BodyParams
- type Collection
- type ExampleResponse
- type FileTrunk
- type FolderProperties
- type Folders
- type Headers
- type RequestVariable
- type RequestVariables
- type Requests
Constants ¶
This section is empty.
Variables ¶
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 ¶
BasicRequestWithBody sends put|patch|post|delete requests
func GenerateDocs ¶
func GenerateDocs(output string, exportPathfile string, servePort int, isOpenBrowser bool, templatedir string) error
GenerateDocs generates the Documentation site from the hoppscotch-collection.json
func Getbasic ¶
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 AuthType ¶
type AuthType struct { Key string `json:"key"` AddTo string `json:"addTo"` Value string `json:"value"` // value enum => none,inherit,bearer AuthType string `json:"authType"` AuthActive bool `json:"authActive"` // JWT Token on auth type bearer Token string `json:"token"` // for basic auth Username string `json:"username"` Password string `json:"password"` }
type Body ¶
type Body struct { Body interface{} `json:"body"` ContentType string `json:"contentType"` }
func (*Body) UnmarshalJSON ¶
type BodyParams ¶
BodyParams include the Body Parameters
type Collection ¶
type Collection struct { Version int `json:"v"` // Name of the Whole Collection Name string `json:"name"` // Folders JSON Type // Folders []Folders `json:"folders"` Folders []Collection `json:"folders"` // Requests inside the Collection Requests []Requests `json:"requests"` // Set Data into Collection Property FolderProperties `json:"data"` // for Folder v2 Headers []Headers `json:"headers"` Auth AuthType `json:"auth"` }
Collection hold the structure of the basic `postwoman-collection.json`
func ParseCollection ¶
func ParseCollection(data []byte) ([]Collection, error)
func ReadCollection ¶
func ReadCollection(filename string) ([]Collection, error)
ReadCollection reads the `hoppScotch-collection.json` File and returns a the Loaded Collection Struct
func (*Collection) UnmarshalJSON ¶
func (c *Collection) UnmarshalJSON(data []byte) error
type ExampleResponse ¶
type FileTrunk ¶
FileTrunk handles the buffer for generated README.md File
type FolderProperties ¶
func (*FolderProperties) UnmarshalJSON ¶
func (f *FolderProperties) UnmarshalJSON(data []byte) error
type Folders ¶
type Folders struct { // Folder name Name string `json:"name"` // Requests inside the Folder Requests []Requests `json:"requests"` // Set Data into Collection Property FolderProperties `json:"data"` }
Folders can be organized to Folders
type RequestVariable ¶
type RequestVariable struct { Key string `json:"key"` Value string `json:"value"` Examples []ExampleResponse `json:"-"` }
func (*RequestVariable) UnmarshalJSON ¶
func (b *RequestVariable) UnmarshalJSON(data []byte) error
type RequestVariables ¶
type RequestVariables []RequestVariable
func (RequestVariables) GetRequestVariables ¶
func (r RequestVariables) GetRequestVariables() []RequestVariable
type Requests ¶
type Requests struct { // Base URL of the Request URL string `json:"endpoint"` // 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 AuthType `json:"auth"` // Username for Basic Auth User string `json:"httpUser"` // Password for Basic Auth Pass string `json:"httpPassword"` PasswordFieldType string `json:"passwordFieldType"` // 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 Body Body `json:"body"` RequestType string `json:"requestType"` PreRequestScript string `json:"preRequestScript"` TestScript string `json:"testScript"` RequestVariable []RequestVariable `json:"requestVariables"` // 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
func (*Requests) PrepareText ¶
func (r *Requests) PrepareText()