New features for Robots: Bundled Annotations, Inline Blips, Read-Only Roles
Wednesday, May 12, 2010 | 11:34 AM
Labels: Wave Developer Blog
Over the last few releases, we've been rolling out incremental improvements to the robots API, based on the feedback from all of you developers. For those of you who haven't been reading the forum waves and changelogs, here's a summary of the new features:
Bundled Annotations:
When you're adding new text to a blip, you often want to annotate that text with a particular set of annotations. In the past, you had to calculate the range of that text and use the annotate operation, like so:
blip.append('New text') blip.range(len(blip.text), len(blip.text)+8).annotate('style/fontWeight', 'bold')
This often led to off-by-1 errors and frustration. Now with bundled annotations, you can specify both the content to append and the annotation(s) to apply to that content, all in the same operation, like so:
blip.append('New Text', bundled_annotations=[('style/fontWeight', 'bold')])
For more information, read the announcement wave.
Inline Blip Positions:
Several robots produce alternate rendering of waves, like Mr. Ray and its "Wave Lite" view, and those robots needed to know the positions of inline blips inside other blips for a more accurate rendering. To help with this, we introduced a new attribute to the Blip classes to let robots access that position. For more info, see the Python or Java reference.
Read Only Roles:
A few months ago Google Wave launched the ability to have "Read-only" participants, which lets the creator of a wave set access rights for the other participants as either "full access" (the default) or "read only". We now offer that same ability in the API, so a robot that creates a wave can set the access rights of all the participants on the wave, like so:
new_wave.participants.set_role('public@a.gwave.com', wavelet.Participants.ROLE_READ_ONLY)
For more information, read the announcement wave.
Check out the new features, and let us know in the forum how you're using them in your robots.