Пример #1
0
 /**
  * Returns the fully configured {@link OAuthService}
  *
  * @return fully configured {@link OAuthService}
  */
 public OAuthService build() {
   Preconditions.checkNotNull(api, "You must specify a valid api through the provider() method");
   Preconditions.checkEmptyString(apiKey, "You must provide an api key");
   Preconditions.checkEmptyString(apiSecret, "You must provide an api secret");
   return api.createService(
       new OAuthConfig(apiKey, apiSecret, callback, signatureType, scope, debugStream));
 }
Пример #2
0
 /**
  * Configures the api secret
  *
  * @param apiSecret The api secret for your application
  * @return the {@link ServiceBuilder} instance for method chaining
  */
 public ServiceBuilder apiSecret(String apiSecret) {
   Preconditions.checkEmptyString(apiSecret, "Invalid Api secret");
   this.apiSecret = apiSecret;
   return this;
 }
Пример #3
0
 /**
  * Configures the api key
  *
  * @param apiKey The api key for your application
  * @return the {@link ServiceBuilder} instance for method chaining
  */
 public ServiceBuilder apiKey(String apiKey) {
   Preconditions.checkEmptyString(apiKey, "Invalid Api key");
   this.apiKey = apiKey;
   return this;
 }
Пример #4
0
 /**
  * Configures the OAuth scope. This is only necessary in some APIs (like Google's).
  *
  * @param scope The OAuth scope
  * @return the {@link ServiceBuilder} instance for method chaining
  */
 public ServiceBuilder scope(String scope) {
   Preconditions.checkEmptyString(scope, "Invalid OAuth scope");
   this.scope = scope;
   return this;
 }