From 9e800327eafb41f302b7585f5629d2ae3464f632 Mon Sep 17 00:00:00 2001 From: mortenmg Date: Wed, 6 Sep 2017 16:18:21 +0200 Subject: [PATCH] Add Application Field get and update Added support for application.get_field and application.update_field --- pypodio2/areas.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/pypodio2/areas.py b/pypodio2/areas.py index cfd60f0..7751275 100644 --- a/pypodio2/areas.py +++ b/pypodio2/areas.py @@ -240,6 +240,35 @@ def list_in_space(self, space_id): """ return self.transport.GET(url='/app/space/%s/' % space_id) + def get_field(self, app_id, field_id): + """ + Returns all specifications for the given field + + :param app_id: Application ID + :type app_id: str or int + :param space_id: Space ID + :type space_id: str or int + + :return Python dict of JSON response with the apps that the given app depends on. + """ + return self.transport.GET(url='/app/%s/field/%s' % (app_id,field_id)) + + def update_field(self, app_id, field_id, attributes): + """ + Returns all specifications for the given field + + :param app_id: Application ID + :type app_id: str or int + :param space_id: Space ID + :type space_id: str or int + :param attributes: Updated field information. see https://developers.podio.com/doc/applications/update-an-app-field-22356 + :type attributes: json, can be created with json.load('{"label": "labelname",') if manual. + + :return Python dict of JSON response with app revision number if successful + """ + attributes = json.dumps(attributes) + return self.transport.PUT(url='/app/%s/field/%s' % (app_id, field_id), body=attributes, type='application/json') + class Task(Area): def get(self, **kwargs):