Class FilesApi


  • public class FilesApi
    extends Object
    FilesApi has methods for interacting with all endpoints in the API set
    • Constructor Detail

      • FilesApi

        public FilesApi()
        FilesApi
      • FilesApi

        public FilesApi​(ApiClient apiClient)
        FilesApi
        Parameters:
        apiClient - ApiClient pass into the new instance of this class
    • Method Detail

      • getInstance

        public static FilesApi getInstance​(ApiClient apiClient)
        FilesApi getInstance
        Parameters:
        apiClient - ApiClient pass into the new instance of this class
        Returns:
        instance of this class
      • getApiClient

        public ApiClient getApiClient()
        get ApiClient
        Returns:
        apiClient the current ApiClient
      • setApiClient

        public void setApiClient​(ApiClient apiClient)
        set ApiClient
        Parameters:
        apiClient - ApiClient pass into the new instance of this class
      • setUserAgent

        public void setUserAgent​(String userAgent)
        set user agent
        Parameters:
        userAgent - string to override the user agent
      • getUserAgent

        public String getUserAgent()
        get user agent
        Returns:
        String of user agent
      • createFileAssociation

        public Association createFileAssociation​(String accessToken,
                                                 String xeroTenantId,
                                                 UUID fileId,
                                                 Association association)
                                          throws IOException
        Creates a new file association By passing in the appropriate options, you can create a new folder

        201 - A successful request

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        association - The association parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        Association
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • createFileAssociationForHttpResponse

        public com.google.api.client.http.HttpResponse createFileAssociationForHttpResponse​(String accessToken,
                                                                                            String xeroTenantId,
                                                                                            UUID fileId,
                                                                                            Association association)
                                                                                     throws IOException
        Creates a new file association By passing in the appropriate options, you can create a new folder

        201 - A successful request

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        association - The association parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • createFolder

        public Folder createFolder​(String accessToken,
                                   String xeroTenantId,
                                   Folder folder)
                            throws IOException
        Creates a new folder By passing in the appropriate properties, you can create a new folder

        200 - search results matching criteria

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        folder - The folder parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        Folder
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • createFolderForHttpResponse

        public com.google.api.client.http.HttpResponse createFolderForHttpResponse​(String accessToken,
                                                                                   String xeroTenantId,
                                                                                   Folder folder)
                                                                            throws IOException
        Creates a new folder By passing in the appropriate properties, you can create a new folder

        200 - search results matching criteria

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        folder - The folder parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • deleteFile

        public void deleteFile​(String accessToken,
                               String xeroTenantId,
                               UUID fileId)
                        throws IOException
        Deletes a specific file Delete a specific file

        204 - Successful deletion - return response 204 no content

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        accessToken - Authorization token for user set in header of each request
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • deleteFileForHttpResponse

        public com.google.api.client.http.HttpResponse deleteFileForHttpResponse​(String accessToken,
                                                                                 String xeroTenantId,
                                                                                 UUID fileId)
                                                                          throws IOException
        Deletes a specific file Delete a specific file

        204 - Successful deletion - return response 204 no content

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • deleteFileAssociation

        public void deleteFileAssociation​(String accessToken,
                                          String xeroTenantId,
                                          UUID fileId,
                                          UUID objectId)
                                   throws IOException
        Deletes an existing file association By passing in the appropriate options, you can create a new folder

        204 - Successful deletion - return response 204 no content

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        objectId - Object id for single object
        accessToken - Authorization token for user set in header of each request
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • deleteFileAssociationForHttpResponse

        public com.google.api.client.http.HttpResponse deleteFileAssociationForHttpResponse​(String accessToken,
                                                                                            String xeroTenantId,
                                                                                            UUID fileId,
                                                                                            UUID objectId)
                                                                                     throws IOException
        Deletes an existing file association By passing in the appropriate options, you can create a new folder

        204 - Successful deletion - return response 204 no content

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        objectId - Object id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • deleteFolder

        public void deleteFolder​(String accessToken,
                                 String xeroTenantId,
                                 UUID folderId)
                          throws IOException
        Deletes a folder By passing in the appropriate ID, you can delete a folder

        204 - Successful deletion - return response 204 no content

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        folderId - Folder id for single object
        accessToken - Authorization token for user set in header of each request
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • deleteFolderForHttpResponse

        public com.google.api.client.http.HttpResponse deleteFolderForHttpResponse​(String accessToken,
                                                                                   String xeroTenantId,
                                                                                   UUID folderId)
                                                                            throws IOException
        Deletes a folder By passing in the appropriate ID, you can delete a folder

        204 - Successful deletion - return response 204 no content

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        folderId - Folder id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • getAssociationsByObject

        public List<Association> getAssociationsByObject​(String accessToken,
                                                         String xeroTenantId,
                                                         UUID objectId)
                                                  throws IOException
        Retrieves an association object using a unique object ID By passing in the appropriate options,

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        objectId - Object id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        List<Association>
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • getAssociationsByObjectForHttpResponse

        public com.google.api.client.http.HttpResponse getAssociationsByObjectForHttpResponse​(String accessToken,
                                                                                              String xeroTenantId,
                                                                                              UUID objectId)
                                                                                       throws IOException
        Retrieves an association object using a unique object ID By passing in the appropriate options,

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        objectId - Object id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • getFile

        public FileObject getFile​(String accessToken,
                                  String xeroTenantId,
                                  UUID fileId)
                           throws IOException
        Retrieves a file by a unique file ID

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        FileObject
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • getFileForHttpResponse

        public com.google.api.client.http.HttpResponse getFileForHttpResponse​(String accessToken,
                                                                              String xeroTenantId,
                                                                              UUID fileId)
                                                                       throws IOException
        Retrieves a file by a unique file ID

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • getFileAssociations

        public List<Association> getFileAssociations​(String accessToken,
                                                     String xeroTenantId,
                                                     UUID fileId)
                                              throws IOException
        Retrieves a specific file associations By passing in the appropriate options,

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        List<Association>
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • getFileAssociationsForHttpResponse

        public com.google.api.client.http.HttpResponse getFileAssociationsForHttpResponse​(String accessToken,
                                                                                          String xeroTenantId,
                                                                                          UUID fileId)
                                                                                   throws IOException
        Retrieves a specific file associations By passing in the appropriate options,

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • getFileContent

        public ByteArrayInputStream getFileContent​(String accessToken,
                                                   String xeroTenantId,
                                                   UUID fileId)
                                            throws IOException
        Retrieves the content of a specific file By passing in the appropriate options, retrieve data for specific file

        200 - returns the byte array of the specific file based on id

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        ByteArrayInputStream
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • getFileContentForHttpResponse

        public com.google.api.client.http.HttpResponse getFileContentForHttpResponse​(String accessToken,
                                                                                     String xeroTenantId,
                                                                                     UUID fileId)
                                                                              throws IOException
        Retrieves the content of a specific file By passing in the appropriate options, retrieve data for specific file

        200 - returns the byte array of the specific file based on id

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • getFiles

        public Files getFiles​(String accessToken,
                              String xeroTenantId,
                              Integer pagesize,
                              Integer page,
                              String sort)
                       throws IOException
        Retrieves files

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        pagesize - pass an optional page size value
        page - number of records to skip for pagination
        sort - values to sort by
        accessToken - Authorization token for user set in header of each request
        Returns:
        Files
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • getFilesForHttpResponse

        public com.google.api.client.http.HttpResponse getFilesForHttpResponse​(String accessToken,
                                                                               String xeroTenantId,
                                                                               Integer pagesize,
                                                                               Integer page,
                                                                               String sort)
                                                                        throws IOException
        Retrieves files

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        pagesize - pass an optional page size value
        page - number of records to skip for pagination
        sort - values to sort by
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • getFolder

        public Folder getFolder​(String accessToken,
                                String xeroTenantId,
                                UUID folderId)
                         throws IOException
        Retrieves specific folder by using a unique folder ID By passing in the appropriate ID, you can search for specific folder

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        folderId - Folder id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        Folder
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • getFolderForHttpResponse

        public com.google.api.client.http.HttpResponse getFolderForHttpResponse​(String accessToken,
                                                                                String xeroTenantId,
                                                                                UUID folderId)
                                                                         throws IOException
        Retrieves specific folder by using a unique folder ID By passing in the appropriate ID, you can search for specific folder

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        folderId - Folder id for single object
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • getFolders

        public List<Folder> getFolders​(String accessToken,
                                       String xeroTenantId,
                                       String sort)
                                throws IOException
        Retrieves folders By passing in the appropriate options, you can search for available folders

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        sort - values to sort by
        accessToken - Authorization token for user set in header of each request
        Returns:
        List<Folder>
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • getFoldersForHttpResponse

        public com.google.api.client.http.HttpResponse getFoldersForHttpResponse​(String accessToken,
                                                                                 String xeroTenantId,
                                                                                 String sort)
                                                                          throws IOException
        Retrieves folders By passing in the appropriate options, you can search for available folders

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        sort - values to sort by
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • getInbox

        public Folder getInbox​(String accessToken,
                               String xeroTenantId)
                        throws IOException
        Retrieves inbox folder Search for the user inbox

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        accessToken - Authorization token for user set in header of each request
        Returns:
        Folder
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • getInboxForHttpResponse

        public com.google.api.client.http.HttpResponse getInboxForHttpResponse​(String accessToken,
                                                                               String xeroTenantId)
                                                                        throws IOException
        Retrieves inbox folder Search for the user inbox

        200 - search results matching criteria

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • updateFile

        public FileObject updateFile​(String accessToken,
                                     String xeroTenantId,
                                     UUID fileId,
                                     FileObject fileObject)
                              throws IOException
        Update a file Updates file properties of a single file

        200 - A successful request

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        fileObject - The fileObject parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        FileObject
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • updateFileForHttpResponse

        public com.google.api.client.http.HttpResponse updateFileForHttpResponse​(String accessToken,
                                                                                 String xeroTenantId,
                                                                                 UUID fileId,
                                                                                 FileObject fileObject)
                                                                          throws IOException
        Update a file Updates file properties of a single file

        200 - A successful request

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        fileId - File id for single object
        fileObject - The fileObject parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • updateFolder

        public Folder updateFolder​(String accessToken,
                                   String xeroTenantId,
                                   UUID folderId,
                                   Folder folder)
                            throws IOException
        Updates an existing folder By passing in the appropriate ID and properties, you can update a folder

        200 - return the updated object

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        folderId - Folder id for single object
        folder - The folder parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        Folder
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • updateFolderForHttpResponse

        public com.google.api.client.http.HttpResponse updateFolderForHttpResponse​(String accessToken,
                                                                                   String xeroTenantId,
                                                                                   UUID folderId,
                                                                                   Folder folder)
                                                                            throws IOException
        Updates an existing folder By passing in the appropriate ID and properties, you can update a folder

        200 - return the updated object

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        folderId - Folder id for single object
        folder - The folder parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • uploadFile

        public FileObject uploadFile​(String accessToken,
                                     String xeroTenantId,
                                     File body,
                                     String name,
                                     String filename,
                                     String mimeType)
                              throws IOException
        Uploads a File to the inbox

        201 - A successful request

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        body - The body parameter
        name - exact name of the file you are uploading
        filename - The filename parameter
        mimeType - The mimeType parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        FileObject
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • uploadFileForHttpResponse

        public com.google.api.client.http.HttpResponse uploadFileForHttpResponse​(String accessToken,
                                                                                 String xeroTenantId,
                                                                                 File body,
                                                                                 String name,
                                                                                 String filename,
                                                                                 String mimeType)
                                                                          throws IOException
        Uploads a File to the inbox

        201 - A successful request

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        body - The body parameter
        name - exact name of the file you are uploading
        filename - The filename parameter
        mimeType - The mimeType parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • uploadFileToFolder

        public FileObject uploadFileToFolder​(String accessToken,
                                             String xeroTenantId,
                                             UUID folderId,
                                             File body,
                                             String name,
                                             String filename,
                                             String mimeType)
                                      throws IOException
        Uploads a File to a specific folder

        201 - A successful request

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        folderId - pass required folder id to save file to specific folder
        body - The body parameter
        name - exact name of the file you are uploading
        filename - The filename parameter
        mimeType - The mimeType parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        FileObject
        Throws:
        IOException - if an error occurs while attempting to invoke the API *
      • uploadFileToFolderForHttpResponse

        public com.google.api.client.http.HttpResponse uploadFileToFolderForHttpResponse​(String accessToken,
                                                                                         String xeroTenantId,
                                                                                         UUID folderId,
                                                                                         File body,
                                                                                         String name,
                                                                                         String filename,
                                                                                         String mimeType)
                                                                                  throws IOException
        Uploads a File to a specific folder

        201 - A successful request

        400 - invalid input, object invalid

        Parameters:
        xeroTenantId - Xero identifier for Tenant
        folderId - pass required folder id to save file to specific folder
        body - The body parameter
        name - exact name of the file you are uploading
        filename - The filename parameter
        mimeType - The mimeType parameter
        accessToken - Authorization token for user set in header of each request
        Returns:
        HttpResponse
        Throws:
        IOException - if an error occurs while attempting to invoke the API
      • convertInputToByteArray

        public ByteArrayInputStream convertInputToByteArray​(InputStream is)
                                                     throws IOException
        convert intput to byte array
        Parameters:
        is - InputStream the server status code returned
        Returns:
        byteArrayInputStream a ByteArrayInputStream
        Throws:
        IOException - for failed or interrupted I/O operations