From 1ba7c0d60c21a9afa905bbcf8d4f2a06832b78f4 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Wed, 18 Jan 2023 08:38:06 +0000 Subject: [PATCH] Flickr demo: refactor to get photosets or interesting set --- ...essage_ tm-http-request Example Flickr.tid | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request Example Flickr.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request Example Flickr.tid index d2ce6b0bb..4f95e127a 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request Example Flickr.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request Example Flickr.tid @@ -1,7 +1,10 @@ title: WidgetMessage: tm-http-request Example - Flickr tags: $:/tags/Macro -\define flickr-get-album-items() + +\define flickr-get-items(method:"flickr.photosets.getPhotos",resultPhotoRoot:"photoset") \define completion() \import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] @@ -9,9 +12,9 @@ tags: $:/tags/Macro <$action-log/> <$list filter="[compare:number:gteq[200]compare:number:lteq[299]]" variable="ignore"> - <$list filter="[jsonindexes[photoset],[photo]]" variable="photoIndex"> + <$list filter="[jsonindexes,[photo]]" variable="photoIndex"> <$let - photoData={{{ [jsonextract[photoset],[photo],] }}} + photoData={{{ [jsonextract,[photo],] }}} photoFarm={{{ [jsonget[farm]] }}} photoServer={{{ [jsonget[server]] }}} photoID={{{ [jsonget[id]] }}} @@ -45,7 +48,7 @@ https://api.flickr.com/services/rest/ $message="tm-http-request" url=<> method="GET" - query-method="flickr.photosets.getPhotos" + query-method=<<__method__>> query-extras="geo" query-format="json" query-nojsoncallback="1" @@ -58,9 +61,18 @@ https://api.flickr.com/services/rest/ onprogress=<> var-start=<<__start__>> var-limit=<<__limit__>> + var-resultPhotoRoot=<<__resultPhotoRoot__>> /> \end +\define flickr-get-album-items() +<$macrocall $name="flickr-get-items" method="flickr.photosets.getPhotos" resultPhotoRoot="photoset"/> +\end + +\define flickr-get-interesting-items() +<$macrocall $name="flickr-get-items" method="flickr.interestingness.getList" resultPhotoRoot="photos"/> +\end + \define flickr-actions() <$macrocall $name="flickr-get-album-items"/> \end @@ -71,8 +83,14 @@ Flickr API Key: <$password name="flickr-api-key"/> Flickr album ID: <$edit-text tiddler="$:/config/flickr-album" tag="input"/> -<$button actions=<>> -Call Flickr +<$button> +<$macrocall $name="flickr-get-album-items"/> +Get Flickr album + + +<$button> +<$macrocall $name="flickr-get-interesting-items"/> +Get Flickr interesting items <$geomap