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

io.formapi.PdfApi Maven / Gradle / Ivy

The newest version!
package io.formapi;

import io.formapi.CollectionFormats.*;

import retrofit2.Call;
import retrofit2.http.*;

import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import okhttp3.MultipartBody;

import io.formapi.AuthenticationError;
import io.formapi.AuthenticationSuccessResponse;
import io.formapi.CombinePdfsData;
import io.formapi.CombinedSubmission;
import io.formapi.CombinedSubmissionData;
import io.formapi.CreateCombinedSubmissionResponse;
import io.formapi.CreateCustomFileData;
import io.formapi.CreateCustomFileResponse;
import io.formapi.CreateFolderData;
import io.formapi.CreateSubmissionBatchResponse;
import io.formapi.CreateSubmissionDataRequestTokenResponse;
import io.formapi.CreateSubmissionResponse;
import io.formapi.CreateTemplateData;
import io.formapi.Error;
import java.io.File;
import io.formapi.Folder;
import io.formapi.InvalidRequest;
import io.formapi.MoveFolderData;
import io.formapi.MoveTemplateData;
import io.formapi.PendingTemplate;
import io.formapi.RenameFolderData;
import io.formapi.Submission;
import io.formapi.SubmissionBatch;
import io.formapi.SubmissionBatchData;
import io.formapi.SubmissionData;
import io.formapi.SubmissionDataRequest;
import io.formapi.Template;
import io.formapi.UpdateDataRequestResponse;
import io.formapi.UpdateSubmissionDataRequestData;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface PdfApi {
  /**
   * Generates multiple PDFs
   * 
   * @param templateId  (required)
   * @param requestBody  (required)
   * @return Call<List<CreateSubmissionResponse>>
   */
  @Headers({
    "Content-Type:application/json"
  })
  @POST("templates/{template_id}/submissions/batch")
  Call> batchGeneratePdfV1(
    @retrofit2.http.Path("template_id") String templateId, @retrofit2.http.Body List requestBody
  );

  /**
   * Generates multiple PDFs
   * 
   * @param submissionBatchData  (required)
   * @return Call<CreateSubmissionBatchResponse>
   */
  @Headers({
    "Content-Type:application/json"
  })
  @POST("submissions/batches")
  Call batchGeneratePdfs(
    @retrofit2.http.Body SubmissionBatchData submissionBatchData
  );

  /**
   * Merge submission PDFs, template PDFs, or custom files
   * 
   * @param combinePdfsData  (required)
   * @return Call<CreateCombinedSubmissionResponse>
   */
  @Headers({
    "Content-Type:application/json"
  })
  @POST("combined_submissions?v=2")
  Call combinePdfs(
    @retrofit2.http.Body CombinePdfsData combinePdfsData
  );

  /**
   * Merge generated PDFs together
   * 
   * @param combinedSubmissionData  (required)
   * @return Call<CreateCombinedSubmissionResponse>
   */
  @Headers({
    "Content-Type:application/json"
  })
  @POST("combined_submissions")
  Call combineSubmissions(
    @retrofit2.http.Body CombinedSubmissionData combinedSubmissionData
  );

  /**
   * Create a new custom file from a cached presign upload
   * 
   * @param createCustomFileData  (required)
   * @return Call<CreateCustomFileResponse>
   */
  @Headers({
    "Content-Type:application/json"
  })
  @POST("custom_files")
  Call createCustomFileFromUpload(
    @retrofit2.http.Body CreateCustomFileData createCustomFileData
  );

  /**
   * Creates a new data request token for form authentication
   * 
   * @param dataRequestId  (required)
   * @return Call<CreateSubmissionDataRequestTokenResponse>
   */
  @POST("data_requests/{data_request_id}/tokens")
  Call createDataRequestToken(
    @retrofit2.http.Path("data_request_id") String dataRequestId
  );

  /**
   * Create a folder
   * 
   * @param createFolderData  (required)
   * @return Call<Folder>
   */
  @Headers({
    "Content-Type:application/json"
  })
  @POST("folders/")
  Call createFolder(
    @retrofit2.http.Body CreateFolderData createFolderData
  );

  /**
   * Upload a new PDF template with a file upload
   * 
   * @param templateDocument  (required)
   * @param templateName  (required)
   * @param templateParentFolderId  (optional, default to null)
   * @return Call<PendingTemplate>
   */
  @retrofit2.http.Multipart
  @POST("templates")
  Call createTemplate(
    @retrofit2.http.Part("template[document]") MultipartBody.Part templateDocument, @retrofit2.http.Part("template[name]") String templateName, @retrofit2.http.Part("template[parent_folder_id]") String templateParentFolderId
  );

  /**
   * Create a new PDF template from a cached presign upload
   * 
   * @param createTemplateData  (required)
   * @return Call<PendingTemplate>
   */
  @Headers({
    "Content-Type:application/json"
  })
  @POST("templates?v=2")
  Call createTemplateFromUpload(
    @retrofit2.http.Body CreateTemplateData createTemplateData
  );

  /**
   * Delete a folder
   * 
   * @param folderId  (required)
   * @return Call<Folder>
   */
  @DELETE("folders/{folder_id}")
  Call deleteFolder(
    @retrofit2.http.Path("folder_id") String folderId
  );

  /**
   * Expire a combined submission
   * 
   * @param combinedSubmissionId  (required)
   * @return Call<CombinedSubmission>
   */
  @DELETE("combined_submissions/{combined_submission_id}")
  Call expireCombinedSubmission(
    @retrofit2.http.Path("combined_submission_id") String combinedSubmissionId
  );

  /**
   * Expire a PDF submission
   * 
   * @param submissionId  (required)
   * @return Call<Submission>
   */
  @DELETE("submissions/{submission_id}")
  Call expireSubmission(
    @retrofit2.http.Path("submission_id") String submissionId
  );

  /**
   * Generates a new PDF
   * 
   * @param templateId  (required)
   * @param submissionData  (required)
   * @return Call<CreateSubmissionResponse>
   */
  @Headers({
    "Content-Type:application/json"
  })
  @POST("templates/{template_id}/submissions")
  Call generatePDF(
    @retrofit2.http.Path("template_id") String templateId, @retrofit2.http.Body SubmissionData submissionData
  );

  /**
   * Check the status of a combined submission (merged PDFs)
   * 
   * @param combinedSubmissionId  (required)
   * @return Call<CombinedSubmission>
   */
  @GET("combined_submissions/{combined_submission_id}")
  Call getCombinedSubmission(
    @retrofit2.http.Path("combined_submission_id") String combinedSubmissionId
  );

  /**
   * Look up a submission data request
   * 
   * @param dataRequestId  (required)
   * @return Call<SubmissionDataRequest>
   */
  @GET("data_requests/{data_request_id}")
  Call getDataRequest(
    @retrofit2.http.Path("data_request_id") String dataRequestId
  );

  /**
   * Get a presigned URL so that you can upload a file to our AWS S3 bucket
   * 
   * @return Call<Map<String, Object>>
   */
  @GET("uploads/presign")
  Call> getPresignUrl();
    

  /**
   * Check the status of a PDF
   * 
   * @param submissionId  (required)
   * @param includeData  (optional)
   * @return Call<Submission>
   */
  @GET("submissions/{submission_id}")
  Call getSubmission(
    @retrofit2.http.Path("submission_id") String submissionId, @retrofit2.http.Query("include_data") Boolean includeData
  );

  /**
   * Check the status of a submission batch job
   * 
   * @param submissionBatchId  (required)
   * @param includeSubmissions  (optional)
   * @return Call<SubmissionBatch>
   */
  @GET("submissions/batches/{submission_batch_id}")
  Call getSubmissionBatch(
    @retrofit2.http.Path("submission_batch_id") String submissionBatchId, @retrofit2.http.Query("include_submissions") Boolean includeSubmissions
  );

  /**
   * Get a single template
   * 
   * @param templateId  (required)
   * @return Call<Template>
   */
  @GET("templates/{template_id}")
  Call