refactoring. remove global state, use new logging, config functions

This commit is contained in:
2018-06-17 16:15:58 +02:00
parent d091398f05
commit 75197310bf
24 changed files with 295 additions and 476 deletions

View File

@@ -2,8 +2,6 @@ package pixelapi
import (
"encoding/json"
"fornaxian.com/pixeldrain-web/conf"
)
// API error constants
@@ -34,9 +32,9 @@ type ListFile struct {
// GetList get a List from the pixeldrain API. Errors will be available through
// List.Error. Standard error checks apply.
func GetList(id string) *List {
func (p *PixelAPI) GetList(id string) *List {
var list = &List{}
body, err := getString(conf.ApiUrlInternal() + "/list/" + id)
body, err := getString(p.apiEndpoint + "/list/" + id)
if err != nil {
list.Error = errorResponseFromError(err)
return list