Sugar Network/Resources

From Sugar Labs
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The following diagram shows the full list of objects implemented by the Sugar Network API.

Sugar Network objects

Property types

Generally, Sugar Network objects' property types correspond to JSON types. The only exceptions mentioned in the following list:

  • enum, is an enumerated type when a value is a string from the predefined list of constants;
  • markdown, is a string formatted in the Markdown syntax;
  • blob, is a file represented by string value which is a SHA-1 digest of file's content; the file itself can be obtained from the GET /blobs/DIGEST request;
  • aggregated, is a list of JSON objects which has special API to treat its items; each aggregated item has a unique identifier; items might be created not only by the object's authors.

Resource.author

A list of authors working on the corresponding resource. List items are dictionaries with the following keys:

  • guid
    Author's guid in the Sugar Network; might be omitted if a particular author is not registered in the Sugar Network;
  • name
    Full author's name;
  • role
    An integer which is a bit-wise ORed value of the following constants:
    • 1, author is registered in the Sugar Network (and guid key is set);
    • 2, author is the original author of the corresponding resource; if it is not set, user is only a maintainer, e.g., an uploader of a book which has its original authors.

Resource.layer

This is a system level property to to track objects' condition. It is a list of states set by the system during the object life cycle. Users cannot directly write to this property. Currently supported states are:

  • featured, the object is popped up by node editors;
  • deleted, set after removing objects by users; right after user deletes, the object still remains in the system but becomes inaccessible to user requests;
  • favorite, applied to local Context objects only, set if a user has "stared" the context;
  • checkin, applied to local Context objects only, set if a user has "pinned" the context to keep its most recent version permanently in the local system;
  • stale, applied to local Context objects only, set if previously checked-in Context might have more fresh releases on the server; it is not possible to filter Contexts by this state;
  • inprogress, applied to local Context objects only, set if the Context is in the process of downloading content from the server; it is being temporally set before launching the Context of checking it in; it is not possible to filter Contexts by this state.

Context.type

Context types:

  • activity, Sugar activity;
  • book, books in various forms;
  • group, offline discussion groups;
  • package, GNU/Linux package metadata.

Context.releases

Contexts with activity or book types might have releases, i.e., activity or book versions that users can download. The releases property is aggregated where each item describes one particular version. There is no need in working with the releases property directly, there are high-level API commands to upload and download releases.

Post.type

  • review, Review the Context;
  • object, Object generated by Context application;
  • question, Q&A request;
  • answer, Q&A response;
  • issue, Propblem with the Context;
  • announce, General announcement;
  • notification, Auto-generated Post for updates within the Context;
  • feedback, Review parent Post;
  • post, General purpose dependent Post.