]> git.mxchange.org Git - friendica.git/commitdiff
API: add private value (bool) to item results (#5647)
authorfabrixxm <fabrix.xm@gmail.com>
Thu, 23 Aug 2018 14:09:50 +0000 (16:09 +0200)
committerHypolite Petovan <mrpetovan@eml.cc>
Thu, 23 Aug 2018 14:09:50 +0000 (10:09 -0400)
* API: add private value (bool) to item results

friendica:private for xml
friendica_privarte for json

* API Docs: add a section about custom value returned in status data

doc/api.md
include/api.php

index 08fca74fa443e1bff940f2b745dc19a109e9ad9c..07813b6a7715c243f91f06cd4dc19e974e88552d 100644 (file)
@@ -634,6 +634,73 @@ Friendica doesn't allow showing the friends of other users.
 * trim_user
 * contributor_details
 
+---
+
+### Return values for statuses/* api calls
+
+Returned status object is conform to GNU Social/Twitter api.
+
+Friendica adds some addictional fields:
+
+- owner: a user object, it's the owner of the item.
+- private: boolean, true if the item is marked as private
+- activities: map with activities related to the item. Every activity is a list of user objects.
+
+This properties are prefixed with "friendica_" in JSON responses and namespaced under "http://friendi.ca/schema/api/1/" in XML responses
+
+JSON:
+
+```json
+[
+       {
+               // ...
+               'friendica_owner' : {
+                       // user object
+               },
+               'friendica_private' : true,
+               'friendica_activities': {
+                       'like': [
+                               {
+                                       // user object 
+                               },
+                               // ...
+                       ],
+                       'dislike': [],
+                       'attendyes': [],
+                       'attendno': [],
+                       'attendmaybe': []
+               }
+       },
+       // ...
+]
+```
+
+XML:
+
+```xml
+<statuses xmlns="http://api.twitter.com" xmlns:statusnet="http://status.net/schema/api/1/" xmlns:friendica="http://friendi.ca/schema/api/1/" xmlns:georss="http://www.georss.org/georss">
+  <status>
+       <!-- ... -->
+       <friendica:owner><!-- user object --></friendica:owner>
+       <friendica:private>true</friendica:private>
+       <friendica:activities>
+               <friendica:like>
+               <user>
+                       <!-- user object -->
+               </user>
+               <!-- ... --->
+               </friendica:like>
+               <friendica:dislike/>
+               <friendica:attendyes/>
+               <friendica:attendno/>
+               <friendica:attendmaybe/>
+       </friendica:activities> 
+       </status>
+       <!-- ... -->
+</statuses>
+```
+
+
 ---
 
 ### statusnet/config (*)
index 7450d650eb4f90ed7b31d0aaa4dba261e400815d..f40674b8941968a3e351dcc43981f98deed32b95 100644 (file)
@@ -2888,6 +2888,7 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json")
                        'favorited' => $item['starred'] ? true : false,
                        'user' =>  $status_user ,
                        'friendica_owner' => $owner_user,
+                       'friendica_private' => $item['private'] == 1,
                        //'entities' => NULL,
                        'statusnet_html' => $converted["html"],
                        'statusnet_conversation_id' => $item['parent'],