Clients authenticate using API tokens. The auth token is used for basic requests (typically HTTP GET) while the post token is shorter-lived (to protect against CSRF) and used for mutations (typically HTTP POST).
Feeds represent RSS/Atom URLs. See Terminology.
Items represent individual articles/posts. See Terminology.
Tags can refer to either user-created tags or states. See Terminology.
Instantiates a new Reader.
The base API URL. The main (/reader/api/0/
) and auth (/accounts/ClientLogin
) endpoint paths will be appended.
Optional
client?: stringThe name to identify as when making requests. Default: libseymour
.
Optional
autoPostToken?: booleanWhether to automatically call Reader#getPostToken and attempt to retry API requests that result
in a 400 or 401 response. Default: true
Retrieves a list of streams having unread items. (GET /unread-count
)
Marks all items in the specified stream as read. (POST /mark-all-as-read
)
The target Stream ID. This can generally be a feed, user-created tag, or state. (param=s
)
Timestamp (microseconds). Only items with a timestamp less than (older) or equal to
this value will be marked as read. (param=ts
)
Retreives an auth token for the specified username/password combination. This token will be used for future requests without needing to call setAuthToken.
Retreives a short-lived (for CSRF protection) post token to be used for mutation requests. (GET /token
)
This token will be used for future requests without needing to call setPostToken.
This method will automatically be called once before retrying a mutation request where
the API has responded with a 400 or 401 status code, unless IConfig#autoPostToken is false
.
Adds a feed. (POST /subscription/edit
)
Note: While the original API supported multiple feeds and tags in a single request, support by contemporary aggregators varies. For simplicity, this method handles one feed with an optional user-created tag (often a "category" or "folder") at a time.
The feed's URL, or an object with url
, title
(optional) and tag
(optional).
Adds a user-created tag (often a "category" or "folder") to one or more feeds. (POST /subscription/edit
)
A feed ID or URL, or an array of feed IDs or URLs. Stream ID form optional. (param=s
)
The tag name/id to remove. Stream ID form optional. (param=a
)
Removes a user-created tag (often a "category" or "folder") from one or more feeds. (POST /subscription/edit
)
A feed ID or URL, or an array of feed IDs or URLs. Stream ID form optional. (param=s
)
The tag name/id to remove. Stream ID form optional. (param=r
)
Retrieves a list of items for a given stream. (GET /stream/contents/<streamId>
)
A Stream ID. If the provided value is not in Stream ID form it's assumed to refer to a feed ID or URL.
Additional options for the request.
Optional
continuation?: stringContinuation key from a previous request, used to fetch the next batch. (param=c
)
Optional
exclude?: stringExclude a streamId. (param=xt
)
Optional
sMax?: numberExclude items newer than this timestamp (seconds). (param=nt
)
Optional
sMin?: numberExclude items older than this timestamp (seconds). (param=ot
)
Optional
num?: numberNumber of items per request. Default: 50
(param=n
)
Optional
sort?: "asc" | "desc"Date sort order. Default: desc
(param=r
)
Retrieves a list of items having the specified item IDs. (POST /stream/items/contents
)
Note: POST is used to avoid URI length limits when requesting many items. A post token should not be required since no mutations are performed.
The item ID, or an array of item IDs. (param=i
)
Retrieves a list of item IDs for a given stream. (GET /stream/items/ids
)
A Stream ID. If the provided value is not in Stream ID form (e.g.
a URL instead) it's assumed to refer to a feed. (param=s
)
Additional options for the request.
Optional
continuation?: stringContinuation key from a previous request, used to fetch the next batch. (param=c
)
Optional
exclude?: stringExclude a streamId. (param=xt
)
Optional
sMax?: numberExclude items newer than this timestamp (seconds). (param=nt
)
Optional
sMin?: numberExclude items older than this timestamp (seconds). (param=ot
)
Optional
num?: numberNumber of items per request. Default: 50
(param=n
)
Optional
sort?: "asc" | "desc"Date sort order. Default: desc
(param=r
)
Adds one or more tags (user-created or state) to the specified item(s). (POST /edit-tag
)
The item's ID, or an array of item IDs. (param=i
)
The tag, or an array of tags, to remove. Stream ID form is required, since both
a
)Removes one or more tag (user-created or state) from the specified item(s). (POST /edit-tag
)
The item's ID, or an array of item IDs. (param=i
)
The tag, or an array of tags, to remove. Stream ID form is required, since both
user-created and state tags can be referenced. (param=r
)
Renames a user-created tag (often a "category" or "folder" for a feed, or "label" for an item).
(POST /rename-tag
)
Current tag name/id. Stream ID form optional. (param=s
)
New tag name/id. Stream ID form optional. (param=dest
)
Static
ensureA utility method to ensure a string is in Stream ID form. If it is, the string is returned verbatim. If not, the specified stream type's prefix is prepended.
The input string.
The desired Stream ID form, only if the input is not already in Stream ID form.