Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Commit

Permalink
🌱 New Send Feature
Browse files Browse the repository at this point in the history
  • Loading branch information
athul committed Jan 30, 2020
1 parent eccd3a7 commit ebcb9f0
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@

# End of https://www.gitignore.io/api/go,visualstudiocode
docs.md
.DS_Store
56 changes: 56 additions & 0 deletions methods/json.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//Colls hold the format of the basic `postwoman-collection.json`
type Colls struct {
Name string `json:"name"`
Folders []string `json:"folders"`
Request []Reqdata `json:"requests"`
}

//Reqdata hold the format of the request part in `postwoman-collection.json`
type Reqdata struct {
URL string `json:"url"`
Path string `json:"path"`
Method string `json:"method"`
Auth string `json:"auth"`
User string `json:"httpUser"`
Pass string `json:"httpPassword"`
Token string `json:"bearerToken"`
Ctype string `json:"contentType"`
Heads []string `json:"headers"`
Params []string `json:"params"`
Bparams []Bpardata `json:"bodyParams"`
}

//Bpardata hold the format of the bodyParams of `postwoman-collection.json`
type Bpardata struct {
Key string `json:"key"`
Value string `json:"value"`
}

func main() {
data, err := ioutil.ReadFile("/Users/athul/Downloads/pwclc.json")
if err != nil {
fmt.Print(err)
}
//fmt.Print(string(data))
jsondat := []Colls{}

err = json.Unmarshal([]byte(data), &jsondat)
if err != nil {
fmt.Println(err)
}
//fmt.Println(jsondat)
//fmt.Print(jsondat[0].Name + "\n")
//fmt.Println(jsondat[0].Request[4].URL)
//fmt.Println(jsondat[0].Request[0].Method)
for i := 0; i < len(jsondat[0].Request); i++ {
fmt.Printf(`
URL: %s
Method: %s
Auth: %s
-------`, jsondat[0].Request[i].URL, jsondat[0].Request[i].Method, jsondat[0].Request[i].Auth)
}

}
func request(){

}

0 comments on commit ebcb9f0

Please sign in to comment.