/**
   * Adds a File Attachment to a Comment
   *
   * @param id Comment ID
   * @param file File and metadata to be attached to Comment
   * @param fileName The name and extension of the File Attachment
   * @param contentType The MIME type of the File Attachment
   * @param fileCategoryId The category of the File Attachment, if it has been assigned to one
   * @return APIFileAttachment
   */
  public APIFileAttachment addFileAttachment(
      Long id, File file, String fileName, String contentType, Integer fileCategoryId)
      throws ApiException {
    Object postBody = null;
    byte[] postBinaryBody = null;

    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(
          400, "Missing the required parameter 'id' when calling addFileAttachment");
    }

    // verify the required parameter 'file' is set
    if (file == null) {
      throw new ApiException(
          400, "Missing the required parameter 'file' when calling addFileAttachment");
    }

    // create path and map variables
    String path =
        "/Comments/{id}/FileAttachments"
            .replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

    // query params
    List<Pair> queryParams = new ArrayList<Pair>();
    Map<String, String> headerParams = new HashMap<String, String>();
    Map<String, Object> formParams = new HashMap<String, Object>();

    if (file != null) formParams.put("file", file);
    if (fileName != null) formParams.put("file_name", fileName);
    if (contentType != null) formParams.put("content_type", contentType);
    if (fileCategoryId != null) formParams.put("file_category_id", fileCategoryId);

    final String[] accepts = {"application/json", "text/json"};
    final String accept = apiClient.selectHeaderAccept(accepts);

    final String[] contentTypes = {"multipart/form-data"};
    final String contentType1 = apiClient.selectHeaderContentType(contentTypes);

    String[] authNames = new String[] {};

    TypeRef returnType = new TypeRef<APIFileAttachment>() {};
    return apiClient.invokeAPI(
        path,
        "POST",
        queryParams,
        postBody,
        postBinaryBody,
        headerParams,
        formParams,
        accept,
        contentType1,
        authNames,
        returnType);
  }
  /**
   * Gets a Comments&#39;s File Attachments
   *
   * @param id A Comments&#39;s ID (COMMENT_ID)
   * @param updatedAfterUtc Optional, earliest date when file attachment was last updated.
   * @param skip Optional, number of file attachments to skip.
   * @param top Optional, maximum number of file attachments to return in the response.
   * @param countTotal true if total number of records should be returned in the response headers.
   * @return List<APIFileAttachment>
   */
  public List<APIFileAttachment> getFileAttachments(
      Long id, Date updatedAfterUtc, Integer skip, Integer top, Boolean countTotal)
      throws ApiException {
    Object postBody = null;
    byte[] postBinaryBody = null;

    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(
          400, "Missing the required parameter 'id' when calling getFileAttachments");
    }

    // create path and map variables
    String path =
        "/Comments/{id}/FileAttachments"
            .replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

    // query params
    List<Pair> queryParams = new ArrayList<Pair>();
    Map<String, String> headerParams = new HashMap<String, String>();
    Map<String, Object> formParams = new HashMap<String, Object>();

    queryParams.addAll(apiClient.parameterToPairs("", "updated_after_utc", updatedAfterUtc));

    queryParams.addAll(apiClient.parameterToPairs("", "skip", skip));

    queryParams.addAll(apiClient.parameterToPairs("", "top", top));

    queryParams.addAll(apiClient.parameterToPairs("", "count_total", countTotal));

    final String[] accepts = {"application/json"};
    final String accept = apiClient.selectHeaderAccept(accepts);

    final String[] contentTypes = {"application/json"};
    final String contentType = apiClient.selectHeaderContentType(contentTypes);

    String[] authNames = new String[] {};

    TypeRef returnType = new TypeRef<List<APIFileAttachment>>() {};
    return apiClient.invokeAPI(
        path,
        "GET",
        queryParams,
        postBody,
        postBinaryBody,
        headerParams,
        formParams,
        accept,
        contentType,
        authNames,
        returnType);
  }
Exemplo n.º 3
0
  /**
   * Gets a list of Tags used for a record type This endpoint returns a list of tags associated with
   * a record type. The endpoint expects the query parameter
   * record_type=contacts|leads|opportunities|organisations|projects|emails, so to fetch a list of
   * tags associated with contacts, your query would be /Tags?record_type=contacts
   *
   * @param recordType Required, filters tags by a given record type.
   * @param skip Optional, number of records to skip.
   * @param top Optional, maximum number of records to return in the response.
   * @param countTotal Optional, true if total number of records should be returned in the response
   *     headers.
   * @return List<APITag>
   */
  public List<APITag> getTags(String recordType, Integer skip, Integer top, Boolean countTotal)
      throws ApiException {
    Object postBody = null;
    byte[] postBinaryBody = null;

    // verify the required parameter 'recordType' is set
    if (recordType == null) {
      throw new ApiException(
          400, "Missing the required parameter 'recordType' when calling getTags");
    }

    // create path and map variables
    String path = "/Tags".replaceAll("\\{format\\}", "json");

    // query params
    List<Pair> queryParams = new ArrayList<Pair>();
    Map<String, String> headerParams = new HashMap<String, String>();
    Map<String, Object> formParams = new HashMap<String, Object>();

    queryParams.addAll(apiClient.parameterToPairs("", "record_type", recordType));

    queryParams.addAll(apiClient.parameterToPairs("", "skip", skip));

    queryParams.addAll(apiClient.parameterToPairs("", "top", top));

    queryParams.addAll(apiClient.parameterToPairs("", "count_total", countTotal));

    final String[] accepts = {"application/json"};
    final String accept = apiClient.selectHeaderAccept(accepts);

    final String[] contentTypes = {"application/json"};
    final String contentType = apiClient.selectHeaderContentType(contentTypes);

    String[] authNames = new String[] {};

    TypeRef returnType = new TypeRef<List<APITag>>() {};
    return apiClient.invokeAPI(
        path,
        "GET",
        queryParams,
        postBody,
        postBinaryBody,
        headerParams,
        formParams,
        accept,
        contentType,
        authNames,
        returnType);
  }
  /**
   * Gets a Comment
   *
   * @param id A Comments&#39;s ID
   * @return APIComment
   */
  public APIComment getComment(Long id) throws ApiException {
    Object postBody = null;
    byte[] postBinaryBody = null;

    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling getComment");
    }

    // create path and map variables
    String path =
        "/Comments/{id}"
            .replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

    // query params
    List<Pair> queryParams = new ArrayList<Pair>();
    Map<String, String> headerParams = new HashMap<String, String>();
    Map<String, Object> formParams = new HashMap<String, Object>();

    final String[] accepts = {"application/json"};
    final String accept = apiClient.selectHeaderAccept(accepts);

    final String[] contentTypes = {"application/json"};
    final String contentType = apiClient.selectHeaderContentType(contentTypes);

    String[] authNames = new String[] {};

    TypeRef returnType = new TypeRef<APIComment>() {};
    return apiClient.invokeAPI(
        path,
        "GET",
        queryParams,
        postBody,
        postBinaryBody,
        headerParams,
        formParams,
        accept,
        contentType,
        authNames,
        returnType);
  }