com.github.scribejava.apis.FlickrApi Maven / Gradle / Ivy
package com.github.scribejava.apis;
import com.github.scribejava.core.builder.api.DefaultApi10a;
/**
* OAuth API for Flickr.
*
* @see Flickr API
*/
public class FlickrApi extends DefaultApi10a {
private static final String AUTHORIZE_URL = "https://www.flickr.com/services/oauth/authorize";
public enum FlickrPerm {
READ, WRITE, DELETE
};
/**
* read, write, or delete (delete includes read/write)
*/
private final String permString;
protected FlickrApi() {
permString = null;
}
protected FlickrApi(FlickrPerm perm) {
permString = perm.name().toLowerCase();
}
private static class InstanceHolder {
private static final FlickrApi INSTANCE = new FlickrApi();
}
public static FlickrApi instance() {
return InstanceHolder.INSTANCE;
}
public static FlickrApi instance(FlickrPerm perm) {
return perm == null ? instance() : new FlickrApi(perm);
}
/**
* {@inheritDoc}
*/
@Override
public String getAccessTokenEndpoint() {
return "https://www.flickr.com/services/oauth/access_token";
}
@Override
public String getAuthorizationBaseUrl() {
return permString == null ? AUTHORIZE_URL : AUTHORIZE_URL + "?perms=" + permString;
}
/**
* {@inheritDoc}
*/
@Override
public String getRequestTokenEndpoint() {
return "https://www.flickr.com/services/oauth/request_token";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy