xero.files
Module xero.files
API
![](https://bcentral-packageicons.azureedge.net/images/ballerinax_xero.files_1.2.0.png)
ballerinax/xero.files Ballerina library
Overview
This is a generated connector for Xero Files API v2.16.1 OpenAPI specification. The Files API provides access to the files, folders, and the association of files within a Xero organisation. It can be used to upload/download files, manage folders and associate files to invoices, contacts, payments etc.
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create a Xero account
- Obtain tokens by following this guide
Quickstart
To use the Xero Files connector in your Ballerina application, update the .bal file as follows:
Step 1: Import connector
First, import the ballerinax/xero.files
module into the Ballerina project.
import ballerinax/xero.files;
Step 2: Create a new connector instance
Create a files:ClientConfig
with the access token
obtained, and initialize the connector with it.
files:ClientConfig clientConfig = { auth: { token: <ACCESS_TOKEN> } }; files:Client baseClient = check new Client(clientConfig);
Step 3: Invoke connector operation
-
You can get all the files by providing Xero tenant identifier as parameter.
files:Files response = check baseClient->getFiles(<Xero_Identifier_For_Tenant>);
-
Use
bal run
command to compile and run the Ballerina program.
Clients![](/images/permalink.svg)
xero.files: Client![](/images/permalink.svg)
This is a generated connector for Xero Files API v2.16.1 OpenAPI specification. The Files API provides access to the files, folders, and the association of files within a Xero organisation. It can be used to upload/download files, manage folders and associate files to invoices, contacts, payments etc.
Constructor![](/images/permalink.svg)
Gets invoked to initialize the connector
.
The connector initialization requires setting the API credentials.
Create a Xero account and obtain tokens by following this guide.
init (ClientConfig clientConfig, string serviceUrl)
- clientConfig ClientConfig - The configurations to be used when initializing the
connector
- serviceUrl string "https://api.xero.com/files.xro/1.0/" - URL of the target service
getFiles![](/images/permalink.svg)
Retrieves files
Parameters
- xeroTenantId string - Xero identifier for Tenant
- pagesize int? (default ()) - pass an optional page size value
- page int? (default ()) - number of records to skip for pagination
- sort string? (default ()) - values to sort by
uploadFile![](/images/permalink.svg)
function uploadFile(string xeroTenantId, UploadObject payload) returns FileObject|error
Uploads a File to the inbox
Parameters
- xeroTenantId string - Xero identifier for Tenant
- payload UploadObject - A record of type
UploadObject
which contains details to upload a file to inbox
Return Type
- FileObject|error - A successful request
getFile![](/images/permalink.svg)
function getFile(string xeroTenantId, string fileId) returns FileObject|error
Retrieves a file by a unique file ID
Return Type
- FileObject|error - search results matching criteria
updateFile![](/images/permalink.svg)
function updateFile(string xeroTenantId, string fileId, FileObject payload) returns FileObject|error
Update a file
Parameters
- xeroTenantId string - Xero identifier for Tenant
- fileId string - File id for single object
- payload FileObject - A record of type
FileObject
which contains details to update a file
Return Type
- FileObject|error - A successful request
deleteFile![](/images/permalink.svg)
Deletes a specific file
uploadFileToFolder![](/images/permalink.svg)
function uploadFileToFolder(string xeroTenantId, string folderId, UploadObject payload) returns FileObject|error
Uploads a File to a specific folder
Parameters
- xeroTenantId string - Xero identifier for Tenant
- folderId string - pass required folder id to save file to specific folder
- payload UploadObject - A record of type
UploadObject
which contains details to upload a file to specific folder
Return Type
- FileObject|error - A successful request
getFileContent![](/images/permalink.svg)
Retrieves the content of a specific file
getFileAssociations![](/images/permalink.svg)
function getFileAssociations(string xeroTenantId, string fileId) returns Association[]|error
Retrieves a specific file associations
Return Type
- Association[]|error - search results matching criteria
createFileAssociation![](/images/permalink.svg)
function createFileAssociation(string xeroTenantId, string fileId, Association payload) returns Association|error
Creates a new file association
Parameters
- xeroTenantId string - Xero identifier for Tenant
- fileId string - File id for single object
- payload Association - A record of type
Association
which contains details to create a new file association
Return Type
- Association|error - A successful request
deleteFileAssociation![](/images/permalink.svg)
function deleteFileAssociation(string xeroTenantId, string fileId, string objectId) returns Response|error
Deletes an existing file association
Parameters
- xeroTenantId string - Xero identifier for Tenant
- fileId string - File id for single object
- objectId string - Object id for single object
getAssociationsByObject![](/images/permalink.svg)
function getAssociationsByObject(string xeroTenantId, string objectId) returns Association[]|error
Retrieves an association object using a unique object ID
Parameters
- xeroTenantId string - Xero identifier for Tenant
- objectId string - Object id for single object
Return Type
- Association[]|error - search results matching criteria
getFolders![](/images/permalink.svg)
Retrieves folders
Parameters
- xeroTenantId string - Xero identifier for Tenant
- sort string? (default ()) - values to sort by
createFolder![](/images/permalink.svg)
Creates a new folder
Parameters
- xeroTenantId string - Xero identifier for Tenant
- payload Folder - A record of type
Folder
which contains details to create a new folder
getFolder![](/images/permalink.svg)
Retrieves specific folder by using a unique folder ID
Parameters
- xeroTenantId string - Xero identifier for Tenant
- folderId string - Folder id for single object
updateFolder![](/images/permalink.svg)
Updates an existing folder
Parameters
- xeroTenantId string - Xero identifier for Tenant
- folderId string - Folder id for single object
- payload Folder - A record of type
Folder
which contains details to update a existing folder
deleteFolder![](/images/permalink.svg)
Deletes a folder
Parameters
- xeroTenantId string - Xero identifier for Tenant
- folderId string - Folder id for single object
getInbox![](/images/permalink.svg)
Retrieves inbox folder
Parameters
- xeroTenantId string - Xero identifier for Tenant
Records![](/images/permalink.svg)
xero.files: Association![](/images/permalink.svg)
Fields
- FileId string? - The unique identifier of the file
- ObjectId string? - The identifier of the object that the file is being associated with (e.g. InvoiceID, BankTransactionID, ContactID)
- ObjectGroup ObjectGroup? - The Object Group that the object is in. These roughly correlate to the endpoints that can be used to retrieve the object via the core accounting API.
- ObjectType ObjectType? - The Object Type
xero.files: ClientConfig![](/images/permalink.svg)
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- auth BearerTokenConfig|OAuth2RefreshTokenGrantConfig - Configurations related to client authentication
- httpVersion string(default "1.1") - The HTTP version understood by the client
- http1Settings ClientHttp1Settings(default {}) - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings(default {}) - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- followRedirects FollowRedirects?(default ()) - Configurations associated with Redirection
- poolConfig PoolConfiguration?(default ()) - Configurations associated with request pooling
- cache CacheConfig(default {}) - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig?(default ()) - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig?(default ()) - Configurations associated with retrying
- cookieConfig CookieConfig?(default ()) - Configurations associated with cookies
- responseLimits ResponseLimitConfigs(default {}) - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket?(default ()) - SSL/TLS-related options
xero.files: FileObject![](/images/permalink.svg)
Fields
- Name string? - File Name
- MimeType string? - MimeType of the file (image/png, image/jpeg, application/pdf, etc..)
- Size int? - Numeric value in bytes
- CreatedDateUtc string? - Created date in UTC
- UpdatedDateUtc string? - Updated date in UTC
- User User? -
- Id string? - File object's UUID
- FolderId string? - Folder relation object's UUID
xero.files: Files![](/images/permalink.svg)
Fields
- TotalCount int? -
- Page int? -
- PerPage int? -
- Items FileObject[]? -
xero.files: Folder![](/images/permalink.svg)
Fields
- Name string? - The name of the folder
- FileCount int? - The number of files in the folder
- Email string? - The email address used to email files to the inbox. Only the inbox will have this element.
- IsInbox boolean? - to indicate if the folder is the Inbox. The Inbox cannot be renamed or deleted.
- Id string? - Xero unique identifier for a folder Files
xero.files: Folders![](/images/permalink.svg)
Fields
- Folders Folder[]? -
xero.files: UploadObject![](/images/permalink.svg)
Fields
- body string -
- name string - exact name of the file you are uploading
- filename string -
- mimeType string? -
xero.files: User![](/images/permalink.svg)
Fields
- Id string - Xero identifier
- Name string? - Key is Name, but returns Email address of user who created the file
- FirstName string? - First name of user
- LastName string? - Last name of user
- FullName string? - Last name of user
String types![](/images/permalink.svg)
Import
import ballerinax/xero.files;
Metadata
Released date: over 2 years ago
Version: 1.2.0
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.0.0
GraalVM compatible: Yes
Pull count
Total: 1
Current verison: 0
Weekly downloads
Keywords
Content & Files/Documents
Cost/Paid
Contributors