Skip to content

add iter in FeedlyData #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion feedly/api_client/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class FeedlyData:
def __init__(self, json:Dict[str,Any], client:APIClient=None):
self._json = json
self._client = client

def _onchange(self):
# sub classes should clear any cached items here
pass
Expand All @@ -33,6 +34,10 @@ def __getitem__(self, name):
def __setitem__(self, key, value):
self.json[key] = value

def __contains__(self, item):
return item in self._json


class IdStream(StreamBase):
"""
stream entry ids, e.g. https://developers.feedly.com/v3/streams/#get-a-list-of-entry-ids-for-a-specific-stream
Expand All @@ -49,7 +54,6 @@ def __init__(self, client:APIClient, id_:str, options:StreamOptions):
super().__init__(client, id_, options, 'contents', 'items', Entry)



class Streamable(FeedlyData):
def _get_id(self):
return self['id']
Expand All @@ -67,6 +71,7 @@ def stream_ids(self, options:StreamOptions=None):
def __repr__(self):
return f'<{type(self).__name__}: {self._get_id()}>'


class TagBase(Streamable):

def tag_entry(self, entry_id:str):
Expand All @@ -90,6 +95,7 @@ class UserTag(TagBase):
def stream_id(self):
return UserStreamId(self['id'], self['id'].split('/'))


class EnterpriseCategory(Streamable):

@property
Expand Down Expand Up @@ -118,6 +124,7 @@ def delete(self):
"""
self._client.do_api_request('v3/enterprise/tags/'+quote_plus(self.stream_id.id)+'?deleteContent=true', method='delete')


class Entry(FeedlyData):
pass

Expand Down