Daylite Client SDK

Daylite has several integration options. Here we try to illustrate those in a way best understood by someone with coding and scripting experience.

Client Side

There are 4 ways you can integrate with Daylite using the desktop app as the medium:

  • AppleScript: You can wrap fscript inside an applescript.
  • Direct Script: You can write fscript without requiring to wrap it in applescript
  • Distributed Objects: You can use NSConnection and NSDistant object to talk to Daylite from your Cocoa App - although the status of Distributed Objects and Sandboxing is opaque at this point.
  • Plugins: You can create an Cocoa plugin to add things like menus and tabs in the app itself.

Server Side

You can interact with the Daylite Server directly using 2 methods:

  • CalDAV: Daylite Server implement a CalDAV server and you can interact with it the same way iCal & Calendar do.
  • CardDAV: Daylite Server also implements a CardDAV server and you can interact with it the same way Contacts and AddressBook do.

Prerequisites

In order to take advantage of the API environments on the client side, you should be familiar with:

Daylite Application Architecture

Daylite (the desktop app) is a full Cocoa application written in Objective-C. It uses many common patterns in Cocoa and especially MVC. For integration purposes, the most common used part of that pattern is the M (Model).

While it's backed by a SQL database, you never talk to the database directly. Instead, you talk to the ObjectContext and the objects it returns or creates for you.

Daylite uses an ORM and abstracts all the SQL from you. The ORM in Daylite is loosely based on EOF with many simplifications and changes.

The key aspects you need to remember are:

  • All persistent data is created or fetched via the objectContext (an instance of DLPObjectContext)
  • Any persistent object is a subclass of MCPObject
  • You interact with persistent objects using valueForKey: or setValue:forKey: in Objective-C or you do a set: or in FScript (you can also use valueForKey: and setValue:forKey: in FScript). Updated objects are automatically saved.
  • You fetch objects using BDQualifiers or locums

Daylite Data Model

Daylite has a complex data structure comprising of a couple hundred database tables. We've exposed the most commonly used entities. Find the list here.

Daylite OptionsCache Keys

There is a set of objects that require special handing because they are used as options on objects (i.e. category or keywords). We keep these in the options cache and you access them using the optionsCache on the objectContext. You can find the list here.

Classes & Class Extensions

The API exposes some classes and extensions (objective-c categories) that can be used in both the FScript and Objective-C environments. You can find them here.

FScript

The key scripting language for Daylite on the client side is FScript. FScript is a smalltalk like language implemented using the objective-c runtime giving you access to tons of Cocoa goodness. The flexibility it gives you is a bit of a double-edged sword in the sense that you can do great things but you can also really mess things up, so you have to be careful. You can execute FScript in the following places in Daylite:

  • AppleScript
  • Direct Script - just called fscripts
  • Distributed Objects
  • PDF Reports
  • Interactive Reports

FScript Recipes

We've assembled some commonly used code snippets. For some people, the best way to learn is through examples. The concepts discussed on this page can also be applied in the Objective-C environment albeit with syntax changes.

Interactive Reports

In Daylite 4.1, we added the ability to create HTML based reports and print layouts that offer interactivity and the ability to use a plethora of javascript libraries. You can find more information here.