Skip to content

chyroc/go-feedbin

Repository files navigation

go-feedbin

codecov go report card test status Apache-2.0 license Go.Dev reference Go project version

Feedbin API Documentation: https://github.com/feedbin/feedbin-api.

Install

go get github.com/chyroc/go-feedbin

Usage

Create Page

package main

import (
	"context"
	"fmt"

	"github.com/chyroc/go-feedbin"
)

func main() {
	url := ""
	cli := feedbin.New(feedbin.WithCredential("username", "password"))

	resp, err := cli.CreatePage(context.Background(), &feedbin.CreatePageReq{
		URL: url,
	})
	if err != nil {
		panic(err)
	}
	fmt.Println("title", resp.Title)
	fmt.Println("content", resp.Content)
}

Get Subscriptions

package main

import (
	"context"
	"fmt"

	"github.com/chyroc/go-feedbin"
)

func main() {
	cli := feedbin.New(feedbin.WithCredential("username", "password"))

	resp, err := cli.GetSubscriptions(context.Background(), &feedbin.GetSubscriptionsReq{})
	if err != nil {
		panic(err)
	}
	fmt.Println("subscriptions length:", len(resp.Subscriptions))
	for _, v := range resp.Subscriptions {
		fmt.Println(v.ID, v.Title, v.FeedURL)
	}
}

Extracting Content

package main

import (
	"context"
	"fmt"

	"github.com/chyroc/go-feedbin"
)

func main() {
	url := ""
	cli := feedbin.New()

	resp, err := cli.ExtractingContent(context.Background(), &feedbin.ExtractingContentReq{
		URL: url,
	})
	if err != nil {
		panic(err)
	}
	fmt.Println("title", resp.Title)
	fmt.Println("content", resp.Content)
}