28 lines
436 B
Go
28 lines
436 B
Go
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"net/http"
|
|
|
|
"gitnet.fr/deblan/mu-go/internal/fs"
|
|
)
|
|
|
|
func RequestFileList(url, name, order string) fs.Files {
|
|
response, err := http.Get(fmt.Sprintf("%s/api/list?name=%s&order=%s", url, name, order))
|
|
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
|
|
return nil
|
|
}
|
|
|
|
body, err := ioutil.ReadAll(response.Body)
|
|
|
|
var files fs.Files
|
|
|
|
json.Unmarshal([]byte(body), &files)
|
|
|
|
return files
|
|
}
|