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

jp.co.yahoo.adssearchapi.v12.YahooJapanAdsApiClient Maven / Gradle / Ivy

The newest version!
// DO NOT EDIT THIS FILE, THIS FILE IS AUTO GENERATED!
package jp.co.yahoo.adssearchapi.v12;

import jp.co.yahoo.adssearchapi.v12.oauth2.OAuth2TokenService;
import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

public class YahooJapanAdsApiClient extends ApiClient {

  private static final String USER_AGENT = "Java/jp.co.yahoo.api-ads:ads-search-api-lib:8.1.1-spring5";

  private final OAuth2TokenService oAuth2TokenService;

  public YahooJapanAdsApiClient(String clientId, String clientSecret, String refreshToken) {
    this(new OAuth2TokenService(clientId, clientSecret, refreshToken));
  }

  public YahooJapanAdsApiClient(OAuth2TokenService oAuth2TokenService) {
    super();
    setUserAgent(USER_AGENT);
    this.oAuth2TokenService = oAuth2TokenService;
  }

  public YahooJapanAdsApiClient(String clientId, String clientSecret, String refreshToken, RestTemplate restTemplate) {
    this(new OAuth2TokenService(clientId, clientSecret, refreshToken), restTemplate);
  }

  public YahooJapanAdsApiClient(OAuth2TokenService oAuth2TokenService, RestTemplate restTemplate) {
    super(restTemplate);
    setUserAgent(USER_AGENT);
    this.oAuth2TokenService = oAuth2TokenService;
  }

  @Override
  protected void updateParamsForAuth(String[] authNames, MultiValueMap queryParams, HttpHeaders headerParams, MultiValueMap cookieParams) {
    headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + oAuth2TokenService.getAccessToken());
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy