Refactored AUR package

This commit is contained in:
Jguer 2017-05-02 17:32:50 +01:00
parent 484eb3b75f
commit a91984045c
3 changed files with 3 additions and 22 deletions

View file

@ -13,6 +13,9 @@ import (
rpc "github.com/mikkeloscar/aur"
)
// BaseURL givers the AUR default address.
const BaseURL string = "https://aur.archlinux.org"
// NarrowSearch searches AUR and narrows based on subarguments
func NarrowSearch(pkgS []string, sortS bool) (Query, error) {
if len(pkgS) == 0 {

View file

@ -7,8 +7,6 @@ import (
rpc "github.com/mikkeloscar/aur"
)
const aurURL = "https://aur.archlinux.org/rpc/?"
// Query is a collection of Results
type Query []rpc.Pkg

View file

@ -1,20 +0,0 @@
package aur
import (
"encoding/json"
"net/http"
)
// BaseURL givers the AUR default address.
const BaseURL string = "https://aur.archlinux.org"
// getJSON handles JSON retrieval and decoding to struct
func getJSON(url string, target interface{}) error {
r, err := http.Get(url)
if err != nil {
return err
}
defer r.Body.Close()
return json.NewDecoder(r.Body).Decode(target)
}