Sugar Network/API: Difference between revisions

No edit summary
Cleanup page, since there is Object model
Line 2: Line 2:


== Overview ==
== Overview ==
To better understand this API, see technical explanation of the [[Platform_Team/Sugar_Network/Architecture#Conceptual_level|conceptual level]].


The API operates with [[#Resources|resources]] that are collections of objects. All objects are identified by global unique identifiers, GUIDs. Resources might support [[#Actions|common actions]]. While processing requests, server might generate [[#events|events]]. There are [[#Events|common events]] that all resources might generate.
The API operates with [[#Resources|resources]] that are collections of objects. All objects are identified by global unique identifiers, GUIDs. Resources might support [[#Actions|common actions]]. While processing requests, server might generate [[#events|events]]. There are [[#Events|common events]] that all resources might generate.
Line 109: Line 111:
Events:
Events:
: {{Code|type: update}}
: {{Code|type: update}}
=== Events ===
All events have the following common properties:
* {{Code|type}}, ''str''<br>the type of event;
* {{Code|timestamp}}, ''int''<br>the UNIX seconds in UTC timezone of the time when event was created;
* {{Code|resource}}, ''str''<br>the name of affected resource;
* {{Code|object}}, ''guid''<br>the GUID of affected resource object;
* {{Code|creator}}<br>the GUID of a ''player'' the event was created on behalf of.
Different types of events might add new options.
There are the following common event types:
: The particular resource was created:
:* {{Code|type: create}}
: The particular resource properties were modified:
:* {{Code|type: update}}
: The particular resource was deleted (hidden):
:* {{Code|type: delete}}


== Resources ==
== Resources ==


=== player ===
=== player ===
Properties:
:* {{Code|nickname}}, ''str'', ''read''<br>set by Sugar Shell;
:* {{Code|color}}, ''str'', ''read''<br>colors pair in format {{Code|#RRGGBB,#RRGGBB}}, set by Sugar Shell.
Calculated properties:
:* {{Code|reputation}}, ''int'', ''read''<br>current ''player'''s reputation based on:
:** direct votes from other players,
:** votes given to objects where the ''player'' is a creator;
:* {{Code|vote}}, ''bool'', ''read'', ''write''<br>did url requester voted for the current object or not;


Actions:
Actions:
Line 163: Line 132:
:* {{Code|type: message}}.
:* {{Code|type: message}}.


=== project ===
=== context ===
 
Properties:
:* {{Code|title}}, ''str'', ''read'', ''write'' only for the team members<br>one line title;
description;
:* {{Code|type}}, ''str'', ''read'', ''write'' only for the team members<br>the project type:
:** {{Code|general}},
:** {{Code|activity}},
:** {{Code|wiki}},
:** {{Code|gallery}};
:* {{Code|zoom}}, ''str'', ''read'', ''write'' only for the team members<br>Network Zoom level that project belongs:
:** {{Code|worldwide}},
:** {{Code|neighbourhood}},
:** {{Code|private}}.
 
Calculated properties:
:* {{Code|reputation}}, ''int'', ''read''<br>current ''project'''s reputation based on:
:** direct votes from other players,
:** votes given to related objects if theirs ''respect'' property is empty;
:* {{Code|vote}}, ''bool'', ''read'', ''write''<br>did url requester voted for the current object or not.


Actions:
Actions:
Line 207: Line 157:


=== question ===
=== question ===
Properties:
:* {{Code|project}}, ''guid'', ''read''<br>the ''project'' this object belongs to;
:* {{Code|title}}, ''str'', ''read'', ''write'' only for creator<br>one line title;
:* {{Code|solution}}, ''guid'', ''read'', ''write'' only by creator<br>the ''solution'' which solves the object.
Calculated properties:
:* {{Code|implementation_status}}, ''str'', ''read''<br>if ''question'' has an associated ''objective'', this ''objective'''s status is a status of the ''question'', otherwise the property is empty.


Actions:
Actions:
Line 220: Line 162:


=== idea ===
=== idea ===
Properties:
:* {{Code|project}}, ''guid'', ''read''<br>the ''project'' this object belongs to;
:* {{Code|title}}, ''str'', ''read'', ''write'' only for creator<br>one line title.
Calculated properties:
:* {{Code|implementation_status}}, ''str'', ''read''<br>if ''idea'' has an associated ''objective'', this ''objective'''s status is a status of the ''idea'', otherwise the property is empty.


Actions:
Actions:
Line 233: Line 168:
=== problem ===
=== problem ===


Properties:
Actions:
:* {{Code|project}}, ''guid'', ''read''<br>the ''project'' this object belongs to;
* [[#Wiki_actions|Wiki related actions]] to manage object description.
:* {{Code|title}}, ''str'', ''read'', ''write'' only for creator<br>one line title;
:* {{Code|solution}}, ''guid'', ''read'', ''write'' only by creator<br>the ''solution'' which solves the object.


Calculated properties:
=== review ===
:* {{Code|implementation_status}}, ''str'', ''read''<br>if ''problem'' has an associated ''objective'', this ''objective'''s status is a status of the ''problem'', otherwise the property is empty.


Actions:
Actions:
Line 245: Line 177:


=== wiki ===
=== wiki ===
Properties:
:* {{Code|project}}, ''guid'', ''read''<br>the ''project'' this object belongs to;
:* {{Code|title}}, ''str'', ''read'', ''write'' only for creator<br>one line title.


Actions:
Actions:
Line 254: Line 182:


=== gallery ===
=== gallery ===
Properties:
:* {{Code|project}}, ''guid'', ''read''<br>the ''project'' this object belongs to;
:* {{Code|title}}, ''str'', ''read'', ''write'' only for creator<br>one line title.


Actions:
Actions:
Line 279: Line 203:
: {{Code|type: update}}
: {{Code|type: update}}


=== objective ===
=== version ===
 
Properties:
:* {{Code|project}}, ''guid'', ''read''<br>the ''project'' this object belongs to;
:* {{Code|title}}, ''str'', ''read'', ''write'' only for the team members<br>one line title.
 
Actions:
* [[#Wiki_actions|Wiki related actions]] to manage object description.
 
=== release ===
 
Properties:
:* {{Code|project}}, ''guid'', ''read''<br>the ''project'' this object belongs to;
:* {{Code|version}}, ''str'', ''read''<br>release version;
:* {{Code|stability}}, ''str'', ''read''<br>release stability level, the same as for Zero Install/Sweets.


Actions:
Actions:
Line 299: Line 209:


=== report ===
=== report ===
Properties:
:* {{Code|release}}, ''guid'', ''read''<br>the ''release'' this object belongs to.


Actions:
Actions:
Line 327: Line 234:


The solution for ''question''/''idea''/''problem'' objects.
The solution for ''question''/''idea''/''problem'' objects.
Properties:
:* {{Code|resource}}, ''str'', ''read''<br>the type of resource this solution is for;
:* {{Code|object}}, ''guid'', ''read''<br>the resource object this solution is for.


Actions:
Actions:
Line 336: Line 239:


=== comment ===
=== comment ===
Properties:
:* {{Code|resource}}, ''str'', ''read''<br>the type of resource this comment is about;
:* {{Code|object}}, ''guid'', ''read''<br>the resource object this comment is about;
:* {{Code|text}}, ''str'', ''read'', ''write'' only for creator<br>comment text.


=== event ===
=== event ===
Properties:
: No specific properties except the [[#Events|common]] ones.


Actions:
Actions: