[sync] API proposal..
Chuck Hagenbuch
chuck at horde.org
Sun Dec 28 20:40:40 PST 2003
Quoting Anthony Mills <amills at gascard.net>:
> Here is a list of functions that I think should be included in lib/api.php.
>
> function list();
> function list($action, $timestamp)
PHP doesn't do overloading like this, though you could just have list($action =
null, $timestamp = null) and do the default. We also have list() methods that
take other arguments, and list() methods that return various different formats.
It's kind of a mess - some of them take sorting options, also. I'm not really
sure how to clean that up.
> function get($uid);
> function get($object);
How would you differentiate these?
How about having a general get($uid, $format = null) method, that could take
either a single id or an array of ids (for batch fetching - so that maybe we
can just have list() return uids?), and optionally a format to specify the
format to return things in.
That *should* handle pretty much any use, and might clean up list to boot.
Though, still not sure what to do about the sorting - it should be able to be
specified in the call, since this is remote access.
> function set($uid, $object);
Okay... what about also specifying the format of $object, and allowing batch
operations, too?
> function compare($object, $object, $compareflag);
> function equals($object, $object);
Do we need those for syncml, and is it really the best to have them implemented
in each app?
> function convert($object, $contentType);
Sounds useful.
> I know some of these already exist. I am just putting them in a list
> for discussion.
Yup! We definitely have cleaning up/improvement to do here.
-chuck
--
Charles Hagenbuch, <chuck at horde.org>
"I'm really... I'm not too fascinated by green food." - Average Joe
More information about the sync
mailing list