Skip to content

Add create_feed_in_group #62

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

Merged
merged 1 commit into from
Jan 29, 2021
Merged
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
30 changes: 20 additions & 10 deletions adafruit_io/adafruit_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,16 +589,6 @@ def delete_data(self, feed_key, data_id):
return self._delete(path)

# Groups
def add_feed_to_group(self, group_key, feed_key):
"""
Adds an existing feed to a group
:param str group_key: Group
:param str feed_key: Feed to add to the group
"""
path = self._compose_path("groups/{0}/add".format(group_key))
payload = {"feed_key": feed_key}
return self._post(path, payload)

def create_new_group(self, group_key, group_description):
"""
Creates a new Adafruit IO Group.
Expand All @@ -625,6 +615,26 @@ def get_group(self, group_key):
path = self._compose_path("groups/{0}".format(group_key))
return self._get(path)

def create_feed_in_group(self, group_key, feed_name):
"""Creates a new feed in an existing group.
:param str group_key: Group name.
:param str feed_name: Name of new feed.

"""
path = self._compose_path("groups/{0}/feeds".format(group_key))
payload = {"feed": {"name": feed_name}}
return self._post(path, payload)

def add_feed_to_group(self, group_key, feed_key):
"""
Adds an existing feed to a group
:param str group_key: Group
:param str feed_key: Feed to add to the group
"""
path = self._compose_path("groups/{0}/add".format(group_key))
payload = {"feed_key": feed_key}
return self._post(path, payload)

# Feeds
def get_feed(self, feed_key, detailed=False):
"""
Expand Down