pub struct FeedlyApi { /* private fields */ }
Implementations§
Source§impl FeedlyApi
impl FeedlyApi
Sourcepub fn new(
client_id: String,
client_secret: String,
access_token: AccessToken,
refresh_token: RefreshToken,
token_expires: DateTime<Utc>,
) -> Result<FeedlyApi, ApiError>
pub fn new( client_id: String, client_secret: String, access_token: AccessToken, refresh_token: RefreshToken, token_expires: DateTime<Utc>, ) -> Result<FeedlyApi, ApiError>
Create a new FeedlyApi instance
client_id
: identifies the client making requests to feedlyclient_secret
: issued by feedly staff together withclient_id
access_token
: access token received after sucessfull oauth processrefresh_token
: received together withaccess_token
, used to refresh it when expiredtoken_expires
: point in time whenaccess_token
expires and has to refreshed
Sourcepub fn login_url(client_id: &str, client_secret: &str) -> Result<Url, ApiError>
pub fn login_url(client_id: &str, client_secret: &str) -> Result<Url, ApiError>
Generate OAuth login URL.
Sourcepub fn parse_redirected_url(url: &Url) -> Result<AuthCode, ApiError>
pub fn parse_redirected_url(url: &Url) -> Result<AuthCode, ApiError>
Parse the redirected URL after login via OAuth.
Returns the AuthCode
needed to continue with the login process.
Sourcepub fn redirect_uri() -> Result<Url, ApiError>
pub fn redirect_uri() -> Result<Url, ApiError>
Base URL of the desired redirect URL. Will contain the AuthCode
and can be fed into parse_redirected_url
.
Sourcepub async fn initialize_user_id(&self, client: &Client) -> Result<(), ApiError>
pub async fn initialize_user_id(&self, client: &Client) -> Result<(), ApiError>
Will fetch the user id from feedly if not already done so.
Sourcepub fn parse_expiration_date(
expires_in: &str,
) -> Result<DateTime<Utc>, ApiError>
pub fn parse_expiration_date( expires_in: &str, ) -> Result<DateTime<Utc>, ApiError>
Parse expiration date of access_token
to rust NaiveDateTime
.
Sourcepub fn gernerate_feed_id(url: &Url) -> String
pub fn gernerate_feed_id(url: &Url) -> String
Generate a feedly feed id from a feed URL (not a website URL).
Sourcepub async fn generate_category_id(
&self,
title: &str,
client: &Client,
) -> Result<String, ApiError>
pub async fn generate_category_id( &self, title: &str, client: &Client, ) -> Result<String, ApiError>
Generate a category id based on its name and the user id.
Sourcepub async fn generate_tag_id(
&self,
title: &str,
client: &Client,
) -> Result<String, ApiError>
pub async fn generate_tag_id( &self, title: &str, client: &Client, ) -> Result<String, ApiError>
Generate a tag id based on its name and the user id.
Sourcepub async fn category_all(&self, client: &Client) -> Result<String, ApiError>
pub async fn category_all(&self, client: &Client) -> Result<String, ApiError>
The id of the global all
tag of feedly.
Sourcepub async fn tag_marked(&self, client: &Client) -> Result<String, ApiError>
pub async fn tag_marked(&self, client: &Client) -> Result<String, ApiError>
The id of the global saved
tag of feedly (starred articles).
Sourcepub async fn tag_read(&self, client: &Client) -> Result<String, ApiError>
pub async fn tag_read(&self, client: &Client) -> Result<String, ApiError>
The id of the global read
tag of feedly.
Sourcepub async fn request_auth_token(
client_id: &str,
client_secret: &str,
auth_code: AuthCode,
client: &Client,
) -> Result<AccessTokenResponse, ApiError>
pub async fn request_auth_token( client_id: &str, client_secret: &str, auth_code: AuthCode, client: &Client, ) -> Result<AccessTokenResponse, ApiError>
Generate a access_token
from the AuthCode
parsed from the redirect URL after successful OAuth.
Sourcepub async fn refresh_auth_token(
&self,
client: &Client,
) -> Result<RefreshTokenResponse, ApiError>
pub async fn refresh_auth_token( &self, client: &Client, ) -> Result<RefreshTokenResponse, ApiError>
Refresh the access_token
after it expired.
pub async fn get_profile(&self, client: &Client) -> Result<Profile, ApiError>
pub async fn update_profile( &self, client: &Client, email: Option<String>, given_name: Option<String>, family_name: Option<String>, picture: Option<String>, gender: Option<bool>, locale: Option<String>, twitter: Option<String>, facebook: Option<String>, ) -> Result<Profile, ApiError>
pub async fn get_categories( &self, client: &Client, ) -> Result<Vec<Category>, ApiError>
pub async fn get_collections( &self, client: &Client, ) -> Result<Vec<Collection>, ApiError>
pub async fn get_collection( &self, id: &str, client: &Client, ) -> Result<Vec<Collection>, ApiError>
pub async fn update_category( &self, id: &str, label: &str, client: &Client, ) -> Result<(), ApiError>
pub async fn delete_category( &self, id: &str, client: &Client, ) -> Result<(), ApiError>
pub async fn get_subsriptions( &self, client: &Client, ) -> Result<Vec<Subscription>, ApiError>
pub async fn create_or_update_collection( &self, collection: CollectionInput, client: &Client, ) -> Result<(), ApiError>
pub async fn add_feeds_to_collection( &self, collection_id: &str, feeds: Vec<CollectionFeedInput>, client: &Client, ) -> Result<(), ApiError>
pub async fn remove_feeds_from_collection( &self, collection_id: &str, feeds: Vec<CollectionFeedInput>, client: &Client, ) -> Result<(), ApiError>
Sourcepub async fn add_subscription(
&self,
subscription: SubscriptionInput,
client: &Client,
) -> Result<(), ApiError>
pub async fn add_subscription( &self, subscription: SubscriptionInput, client: &Client, ) -> Result<(), ApiError>
Also updates existing subscriptions.
Sourcepub async fn update_subscriptions(
&self,
subscriptions: Vec<SubscriptionInput>,
client: &Client,
) -> Result<(), ApiError>
pub async fn update_subscriptions( &self, subscriptions: Vec<SubscriptionInput>, client: &Client, ) -> Result<(), ApiError>
Same as add_subscription
but update multiple subscriptions at once.
pub async fn delete_subscription( &self, id: &str, client: &Client, ) -> Result<(), ApiError>
Sourcepub async fn tag_entry(
&self,
entry_id: &str,
tag_ids: Vec<&str>,
client: &Client,
) -> Result<(), ApiError>
pub async fn tag_entry( &self, entry_id: &str, tag_ids: Vec<&str>, client: &Client, ) -> Result<(), ApiError>
Add a tag to an entry (also used to mark entries as read or starred etc.).
Sourcepub async fn tag_entries(
&self,
entry_ids: Vec<&str>,
tag_ids: Vec<&str>,
client: &Client,
) -> Result<(), ApiError>
pub async fn tag_entries( &self, entry_ids: Vec<&str>, tag_ids: Vec<&str>, client: &Client, ) -> Result<(), ApiError>
Same as tag_entry
but for multiple entries at once.
pub async fn update_tag( &self, tag_id: &str, label: &str, client: &Client, ) -> Result<(), ApiError>
pub async fn untag_entries( &self, entry_ids: Vec<&str>, tag_ids: Vec<&str>, client: &Client, ) -> Result<(), ApiError>
pub async fn get_entries( &self, entry_ids: Vec<&str>, client: &Client, ) -> Result<Vec<Entry>, ApiError>
pub async fn create_entry( &self, entry: Entry, client: &Client, ) -> Result<Vec<String>, ApiError>
pub async fn get_stream( &self, stream_id: &str, continuation: Option<String>, count: Option<u32>, ranked: Option<&str>, unread_only: Option<bool>, newer_than: Option<u64>, client: &Client, ) -> Result<Stream, ApiError>
pub async fn get_unread_counts( &self, client: &Client, ) -> Result<Counts, ApiError>
pub async fn mark_entries_read( &self, entry_ids: Vec<&str>, client: &Client, ) -> Result<(), ApiError>
pub async fn mark_entries_unread( &self, entry_ids: Vec<&str>, client: &Client, ) -> Result<(), ApiError>
pub async fn mark_feeds_read( &self, feed_ids: Vec<&str>, client: &Client, ) -> Result<(), ApiError>
pub async fn mark_categories_read( &self, category_ids: Vec<&str>, client: &Client, ) -> Result<(), ApiError>
pub async fn mark_entries_saved( &self, entry_ids: Vec<&str>, client: &Client, ) -> Result<(), ApiError>
pub async fn mark_entries_unsaved( &self, entry_ids: Vec<&str>, client: &Client, ) -> Result<(), ApiError>
pub async fn export_opml(&self, client: &Client) -> Result<String, ApiError>
pub async fn import_opml( &self, opml: &str, client: &Client, ) -> Result<(), ApiError>
Sourcepub async fn search_feedly_cloud(
client: &Client,
query: &str,
count: Option<u32>,
locale: Option<&str>,
) -> Result<SearchResult, ApiError>
pub async fn search_feedly_cloud( client: &Client, query: &str, count: Option<u32>, locale: Option<&str>, ) -> Result<SearchResult, ApiError>
Search the feedly cloud for new feeds to subscribe to
§Arguments
client
- reqwest::Clientquery
- Can be a feed url, a site title, a site url or a #topic.count
- Number of results. Default value is 20.locale
- Locale hint for the search engine to return feeds in that localse (e.g. “pt”, “fr_FR”).