Browse Source

enterprise stuff

master
boB Rudis 4 years ago
parent
commit
09c1778875
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 6
      DESCRIPTION
  2. 2
      NAMESPACE
  3. 38
      R/feedly-enterprise-profile.R
  4. 29
      R/feedly-refresh-token.R
  5. 4
      README.Rmd
  6. 17
      README.md
  7. 3
      man/feedly_collections.Rd
  8. 17
      man/feedly_enterprise_profile.Rd
  9. 2
      man/feedly_feed_meta.Rd
  10. 3
      man/feedly_opml.Rd
  11. 17
      man/feedly_refresh_token.Rd
  12. 15
      man/feedly_search_contents.Rd
  13. 12
      man/feedly_search_title.Rd
  14. 11
      man/feedly_stream.Rd
  15. 9
      man/feedly_subscribe.Rd
  16. 34
      man/global_resource_ids.Rd
  17. 9
      man/render_stream.Rd
  18. 3
      man/seymour.Rd

6
DESCRIPTION

@ -1,8 +1,8 @@
Package: seymour
Type: Package
Title: Tools to Work with the 'Feedly' 'API'
Version: 0.2.0
Date: 2010-01-29
Version: 0.2.5
Date: 2019-12-03
Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5670-2640"))
@ -32,4 +32,4 @@ Imports:
utils,
jsonlite,
magrittr
RoxygenNote: 6.1.1
RoxygenNote: 7.0.1

2
NAMESPACE

@ -5,9 +5,11 @@ export(feedly_access_token)
export(feedly_categories)
export(feedly_collections)
export(feedly_continue)
export(feedly_enterprise_profile)
export(feedly_feed_meta)
export(feedly_opml)
export(feedly_profile)
export(feedly_refresh_token)
export(feedly_search_contents)
export(feedly_search_title)
export(feedly_stream)

38
R/feedly-enterprise-profile.R

@ -0,0 +1,38 @@
#' Retrieve Your Feedly Enterprise Profile
#'
#' @md
#' @param feedly_token Your Feedly Developer Access Token (see [feedly_access_token()])
#' @references (<https://developer.feedly.com/v3/opml/>)
#' @export
feedly_enterprise_profile <- function(feedly_token = feedly_access_token()) {
httr::GET(
.seymour_ua,
url = "https://cloud.feedly.com/v3/profile",
httr::add_headers(
`Authorization` = sprintf("OAuth %s", feedly_token)
)
) -> res
httr::stop_for_status(res)
out <- httr::content(res, as="text")
out <- jsonlite::fromJSON(out)
ln <- names(out)
if ("productExpiration" %in% ln)
out$productExpiration <- as.POSIXct(out$productExpiration/1000, origin = "1970-01-01")
if ("subscriptionRenewalDate" %in% ln)
out$subscriptionRenewalDate <- as.POSIXct(out$subscriptionRenewalDate/1000, origin = "1970-01-01")
if ("upgradeDate" %in% ln)
out$upgradeDate <- as.POSIXct(out$upgradeDate/1000, origin = "1970-01-01")
if ("lastChargeDate" %in% ln)
out$lastChargeDate <- as.POSIXct(out$lastChargeDate/1000, origin = "1970-01-01")
if ("nextChargeDate" %in% ln)
out$nextChargeDate <- as.POSIXct(out$nextChargeDate/1000, origin = "1970-01-01")
out
}

29
R/feedly-refresh-token.R

@ -0,0 +1,29 @@
#' Generate a Feedly Refresh Token
#'
#' Stick this into `FEEDLY_ACCESS_TOKEN` when obtained.
#'
#' @md
#' @param feedly_token Your Feedly Developer Access Token (see [feedly_access_token()])
#' @references (<https://developer.feedly.com/v3/auth/#refreshing-an-access-token>)
#' @export
feedly_refresh_token <- function(feedly_token = feedly_access_token()) {
httr::POST(
seymour:::.seymour_ua,
url = "https://cloud.feedly.com/v3/auth/token",
httr::add_headers(
`Authorization` = sprintf("OAuth %s", seymour::feedly_access_token())
),
body = list(
refresh_token = Sys.getenv("FEEDLY_REFRESH_TOKEN"),
client_id = "feedlydev",
client_secret = "feedlydev",
grant_type = "refresh_token"
)
) -> res
httr::stop_for_status(res)
httr::content(res)
}

4
README.Rmd

@ -25,9 +25,11 @@ The following API functions are implemented:
- `feedly_access_token`: Retrieve the Feedly Developer Token
- `feedly_collections`: Retrieve Feedly Connections
- `feedly_categories`: Show Feedly Categories
- `feedly_enterprise_profile`: Retrieve Your Feedly Enterprise Profile
- `feedly_feed_meta`: Retrieve Metadata for a Feed
- `feedly_opml`: Retrieve Your Feedly OPML File
- `feedly_profile`: Retrieve Your Feedly Profile
- `feedly_refresh_token`: Generate a Feedly Refresh Token
- `feedly_search_contents`: Search content of a stream
- `feedly_search_title`: Find feeds based on title, url or '#topic'
- `feedly_stream`: Retrieve contents of a Feedly "stream"
@ -35,7 +37,7 @@ The following API functions are implemented:
- `feedly_subscriptions`: Retrieve Feedly Subscriptions
- `feedly_tags`: Retrieve List of Tags
The following helper functions are åvailable:
The following helper functions are available:
- `feedly_continue`: Helper function to iterate through a `feedly_stream()` result set
- `render_stream`: Render a Feedly Stream Data Frame to R Markdown

17
README.md

@ -21,9 +21,11 @@ The following API functions are implemented:
- `feedly_access_token`: Retrieve the Feedly Developer Token
- `feedly_collections`: Retrieve Feedly Connections
- `feedly_categories`: Show Feedly Categories
- `feedly_enterprise_profile`: Retrieve Your Feedly Enterprise Profile
- `feedly_feed_meta`: Retrieve Metadata for a Feed
- `feedly_opml`: Retrieve Your Feedly OPML File
- `feedly_profile`: Retrieve Your Feedly Profile
- `feedly_refresh_token`: Generate a Feedly Refresh Token
- `feedly_search_contents`: Search content of a stream
- `feedly_search_title`: Find feeds based on title, url or ‘\#topic’
- `feedly_stream`: Retrieve contents of a Feedly “stream”
@ -31,7 +33,7 @@ The following API functions are implemented:
- `feedly_subscriptions`: Retrieve Feedly Subscriptions
- `feedly_tags`: Retrieve List of Tags
The following helper functions are åvailable:
The following helper functions are available:
- `feedly_continue`: Helper function to iterate through a
`feedly_stream()` result set
@ -53,8 +55,8 @@ sufficient demand via Git\[la|hu\]b issues & issue votes.
Neither `feedly_search_title()` nor `feedly_stream()` require
authentication (i.e. you do not need a developer token) to retrieve the
contents of the API call. For `feedly_stream()` You *do* need to know
the Feedly-structured feed id which is (generally) `feed/FEED_URL` (e.g.
`feed/http://feeds.feedburner.com/RBloggers`).
the Feedly-structured feed id which is (generally) `feed/FEED_URL`
(e.g. `feed/http://feeds.feedburner.com/RBloggers`).
## Installation
@ -72,7 +74,7 @@ library(tidyverse) # mostly for printing
packageVersion("seymour")
```
## [1] '0.2.0'
## [1] '0.2.5'
### Collections
@ -315,8 +317,7 @@ render_stream(
Click on the following to see the complete render or view the
[Rmd](https://rud.is/seymour/sample-report.Rmd) or
[HTML](https://rud.is/seymour/sample-report.html) in your
browser:
[HTML](https://rud.is/seymour/sample-report.html) in your browser:
<center>
@ -332,8 +333,8 @@ cloc::cloc_pkg_md()
| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) |
| :--- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | ---: |
| R | 22 | 0.96 | 447 | 0.92 | 172 | 0.77 | 389 | 0.83 |
| Rmd | 1 | 0.04 | 40 | 0.08 | 52 | 0.23 | 82 | 0.17 |
| R | 24 | 0.96 | 488 | 0.92 | 184 | 0.78 | 404 | 0.83 |
| Rmd | 1 | 0.04 | 40 | 0.08 | 52 | 0.22 | 84 | 0.17 |
## Code of Conduct

3
man/feedly_collections.Rd

@ -4,8 +4,7 @@
\alias{feedly_collections}
\title{Retrieve Feedly Connections}
\usage{
feedly_collections(with_stats = FALSE,
feedly_token = feedly_access_token())
feedly_collections(with_stats = FALSE, feedly_token = feedly_access_token())
}
\arguments{
\item{with_stats}{if \code{TRUE}, return reading and tag stats for the past 31 days (default: \code{FALSE})}

17
man/feedly_enterprise_profile.Rd

@ -0,0 +1,17 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/feedly-enterprise-profile.R
\name{feedly_enterprise_profile}
\alias{feedly_enterprise_profile}
\title{Retrieve Your Feedly Enterprise Profile}
\usage{
feedly_enterprise_profile(feedly_token = feedly_access_token())
}
\arguments{
\item{feedly_token}{Your Feedly Developer Access Token (see \code{\link[=feedly_access_token]{feedly_access_token()}})}
}
\description{
Retrieve Your Feedly Enterprise Profile
}
\references{
(\url{https://developer.feedly.com/v3/opml/})
}

2
man/feedly_feed_meta.Rd

@ -7,7 +7,7 @@
feedly_feed_meta(feed, feedly_token = feedly_access_token())
}
\arguments{
\item{feed}{an RSS feed URL. \code{feed/} will be prepended if not present.}
\item{feed}{an RSS feed URL. \verb{feed/} will be prepended if not present.}
\item{feedly_token}{Your Feedly Developer Access Token (see \code{\link[=feedly_access_token]{feedly_access_token()}})}
}

3
man/feedly_opml.Rd

@ -4,8 +4,7 @@
\alias{feedly_opml}
\title{Retrieve Your Feedly OPML File}
\usage{
feedly_opml(as = c("text", "parsed"),
feedly_token = feedly_access_token())
feedly_opml(as = c("text", "parsed"), feedly_token = feedly_access_token())
}
\arguments{
\item{as}{one of "\code{text}" (plain character XML) or "\code{parsed}" (which will return

17
man/feedly_refresh_token.Rd

@ -0,0 +1,17 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/feedly-refresh-token.R
\name{feedly_refresh_token}
\alias{feedly_refresh_token}
\title{Generate a Feedly Refresh Token}
\usage{
feedly_refresh_token(feedly_token = feedly_access_token())
}
\arguments{
\item{feedly_token}{Your Feedly Developer Access Token (see \code{\link[=feedly_access_token]{feedly_access_token()}})}
}
\description{
Stick this into \code{FEEDLY_ACCESS_TOKEN} when obtained.
}
\references{
(\url{https://developer.feedly.com/v3/auth/#refreshing-an-access-token})
}

15
man/feedly_search_contents.Rd

@ -4,12 +4,19 @@
\alias{feedly_search_contents}
\title{Search content of a stream}
\usage{
feedly_search_contents(query, stream_id = NULL, fields = "all",
embedded = NULL, engagement = NULL, count = 20L, locale = NULL,
feedly_token = feedly_access_token())
feedly_search_contents(
query,
stream_id = NULL,
fields = "all",
embedded = NULL,
engagement = NULL,
count = 20L,
locale = NULL,
feedly_token = feedly_access_token()
)
}
\arguments{
\item{query}{a full or partial title string, URL, or \code{#topic}}
\item{query}{a full or partial title string, URL, or \verb{#topic}}
\item{stream_id}{the id of the stream; a feed id, category id, tag id or a
system collection/category ids can be used as

12
man/feedly_search_title.Rd

@ -2,13 +2,17 @@
% Please edit documentation in R/feedly-search-title.R
\name{feedly_search_title}
\alias{feedly_search_title}
\title{Find feeds based on title, url or \code{#topic}}
\title{Find feeds based on title, url or \verb{#topic}}
\usage{
feedly_search_title(query, count = 20L, locale = NULL,
feedly_token = feedly_access_token())
feedly_search_title(
query,
count = 20L,
locale = NULL,
feedly_token = feedly_access_token()
)
}
\arguments{
\item{query}{a full or partial title string, URL, or \code{#topic}}
\item{query}{a full or partial title string, URL, or \verb{#topic}}
\item{count}{number of items to return (API default is 20)}

11
man/feedly_stream.Rd

@ -4,9 +4,14 @@
\alias{feedly_stream}
\title{Retrieve contents of a Feedly "stream"}
\usage{
feedly_stream(stream_id, ranked = c("newest", "oldest"),
unread_only = FALSE, count = 1000L, continuation = NULL,
feedly_token = feedly_access_token())
feedly_stream(
stream_id,
ranked = c("newest", "oldest"),
unread_only = FALSE,
count = 1000L,
continuation = NULL,
feedly_token = feedly_access_token()
)
}
\arguments{
\item{stream_id}{the id of the stream}

9
man/feedly_subscribe.Rd

@ -4,8 +4,12 @@
\alias{feedly_subscribe}
\title{Subscribe to an RSS feed}
\usage{
feedly_subscribe(feed_url, categories = NULL, title = NULL,
feedly_token = feedly_access_token())
feedly_subscribe(
feed_url,
categories = NULL,
title = NULL,
feedly_token = feedly_access_token()
)
}
\arguments{
\item{feed_url}{a URL to an RSS feed (this will be validated).}
@ -28,6 +32,7 @@ Authorization is \emph{required} for this API call.
\dontrun{
feedly_subscribe("https://journal.r-project.org/rss.atom")
feedly_subscribe("http://gh-feed.imsun.net/hrbrmstr/sergeant/issues", "git issues")
feedly_subscribe("https://rsshub.app/github/issue/hrbrmstr/sergeant", "git issues")
}
}
\references{

34
man/global_resource_ids.Rd

@ -9,25 +9,25 @@ The following is a list of built-in categories and tags applications can take ad
\section{Id List}{
\itemize{
\item \code{user/:userId/category/global.all}
All articles from all the feeds the user subscribes to (example: \code{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/category/global.all})
\item \code{user/:userId/category/global.uncategorized}
All the articles from all the sources the user subscribes to and are not in a category (example: \code{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/category/global.uncategorized})
\item \code{user/:userId/category/global.must}
Users can promote sources they really love to read to must have (example: \code{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/category/global.must})
\item \code{user/:userId/tag/global.read’ List of entries the user has recently read - limited to the feeds the users subscribes to (example: }user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/tag/global.read`)
\item \code{user/:userId/tag/global.saved}
Users can save articles for later. Equivalent of starring articles in Google Reader (example: \code{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/tag/global.saved})
\item \code{user/:userId/tag/global.all}
All articles from all personal tags, including global.saved (example: \code{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/tag/global.all})
\item \code{enterprise/:enterpriseName/category/global.all}
\item \verb{user/:userId/category/global.all}
All articles from all the feeds the user subscribes to (example: \verb{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/category/global.all})
\item \verb{user/:userId/category/global.uncategorized}
All the articles from all the sources the user subscribes to and are not in a category (example: \verb{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/category/global.uncategorized})
\item \verb{user/:userId/category/global.must}
Users can promote sources they really love to read to must have (example: \verb{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/category/global.must})
\item \verb{user/:userId/tag/global.read’ List of entries the user has recently read - limited to the feeds the users subscribes to (example: }user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/tag/global.read`)
\item \verb{user/:userId/tag/global.saved}
Users can save articles for later. Equivalent of starring articles in Google Reader (example: \verb{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/tag/global.saved})
\item \verb{user/:userId/tag/global.all}
All articles from all personal tags, including global.saved (example: \verb{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/tag/global.all})
\item \verb{enterprise/:enterpriseName/category/global.all}
All articles from all team feeds (example: \code{enterprise/acmeinc/category/global.all})
\item \code{enterprise/:enterpriseName/tags/global.all}
\item \verb{enterprise/:enterpriseName/tags/global.all}
All articles from all team tags (example: \code{enterprise/acmeinc/tags/global.all})
\item \code{user/:userId/category/global.enterprise}
All articles from all the team categories a user is following (example: \code{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/category/global.enterprise})
\item \code{user/:userId/tag/global.enterprise}
All articles from all the team tags a user is subscribed to (example: \code{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/tag/global.enterprise})
\item \verb{user/:userId/category/global.enterprise}
All articles from all the team categories a user is following (example: \verb{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/category/global.enterprise})
\item \verb{user/:userId/tag/global.enterprise}
All articles from all the team tags a user is subscribed to (example: \verb{user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/tag/global.enterprise})
}
}

9
man/render_stream.Rd

@ -4,8 +4,13 @@
\alias{render_stream}
\title{Render a Feedly Stream Data Frame to RMarkdown}
\usage{
render_stream(feedly_stream, title = "Feedly Stream Summary",
include_visual = FALSE, browse = FALSE, quiet = TRUE)
render_stream(
feedly_stream,
title = "Feedly Stream Summary",
include_visual = FALSE,
browse = FALSE,
quiet = TRUE
)
}
\arguments{
\item{feedly_stream}{output from \code{\link[=feedly_stream]{feedly_stream()}}. Ideally, you'll filter

3
man/seymour.Rd

@ -3,7 +3,6 @@
\docType{package}
\name{seymour}
\alias{seymour}
\alias{seymour-package}
\title{Tools to Work with the 'Feedly' 'API'}
\description{
\if{html}{
@ -26,7 +25,7 @@ Neither \code{\link[=feedly_search]{feedly_search()}} nor \code{\link[=feedly_st
(i.e. you do not need a developer token) to retrieve the contents of the
API call. For \code{feedly_stream()} You \emph{do} need to know the
Feedly-structured feed id which is (generally) \code{feed/FEED_URL}
(e.g. \code{feed/http://feeds.feedburner.com/RBloggers}).
(e.g. \verb{feed/http://feeds.feedburner.com/RBloggers}).
\itemize{
\item URL: \url{https://gitlab.com/hrbrmstr/seymour}
\item BugReports: \url{https://gitlab.com/hrbrmstr/seymour/issues}

Loading…
Cancel
Save