This repository has been archived by the owner on Jul 14, 2022. It is now read-only.
/
collection.go
72 lines (67 loc) 路 2.03 KB
/
collection.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package methods
//Collection hold the structure of the basic `postwoman-collection.json`
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"`
}
// Folders can be organized to Folders
type Folders struct {
// Folder name
Name string `json:"name"`
// Requests inside the Folder
Requests []Requests `json:"requests"`
}
// Headers are the Request Headers
type Headers struct {
Key string `json:"key"`
Value string `json:"value"`
}
// Requests are the Request Model in JSON
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"`
}
// BodyParams include the Body Parameters
type BodyParams struct {
Key string `json:"key"`
Value string `json:"value"`
}