Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includin...
If you think the Android project pocket4android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright (c) 2012-2014 Yu AOKI//www.java2s.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/package com.aokyu.dev.pocket;
import com.aokyu.dev.pocket.util.PocketUtils;
publicclass PocketServer {
privatestaticfinal String SERVER_URL = "https://getpocket.com";
privatestaticfinal String REDIRECT_FORMAT = "/auth/authorize?request_token=%s&redirect_uri=%s";
publicenum RequestType {
OAUTH_REQUEST("/v3/oauth/request"),
OAUTH_AUTHORIZE("/v3/oauth/authorize"),
ADD("/v3/add"),
MODIFY("/v3/send"),
RETRIEVE("/v3/get");
private String mEndpoint;
private RequestType(String endpoint) {
mEndpoint = endpoint;
}
private String getEndpoint() {
return mEndpoint;
}
}
publicstatic String getEndpoint(RequestType type) {
return SERVER_URL + type.getEndpoint();
}
publicstatic String getRedirectUrl(ConsumerKey consumerKey, RequestToken requestToken) {
String format = SERVER_URL + REDIRECT_FORMAT;
String redirectUrl =
String.format(format, requestToken.get(), PocketUtils.getRedirectUri(consumerKey));
return redirectUrl;
}
}