Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API to access Links #1276

Open
mmarum-sugarcrm opened this issue Jun 5, 2013 · 0 comments
Open

API to access Links #1276

mmarum-sugarcrm opened this issue Jun 5, 2013 · 0 comments

Comments

@mmarum-sugarcrm
Copy link
Member

Original author: [email protected] (April 06, 2012 19:51:53)

SPECIFICATION BUGS ONLY - Description
=====================================
I note that there is currently no API to access the collection of Link elements defined for a gadget spec. This seems like an important limitation.

As a Gadget developer, it would be handy to be able to define links such that I can reference them easily within code and have the container proxy the requests for me.. e.g. if I have...

<Module>
<ModulePrefs>
<Link rel="foo" href="http://example.org" authz="signed" />
<Link rel="foo" href="http://example.net" authz="oauth2" />
<Link rel="bar" href="http://example.com" authz="none" />
</ModulePrefs>
...
</Module>

Then within my Javascript code, I should be able to do something along the lines of...

osapi.links.foo[0].get().execute(function(result) {...});
osapi.links.foo[1].get().execute(function(result) {...});
osapi.links.bar.get().execute(function(result) {...});

And have the container fetch the linked resource for me with proper authentication handled.

Alternatively, we can add a label to Link's to differentiate between multiple instances of a single rel...

<Module>
<ModulePrefs>
<Link rel="foo" label="one" href="http://example.org" authz="signed" />
<Link rel="foo" label="two" href="http://example.net" authz="oauth2" />
<Link rel="bar" href="http://example.com" authz="none" />
</ModulePrefs>
...
</Module>

Such that...

osapi.links.foo["one"].get().execute(function(result) {...});
osapi.links.foo["two"].get().execute(function(result) {...});
osapi.links.bar.get().execute(function(result) {...});

I should also be able to reference the links using variable substitution... e.g.

<img src="${Links.foo.1}" />
<img src="${Links.foo.2}" />
<script src="${Links.bar}" />
<iframe src="${Links.foo.one}" />

And again, have the container proxy those links for me with appropriate authentication in place.

Document affected:
==================
1.) Please attach a patch for the document if appropriate.
2.) Post a thread at
http://groups.google.com/group/opensocial-and-gadgets-spec/topics
linking to this issue report.
3.) Post a comment on this issue, linking back to the thread.

Original issue: http://code.google.com/p/opensocial-resources/issues/detail?id=1291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant