Пример #1
0
  public Integer deleteCreative(List<Long> creativeIds) throws ApiException {
    DeleteCreativeRequest request = new DeleteCreativeRequest();
    request.setCreativeIds(creativeIds);

    CreativeService creativeService = commonService.getService(CreativeService.class);
    DeleteCreativeResponse response = creativeService.deleteCreative(request);
    if (response == null) {
      try {
        TimeUnit.SECONDS.sleep(3);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      if (response != null) return response.getResult();
    }

    return -1;
  }
Пример #2
0
  public Integer deleteKeyword(List<Long> keywordIds) throws ApiException {
    DeleteKeywordRequest request = new DeleteKeywordRequest();
    request.setKeywordIds(keywordIds);

    KeywordService keywordService = commonService.getService(KeywordService.class);
    DeleteKeywordResponse response = keywordService.deleteKeyword(request);
    if (response == null) {
      try {
        TimeUnit.SECONDS.sleep(3);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      if (response != null) return response.getResult();
    }

    return -1;
  }
Пример #3
0
  public List<CreativeType> addCreative(List<CreativeType> list) throws ApiException {
    AddCreativeRequest request = new AddCreativeRequest();
    request.setCreativeTypes(list);

    CreativeService creativeService = commonService.getService(CreativeService.class);
    AddCreativeResponse response = creativeService.addCreative(request);
    if (response == null) {
      try {
        TimeUnit.SECONDS.sleep(3);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      if (response != null) return response.getCreativeTypes();
    }

    return Collections.emptyList();
  }
Пример #4
0
  public String deleteAdgroup(List<Long> adgroupIds) throws ApiException {
    DeleteAdgroupRequest request = new DeleteAdgroupRequest();
    request.setAdgroupIds(adgroupIds);

    AdgroupService adgroupService = commonService.getService(AdgroupService.class);
    DeleteAdgroupResponse response = adgroupService.deleteAdgroup(request);
    if (response == null) {
      try {
        TimeUnit.SECONDS.sleep(3);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      if (response != null) return response.getResponse();
    }

    return "";
  }
Пример #5
0
  public List<KeywordType> addKeyword(List<KeywordType> list) throws ApiException {
    AddKeywordRequest request = new AddKeywordRequest();
    request.setKeywordTypes(list);

    KeywordService keywordService = commonService.getService(KeywordService.class);
    AddKeywordResponse response = keywordService.addKeyword(request);
    if (response == null) {
      try {
        TimeUnit.SECONDS.sleep(3);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      if (response != null) return response.getKeywordTypes();
    }

    return Collections.emptyList();
  }