diff --git a/pkg/feedbin/feeds.go b/pkg/feedbin/feeds.go deleted file mode 100644 index c1d9fcc..0000000 --- a/pkg/feedbin/feeds.go +++ /dev/null @@ -1,69 +0,0 @@ -package feedbin - -import ( - "encoding/json" - "fmt" -) - -// Feedbin is the main object for calling the Feedbin API -type Feedbin struct { - user string - password string -} - -// New returns a new Feedbin object with the provided user and password -func New(user, password string) *Feedbin { - var fb Feedbin - fb.user = user - fb.password = password - return &fb -} - -// Taggings returns taggings -func (fb *Feedbin) Taggings() ([]Tagging, error) { - resp, err := fb.get("/v2/taggings.json") - if err != nil { - return []Tagging{}, err - } - defer resp.Body.Close() - - var taggings []Tagging - - dec := json.NewDecoder(resp.Body) - dec.Decode(&taggings) - - return taggings, nil -} - -// Feed returns a Feed for id -func (fb *Feedbin) Feed(id int64) (Feed, error) { - resp, err := fb.get(fmt.Sprintf("/v2/feeds/%d.json", id)) - if err != nil { - return Feed{}, err - } - - defer resp.Body.Close() - - var feed Feed - - dec := json.NewDecoder(resp.Body) - dec.Decode(&feed) - - return feed, nil -} - -// Entries return a slice of entries -func (fb *Feedbin) Entries() ([]Entry, error) { - resp, err := fb.get("/v2/entries.json") - if err != nil { - return []Entry{}, err - } - defer resp.Body.Close() - - var entries []Entry - - dec := json.NewDecoder(resp.Body) - dec.Decode(&entries) - - return entries, nil -} diff --git a/pkg/feedbin/requests.go b/pkg/feedbin/requests.go deleted file mode 100644 index 90d7c3a..0000000 --- a/pkg/feedbin/requests.go +++ /dev/null @@ -1,20 +0,0 @@ -package feedbin - -import ( - "fmt" - "net/http" -) - -func (fb *Feedbin) get(u string) (*http.Response, error) { - - req, err := http.NewRequest("GET", fmt.Sprintf("https://api.feedbin.com%s", u), nil) - if err != nil { - return nil, err - } - - req.SetBasicAuth(fb.user, fb.password) - - client := http.Client{} - - return client.Do(req) -} diff --git a/pkg/feedbin/types.go b/pkg/feedbin/types.go deleted file mode 100644 index 5d5dbb7..0000000 --- a/pkg/feedbin/types.go +++ /dev/null @@ -1,33 +0,0 @@ -package feedbin - -import ( - "time" -) - -// Entry is a feedbin api entry -type Entry struct { - ID int64 `json:"id"` - FeedID int64 `json:"feed_id"` - Title string `json:"title"` - URL string `json:"url"` - Author string `json:"author"` - Content string `json:"content"` - Summary string `json:"summary"` - Published time.Time `json:"published"` - CreatedAt time.Time `json:"created_at"` -} - -// Feed is a feedbin api feed -type Feed struct { - ID int64 `json:"id,omitempty"` - Title string `json:"title"` - FeedURL string `json:"feed_url"` - SiteURL string `json:"site_url"` -} - -// Tagging is a feedbin api tagging -type Tagging struct { - ID int64 `json:"id,omitempty"` - FeedID int64 `json:"feed_id"` - Name string `json:"name"` -}