hubspot.files
Module hubspot.files
API
Definitions
ballerinax/hubspot.files Ballerina library
Overview
This is a generated connector from HubSpot OpenAPI specification.
These APIs allow to upload and manage files.
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create a HubSpot developer account
- Obtain tokens
- Use this guide to obtain the credentials which are needed to create the <CLIENT_ID> and <CLIENT_SECRET>
Quickstart
To use the HubSpot Files connector in your Ballerina application, update the .bal file as follows:
Step 1 - Import connector
First, import the ballerinax/hubspot.files module into the Ballerina project.
import ballerinax/hubspot.files;
Step 2 - Create a new connector instance
You can now make the connection configuration using the access token.
files:ClientConfig clientConfig = { auth : { token: <ACCESS_TOKEN> } }; files:Client baseClient = check new Client(clientConfig);
Step 3 - Invoke connector operation
- Upload a file
files:Body payload = { file: "", fileName: "" }; files:File|error bEvent = baseClient->filesUpload(payload); if (bEvent is files:File) { log:printInfo("Created File"); } else { log:printInfo(msg = bEvent.message()); }
- Use
bal run
command to compile and run the Ballerina program
Clients
hubspot.files: Client
This is a generated connector from HubSpot OpenAPI specification. These APIs allow to upload and manage files.
Constructor
Gets invoked to initialize the connector
.
The connector initialization requires setting the API credentials.
Create a HubSpot account and obtain OAuth tokens following this guide.
During initialization you can pass either http:BearerTokenConfig if you have a bearer token or http:OAuth2RefreshTokenGrantConfig if you have Oauth tokens.
init (ConnectionConfig config, string serviceUrl)
- config ConnectionConfig - The configurations to be used when initializing the
connector
- serviceUrl string "https://api.hubapi.com" - URL of the target service
filesUpload
function filesUpload(V3FilesBody payload) returns File|error
Upload file
Parameters
- payload V3FilesBody - File data
filesImportFromUrl
function filesImportFromUrl(ImportFromUrlInput payload) returns ImportFromUrlTaskLocator|error
Import a file from a URL into the file manager.
Parameters
- payload ImportFromUrlInput - Import data input
Return Type
- ImportFromUrlTaskLocator|error - accepted
checkImportStatus
function checkImportStatus(string taskId) returns FileActionResponse|error
Check import status.
Parameters
- taskId string - Import by URL task ID
Return Type
- FileActionResponse|error - successful operation
filesDoSearch
function filesDoSearch(string[]? properties, string? after, string? before, int? 'limit, string[]? sort, string? id, string? createdAt, string? createdAtLte, string? createdAtGte, string? updatedAt, string? updatedAtLte, string? updatedAtGte, string? name, string? filePath, int? parentFolderId, int? size, int? height, int? width, string? encoding, string? 'type, string? extension, string? url, boolean? isUsableInContent, boolean? allowsAnonymousAccess) returns CollectionResponseFile|error
Search files
Parameters
- properties string[]? (default ()) - Desired file properties in the return object.
- after string? (default ()) - The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit.
- before string? (default ()) - The minimum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit.
- 'limit int? (default ()) - Number of items to return. Maximum limit is 100.
- sort string[]? (default ()) - Sort files by a given field.
- id string? (default ()) - Search files by given ID.
- createdAt string? (default ()) - Search files by time of creation.
- createdAtLte string? (default ()) - Search files whose created time less than or equal to time
- createdAtGte string? (default ()) - Search files whose created time greater than or equal to time
- updatedAt string? (default ()) - Search files by time of latest updated.
- updatedAtLte string? (default ()) - Search files whose updated time less than or equal to time
- updatedAtGte string? (default ()) - Search files whose updated time greater than or equal to time
- name string? (default ()) - Search for files containing the given name.
- filePath string? (default ()) - Search files by path.
- parentFolderId int? (default ()) - Search files within given folder ID.
- size int? (default ()) - Query by file size.
- height int? (default ()) - Search files by height of image or video.
- width int? (default ()) - Search files by width of image or video.
- encoding string? (default ()) - Search files with specified encoding.
- 'type string? (default ()) - Filter by provided file type.
- extension string? (default ()) - Search files by given extension.
- url string? (default ()) - Search for given URL
- isUsableInContent boolean? (default ()) - If true shows files that have been marked to be used in new content. It false shows files that should not be used in new content.
- allowsAnonymousAccess boolean? (default ()) - If 'true' will show private files; if 'false' will show public files
Return Type
- CollectionResponseFile|error - successful operation
filesGetById
Get file.
filesReplace
function filesReplace(string fileId, FilesFileidBody payload) returns File|error
Replace file.
deleteFiles
Delete file
Parameters
- fileId string - File ID to delete
updateFileProperties
function updateFileProperties(string fileId, FileUpdateInput payload) returns File|error
update file properties
deleteArchiveGdpr
GDPR delete
Parameters
- fileId string - ID of file to GDPR delete
getSignedUrl
function getSignedUrl(string fileId, string? size, int? expirationSeconds, boolean? upscale) returns SignedUrl|error
Get signed URL to access private file.
Parameters
- fileId string - ID of file.
- size string? (default ()) - For image files. This will resize the image to the desired size before sharing. Does not affect the original file, just the file served by this signed URL.
- expirationSeconds int? (default ()) - How long in seconds the link will provide access to the file.
- upscale boolean? (default ()) - If size is provided, this will upscale the image to fit the size dimensions.
foldersCreate
function foldersCreate(FolderInput payload) returns Folder|error
Create folder.
Parameters
- payload FolderInput - Folder creation options
doSearch
function doSearch(string[]? properties, string? after, string? before, int? 'limit, string[]? sort, string? id, string? createdAt, string? createdAtLte, string? createdAtGte, string? updatedAt, string? updatedAtLte, string? updatedAtGte, string? name, string? folderPath, int? parentFolderId) returns CollectionResponseFolder|error
Search folders
Parameters
- properties string[]? (default ()) - Properties that should be included in the returned folders.
- after string? (default ()) - The maximum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit.
- before string? (default ()) - The minimum offset of items for a given search is 10000. Narrow your search down if you are reaching this limit.
- 'limit int? (default ()) - Limit of results to return. Max limit is 100.
- sort string[]? (default ()) - Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending.
- id string? (default ()) - Search folder by given ID.
- createdAt string? (default ()) - Search for folders with the given creation timestamp.
- createdAtLte string? (default ()) - Search files whose created time less than or equal to time
- createdAtGte string? (default ()) - Search files whose created time greater than or equal to time
- updatedAt string? (default ()) - Search for folder at given update timestamp.
- updatedAtLte string? (default ()) - Search files whose updated time less than or equal to time
- updatedAtGte string? (default ()) - Search files whose updated time greater than or equal to time
- name string? (default ()) - Search for folders containing the specified name.
- folderPath string? (default ()) - Search for folders by path.
- parentFolderId int? (default ()) - Search for folders with the given parent folder ID.
Return Type
- CollectionResponseFolder|error - successful operation
updateFolderProperties
function updateFolderProperties(FolderUpdateInput payload) returns FolderUpdateTaskLocator|error
Update folder properties
Parameters
- payload FolderUpdateInput - Properties to change in the folder
Return Type
- FolderUpdateTaskLocator|error - accepted
checkUpdateStatus
function checkUpdateStatus(string taskId) returns FolderActionResponse|error
Check folder update status.
Parameters
- taskId string - Task ID of folder update
Return Type
- FolderActionResponse|error - successful operation
foldersGetById
Get folder
Parameters
- folderId string - ID of desired folder
- properties string[]? (default ()) - Properties to set on returned folder.
deleteFolders
Delete folder.
Parameters
- folderId string - ID of folder to delete.
foldersGetByPath
Get folder.
Parameters
- folderPath string - Path of desired folder.
- properties string[]? (default ()) - Properties to set on returned folder.
foldersArchiveByPath
Delete folder.
Parameters
- folderPath string - Path of folder to delete
Records
hubspot.files: ClientHttp1Settings
Provides settings related to HTTP/1.x protocol.
Fields
- keepAlive KeepAlive(default http:KEEPALIVE_AUTO) - Specifies whether to reuse a connection for multiple requests
- chunking Chunking(default http:CHUNKING_AUTO) - The chunking behaviour of the request
- proxy ProxyConfig? - Proxy server related options
hubspot.files: CollectionResponseFile
Collection of files
Fields
- results File[] - Array of file info.
- paging Paging? - Pagination info.
hubspot.files: CollectionResponseFolder
Fields
- results Folder[] -
- paging Paging? - Pagination info.
hubspot.files: ConnectionConfig
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 HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings? - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings? - 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
- poolConfig PoolConfiguration? - Configurations associated with request pooling
- cache CacheConfig? - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig? - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig? - Configurations associated with retrying
- responseLimits ResponseLimitConfigs? - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket? - SSL/TLS-related options
- proxy ProxyConfig? - Proxy server related options
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
hubspot.files: Error
Fields
- message string - A human readable message describing the error along with remediation steps where appropriate
- correlationId string - A unique identifier for the request. Include this value with any error reports or support tickets
- category string - The error category
- subCategory string? - A specific category that contains more specific detail about the error
- errors ErrorDetail[]? - further information about the error
- context record {}? - Context about the error condition
- links record {}? - A map of link names to associated URIs containing documentation about the error or recommended remediation steps
hubspot.files: ErrorCategory
Fields
- name string -
- httpStatus string -
hubspot.files: ErrorDetail
Fields
- message string - A human readable message describing the error along with remediation steps where appropriate
- 'in string? - The name of the field or parameter in which the error was found.
- code string? - The status code associated with the error detail
- subCategory string? - A specific category that contains more specific detail about the error
- context record {}? - Context about the error condition
hubspot.files: File
File
Fields
- id string - File ID.
- createdAt string - Creation time of the file object.
- archivedAt string? - Deletion time of the file object.
- updatedAt string - Timestamp of the latest update to the file.
- archived boolean - If the file is deleted.
- parentFolderId string? - Id of the folder the file is in.
- name string? - Name of the file.
- path string? - Path of the file in the file manager.
- size int? - Size in bytes of the file.
- height int? - For image and video files, the height of the content.
- width int? - For image and video files, the width of the content.
- encoding string? - Encoding of the file.
- 'type string? - Type of the file. Can be IMG, DOCUMENT, AUDIO, MOVIE, or OTHER.
- extension string? - Extension of the file. For example png.
- defaultHostingUrl string? - Default hosting URL of the file. This will use one of HubSpot's provided URLs to serve the file.
- url string? - URL of the given file. This URL can change depending on the domain settings of the account. Will use the select file hosting domain.
- isUsableInContent boolean? - Previously "archied". Indicates if the file should be used when creating new content like web pages.
- access string - File access. Can be PUBLIC_INDEXABLE, PUBLIC_NOT_INDEXABLE, PRIVATE.
hubspot.files: FileActionResponse
File action response
Fields
- status string - Current status of the task.
- result File? - File
- numErrors int? - Number of errors resulting from the task.
- errors StandardError[]? - Descriptive error messages.
- requestedAt string? - Timestamp of when the task was requested.
- startedAt string - Timestamp of when the task was started.
- completedAt string - Time of completion of task.
- links record {}? - Link to check the status of the requested task.
- taskId string - If of the requested task.
hubspot.files: FilesFileidBody
Fields
- file string? - File data that will replace existing file in the file manager.
- charsetHunch string? - Character set of given file data.
- options string? - JSON String representing FileReplaceOptions
hubspot.files: FileUpdateInput
Object for updating files.
Fields
- name string? - New name for the file.
- parentFolderId string? - Folder ID where the file should be moved to. folderId and folderPath cannot be set at the same time.
- parentFolderPath string? - Folder path where the file should be moved to. folderId and folderPath cannot be set at the same time.
- isUsableInContent boolean? - Mark weather the file should be used in new content or not.
- access string? - NONE: Do not run any duplicate validation. REJECT: Reject the upload if a duplicate is found. RETURN_EXISTING: If a duplicate file is found, do not upload a new file and return the found duplicate instead.
hubspot.files: Folder
Folder info
Fields
- id string - Id of the folder.
- createdAt string - Timestamp of folder creation.
- archivedAt string? - Timestamp of folder deletion.
- updatedAt string - Timestamp of the latest update to the folder.
- archived boolean - Marks weather the folder is deleted or not.
- parentFolderId string? - Id of the parent folder.
- name string? - Name of the folder.
- path string? - Path of the folder in the file manager.
hubspot.files: FolderActionResponse
Folder action response
Fields
- status string - Current status of the task.
- result Folder? - Folder info
- numErrors int? - Number of errors resulting from the requested changes.
- errors StandardError[]? - Detailed errors resulting from the task.
- requestedAt string? - Timestamp representing when the task was requested.
- startedAt string - Timestamp representing when the task was started at.
- completedAt string - When the requested changes have been completed.
- links record {}? - Link to check the status of the task.
- taskId string - Id of the task.
hubspot.files: FolderInput
Object for creating a folder.
Fields
- name string - Desired name for the folder.
- parentFolderId string? - Folder ID of the parent of the created folder. If not specified, the folder will be created at the root level. parentFolderId and parentFolderPath cannot be set at the same time.
- parentPath string? - Path of the parent of the created folder. If not specified the folder will be created at the root level. parentFolderPath and parentFolderId cannot be set at the same time.
hubspot.files: FolderUpdateInput
Object for updating folders.
Fields
- id string - Id of the folder to change.
- name string? - New name. If specified the folder's name and fullPath will change. All children of the folder will be updated accordingly.
- parentFolderId int? - New parent folder ID. If changed, the folder and all it's children will be moved into the specified folder. parentFolderId and parentFolderPath cannot be specified at the same time.
hubspot.files: FolderUpdateTaskLocator
Information on the task that has been started, and where to check it's status.
Fields
- id string - The ID of the task
- links record {}? - Links for where to check information related to the task. The
status
link gives the URL for where to check the status of the task.
hubspot.files: ImportFromUrlInput
Import data input
Fields
- access string - PUBLIC_INDEXABLE: File is publicly accessible by anyone who has the URL. Search engines can index the file. PUBLIC_NOT_INDEXABLE: File is publicly accessible by anyone who has the URL. Search engines can't index the file. PRIVATE: File is NOT publicly accessible. Requires a signed URL to see content. Search engines can't index the file.
- ttl string? - Time to live. If specified the file will be deleted after the given time frame.
- name string? - Name to give the resulting file in the file manager.
- url string - URL to download the new file from.
- folderId string? - One of folderId or folderPath is required. Destination folder ID for the uploaded file.
- folderPath string? - One of folderPath or folderId is required. Destination folder path for the uploaded file. If the folder path does not exist, there will be an attempt to create the folder path.
- duplicateValidationStrategy string - NONE: Do not run any duplicate validation. REJECT: Reject the upload if a duplicate is found. RETURN_EXISTING: If a duplicate file is found, do not upload a new file and return the found duplicate instead.
- duplicateValidationScope string - ENTIRE_PORTAL: Look for a duplicate file in the entire account. EXACT_FOLDER: Look for a duplicate file in the provided folder.
- overwrite boolean - If true, it will overwrite existing files if a file with the same name exists in the given folder.
hubspot.files: ImportFromUrlTaskLocator
Information on the task that has been started, and where to check it's status.
Fields
- id string - The ID of the task
- links record {}? - Links for where to check information related to the task. The
status
link gives the URL for where to check the status of the task.
hubspot.files: NextPage
Next page info
Fields
- after string - After info
- link string? - Page link
hubspot.files: OAuth2RefreshTokenGrantConfig
OAuth2 Refresh Token Grant Configs
Fields
- Fields Included from *OAuth2RefreshTokenGrantConfig
- refreshUrl string(default "https://api.hubapi.com/oauth/v1/token") - Refresh URL
hubspot.files: Paging
Pagination info.
Fields
- next NextPage? - Next page info
- prev PreviousPage? - Previous page info
hubspot.files: PreviousPage
Previous page info
Fields
- before string - Before page
- link string? - Page link
hubspot.files: ProxyConfig
Proxy server configurations to be used with the HTTP client endpoint.
Fields
- host string(default "") - Host name of the proxy server
- port int(default 0) - Proxy server port
- userName string(default "") - Proxy server username
- password string(default "") - Proxy server password
hubspot.files: SignedUrl
Fields
- expiresAt string - Timestamp of when the URL will no longer grant access to the file.
- url string - Signed URL with access to the specified file. Anyone with this URL will be able to access the file until it expires.
- name string - Name of the requested file.
- extension string - Extension of the requested file.
- 'type string - Type of the file. Can be IMG, DOCUMENT, AUDIO, MOVIE, or OTHER.
- size int - Size in bytes of the requested file.
- height int? - For image and video files. The height of the file.
- width int? - For image and video files. The width of the file.
hubspot.files: StandardError
Fields
- status string -
- id string? -
- category ErrorCategory -
- subCategory record {}? -
- message string -
- errors ErrorDetail[] -
- context record {} -
- links record {} -
hubspot.files: V3FilesBody
Fields
- file string? - File to be uploaded.
- folderId string? - Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to.
- folderPath string? - Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one.
- fileName string? - Desired name for the uploaded file.
- charsetHunch string? - Character set of the uploaded file.
- options string? - JSON string representing FileUploadOptions.
Import
import ballerinax/hubspot.files;
Metadata
Released date: over 1 year ago
Version: 2.3.1
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.4.1
GraalVM compatible: Yes
Pull count
Total: 1
Current verison: 1
Weekly downloads
Keywords
Content & Files/File Management & Storage
Cost/Freemium
Contributors