Skip to content

Commit bfbba77

Browse files
author
boncey
committed
Added Flickr endpoint (not yet tested)
1 parent 762e100 commit bfbba77

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package org.scribe.builder.api;
2+
3+
import org.scribe.builder.api.DefaultApi10a;
4+
import org.scribe.model.Token;
5+
import org.scribe.utils.OAuthEncoder;
6+
7+
/**
8+
* OAuth API for Flickr.
9+
* @author Darren Greaves
10+
* @see <a href="http://www.flickr.com/services/api/">Flickr API</a>
11+
*/
12+
public class FlickrApi extends DefaultApi10a
13+
{
14+
15+
/**
16+
* {@inheritDoc}
17+
*/
18+
@Override
19+
public String getAccessTokenEndpoint()
20+
{
21+
22+
return "http://www.flickr.com/services/oauth/access_token";
23+
}
24+
25+
26+
/**
27+
* {@inheritDoc}
28+
*/
29+
@Override
30+
public String getAuthorizationUrl(Token requestToken)
31+
{
32+
33+
return "http://www.flickr.com/services/oauth/authorize?oauth_token=" + requestToken.getToken();
34+
}
35+
36+
37+
/**
38+
* {@inheritDoc}
39+
*/
40+
@Override
41+
public String getRequestTokenEndpoint()
42+
{
43+
44+
return "http://www.flickr.com/services/oauth/request_token";
45+
}
46+
47+
48+
/**
49+
* Get request token endpoint with a callback URL.
50+
*
51+
* @param callbackUrl
52+
* @return
53+
*/
54+
public String getRequestTokenEndpoint(String callbackUrl)
55+
{
56+
57+
return String.format("%s?oauth_callback=%s", getRequestTokenEndpoint(), OAuthEncoder.encode(callbackUrl));
58+
}
59+
}

0 commit comments

Comments
 (0)