All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.echobox.api.tiktok.client.TikTokClient Maven / Gradle / Ivy

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.echobox.api.tiktok.client;

import com.echobox.api.tiktok.connection.Connection;
import com.echobox.api.tiktok.model.HasCursor;
import com.echobox.api.tiktok.version.Version;

/**
 * Interface for TikTok client to communicate with API
 * @author eddspencer
 */
public interface TikTokClient {
  
  /**
   * Get the current API version
   * @return the current API version
   */
  Version getVersion();
  
  /**
   * Fetches a single API object, mapping the result to an instance of {@code responseType}.
   *
   * @param  Java type to map response to
   * @param endpoint the endpoint to get
   * @param responseType response type token
   * @param parameters URL parameters to include in the API call (optional)
   * @return instance of type {@code responseType} which contains the response data
   */
   T fetchObject(String endpoint, Class responseType, Parameter... parameters);
  
  /**
   * Fetches a connection that allows you to get lists of data from the API in pages, mapping the
   * result to an instance of {@code responseType}. This response will contain a list of data of
   * the type T, which will get returned by the connection.
   *
   * @param   Java type to map data to
   * @param   Java type to map response to
   * @param endpoint the endpoint to get
   * @param responseType response type token
   * @param parameters URL parameters to include in the API call (optional)
   * @return connection to list objects
   */
  > Connection fetchConnection(String endpoint, Class responseType,
      Parameter... parameters);
  
  /**
   * Performs a API publish operation on the given {@code endpoint}, mapping the result
   * to an instance of {@code responseType}.
   *
   * @param  Java type to map response to
   * @param endpoint endpoint to publish to
   * @param responseType response type token
   * @param data The data to publish
   * @param parameters URL parameters to include in the API call (optional)
   * @return instance of type {@code responseType} which contains the response data
   */
   T publish(String endpoint, Class responseType, Object data, Parameter... parameters);
  
  /**
   * Obtains an access and refresh tokens which can be used to perform API operations from the
   * authorization_code grant type
   *
   * @param appId id of the app for which you'd like to obtain the tokens
   * @param appSecret secret for the app for which you'd like to obtain the tokens
   * @param authCode authentication code in the API callback to the redirect URI.
   * @param redirectURI the redirectURI which the client will be directed to.
   * @return authentication tokens returned from the API
   */
  AuthTokensV2 obtainAuthTokensFromAuthCodeV2(String appId, String appSecret, String authCode,
      String redirectURI);
  
  /**
   * Obtains an access and refresh tokens which can be used to perform API operations from the
   * refresh_token grant type
   *
   * @param appId id of the app for which you'd like to obtain the tokens
   * @param appSecret secret for the app for which you'd like to obtain the tokens
   * @param refreshToken refresh token to use
   * @return authentication tokens returned from the API
   */
  AuthTokensV2 obtainAuthTokensFromRefreshTokenV2(String appId, String appSecret,
      String refreshToken);
  
  /**
   * Gets the {@code WebRequestor} used to talk to the API endpoints.
   *
   * @return the {@code WebRequestor} used to talk to the API endpoints.
   */
  WebRequestor getWebRequestor();
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy