├── .gitignore ├── .java-version ├── .vscode └── extension.json ├── CONTRIBUTORS ├── LICENSE ├── README.md ├── SECURITY.md ├── _VERSION ├── build.sh ├── config └── checkstyle │ ├── checkstyle-suppressions.xml │ └── checkstyle.xml ├── docs ├── AccountLineItem.md ├── Action.md ├── ActionNotificationExport.md ├── ActionNotificationExportResult.md ├── ApiKey.md ├── ApiRequestLog.md ├── App.md ├── As2IncomingMessage.md ├── As2OutgoingMessage.md ├── As2Partner.md ├── As2Station.md ├── Auto.md ├── Automation.md ├── AutomationLog.md ├── AutomationRun.md ├── BandwidthSnapshot.md ├── Behavior.md ├── Bundle.md ├── BundleAction.md ├── BundleDownload.md ├── BundleNotification.md ├── BundlePath.md ├── BundleRecipient.md ├── BundleRegistration.md ├── Clickwrap.md ├── DnsRecord.md ├── EmailIncomingMessage.md ├── EmailLog.md ├── Errors.md ├── ExavaultApiRequestLog.md ├── ExternalEvent.md ├── File.md ├── FileAction.md ├── FileComment.md ├── FileCommentReaction.md ├── FileMigration.md ├── FileMigrationLog.md ├── FileUploadPart.md ├── Folder.md ├── FormField.md ├── FormFieldSet.md ├── FtpActionLog.md ├── GpgKey.md ├── Group.md ├── GroupUser.md ├── History.md ├── HistoryExport.md ├── HistoryExportResult.md ├── Image.md ├── InboxRecipient.md ├── InboxRegistration.md ├── InboxUpload.md ├── Invoice.md ├── InvoiceLineItem.md ├── IpAddress.md ├── Lock.md ├── Message.md ├── MessageComment.md ├── MessageCommentReaction.md ├── MessageReaction.md ├── Notification.md ├── OutboundConnectionLog.md ├── Payment.md ├── PaymentLineItem.md ├── Permission.md ├── Preview.md ├── Priority.md ├── Project.md ├── PublicHostingRequestLog.md ├── PublicIpAddress.md ├── PublicKey.md ├── RemoteBandwidthSnapshot.md ├── RemoteServer.md ├── RemoteServerConfigurationFile.md ├── Request.md ├── Restore.md ├── Session.md ├── SettingsChange.md ├── SftpActionLog.md ├── SftpHostKey.md ├── ShareGroup.md ├── ShareGroupMember.md ├── SiemHttpDestination.md ├── Site.md ├── Snapshot.md ├── SsoStrategy.md ├── Status.md ├── Style.md ├── SyncLog.md ├── UsageByTopLevelDir.md ├── UsageDailySnapshot.md ├── UsageSnapshot.md ├── User.md ├── UserCipherUse.md ├── UserLifecycleRule.md ├── UserRequest.md ├── UserSftpClientUse.md ├── WebDavActionLog.md └── WebhookTest.md ├── pom.xml ├── rewrite.yml ├── shared ├── header_test_data.json ├── normalization_for_comparison_test_data.json └── url_test_data.json ├── src ├── main │ ├── java │ │ └── com │ │ │ └── files │ │ │ ├── FilesClient.java │ │ │ ├── FilesConfig.java │ │ │ ├── ListIterator.java │ │ │ ├── ListIteratorIterable.java │ │ │ ├── ResponseError.java │ │ │ ├── exceptions │ │ │ ├── ApiErrorException.java │ │ │ ├── SdkException.java │ │ │ └── StackSuppressedRuntimeException.java │ │ │ ├── models │ │ │ ├── AccountLineItem.java │ │ │ ├── Action.java │ │ │ ├── ActionNotificationExport.java │ │ │ ├── ActionNotificationExportResult.java │ │ │ ├── ApiKey.java │ │ │ ├── ApiRequestLog.java │ │ │ ├── App.java │ │ │ ├── As2IncomingMessage.java │ │ │ ├── As2OutgoingMessage.java │ │ │ ├── As2Partner.java │ │ │ ├── As2Station.java │ │ │ ├── Auto.java │ │ │ ├── Automation.java │ │ │ ├── AutomationLog.java │ │ │ ├── AutomationRun.java │ │ │ ├── BandwidthSnapshot.java │ │ │ ├── Behavior.java │ │ │ ├── Bundle.java │ │ │ ├── BundleAction.java │ │ │ ├── BundleDownload.java │ │ │ ├── BundleNotification.java │ │ │ ├── BundlePath.java │ │ │ ├── BundleRecipient.java │ │ │ ├── BundleRegistration.java │ │ │ ├── Clickwrap.java │ │ │ ├── DnsRecord.java │ │ │ ├── EmailIncomingMessage.java │ │ │ ├── EmailLog.java │ │ │ ├── Errors.java │ │ │ ├── ExavaultApiRequestLog.java │ │ │ ├── ExternalEvent.java │ │ │ ├── File.java │ │ │ ├── FileAction.java │ │ │ ├── FileComment.java │ │ │ ├── FileCommentReaction.java │ │ │ ├── FileMigration.java │ │ │ ├── FileMigrationLog.java │ │ │ ├── FileUploadPart.java │ │ │ ├── Folder.java │ │ │ ├── FormField.java │ │ │ ├── FormFieldSet.java │ │ │ ├── FtpActionLog.java │ │ │ ├── GpgKey.java │ │ │ ├── Group.java │ │ │ ├── GroupUser.java │ │ │ ├── History.java │ │ │ ├── HistoryExport.java │ │ │ ├── HistoryExportResult.java │ │ │ ├── Image.java │ │ │ ├── InboxRecipient.java │ │ │ ├── InboxRegistration.java │ │ │ ├── InboxUpload.java │ │ │ ├── Invoice.java │ │ │ ├── InvoiceLineItem.java │ │ │ ├── IpAddress.java │ │ │ ├── Lock.java │ │ │ ├── Message.java │ │ │ ├── MessageComment.java │ │ │ ├── MessageCommentReaction.java │ │ │ ├── MessageReaction.java │ │ │ ├── ModelInterface.java │ │ │ ├── Notification.java │ │ │ ├── OutboundConnectionLog.java │ │ │ ├── Payment.java │ │ │ ├── PaymentLineItem.java │ │ │ ├── Permission.java │ │ │ ├── Preview.java │ │ │ ├── Priority.java │ │ │ ├── Project.java │ │ │ ├── PublicHostingRequestLog.java │ │ │ ├── PublicIpAddress.java │ │ │ ├── PublicKey.java │ │ │ ├── RemoteBandwidthSnapshot.java │ │ │ ├── RemoteServer.java │ │ │ ├── RemoteServerConfigurationFile.java │ │ │ ├── Request.java │ │ │ ├── Restore.java │ │ │ ├── Session.java │ │ │ ├── SettingsChange.java │ │ │ ├── SftpActionLog.java │ │ │ ├── SftpHostKey.java │ │ │ ├── ShareGroup.java │ │ │ ├── ShareGroupMember.java │ │ │ ├── SiemHttpDestination.java │ │ │ ├── Site.java │ │ │ ├── Snapshot.java │ │ │ ├── SsoStrategy.java │ │ │ ├── Status.java │ │ │ ├── Style.java │ │ │ ├── SyncLog.java │ │ │ ├── UsageByTopLevelDir.java │ │ │ ├── UsageDailySnapshot.java │ │ │ ├── UsageSnapshot.java │ │ │ ├── User.java │ │ │ ├── UserCipherUse.java │ │ │ ├── UserLifecycleRule.java │ │ │ ├── UserRequest.java │ │ │ ├── UserSftpClientUse.java │ │ │ ├── WebDavActionLog.java │ │ │ └── WebhookTest.java │ │ │ ├── net │ │ │ ├── ApacheHttpEvictor.java │ │ │ ├── FilesApacheHttpApi.java │ │ │ ├── FilesApacheHttpInputStream.java │ │ │ ├── FilesApiInterface.java │ │ │ ├── FilesHttpClient.java │ │ │ ├── FilesHttpExecutor.java │ │ │ ├── FilesResponse.java │ │ │ └── HttpMethods.java │ │ │ └── util │ │ │ ├── BufferPool.java │ │ │ ├── FilesInputStream.java │ │ │ ├── HeaderUtils.java │ │ │ ├── ModelUtils.java │ │ │ ├── PathUtils.java │ │ │ ├── StreamTransfer.java │ │ │ └── UrlUtils.java │ └── resources │ │ ├── files-sdk.properties │ │ └── log4j2.xml └── test │ └── java │ └── com │ └── files │ ├── FilesApiTest.java │ ├── FilesAuthTest.java │ ├── FilesFileTest.java │ ├── HeaderUtilsTest.java │ ├── PathUtilsTest.java │ ├── TestSettingsHelper.java │ └── UrlUtilsTest.java └── test.sh /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | release.properties 3 | -------------------------------------------------------------------------------- /.java-version: -------------------------------------------------------------------------------- 1 | 1.8 2 | -------------------------------------------------------------------------------- /.vscode/extension.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "vscjava.vscode-java-pack", 4 | "GabrielBB.vscode-lombok", 5 | "naco-siren.gradle-language", 6 | "EditorConfig.editorconfig" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Daniel Cowgill 2 | Dustin Zeisler 3 | Jesse Harris 4 | Kevin Bombino 5 | Kevin Killingsworth 6 | Martyn Garcia 7 | Rommel Santor 8 | Sam Harrison 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2019- Action Verb, LLC (https://www.files.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | Thank you for your interest in Files.com security. We recognize that your data is very personal and sensitive and we work hard to keep it protected. 4 | 5 | 6 | ## Supported Versions 7 | 8 | Only the latest version will be supported with security updates. 9 | 10 | 11 | ## Reporting a Vulnerability 12 | 13 | Here at Files.com, we celebrate security and we encourage independent security researchers to help us keep our products secure. 14 | 15 | We offer a Security Bug Bounty Program to create an incentive and reward structure so that researchers are able to devote resources to working on Files.com. 16 | 17 | We offer our Bug Bounty Program on HackerOne at https://hackerone.com/files 18 | 19 | We prefer to receive reports of vulnerabilities there. 20 | 21 | If you do not wish to use HackerOne, alternate submission instructions are available at: 22 | https://www.files.com/legal/security-bounty/ 23 | 24 | Thank you for helping keep the Files.com community secure! 25 | -------------------------------------------------------------------------------- /_VERSION: -------------------------------------------------------------------------------- 1 | 1.6.7 2 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #set -e 4 | 5 | # Make sure we have the correct version of Java set 6 | if command -v jenv &> /dev/null; then 7 | if [ -d /usr/lib/jvm/java-8-openjdk-amd64 ]; then jenv add /usr/lib/jvm/java-8-openjdk-amd64; fi 8 | if [ -d /usr/lib/jvm/java-8-openjdk-arm64 ]; then jenv add /usr/lib/jvm/java-8-openjdk-arm64; fi 9 | if [ -d /opt/jdk-14.0.1 ]; then jenv add /opt/jdk-14.0.1; fi 10 | 11 | jenv local 1.8 # Force 1.8 with jenv 12 | fi 13 | mvn rewrite:run 14 | mvn -B -DskipTests -DnewVersion=$(cat ./_VERSION) -DgenerateBackupPoms=false versions:set && mvn -DskipTests clean package 15 | -------------------------------------------------------------------------------- /config/checkstyle/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 10 | 12 | 13 | -------------------------------------------------------------------------------- /docs/AccountLineItem.md: -------------------------------------------------------------------------------- 1 | # Files.Models.AccountLineItem 2 | 3 | ## Example AccountLineItem Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "amount": 1.0, 9 | "balance": 1.0, 10 | "created_at": "2000-01-01T01:00:00Z", 11 | "currency": "USD", 12 | "download_uri": "https://url...", 13 | "invoice_line_items": [ 14 | { 15 | "amount": 1.0, 16 | "created_at": "2000-01-01T01:00:00Z", 17 | "description": "Service from 2019-01-01 through 2019-12-31", 18 | "type": "invoice", 19 | "service_end_at": "2000-01-01T01:00:00Z", 20 | "service_start_at": "2000-01-01T01:00:00Z", 21 | "plan": "Premier", 22 | "site": "My site" 23 | } 24 | ], 25 | "method": "paypal", 26 | "payment_line_items": [ 27 | { 28 | "amount": 1.0, 29 | "created_at": "2000-01-01T01:00:00Z", 30 | "invoice_id": 1, 31 | "payment_id": 1 32 | } 33 | ], 34 | "payment_reversed_at": "2000-01-01T01:00:00Z", 35 | "payment_type": "example", 36 | "site_name": "My Site", 37 | "type": "invoice" 38 | } 39 | ``` 40 | 41 | * `id` / `id` (int64): Line item Id 42 | * `amount` / `amount` (double): Line item amount 43 | * `balance` / `balance` (double): Line item balance 44 | * `created_at` / `createdAt` (date-time): Line item created at 45 | * `currency` / `currency` (string): Line item currency 46 | * `download_uri` / `downloadUri` (string): Line item download uri 47 | * `invoice_line_items` / `invoiceLineItems` (array(object)): Associated invoice line items 48 | * `method` / `method` (string): Line item payment method 49 | * `payment_line_items` / `paymentLineItems` (array(object)): Associated payment line items 50 | * `payment_reversed_at` / `paymentReversedAt` (date-time): Date/time payment was reversed if applicable 51 | * `payment_type` / `paymentType` (string): Type of payment if applicable 52 | * `site_name` / `siteName` (string): Site name this line item is for 53 | * `type` / `type` (string): Type of line item, either payment or invoice 54 | -------------------------------------------------------------------------------- /docs/Action.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Action 2 | 3 | ## Example Action Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "path": "", 9 | "when": "2000-01-01T01:00:00Z", 10 | "destination": "/to_path", 11 | "display": "Actual text of the action here.", 12 | "ip": "192.283.128.182", 13 | "source": "/from_path", 14 | "targets": null, 15 | "user_id": 1, 16 | "username": "user", 17 | "user_is_from_parent_site": true, 18 | "action": "create", 19 | "failure_type": "none", 20 | "interface": "web" 21 | } 22 | ``` 23 | 24 | * `id` / `id` (int64): Action ID 25 | * `path` / `path` (string): Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 26 | * `when` / `when` (date-time): Action occurrence date/time 27 | * `destination` / `destination` (string): The destination path for this action, if applicable 28 | * `display` / `display` (string): Friendly displayed output 29 | * `ip` / `ip` (string): IP Address that performed this action 30 | * `source` / `source` (string): The source path for this action, if applicable 31 | * `targets` / `targets` (object): Targets 32 | * `user_id` / `userId` (int64): User ID 33 | * `username` / `username` (string): Username 34 | * `user_is_from_parent_site` / `userIsFromParentSite` (boolean): true if this change was performed by a user on a parent site. 35 | * `action` / `action` (string): Type of action 36 | * `failure_type` / `failureType` (string): Failure type. If action was a user login or session failure, why did it fail? 37 | * `interface` / `interfaceName` (string): Interface on which this action occurred. 38 | -------------------------------------------------------------------------------- /docs/ActionNotificationExport.md: -------------------------------------------------------------------------------- 1 | # Files.Models.ActionNotificationExport 2 | 3 | ## Example ActionNotificationExport Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "export_version": "20201213.2", 9 | "start_at": "2000-01-01T01:00:00Z", 10 | "end_at": "2000-01-01T01:00:00Z", 11 | "status": "ready", 12 | "query_path": "MyFile.txt", 13 | "query_folder": "MyFolder", 14 | "query_message": "Connection Refused", 15 | "query_request_method": "GET", 16 | "query_request_url": "http://example.com/webhook", 17 | "query_status": "200", 18 | "query_success": true, 19 | "results_url": "https://files.com/action_notification_results.csv" 20 | } 21 | ``` 22 | 23 | * `id` / `id` (int64): History Export ID 24 | * `export_version` / `exportVersion` (string): Version of the underlying records for the export. 25 | * `start_at` / `startAt` (date-time): Start date/time of export range. 26 | * `end_at` / `endAt` (date-time): End date/time of export range. 27 | * `status` / `status` (string): Status of export. Valid values: `building`, `ready`, or `failed` 28 | * `query_path` / `queryPath` (string): Return notifications that were triggered by actions on this specific path. 29 | * `query_folder` / `queryFolder` (string): Return notifications that were triggered by actions in this folder. 30 | * `query_message` / `queryMessage` (string): Error message associated with the request, if any. 31 | * `query_request_method` / `queryRequestMethod` (string): The HTTP request method used by the webhook. 32 | * `query_request_url` / `queryRequestUrl` (string): The target webhook URL. 33 | * `query_status` / `queryStatus` (string): The HTTP status returned from the server in response to the webhook request. 34 | * `query_success` / `querySuccess` (boolean): true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. 35 | * `results_url` / `resultsUrl` (string): If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. 36 | * `user_id` / `userId` (int64): User ID. Provide a value of `0` to operate the current session's user. 37 | 38 | 39 | --- 40 | 41 | ## Show Action Notification Export 42 | 43 | ``` 44 | ActionNotificationExport actionNotificationExport = ActionNotificationExport.find( 45 | Long id, 46 | HashMap parameters = null, 47 | HashMap options = null 48 | ) 49 | ``` 50 | 51 | ### Parameters 52 | 53 | * `id` (Long): Required - Action Notification Export ID. 54 | 55 | 56 | --- 57 | 58 | ## Create Action Notification Export 59 | 60 | ``` 61 | ActionNotificationExport actionNotificationExport = ActionNotificationExport.create( 62 | 63 | HashMap parameters = null, 64 | HashMap options = null 65 | ) 66 | ``` 67 | 68 | ### Parameters 69 | 70 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 71 | * `start_at` (String): Start date/time of export range. 72 | * `end_at` (String): End date/time of export range. 73 | * `query_message` (String): Error message associated with the request, if any. 74 | * `query_request_method` (String): The HTTP request method used by the webhook. 75 | * `query_request_url` (String): The target webhook URL. 76 | * `query_status` (String): The HTTP status returned from the server in response to the webhook request. 77 | * `query_success` (Boolean): true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. 78 | * `query_path` (String): Return notifications that were triggered by actions on this specific path. 79 | * `query_folder` (String): Return notifications that were triggered by actions in this folder. 80 | -------------------------------------------------------------------------------- /docs/ActionNotificationExportResult.md: -------------------------------------------------------------------------------- 1 | # Files.Models.ActionNotificationExportResult 2 | 3 | ## Example ActionNotificationExportResult Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "created_at": 1, 9 | "status": 200, 10 | "message": "Success", 11 | "success": true, 12 | "request_headers": "{\"User-Agent\":\"Files.com Webhook\"}", 13 | "request_method": "GET", 14 | "request_url": "www.example.com/webhook_receiver", 15 | "path": "MyFolder/MyFile.txt", 16 | "folder": "MyFolder" 17 | } 18 | ``` 19 | 20 | * `id` / `id` (int64): Notification ID 21 | * `created_at` / `createdAt` (int64): When the notification was sent. 22 | * `status` / `status` (int64): HTTP status code returned in the webhook response. 23 | * `message` / `message` (string): A message indicating the overall status of the webhook notification. 24 | * `success` / `success` (boolean): `true` if the webhook succeeded by receiving a 200 or 204 response. 25 | * `request_headers` / `requestHeaders` (string): A JSON-encoded string with headers that were sent with the webhook. 26 | * `request_method` / `requestMethod` (string): The HTTP verb used to perform the webhook. 27 | * `request_url` / `requestUrl` (string): The webhook request URL. 28 | * `path` / `path` (string): The path to the actual file that triggered this notification. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 29 | * `folder` / `folder` (string): The folder associated with the triggering action for this notification. 30 | 31 | 32 | --- 33 | 34 | ## List Action Notification Export Results 35 | 36 | ``` 37 | ListIterator actionNotificationExportResult = ActionNotificationExportResult.list( 38 | 39 | HashMap parameters = null, 40 | HashMap options = null 41 | ) 42 | ``` 43 | 44 | ### Parameters 45 | 46 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 47 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 48 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 49 | * `action_notification_export_id` (Long): Required - ID of the associated action notification export. 50 | -------------------------------------------------------------------------------- /docs/App.md: -------------------------------------------------------------------------------- 1 | # Files.Models.App 2 | 3 | ## Example App Object 4 | 5 | ``` 6 | { 7 | "app_type": "example", 8 | "documentation_links": { 9 | "Important Info": "http://files.test/learn-more" 10 | }, 11 | "extended_description": "example", 12 | "extended_description_for_marketing_site": "example", 13 | "external_homepage_url": "example", 14 | "featured": true, 15 | "folder_behavior_type": "example", 16 | "icon_url": "example", 17 | "logo_thumbnail_url": "example", 18 | "logo_url": "example", 19 | "marketing_intro": "example", 20 | "marketing_youtube_url": "example", 21 | "name": "example", 22 | "package_manager_install_command": "example", 23 | "remote_server_type": "example", 24 | "screenshot_list_urls": [ 25 | "example" 26 | ], 27 | "sdk_installation_instructions_link": "example", 28 | "short_description": "example", 29 | "sso_strategy_type": "example", 30 | "siem_type": "example", 31 | "tutorial_youtube_url": "example" 32 | } 33 | ``` 34 | 35 | * `app_type` / `appType` (string): The type of the App 36 | * `documentation_links` / `documentationLinks` (object): Collection of named links to documentation 37 | * `extended_description` / `extendedDescription` (string): Long description for the in-App landing page 38 | * `extended_description_for_marketing_site` / `extendedDescriptionForMarketingSite` (string): Long form description of the App 39 | * `external_homepage_url` / `externalHomepageUrl` (string): Link to external homepage 40 | * `featured` / `featured` (boolean): Is featured on the App listing? 41 | * `folder_behavior_type` / `folderBehaviorType` (string): Associated Folder Behavior type, if any 42 | * `icon_url` / `iconUrl` (string): App icon 43 | * `logo_thumbnail_url` / `logoThumbnailUrl` (string): Logo thumbnail for the App 44 | * `logo_url` / `logoUrl` (string): Full size logo for the App 45 | * `marketing_intro` / `marketingIntro` (string): Marketing introdution of the App 46 | * `marketing_youtube_url` / `marketingYoutubeUrl` (string): Marketing video page 47 | * `name` / `name` (string): Name of the App 48 | * `package_manager_install_command` / `packageManagerInstallCommand` (string): Package manager install command 49 | * `remote_server_type` / `remoteServerType` (string): Associated Remote Server type, if any 50 | * `screenshot_list_urls` / `screenshotListUrls` (array(string)): Screenshots of the App 51 | * `sdk_installation_instructions_link` / `sdkInstallationInstructionsLink` (string): Link to SDK installation instructions 52 | * `short_description` / `shortDescription` (string): Short description of the App 53 | * `sso_strategy_type` / `ssoStrategyType` (string): Associated SSO Strategy type, if any 54 | * `siem_type` / `siemType` (string): Associated SIEM type, if any 55 | * `tutorial_youtube_url` / `tutorialYoutubeUrl` (string): Tutorial video page 56 | 57 | 58 | --- 59 | 60 | ## List Apps 61 | 62 | ``` 63 | ListIterator app = App.list( 64 | 65 | HashMap parameters = null, 66 | HashMap options = null 67 | ) 68 | ``` 69 | 70 | ### Parameters 71 | 72 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 73 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 74 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `name` and `app_type`. 75 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `name` and `app_type`. Valid field combinations are `[ name, app_type ]`. 76 | * `filter_prefix` (Map): If set, return records where the specified field is prefixed by the supplied value. Valid fields are `name`. 77 | -------------------------------------------------------------------------------- /docs/Auto.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Auto 2 | 3 | ## Example Auto Object 4 | 5 | ``` 6 | { 7 | "dynamic": null 8 | } 9 | ``` 10 | 11 | * `dynamic` / `dynamic` (object): 12 | -------------------------------------------------------------------------------- /docs/AutomationRun.md: -------------------------------------------------------------------------------- 1 | # Files.Models.AutomationRun 2 | 3 | ## Example AutomationRun Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "automation_id": 1, 9 | "completed_at": "2000-01-01T01:00:00Z", 10 | "created_at": "2000-01-01T01:00:00Z", 11 | "retry_at": "2000-01-01T01:00:00Z", 12 | "retried_at": "2000-01-01T01:00:00Z", 13 | "retried_in_run_id": 1, 14 | "retry_of_run_id": 1, 15 | "runtime": 1.0, 16 | "status": "success", 17 | "successful_operations": 1, 18 | "failed_operations": 1, 19 | "status_messages_url": "https://www.example.com/log_file.txt" 20 | } 21 | ``` 22 | 23 | * `id` / `id` (int64): ID. 24 | * `automation_id` / `automationId` (int64): ID of the associated Automation. 25 | * `completed_at` / `completedAt` (date-time): Automation run completion/failure date/time. 26 | * `created_at` / `createdAt` (date-time): Automation run start date/time. 27 | * `retry_at` / `retryAt` (date-time): If set, this automation will be retried at this date/time due to `failure` or `partial_failure`. 28 | * `retried_at` / `retriedAt` (date-time): If set, this Automation run was retried due to `failure` or `partial_failure`. 29 | * `retried_in_run_id` / `retriedInRunId` (int64): ID of the run that is or will be retrying this run. 30 | * `retry_of_run_id` / `retryOfRunId` (int64): ID of the original run that this run is retrying. 31 | * `runtime` / `runtime` (double): Automation run runtime. 32 | * `status` / `status` (string): The success status of the AutomationRun. One of `running`, `success`, `partial_failure`, or `failure`. 33 | * `successful_operations` / `successfulOperations` (int64): Count of successful operations. 34 | * `failed_operations` / `failedOperations` (int64): Count of failed operations. 35 | * `status_messages_url` / `statusMessagesUrl` (string): Link to status messages log file. 36 | 37 | 38 | --- 39 | 40 | ## List Automation Runs 41 | 42 | ``` 43 | ListIterator automationRun = AutomationRun.list( 44 | 45 | HashMap parameters = null, 46 | HashMap options = null 47 | ) 48 | ``` 49 | 50 | ### Parameters 51 | 52 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 53 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 54 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 55 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `automation_id`, `created_at` or `status`. 56 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `status` and `automation_id`. Valid field combinations are `[ automation_id, status ]`. 57 | * `automation_id` (Long): Required - ID of the associated Automation. 58 | 59 | 60 | --- 61 | 62 | ## Show Automation Run 63 | 64 | ``` 65 | AutomationRun automationRun = AutomationRun.find( 66 | Long id, 67 | HashMap parameters = null, 68 | HashMap options = null 69 | ) 70 | ``` 71 | 72 | ### Parameters 73 | 74 | * `id` (Long): Required - Automation Run ID. 75 | -------------------------------------------------------------------------------- /docs/BandwidthSnapshot.md: -------------------------------------------------------------------------------- 1 | # Files.Models.BandwidthSnapshot 2 | 3 | ## Example BandwidthSnapshot Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "bytes_received": 1.0, 9 | "bytes_sent": 1.0, 10 | "sync_bytes_received": 1.0, 11 | "sync_bytes_sent": 1.0, 12 | "requests_get": 1.0, 13 | "requests_put": 1.0, 14 | "requests_other": 1.0, 15 | "logged_at": "2000-01-01T01:00:00Z" 16 | } 17 | ``` 18 | 19 | * `id` / `id` (int64): Site bandwidth ID 20 | * `bytes_received` / `bytesReceived` (double): Site bandwidth report bytes received 21 | * `bytes_sent` / `bytesSent` (double): Site bandwidth report bytes sent 22 | * `sync_bytes_received` / `syncBytesReceived` (double): Site sync bandwidth report bytes received 23 | * `sync_bytes_sent` / `syncBytesSent` (double): Site sync bandwidth report bytes sent 24 | * `requests_get` / `requestsGet` (double): Site bandwidth report get requests 25 | * `requests_put` / `requestsPut` (double): Site bandwidth report put requests 26 | * `requests_other` / `requestsOther` (double): Site bandwidth report other requests 27 | * `logged_at` / `loggedAt` (date-time): Time the site bandwidth report was logged 28 | 29 | 30 | --- 31 | 32 | ## List Bandwidth Snapshots 33 | 34 | ``` 35 | ListIterator bandwidthSnapshot = BandwidthSnapshot.list( 36 | 37 | HashMap parameters = null, 38 | HashMap options = null 39 | ) 40 | ``` 41 | 42 | ### Parameters 43 | 44 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 45 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 46 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `logged_at`. 47 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `logged_at`. 48 | * `filter_gt` (Map): If set, return records where the specified field is greater than the supplied value. Valid fields are `logged_at`. 49 | * `filter_gteq` (Map): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `logged_at`. 50 | * `filter_lt` (Map): If set, return records where the specified field is less than the supplied value. Valid fields are `logged_at`. 51 | * `filter_lteq` (Map): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `logged_at`. 52 | -------------------------------------------------------------------------------- /docs/BundleAction.md: -------------------------------------------------------------------------------- 1 | # Files.Models.BundleAction 2 | 3 | ## Example BundleAction Object 4 | 5 | ``` 6 | { 7 | "action": "create", 8 | "bundle_registration": { 9 | "code": "abc123", 10 | "name": "account", 11 | "company": "Action Verb", 12 | "email": "john.doe@files.com", 13 | "ip": "10.1.1.1", 14 | "inbox_code": "abc123", 15 | "clickwrap_body": "example", 16 | "form_field_set_id": 1, 17 | "form_field_data": { 18 | "key": "example value" 19 | }, 20 | "bundle_code": "example", 21 | "bundle_id": 1, 22 | "bundle_recipient_id": 1, 23 | "created_at": "2000-01-01T01:00:00Z" 24 | }, 25 | "created_at": "2000-01-01T01:00:00Z", 26 | "destination": "/to_path", 27 | "path": "", 28 | "source": "/from_path" 29 | } 30 | ``` 31 | 32 | * `action` / `action` (string): Type of action 33 | * `bundle_registration` / `bundleRegistration` (bundleRegistration): Object that contains bundle registration information 34 | * `created_at` / `createdAt` (date-time): Action occurrence date/time 35 | * `destination` / `destination` (string): The destination path for this bundle action, if applicable 36 | * `path` / `path` (string): Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 37 | * `source` / `source` (string): The source path for this bundle action, if applicable 38 | 39 | 40 | --- 41 | 42 | ## List Bundle Actions 43 | 44 | ``` 45 | ListIterator bundleAction = BundleAction.list( 46 | 47 | HashMap parameters = null, 48 | HashMap options = null 49 | ) 50 | ``` 51 | 52 | ### Parameters 53 | 54 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 55 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 56 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 57 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `created_at`. 58 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `created_at`, `bundle_id` or `bundle_registration_id`. Valid field combinations are `[ bundle_id, created_at ]`, `[ bundle_registration_id, created_at ]`, `[ bundle_id, bundle_registration_id ]` or `[ bundle_id, bundle_registration_id, created_at ]`. 59 | * `filter_gt` (Map): If set, return records where the specified field is greater than the supplied value. Valid fields are `created_at`. 60 | * `filter_gteq` (Map): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`. 61 | * `filter_lt` (Map): If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`. 62 | * `filter_lteq` (Map): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`. 63 | -------------------------------------------------------------------------------- /docs/BundleDownload.md: -------------------------------------------------------------------------------- 1 | # Files.Models.BundleDownload 2 | 3 | ## Example BundleDownload Object 4 | 5 | ``` 6 | { 7 | "bundle_registration": { 8 | "code": "abc123", 9 | "name": "account", 10 | "company": "Action Verb", 11 | "email": "john.doe@files.com", 12 | "ip": "10.1.1.1", 13 | "inbox_code": "abc123", 14 | "clickwrap_body": "example", 15 | "form_field_set_id": 1, 16 | "form_field_data": { 17 | "key": "example value" 18 | }, 19 | "bundle_code": "example", 20 | "bundle_id": 1, 21 | "bundle_recipient_id": 1, 22 | "created_at": "2000-01-01T01:00:00Z" 23 | }, 24 | "download_method": "file", 25 | "path": "a/b/test.txt", 26 | "created_at": "2000-01-01T01:00:00Z" 27 | } 28 | ``` 29 | 30 | * `bundle_registration` / `bundleRegistration` (bundleRegistration): 31 | * `download_method` / `downloadMethod` (string): Download method (file or full_zip) 32 | * `path` / `path` (string): Download path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 33 | * `created_at` / `createdAt` (date-time): Download date/time 34 | 35 | 36 | --- 37 | 38 | ## List Bundle Downloads 39 | 40 | ``` 41 | ListIterator bundleDownload = BundleDownload.list( 42 | 43 | HashMap parameters = null, 44 | HashMap options = null 45 | ) 46 | ``` 47 | 48 | ### Parameters 49 | 50 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 51 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 52 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `created_at`. 53 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `created_at`. 54 | * `filter_gt` (Map): If set, return records where the specified field is greater than the supplied value. Valid fields are `created_at`. 55 | * `filter_gteq` (Map): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`. 56 | * `filter_lt` (Map): If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`. 57 | * `filter_lteq` (Map): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`. 58 | * `bundle_id` (Long): Bundle ID 59 | * `bundle_registration_id` (Long): BundleRegistration ID 60 | -------------------------------------------------------------------------------- /docs/BundlePath.md: -------------------------------------------------------------------------------- 1 | # Files.Models.BundlePath 2 | 3 | ## Example BundlePath Object 4 | 5 | ``` 6 | { 7 | "recursive": true, 8 | "path": "example" 9 | } 10 | ``` 11 | 12 | * `recursive` / `recursive` (boolean): Allow access to subfolders content? 13 | * `path` / `path` (string): The path to the resource relative to filesystem. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 14 | -------------------------------------------------------------------------------- /docs/BundleRecipient.md: -------------------------------------------------------------------------------- 1 | # Files.Models.BundleRecipient 2 | 3 | ## Example BundleRecipient Object 4 | 5 | ``` 6 | { 7 | "company": "Acme Inc.", 8 | "name": "John Doe", 9 | "note": "Some note.", 10 | "recipient": "john.doe@example.com", 11 | "sent_at": "2000-01-01T01:00:00Z" 12 | } 13 | ``` 14 | 15 | * `company` / `company` (string): The recipient's company. 16 | * `name` / `name` (string): The recipient's name. 17 | * `note` / `note` (string): A note sent to the recipient with the bundle. 18 | * `recipient` / `recipient` (string): The recipient's email address. 19 | * `sent_at` / `sentAt` (date-time): When the Bundle was shared with this recipient. 20 | * `user_id` / `userId` (int64): User ID. Provide a value of `0` to operate the current session's user. 21 | * `bundle_id` / `bundleId` (int64): Bundle to share. 22 | * `share_after_create` / `shareAfterCreate` (boolean): Set to true to share the link with the recipient upon creation. 23 | 24 | 25 | --- 26 | 27 | ## List Bundle Recipients 28 | 29 | ``` 30 | ListIterator bundleRecipient = BundleRecipient.list( 31 | 32 | HashMap parameters = null, 33 | HashMap options = null 34 | ) 35 | ``` 36 | 37 | ### Parameters 38 | 39 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 40 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 41 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 42 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are . 43 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `has_registrations`. 44 | * `bundle_id` (Long): Required - List recipients for the bundle with this ID. 45 | 46 | 47 | --- 48 | 49 | ## Create Bundle Recipient 50 | 51 | ``` 52 | BundleRecipient bundleRecipient = BundleRecipient.create( 53 | 54 | HashMap parameters = null, 55 | HashMap options = null 56 | ) 57 | ``` 58 | 59 | ### Parameters 60 | 61 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 62 | * `bundle_id` (Long): Required - Bundle to share. 63 | * `recipient` (String): Required - Email addresses to share this bundle with. 64 | * `name` (String): Name of recipient. 65 | * `company` (String): Company of recipient. 66 | * `note` (String): Note to include in email. 67 | * `share_after_create` (Boolean): Set to true to share the link with the recipient upon creation. 68 | -------------------------------------------------------------------------------- /docs/BundleRegistration.md: -------------------------------------------------------------------------------- 1 | # Files.Models.BundleRegistration 2 | 3 | ## Example BundleRegistration Object 4 | 5 | ``` 6 | { 7 | "code": "abc123", 8 | "name": "account", 9 | "company": "Action Verb", 10 | "email": "john.doe@files.com", 11 | "ip": "10.1.1.1", 12 | "inbox_code": "abc123", 13 | "clickwrap_body": "example", 14 | "form_field_set_id": 1, 15 | "form_field_data": { 16 | "key": "example value" 17 | }, 18 | "bundle_code": "example", 19 | "bundle_id": 1, 20 | "bundle_recipient_id": 1, 21 | "created_at": "2000-01-01T01:00:00Z" 22 | } 23 | ``` 24 | 25 | * `code` / `code` (string): Registration cookie code 26 | * `name` / `name` (string): Registrant name 27 | * `company` / `company` (string): Registrant company name 28 | * `email` / `email` (string): Registrant email address 29 | * `ip` / `ip` (string): Registrant IP Address 30 | * `inbox_code` / `inboxCode` (string): InboxRegistration cookie code, if there is an associated InboxRegistration 31 | * `clickwrap_body` / `clickwrapBody` (string): Clickwrap text that was shown to the registrant 32 | * `form_field_set_id` / `formFieldSetId` (int64): Id of associated form field set 33 | * `form_field_data` / `formFieldData` (object): Data for form field set with form field ids as keys and user data as values 34 | * `bundle_code` / `bundleCode` (string): Bundle URL code 35 | * `bundle_id` / `bundleId` (int64): Id of associated bundle 36 | * `bundle_recipient_id` / `bundleRecipientId` (int64): Id of associated bundle recipient 37 | * `created_at` / `createdAt` (date-time): Registration creation date/time 38 | 39 | 40 | --- 41 | 42 | ## List Bundle Registrations 43 | 44 | ``` 45 | ListIterator bundleRegistration = BundleRegistration.list( 46 | 47 | HashMap parameters = null, 48 | HashMap options = null 49 | ) 50 | ``` 51 | 52 | ### Parameters 53 | 54 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 55 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 56 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 57 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `bundle_id`. 58 | * `bundle_id` (Long): ID of the associated Bundle 59 | -------------------------------------------------------------------------------- /docs/DnsRecord.md: -------------------------------------------------------------------------------- 1 | # Files.Models.DnsRecord 2 | 3 | ## Example DnsRecord Object 4 | 5 | ``` 6 | { 7 | "id": "customdomain.com-CNAME-site.files.com", 8 | "domain": "my-custom-domain.com", 9 | "rrtype": "CNAME", 10 | "value": "mysite.files.com" 11 | } 12 | ``` 13 | 14 | * `id` / `id` (string): Unique label for DNS record; used by Zapier and other integrations. 15 | * `domain` / `domain` (string): DNS record domain name 16 | * `rrtype` / `rrtype` (string): DNS record type 17 | * `value` / `value` (string): DNS record value 18 | 19 | 20 | --- 21 | 22 | ## Show Site DNS Configuration 23 | 24 | ``` 25 | ListIterator dnsRecord = DnsRecord.list( 26 | 27 | HashMap parameters = null, 28 | HashMap options = null 29 | ) 30 | ``` 31 | 32 | ### Parameters 33 | 34 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 35 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 36 | -------------------------------------------------------------------------------- /docs/EmailIncomingMessage.md: -------------------------------------------------------------------------------- 1 | # Files.Models.EmailIncomingMessage 2 | 3 | ## Example EmailIncomingMessage Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "inbox_id": 1, 9 | "sender": "example", 10 | "sender_name": "example", 11 | "status": "success", 12 | "body": "example", 13 | "message": "example", 14 | "created_at": "2000-01-01T01:00:00Z", 15 | "inbox_title": "Inbox Title" 16 | } 17 | ``` 18 | 19 | * `id` / `id` (int64): Id of the Email Incoming Message 20 | * `inbox_id` / `inboxId` (int64): Id of the Inbox associated with this message 21 | * `sender` / `sender` (string): Sender of the email 22 | * `sender_name` / `senderName` (string): Sender name 23 | * `status` / `status` (string): Status of the message 24 | * `body` / `body` (string): Body of the email 25 | * `message` / `message` (string): Message describing the failure 26 | * `created_at` / `createdAt` (date-time): Message creation date/time 27 | * `inbox_title` / `inboxTitle` (string): Title of the Inbox associated with this message 28 | 29 | 30 | --- 31 | 32 | ## List Email Incoming Messages 33 | 34 | ``` 35 | ListIterator emailIncomingMessage = EmailIncomingMessage.list( 36 | 37 | HashMap parameters = null, 38 | HashMap options = null 39 | ) 40 | ``` 41 | 42 | ### Parameters 43 | 44 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 45 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 46 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `created_at`, `sender`, `status` or `inbox_id`. 47 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `created_at`, `inbox_id`, `sender` or `status`. Valid field combinations are `[ inbox_id, created_at ]`, `[ sender, created_at ]`, `[ status, created_at ]`, `[ inbox_id, status ]`, `[ status, sender ]`, `[ inbox_id, status, created_at ]`, `[ status, sender, created_at ]`, `[ inbox_id, status, sender ]` or `[ inbox_id, status, sender, created_at ]`. 48 | * `filter_gt` (Map): If set, return records where the specified field is greater than the supplied value. Valid fields are `created_at`. 49 | * `filter_gteq` (Map): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`. 50 | * `filter_prefix` (Map): If set, return records where the specified field is prefixed by the supplied value. Valid fields are `sender`. 51 | * `filter_lt` (Map): If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`. 52 | * `filter_lteq` (Map): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`. 53 | -------------------------------------------------------------------------------- /docs/EmailLog.md: -------------------------------------------------------------------------------- 1 | # Files.Models.EmailLog 2 | 3 | ## Example EmailLog Object 4 | 5 | ``` 6 | { 7 | "timestamp": "2000-01-01T01:00:00Z", 8 | "message": "example", 9 | "status": "example", 10 | "subject": "example", 11 | "to": "example", 12 | "cc": "example", 13 | "delivery_method": "example", 14 | "smtp_hostname": "example", 15 | "smtp_ip": "example" 16 | } 17 | ``` 18 | 19 | * `timestamp` / `timestamp` (date-time): Start Time of Action 20 | * `message` / `message` (string): Log Message 21 | * `status` / `status` (string): Status of E-Mail delivery 22 | * `subject` / `subject` (string): Subject line of E-Mail 23 | * `to` / `to` (string): To field of E-Mail 24 | * `cc` / `cc` (string): CC field of E-Mail 25 | * `delivery_method` / `deliveryMethod` (string): How was the email delivered? `customer_smtp` or `files.com` 26 | * `smtp_hostname` / `smtpHostname` (string): Customer SMTP Hostname used. 27 | * `smtp_ip` / `smtpIp` (string): Customer SMTP IP address as resolved for use (useful for troubleshooting DNS issues with customer SMTP). 28 | 29 | 30 | --- 31 | 32 | ## List Email Logs 33 | 34 | ``` 35 | ListIterator emailLog = EmailLog.list( 36 | 37 | HashMap parameters = null, 38 | HashMap options = null 39 | ) 40 | ``` 41 | 42 | ### Parameters 43 | 44 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 45 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 46 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `start_date`, `end_date` or `status`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ status ]`, `[ start_date, end_date ]`, `[ start_date, status ]` or `[ end_date, status ]`. 47 | * `filter_prefix` (Map): If set, return records where the specified field is prefixed by the supplied value. Valid fields are `status`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ status ]`, `[ start_date, end_date ]`, `[ start_date, status ]` or `[ end_date, status ]`. 48 | -------------------------------------------------------------------------------- /docs/Errors.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Errors 2 | 3 | ## Example Errors Object 4 | 5 | ``` 6 | { 7 | "fields": [ 8 | 9 | ], 10 | "messages": [ 11 | 12 | ] 13 | } 14 | ``` 15 | 16 | * `fields` / `fields` (array(string)): A list of fields where errors occur 17 | * `messages` / `messages` (array(string)): A list of error messages 18 | -------------------------------------------------------------------------------- /docs/FileAction.md: -------------------------------------------------------------------------------- 1 | # Files.Models.FileAction 2 | 3 | ## Example FileAction Object 4 | 5 | ``` 6 | { 7 | "status": "pending", 8 | "file_migration_id": 1 9 | } 10 | ``` 11 | 12 | * `status` / `status` (string): Status of file operation. 13 | * `file_migration_id` / `fileMigrationId` (int64): If status is pending, this is the id of the File Migration to check for status updates. 14 | -------------------------------------------------------------------------------- /docs/FileComment.md: -------------------------------------------------------------------------------- 1 | # Files.Models.FileComment 2 | 3 | ## Example FileComment Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "body": "What a great file!", 9 | "reactions": [ 10 | { 11 | "id": 1, 12 | "emoji": "👍" 13 | } 14 | ] 15 | } 16 | ``` 17 | 18 | * `id` / `id` (int64): File Comment ID 19 | * `body` / `body` (string): Comment body. 20 | * `reactions` / `reactions` (array(object)): Reactions to this comment. 21 | * `path` / `path` (string): File path. 22 | 23 | 24 | --- 25 | 26 | ## List File Comments by Path 27 | 28 | ``` 29 | ListIterator fileComment = FileComment.listFor( 30 | String path, 31 | HashMap parameters = null, 32 | HashMap options = null 33 | ) 34 | ``` 35 | 36 | ### Parameters 37 | 38 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 39 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 40 | * `path` (String): Required - Path to operate on. 41 | 42 | 43 | --- 44 | 45 | ## Create File Comment 46 | 47 | ``` 48 | FileComment fileComment = FileComment.create( 49 | 50 | HashMap parameters = null, 51 | HashMap options = null 52 | ) 53 | ``` 54 | 55 | ### Parameters 56 | 57 | * `body` (String): Required - Comment body. 58 | * `path` (String): Required - File path. 59 | 60 | 61 | --- 62 | 63 | ## Update File Comment 64 | 65 | ``` 66 | FileComment fileComment = FileComment.update( 67 | Long id, 68 | HashMap parameters = null, 69 | HashMap options = null 70 | ) 71 | ``` 72 | 73 | ### Parameters 74 | 75 | * `id` (Long): Required - File Comment ID. 76 | * `body` (String): Required - Comment body. 77 | 78 | 79 | --- 80 | 81 | ## Delete File Comment 82 | 83 | ``` 84 | void fileComment = FileComment.delete( 85 | Long id, 86 | HashMap parameters = null, 87 | HashMap options = null 88 | ) 89 | ``` 90 | 91 | ### Parameters 92 | 93 | * `id` (Long): Required - File Comment ID. 94 | 95 | 96 | --- 97 | 98 | ## Update File Comment 99 | 100 | ``` 101 | FileComment fileComment = FileComment.list()[0]; 102 | 103 | HashMap parameters = new HashMap<>(); 104 | parameters.put("body", "body"); 105 | 106 | fileComment.update(parameters); 107 | ``` 108 | 109 | ### Parameters 110 | 111 | * `id` (Long): Required - File Comment ID. 112 | * `body` (String): Required - Comment body. 113 | 114 | 115 | --- 116 | 117 | ## Delete File Comment 118 | 119 | ``` 120 | FileComment fileComment = FileComment.list()[0]; 121 | 122 | HashMap parameters = new HashMap<>(); 123 | 124 | fileComment.delete(parameters); 125 | ``` 126 | 127 | ### Parameters 128 | 129 | * `id` (Long): Required - File Comment ID. 130 | -------------------------------------------------------------------------------- /docs/FileCommentReaction.md: -------------------------------------------------------------------------------- 1 | # Files.Models.FileCommentReaction 2 | 3 | ## Example FileCommentReaction Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "emoji": "👍" 9 | } 10 | ``` 11 | 12 | * `id` / `id` (int64): Reaction ID 13 | * `emoji` / `emoji` (string): Emoji used in the reaction. 14 | * `user_id` / `userId` (int64): User ID. Provide a value of `0` to operate the current session's user. 15 | * `file_comment_id` / `fileCommentId` (int64): ID of file comment to attach reaction to. 16 | 17 | 18 | --- 19 | 20 | ## Create File Comment Reaction 21 | 22 | ``` 23 | FileCommentReaction fileCommentReaction = FileCommentReaction.create( 24 | 25 | HashMap parameters = null, 26 | HashMap options = null 27 | ) 28 | ``` 29 | 30 | ### Parameters 31 | 32 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 33 | * `file_comment_id` (Long): Required - ID of file comment to attach reaction to. 34 | * `emoji` (String): Required - Emoji to react with. 35 | 36 | 37 | --- 38 | 39 | ## Delete File Comment Reaction 40 | 41 | ``` 42 | void fileCommentReaction = FileCommentReaction.delete( 43 | Long id, 44 | HashMap parameters = null, 45 | HashMap options = null 46 | ) 47 | ``` 48 | 49 | ### Parameters 50 | 51 | * `id` (Long): Required - File Comment Reaction ID. 52 | 53 | 54 | --- 55 | 56 | ## Delete File Comment Reaction 57 | 58 | ``` 59 | HashMap attributes = new HashMap<>(); 60 | void fileCommentReaction = new FileCommentReaction(attributes); 61 | 62 | HashMap parameters = new HashMap<>(); 63 | 64 | fileCommentReaction.delete(parameters); 65 | ``` 66 | 67 | ### Parameters 68 | 69 | * `id` (Long): Required - File Comment Reaction ID. 70 | -------------------------------------------------------------------------------- /docs/FileMigration.md: -------------------------------------------------------------------------------- 1 | # Files.Models.FileMigration 2 | 3 | ## Example FileMigration Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "path": "MyFolder", 9 | "dest_path": "MyFolder", 10 | "files_moved": 1, 11 | "files_total": 1, 12 | "operation": "move", 13 | "region": "USA", 14 | "status": "complete", 15 | "log_url": "https://www.example.com/log_file" 16 | } 17 | ``` 18 | 19 | * `id` / `id` (int64): File migration ID 20 | * `path` / `path` (string): Source path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 21 | * `dest_path` / `destPath` (string): Destination path 22 | * `files_moved` / `filesMoved` (int64): Number of files processed 23 | * `files_total` / `filesTotal` (int64): 24 | * `operation` / `operation` (string): The type of operation 25 | * `region` / `region` (string): Region 26 | * `status` / `status` (string): Status 27 | * `log_url` / `logUrl` (string): Link to download the log file for this migration. 28 | 29 | 30 | --- 31 | 32 | ## Show File Migration 33 | 34 | ``` 35 | FileMigration fileMigration = FileMigration.find( 36 | Long id, 37 | HashMap parameters = null, 38 | HashMap options = null 39 | ) 40 | ``` 41 | 42 | ### Parameters 43 | 44 | * `id` (Long): Required - File Migration ID. 45 | -------------------------------------------------------------------------------- /docs/FileUploadPart.md: -------------------------------------------------------------------------------- 1 | # Files.Models.FileUploadPart 2 | 3 | ## Example FileUploadPart Object 4 | 5 | ``` 6 | { 7 | "send": { 8 | "key": "example value" 9 | }, 10 | "action": "multipart", 11 | "ask_about_overwrites": true, 12 | "available_parts": 1, 13 | "expires": "example", 14 | "headers": { 15 | "key": "example value" 16 | }, 17 | "http_method": "PUT", 18 | "next_partsize": 1, 19 | "parallel_parts": true, 20 | "retry_parts": true, 21 | "parameters": { 22 | "key": "example value" 23 | }, 24 | "part_number": 1, 25 | "partsize": 1, 26 | "path": "", 27 | "ref": "upload-1", 28 | "upload_uri": "example" 29 | } 30 | ``` 31 | 32 | * `send` / `send` (object): Content-Type and File to send 33 | * `action` / `action` (string): Type of upload 34 | * `ask_about_overwrites` / `askAboutOverwrites` (boolean): If `true`, this file exists and you may wish to ask the user for overwrite confirmation 35 | * `available_parts` / `availableParts` (int64): Number of parts in the upload 36 | * `expires` / `expires` (string): Date/time of when this Upload part expires and the URL cannot be used any more 37 | * `headers` / `headers` (object): Additional upload headers to provide as part of the upload 38 | * `http_method` / `httpMethod` (string): HTTP Method to use for uploading the part, usually `PUT` 39 | * `next_partsize` / `nextPartsize` (int64): Size in bytes for this part 40 | * `parallel_parts` / `parallelParts` (boolean): If `true`, multiple parts may be uploaded in parallel. If `false`, be sure to only upload one part at a time, in order. 41 | * `retry_parts` / `retryParts` (boolean): If `true`, parts may be retried. If `false`, a part cannot be retried and the upload should be restarted. 42 | * `parameters` / `parameters` (object): Additional HTTP parameters to send with the upload 43 | * `part_number` / `partNumber` (int64): Number of this upload part 44 | * `partsize` / `partsize` (int64): Size in bytes for the next upload part 45 | * `path` / `path` (string): New file path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 46 | * `ref` / `ref` (string): Reference name for this upload part 47 | * `upload_uri` / `uploadUri` (string): URI to upload this part to 48 | -------------------------------------------------------------------------------- /docs/FormField.md: -------------------------------------------------------------------------------- 1 | # Files.Models.FormField 2 | 3 | ## Example FormField Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "label": "Sample Label", 9 | "required": true, 10 | "help_text": "Help Text", 11 | "field_type": "text", 12 | "options_for_select": [ 13 | "red", 14 | "green", 15 | "blue" 16 | ], 17 | "default_option": "red", 18 | "form_field_set_id": 1 19 | } 20 | ``` 21 | 22 | * `id` / `id` (int64): Form field id 23 | * `label` / `label` (string): Label to be displayed 24 | * `required` / `required` (boolean): Is this a required field? 25 | * `help_text` / `helpText` (string): Help text to be displayed 26 | * `field_type` / `fieldType` (string): Type of Field 27 | * `options_for_select` / `optionsForSelect` (array(string)): Options to display for radio and dropdown 28 | * `default_option` / `defaultOption` (string): Default option for radio and dropdown 29 | * `form_field_set_id` / `formFieldSetId` (int64): Form field set id 30 | -------------------------------------------------------------------------------- /docs/GroupUser.md: -------------------------------------------------------------------------------- 1 | # Files.Models.GroupUser 2 | 3 | ## Example GroupUser Object 4 | 5 | ``` 6 | { 7 | "group_name": "My Group", 8 | "group_id": 1, 9 | "user_id": 1, 10 | "admin": true, 11 | "usernames": "user" 12 | } 13 | ``` 14 | 15 | * `group_name` / `groupName` (string): Group name 16 | * `group_id` / `groupId` (int64): Group ID 17 | * `user_id` / `userId` (int64): User ID 18 | * `admin` / `admin` (boolean): Is this user an administrator of this group? 19 | * `usernames` / `usernames` (string): Comma-delimited list of usernames who belong to this group (separated by commas). 20 | * `id` / `id` (int64): Group User ID. 21 | 22 | 23 | --- 24 | 25 | ## List Group Users 26 | 27 | ``` 28 | ListIterator groupUser = GroupUser.list( 29 | 30 | HashMap parameters = null, 31 | HashMap options = null 32 | ) 33 | ``` 34 | 35 | ### Parameters 36 | 37 | * `user_id` (Long): User ID. If provided, will return group_users of this user. 38 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 39 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 40 | * `group_id` (Long): Group ID. If provided, will return group_users of this group. 41 | 42 | 43 | --- 44 | 45 | ## Create Group User 46 | 47 | ``` 48 | GroupUser groupUser = GroupUser.create( 49 | 50 | HashMap parameters = null, 51 | HashMap options = null 52 | ) 53 | ``` 54 | 55 | ### Parameters 56 | 57 | * `group_id` (Long): Required - Group ID to add user to. 58 | * `user_id` (Long): Required - User ID to add to group. 59 | * `admin` (Boolean): Is the user a group administrator? 60 | 61 | 62 | --- 63 | 64 | ## Update Group User 65 | 66 | ``` 67 | GroupUser groupUser = GroupUser.update( 68 | Long id, 69 | HashMap parameters = null, 70 | HashMap options = null 71 | ) 72 | ``` 73 | 74 | ### Parameters 75 | 76 | * `id` (Long): Required - Group User ID. 77 | * `group_id` (Long): Required - Group ID to add user to. 78 | * `user_id` (Long): Required - User ID to add to group. 79 | * `admin` (Boolean): Is the user a group administrator? 80 | 81 | 82 | --- 83 | 84 | ## Delete Group User 85 | 86 | ``` 87 | void groupUser = GroupUser.delete( 88 | Long id, 89 | HashMap parameters = null, 90 | HashMap options = null 91 | ) 92 | ``` 93 | 94 | ### Parameters 95 | 96 | * `id` (Long): Required - Group User ID. 97 | * `group_id` (Long): Required - Group ID from which to remove user. 98 | * `user_id` (Long): Required - User ID to remove from group. 99 | 100 | 101 | --- 102 | 103 | ## Update Group User 104 | 105 | ``` 106 | GroupUser groupUser = GroupUser.list()[0]; 107 | 108 | HashMap parameters = new HashMap<>(); 109 | parameters.put("group_id", 1); 110 | parameters.put("user_id", 1); 111 | parameters.put("admin", false); 112 | 113 | groupUser.update(parameters); 114 | ``` 115 | 116 | ### Parameters 117 | 118 | * `id` (Long): Required - Group User ID. 119 | * `group_id` (Long): Required - Group ID to add user to. 120 | * `user_id` (Long): Required - User ID to add to group. 121 | * `admin` (Boolean): Is the user a group administrator? 122 | 123 | 124 | --- 125 | 126 | ## Delete Group User 127 | 128 | ``` 129 | GroupUser groupUser = GroupUser.list()[0]; 130 | 131 | HashMap parameters = new HashMap<>(); 132 | parameters.put("group_id", 1); 133 | parameters.put("user_id", 1); 134 | 135 | groupUser.delete(parameters); 136 | ``` 137 | 138 | ### Parameters 139 | 140 | * `id` (Long): Required - Group User ID. 141 | * `group_id` (Long): Required - Group ID from which to remove user. 142 | * `user_id` (Long): Required - User ID to remove from group. 143 | -------------------------------------------------------------------------------- /docs/Image.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Image 2 | 3 | ## Example Image Object 4 | 5 | ``` 6 | { 7 | "name": "My logo", 8 | "uri": "https://mysite.files.com/.../my_image.png" 9 | } 10 | ``` 11 | 12 | * `name` / `name` (string): Image name 13 | * `uri` / `uri` (string): Image URI 14 | -------------------------------------------------------------------------------- /docs/InboxRecipient.md: -------------------------------------------------------------------------------- 1 | # Files.Models.InboxRecipient 2 | 3 | ## Example InboxRecipient Object 4 | 5 | ``` 6 | { 7 | "company": "Acme Inc.", 8 | "name": "John Doe", 9 | "note": "Some note.", 10 | "recipient": "john.doe@example.com", 11 | "sent_at": "2000-01-01T01:00:00Z" 12 | } 13 | ``` 14 | 15 | * `company` / `company` (string): The recipient's company. 16 | * `name` / `name` (string): The recipient's name. 17 | * `note` / `note` (string): A note sent to the recipient with the inbox. 18 | * `recipient` / `recipient` (string): The recipient's email address. 19 | * `sent_at` / `sentAt` (date-time): When the Inbox was shared with this recipient. 20 | * `inbox_id` / `inboxId` (int64): Inbox to share. 21 | * `share_after_create` / `shareAfterCreate` (boolean): Set to true to share the link with the recipient upon creation. 22 | 23 | 24 | --- 25 | 26 | ## List Inbox Recipients 27 | 28 | ``` 29 | ListIterator inboxRecipient = InboxRecipient.list( 30 | 31 | HashMap parameters = null, 32 | HashMap options = null 33 | ) 34 | ``` 35 | 36 | ### Parameters 37 | 38 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 39 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 40 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are . 41 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `has_registrations`. 42 | * `inbox_id` (Long): Required - List recipients for the inbox with this ID. 43 | 44 | 45 | --- 46 | 47 | ## Create Inbox Recipient 48 | 49 | ``` 50 | InboxRecipient inboxRecipient = InboxRecipient.create( 51 | 52 | HashMap parameters = null, 53 | HashMap options = null 54 | ) 55 | ``` 56 | 57 | ### Parameters 58 | 59 | * `inbox_id` (Long): Required - Inbox to share. 60 | * `recipient` (String): Required - Email address to share this inbox with. 61 | * `name` (String): Name of recipient. 62 | * `company` (String): Company of recipient. 63 | * `note` (String): Note to include in email. 64 | * `share_after_create` (Boolean): Set to true to share the link with the recipient upon creation. 65 | -------------------------------------------------------------------------------- /docs/InboxRegistration.md: -------------------------------------------------------------------------------- 1 | # Files.Models.InboxRegistration 2 | 3 | ## Example InboxRegistration Object 4 | 5 | ``` 6 | { 7 | "code": "abc123", 8 | "name": "account", 9 | "company": "Action Verb", 10 | "email": "john.doe@files.com", 11 | "ip": "10.1.1.1", 12 | "clickwrap_body": "example", 13 | "form_field_set_id": 1, 14 | "form_field_data": { 15 | "key": "example value" 16 | }, 17 | "inbox_id": 1, 18 | "inbox_recipient_id": 1, 19 | "inbox_title": "example", 20 | "created_at": "2000-01-01T01:00:00Z" 21 | } 22 | ``` 23 | 24 | * `code` / `code` (string): Registration cookie code 25 | * `name` / `name` (string): Registrant name 26 | * `company` / `company` (string): Registrant company name 27 | * `email` / `email` (string): Registrant email address 28 | * `ip` / `ip` (string): Registrant IP Address 29 | * `clickwrap_body` / `clickwrapBody` (string): Clickwrap text that was shown to the registrant 30 | * `form_field_set_id` / `formFieldSetId` (int64): Id of associated form field set 31 | * `form_field_data` / `formFieldData` (object): Data for form field set with form field ids as keys and user data as values 32 | * `inbox_id` / `inboxId` (int64): Id of associated inbox 33 | * `inbox_recipient_id` / `inboxRecipientId` (int64): Id of associated inbox recipient 34 | * `inbox_title` / `inboxTitle` (string): Title of associated inbox 35 | * `created_at` / `createdAt` (date-time): Registration creation date/time 36 | 37 | 38 | --- 39 | 40 | ## List Inbox Registrations 41 | 42 | ``` 43 | ListIterator inboxRegistration = InboxRegistration.list( 44 | 45 | HashMap parameters = null, 46 | HashMap options = null 47 | ) 48 | ``` 49 | 50 | ### Parameters 51 | 52 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 53 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 54 | * `folder_behavior_id` (Long): ID of the associated Inbox. 55 | -------------------------------------------------------------------------------- /docs/InboxUpload.md: -------------------------------------------------------------------------------- 1 | # Files.Models.InboxUpload 2 | 3 | ## Example InboxUpload Object 4 | 5 | ``` 6 | { 7 | "inbox_registration": { 8 | "code": "abc123", 9 | "name": "account", 10 | "company": "Action Verb", 11 | "email": "john.doe@files.com", 12 | "ip": "10.1.1.1", 13 | "clickwrap_body": "example", 14 | "form_field_set_id": 1, 15 | "form_field_data": { 16 | "key": "example value" 17 | }, 18 | "inbox_id": 1, 19 | "inbox_recipient_id": 1, 20 | "inbox_title": "example", 21 | "created_at": "2000-01-01T01:00:00Z" 22 | }, 23 | "path": "a/b/test.txt", 24 | "created_at": "2000-01-01T01:00:00Z" 25 | } 26 | ``` 27 | 28 | * `inbox_registration` / `inboxRegistration` (inboxRegistration): 29 | * `path` / `path` (string): Upload path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 30 | * `created_at` / `createdAt` (date-time): Upload date/time 31 | 32 | 33 | --- 34 | 35 | ## List Inbox Uploads 36 | 37 | ``` 38 | ListIterator inboxUpload = InboxUpload.list( 39 | 40 | HashMap parameters = null, 41 | HashMap options = null 42 | ) 43 | ``` 44 | 45 | ### Parameters 46 | 47 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 48 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 49 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `created_at`. 50 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `created_at`, `folder_behavior_id` or `inbox_registration_id`. Valid field combinations are `[ folder_behavior_id, created_at ]`, `[ inbox_registration_id, created_at ]`, `[ folder_behavior_id, inbox_registration_id ]` or `[ folder_behavior_id, inbox_registration_id, created_at ]`. 51 | * `filter_gt` (Map): If set, return records where the specified field is greater than the supplied value. Valid fields are `created_at`. 52 | * `filter_gteq` (Map): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`. 53 | * `filter_lt` (Map): If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`. 54 | * `filter_lteq` (Map): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`. 55 | -------------------------------------------------------------------------------- /docs/Invoice.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Invoice 2 | 3 | ## Example Invoice Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "amount": 1.0, 9 | "balance": 1.0, 10 | "created_at": "2000-01-01T01:00:00Z", 11 | "currency": "USD", 12 | "download_uri": "https://url...", 13 | "invoice_line_items": [ 14 | { 15 | "amount": 1.0, 16 | "created_at": "2000-01-01T01:00:00Z", 17 | "description": "Service from 2019-01-01 through 2019-12-31", 18 | "type": "invoice", 19 | "service_end_at": "2000-01-01T01:00:00Z", 20 | "service_start_at": "2000-01-01T01:00:00Z", 21 | "plan": "Premier", 22 | "site": "My site" 23 | } 24 | ], 25 | "method": "paypal", 26 | "payment_line_items": [ 27 | { 28 | "amount": 1.0, 29 | "created_at": "2000-01-01T01:00:00Z", 30 | "invoice_id": 1, 31 | "payment_id": 1 32 | } 33 | ], 34 | "payment_reversed_at": "2000-01-01T01:00:00Z", 35 | "payment_type": "example", 36 | "site_name": "My Site", 37 | "type": "invoice" 38 | } 39 | ``` 40 | 41 | * `id` / `id` (int64): Line item Id 42 | * `amount` / `amount` (double): Line item amount 43 | * `balance` / `balance` (double): Line item balance 44 | * `created_at` / `createdAt` (date-time): Line item created at 45 | * `currency` / `currency` (string): Line item currency 46 | * `download_uri` / `downloadUri` (string): Line item download uri 47 | * `invoice_line_items` / `invoiceLineItems` (array(object)): Associated invoice line items 48 | * `method` / `method` (string): Line item payment method 49 | * `payment_line_items` / `paymentLineItems` (array(object)): Associated payment line items 50 | * `payment_reversed_at` / `paymentReversedAt` (date-time): Date/time payment was reversed if applicable 51 | * `payment_type` / `paymentType` (string): Type of payment if applicable 52 | * `site_name` / `siteName` (string): Site name this line item is for 53 | * `type` / `type` (string): Type of line item, either payment or invoice 54 | 55 | 56 | --- 57 | 58 | ## List Invoices 59 | 60 | ``` 61 | ListIterator invoice = Invoice.list( 62 | 63 | HashMap parameters = null, 64 | HashMap options = null 65 | ) 66 | ``` 67 | 68 | ### Parameters 69 | 70 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 71 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 72 | 73 | 74 | --- 75 | 76 | ## Show Invoice 77 | 78 | ``` 79 | AccountLineItem invoice = Invoice.find( 80 | Long id, 81 | HashMap parameters = null, 82 | HashMap options = null 83 | ) 84 | ``` 85 | 86 | ### Parameters 87 | 88 | * `id` (Long): Required - Invoice ID. 89 | -------------------------------------------------------------------------------- /docs/InvoiceLineItem.md: -------------------------------------------------------------------------------- 1 | # Files.Models.InvoiceLineItem 2 | 3 | ## Example InvoiceLineItem Object 4 | 5 | ``` 6 | { 7 | "amount": 1.0, 8 | "created_at": "2000-01-01T01:00:00Z", 9 | "description": "Service from 2019-01-01 through 2019-12-31", 10 | "type": "invoice", 11 | "service_end_at": "2000-01-01T01:00:00Z", 12 | "service_start_at": "2000-01-01T01:00:00Z", 13 | "plan": "Premier", 14 | "site": "My site" 15 | } 16 | ``` 17 | 18 | * `amount` / `amount` (double): Invoice line item amount 19 | * `created_at` / `createdAt` (date-time): Invoice line item created at date/time 20 | * `description` / `description` (string): Invoice line item description 21 | * `type` / `type` (string): Invoice line item type 22 | * `service_end_at` / `serviceEndAt` (date-time): Invoice line item service end date/time 23 | * `service_start_at` / `serviceStartAt` (date-time): Invoice line item service start date/time 24 | * `plan` / `plan` (string): Plan name 25 | * `site` / `site` (string): Site name 26 | -------------------------------------------------------------------------------- /docs/IpAddress.md: -------------------------------------------------------------------------------- 1 | # Files.Models.IpAddress 2 | 3 | ## Example IpAddress Object 4 | 5 | ``` 6 | { 7 | "id": "Site", 8 | "associated_with": "Site", 9 | "group_id": 1, 10 | "ip_addresses": [ 11 | "127.0.0.1" 12 | ] 13 | } 14 | ``` 15 | 16 | * `id` / `id` (string): Unique label for list; used by Zapier and other integrations. 17 | * `associated_with` / `associatedWith` (string): The object that this public IP address list is associated with. 18 | * `group_id` / `groupId` (int64): Group ID 19 | * `ip_addresses` / `ipAddresses` (array(string)): A list of IP addresses. 20 | 21 | 22 | --- 23 | 24 | ## List IP Addresses associated with the current site 25 | 26 | ``` 27 | ListIterator ipAddress = IpAddress.list( 28 | 29 | HashMap parameters = null, 30 | HashMap options = null 31 | ) 32 | ``` 33 | 34 | ### Parameters 35 | 36 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 37 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 38 | 39 | 40 | --- 41 | 42 | ## List all possible public SmartFile IP addresses 43 | 44 | ``` 45 | PublicIpAddress ipAddress = IpAddress.getSmartfileReserved( 46 | 47 | HashMap parameters = null, 48 | HashMap options = null 49 | ) 50 | ``` 51 | 52 | ### Parameters 53 | 54 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 55 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 56 | 57 | 58 | --- 59 | 60 | ## List all possible public ExaVault IP addresses 61 | 62 | ``` 63 | PublicIpAddress ipAddress = IpAddress.getExavaultReserved( 64 | 65 | HashMap parameters = null, 66 | HashMap options = null 67 | ) 68 | ``` 69 | 70 | ### Parameters 71 | 72 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 73 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 74 | 75 | 76 | --- 77 | 78 | ## List all possible public IP addresses 79 | 80 | ``` 81 | PublicIpAddress ipAddress = IpAddress.getReserved( 82 | 83 | HashMap parameters = null, 84 | HashMap options = null 85 | ) 86 | ``` 87 | 88 | ### Parameters 89 | 90 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 91 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 92 | -------------------------------------------------------------------------------- /docs/Lock.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Lock 2 | 3 | ## Example Lock Object 4 | 5 | ``` 6 | { 7 | "path": "locked_file", 8 | "timeout": 1, 9 | "depth": "infinity", 10 | "recursive": true, 11 | "owner": "user", 12 | "scope": "shared", 13 | "exclusive": true, 14 | "token": "17c54824e9931a4688ca032d03f6663c", 15 | "type": "write", 16 | "allow_access_by_any_user": true, 17 | "user_id": 1, 18 | "username": "" 19 | } 20 | ``` 21 | 22 | * `path` / `path` (string): Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 23 | * `timeout` / `timeout` (int64): Lock timeout in seconds 24 | * `depth` / `depth` (string): 25 | * `recursive` / `recursive` (boolean): Does lock apply to subfolders? 26 | * `owner` / `owner` (string): Owner of the lock. This can be any arbitrary string. 27 | * `scope` / `scope` (string): 28 | * `exclusive` / `exclusive` (boolean): Is lock exclusive? 29 | * `token` / `token` (string): Lock token. Use to release lock. 30 | * `type` / `type` (string): 31 | * `allow_access_by_any_user` / `allowAccessByAnyUser` (boolean): Can lock be modified by users other than its creator? 32 | * `user_id` / `userId` (int64): Lock creator user ID 33 | * `username` / `username` (string): Lock creator username 34 | 35 | 36 | --- 37 | 38 | ## List Locks by Path 39 | 40 | ``` 41 | ListIterator lock = Lock.listFor( 42 | String path, 43 | HashMap parameters = null, 44 | HashMap options = null 45 | ) 46 | ``` 47 | 48 | ### Parameters 49 | 50 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 51 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 52 | * `path` (String): Required - Path to operate on. 53 | * `include_children` (Boolean): Include locks from children objects? 54 | 55 | 56 | --- 57 | 58 | ## Create Lock 59 | 60 | ``` 61 | Lock lock = Lock.create( 62 | String path, 63 | HashMap parameters = null, 64 | HashMap options = null 65 | ) 66 | ``` 67 | 68 | ### Parameters 69 | 70 | * `path` (String): Required - Path 71 | * `allow_access_by_any_user` (Boolean): Can lock be modified by users other than its creator? 72 | * `exclusive` (Boolean): Is lock exclusive? 73 | * `recursive` (Boolean): Does lock apply to subfolders? 74 | * `timeout` (Long): Lock timeout in seconds 75 | 76 | 77 | --- 78 | 79 | ## Delete Lock 80 | 81 | ``` 82 | void lock = Lock.delete( 83 | String path, 84 | HashMap parameters = null, 85 | HashMap options = null 86 | ) 87 | ``` 88 | 89 | ### Parameters 90 | 91 | * `path` (String): Required - Path 92 | * `token` (String): Required - Lock token 93 | 94 | 95 | --- 96 | 97 | ## Delete Lock 98 | 99 | ``` 100 | Lock lock = Lock.list()[0]; 101 | 102 | HashMap parameters = new HashMap<>(); 103 | parameters.put("token", "token"); 104 | 105 | lock.delete(parameters); 106 | ``` 107 | 108 | ### Parameters 109 | 110 | * `path` (String): Required - Path 111 | * `token` (String): Required - Lock token 112 | -------------------------------------------------------------------------------- /docs/MessageComment.md: -------------------------------------------------------------------------------- 1 | # Files.Models.MessageComment 2 | 3 | ## Example MessageComment Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "body": "What a great idea, thank you!", 9 | "reactions": [ 10 | { 11 | "id": 1, 12 | "emoji": "👍" 13 | } 14 | ] 15 | } 16 | ``` 17 | 18 | * `id` / `id` (int64): Message Comment ID 19 | * `body` / `body` (string): Comment body. 20 | * `reactions` / `reactions` (array(object)): Reactions to this comment. 21 | * `user_id` / `userId` (int64): User ID. Provide a value of `0` to operate the current session's user. 22 | 23 | 24 | --- 25 | 26 | ## List Message Comments 27 | 28 | ``` 29 | ListIterator messageComment = MessageComment.list( 30 | 31 | HashMap parameters = null, 32 | HashMap options = null 33 | ) 34 | ``` 35 | 36 | ### Parameters 37 | 38 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 39 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 40 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 41 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are . 42 | * `message_id` (Long): Required - Message comment to return comments for. 43 | 44 | 45 | --- 46 | 47 | ## Show Message Comment 48 | 49 | ``` 50 | MessageComment messageComment = MessageComment.find( 51 | Long id, 52 | HashMap parameters = null, 53 | HashMap options = null 54 | ) 55 | ``` 56 | 57 | ### Parameters 58 | 59 | * `id` (Long): Required - Message Comment ID. 60 | 61 | 62 | --- 63 | 64 | ## Create Message Comment 65 | 66 | ``` 67 | MessageComment messageComment = MessageComment.create( 68 | 69 | HashMap parameters = null, 70 | HashMap options = null 71 | ) 72 | ``` 73 | 74 | ### Parameters 75 | 76 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 77 | * `body` (String): Required - Comment body. 78 | 79 | 80 | --- 81 | 82 | ## Update Message Comment 83 | 84 | ``` 85 | MessageComment messageComment = MessageComment.update( 86 | Long id, 87 | HashMap parameters = null, 88 | HashMap options = null 89 | ) 90 | ``` 91 | 92 | ### Parameters 93 | 94 | * `id` (Long): Required - Message Comment ID. 95 | * `body` (String): Required - Comment body. 96 | 97 | 98 | --- 99 | 100 | ## Delete Message Comment 101 | 102 | ``` 103 | void messageComment = MessageComment.delete( 104 | Long id, 105 | HashMap parameters = null, 106 | HashMap options = null 107 | ) 108 | ``` 109 | 110 | ### Parameters 111 | 112 | * `id` (Long): Required - Message Comment ID. 113 | 114 | 115 | --- 116 | 117 | ## Update Message Comment 118 | 119 | ``` 120 | MessageComment messageComment = MessageComment.find(id); 121 | 122 | HashMap parameters = new HashMap<>(); 123 | parameters.put("body", "body"); 124 | 125 | messageComment.update(parameters); 126 | ``` 127 | 128 | ### Parameters 129 | 130 | * `id` (Long): Required - Message Comment ID. 131 | * `body` (String): Required - Comment body. 132 | 133 | 134 | --- 135 | 136 | ## Delete Message Comment 137 | 138 | ``` 139 | MessageComment messageComment = MessageComment.find(id); 140 | 141 | HashMap parameters = new HashMap<>(); 142 | 143 | messageComment.delete(parameters); 144 | ``` 145 | 146 | ### Parameters 147 | 148 | * `id` (Long): Required - Message Comment ID. 149 | -------------------------------------------------------------------------------- /docs/MessageCommentReaction.md: -------------------------------------------------------------------------------- 1 | # Files.Models.MessageCommentReaction 2 | 3 | ## Example MessageCommentReaction Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "emoji": "👍" 9 | } 10 | ``` 11 | 12 | * `id` / `id` (int64): Reaction ID 13 | * `emoji` / `emoji` (string): Emoji used in the reaction. 14 | * `user_id` / `userId` (int64): User ID. Provide a value of `0` to operate the current session's user. 15 | 16 | 17 | --- 18 | 19 | ## List Message Comment Reactions 20 | 21 | ``` 22 | ListIterator messageCommentReaction = MessageCommentReaction.list( 23 | 24 | HashMap parameters = null, 25 | HashMap options = null 26 | ) 27 | ``` 28 | 29 | ### Parameters 30 | 31 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 32 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 33 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 34 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are . 35 | * `message_comment_id` (Long): Required - Message comment to return reactions for. 36 | 37 | 38 | --- 39 | 40 | ## Show Message Comment Reaction 41 | 42 | ``` 43 | MessageCommentReaction messageCommentReaction = MessageCommentReaction.find( 44 | Long id, 45 | HashMap parameters = null, 46 | HashMap options = null 47 | ) 48 | ``` 49 | 50 | ### Parameters 51 | 52 | * `id` (Long): Required - Message Comment Reaction ID. 53 | 54 | 55 | --- 56 | 57 | ## Create Message Comment Reaction 58 | 59 | ``` 60 | MessageCommentReaction messageCommentReaction = MessageCommentReaction.create( 61 | 62 | HashMap parameters = null, 63 | HashMap options = null 64 | ) 65 | ``` 66 | 67 | ### Parameters 68 | 69 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 70 | * `emoji` (String): Required - Emoji to react with. 71 | 72 | 73 | --- 74 | 75 | ## Delete Message Comment Reaction 76 | 77 | ``` 78 | void messageCommentReaction = MessageCommentReaction.delete( 79 | Long id, 80 | HashMap parameters = null, 81 | HashMap options = null 82 | ) 83 | ``` 84 | 85 | ### Parameters 86 | 87 | * `id` (Long): Required - Message Comment Reaction ID. 88 | 89 | 90 | --- 91 | 92 | ## Delete Message Comment Reaction 93 | 94 | ``` 95 | MessageCommentReaction messageCommentReaction = MessageCommentReaction.find(id); 96 | 97 | HashMap parameters = new HashMap<>(); 98 | 99 | messageCommentReaction.delete(parameters); 100 | ``` 101 | 102 | ### Parameters 103 | 104 | * `id` (Long): Required - Message Comment Reaction ID. 105 | -------------------------------------------------------------------------------- /docs/MessageReaction.md: -------------------------------------------------------------------------------- 1 | # Files.Models.MessageReaction 2 | 3 | ## Example MessageReaction Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "emoji": "👍" 9 | } 10 | ``` 11 | 12 | * `id` / `id` (int64): Reaction ID 13 | * `emoji` / `emoji` (string): Emoji used in the reaction. 14 | * `user_id` / `userId` (int64): User ID. Provide a value of `0` to operate the current session's user. 15 | 16 | 17 | --- 18 | 19 | ## List Message Reactions 20 | 21 | ``` 22 | ListIterator messageReaction = MessageReaction.list( 23 | 24 | HashMap parameters = null, 25 | HashMap options = null 26 | ) 27 | ``` 28 | 29 | ### Parameters 30 | 31 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 32 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 33 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 34 | * `message_id` (Long): Required - Message to return reactions for. 35 | 36 | 37 | --- 38 | 39 | ## Show Message Reaction 40 | 41 | ``` 42 | MessageReaction messageReaction = MessageReaction.find( 43 | Long id, 44 | HashMap parameters = null, 45 | HashMap options = null 46 | ) 47 | ``` 48 | 49 | ### Parameters 50 | 51 | * `id` (Long): Required - Message Reaction ID. 52 | 53 | 54 | --- 55 | 56 | ## Create Message Reaction 57 | 58 | ``` 59 | MessageReaction messageReaction = MessageReaction.create( 60 | 61 | HashMap parameters = null, 62 | HashMap options = null 63 | ) 64 | ``` 65 | 66 | ### Parameters 67 | 68 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 69 | * `emoji` (String): Required - Emoji to react with. 70 | 71 | 72 | --- 73 | 74 | ## Delete Message Reaction 75 | 76 | ``` 77 | void messageReaction = MessageReaction.delete( 78 | Long id, 79 | HashMap parameters = null, 80 | HashMap options = null 81 | ) 82 | ``` 83 | 84 | ### Parameters 85 | 86 | * `id` (Long): Required - Message Reaction ID. 87 | 88 | 89 | --- 90 | 91 | ## Delete Message Reaction 92 | 93 | ``` 94 | MessageReaction messageReaction = MessageReaction.find(id); 95 | 96 | HashMap parameters = new HashMap<>(); 97 | 98 | messageReaction.delete(parameters); 99 | ``` 100 | 101 | ### Parameters 102 | 103 | * `id` (Long): Required - Message Reaction ID. 104 | -------------------------------------------------------------------------------- /docs/Payment.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Payment 2 | 3 | ## Example Payment Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "amount": 1.0, 9 | "balance": 1.0, 10 | "created_at": "2000-01-01T01:00:00Z", 11 | "currency": "USD", 12 | "download_uri": "https://url...", 13 | "invoice_line_items": [ 14 | { 15 | "amount": 1.0, 16 | "created_at": "2000-01-01T01:00:00Z", 17 | "description": "Service from 2019-01-01 through 2019-12-31", 18 | "type": "invoice", 19 | "service_end_at": "2000-01-01T01:00:00Z", 20 | "service_start_at": "2000-01-01T01:00:00Z", 21 | "plan": "Premier", 22 | "site": "My site" 23 | } 24 | ], 25 | "method": "paypal", 26 | "payment_line_items": [ 27 | { 28 | "amount": 1.0, 29 | "created_at": "2000-01-01T01:00:00Z", 30 | "invoice_id": 1, 31 | "payment_id": 1 32 | } 33 | ], 34 | "payment_reversed_at": "2000-01-01T01:00:00Z", 35 | "payment_type": "example", 36 | "site_name": "My Site", 37 | "type": "invoice" 38 | } 39 | ``` 40 | 41 | * `id` / `id` (int64): Line item Id 42 | * `amount` / `amount` (double): Line item amount 43 | * `balance` / `balance` (double): Line item balance 44 | * `created_at` / `createdAt` (date-time): Line item created at 45 | * `currency` / `currency` (string): Line item currency 46 | * `download_uri` / `downloadUri` (string): Line item download uri 47 | * `invoice_line_items` / `invoiceLineItems` (array(object)): Associated invoice line items 48 | * `method` / `method` (string): Line item payment method 49 | * `payment_line_items` / `paymentLineItems` (array(object)): Associated payment line items 50 | * `payment_reversed_at` / `paymentReversedAt` (date-time): Date/time payment was reversed if applicable 51 | * `payment_type` / `paymentType` (string): Type of payment if applicable 52 | * `site_name` / `siteName` (string): Site name this line item is for 53 | * `type` / `type` (string): Type of line item, either payment or invoice 54 | 55 | 56 | --- 57 | 58 | ## List Payments 59 | 60 | ``` 61 | ListIterator payment = Payment.list( 62 | 63 | HashMap parameters = null, 64 | HashMap options = null 65 | ) 66 | ``` 67 | 68 | ### Parameters 69 | 70 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 71 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 72 | 73 | 74 | --- 75 | 76 | ## Show Payment 77 | 78 | ``` 79 | AccountLineItem payment = Payment.find( 80 | Long id, 81 | HashMap parameters = null, 82 | HashMap options = null 83 | ) 84 | ``` 85 | 86 | ### Parameters 87 | 88 | * `id` (Long): Required - Payment ID. 89 | -------------------------------------------------------------------------------- /docs/PaymentLineItem.md: -------------------------------------------------------------------------------- 1 | # Files.Models.PaymentLineItem 2 | 3 | ## Example PaymentLineItem Object 4 | 5 | ``` 6 | { 7 | "amount": 1.0, 8 | "created_at": "2000-01-01T01:00:00Z", 9 | "invoice_id": 1, 10 | "payment_id": 1 11 | } 12 | ``` 13 | 14 | * `amount` / `amount` (double): Payment line item amount 15 | * `created_at` / `createdAt` (date-time): Payment line item created at date/time 16 | * `invoice_id` / `invoiceId` (int64): Invoice ID 17 | * `payment_id` / `paymentId` (int64): Payment ID 18 | -------------------------------------------------------------------------------- /docs/Permission.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Permission 2 | 3 | ## Example Permission Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "path": "example", 9 | "user_id": 1, 10 | "username": "user", 11 | "group_id": 1, 12 | "group_name": "example", 13 | "permission": "full", 14 | "recursive": true, 15 | "site_id": 1 16 | } 17 | ``` 18 | 19 | * `id` / `id` (int64): Permission ID 20 | * `path` / `path` (string): Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 21 | * `user_id` / `userId` (int64): User ID 22 | * `username` / `username` (string): Username (if applicable) 23 | * `group_id` / `groupId` (int64): Group ID 24 | * `group_name` / `groupName` (string): Group name (if applicable) 25 | * `permission` / `permission` (string): Permission type. See the table referenced in the documentation for an explanation of each permission. 26 | * `recursive` / `recursive` (boolean): Recursive: does this permission apply to subfolders? 27 | * `site_id` / `siteId` (int64): Site ID 28 | 29 | 30 | --- 31 | 32 | ## List Permissions 33 | 34 | ``` 35 | ListIterator permission = Permission.list( 36 | 37 | HashMap parameters = null, 38 | HashMap options = null 39 | ) 40 | ``` 41 | 42 | ### Parameters 43 | 44 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 45 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 46 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`, `group_id`, `path` or `user_id`. 47 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `path`, `group_id` or `user_id`. Valid field combinations are `[ group_id, path ]`, `[ user_id, path ]` or `[ user_id, group_id ]`. 48 | * `filter_prefix` (Map): If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`. 49 | * `path` (String): Permission path. If provided, will scope all permissions(including upward) to this path. 50 | * `include_groups` (Boolean): If searching by user or group, also include user's permissions that are inherited from its groups? 51 | * `group_id` (String): 52 | * `user_id` (String): 53 | 54 | 55 | --- 56 | 57 | ## Create Permission 58 | 59 | ``` 60 | Permission permission = Permission.create( 61 | 62 | HashMap parameters = null, 63 | HashMap options = null 64 | ) 65 | ``` 66 | 67 | ### Parameters 68 | 69 | * `path` (String): Required - Folder path 70 | * `group_id` (Long): Group ID. Provide `group_name` or `group_id` 71 | * `permission` (String): Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history` 72 | * `recursive` (Boolean): Apply to subfolders recursively? 73 | * `user_id` (Long): User ID. Provide `username` or `user_id` 74 | * `username` (String): User username. Provide `username` or `user_id` 75 | * `group_name` (String): Group name. Provide `group_name` or `group_id` 76 | * `site_id` (Long): Site ID. If not provided, will default to current site. Used when creating a permission for a child site. 77 | 78 | 79 | --- 80 | 81 | ## Delete Permission 82 | 83 | ``` 84 | void permission = Permission.delete( 85 | Long id, 86 | HashMap parameters = null, 87 | HashMap options = null 88 | ) 89 | ``` 90 | 91 | ### Parameters 92 | 93 | * `id` (Long): Required - Permission ID. 94 | 95 | 96 | --- 97 | 98 | ## Delete Permission 99 | 100 | ``` 101 | Permission permission = Permission.list()[0]; 102 | 103 | HashMap parameters = new HashMap<>(); 104 | 105 | permission.delete(parameters); 106 | ``` 107 | 108 | ### Parameters 109 | 110 | * `id` (Long): Required - Permission ID. 111 | -------------------------------------------------------------------------------- /docs/Preview.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Preview 2 | 3 | ## Example Preview Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "status": "complete", 9 | "download_uri": "https://mysite.files.com/...", 10 | "type": "image", 11 | "size": "large" 12 | } 13 | ``` 14 | 15 | * `id` / `id` (int64): Preview ID 16 | * `status` / `status` (string): Preview status. Can be invalid, not_generated, generating, complete, or file_too_large 17 | * `download_uri` / `downloadUri` (string): Link to download preview 18 | * `type` / `type` (string): Preview type. Can be image, pdf, pdf_native, video, or audio 19 | * `size` / `size` (string): Preview size 20 | -------------------------------------------------------------------------------- /docs/Priority.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Priority 2 | 3 | ## Example Priority Object 4 | 5 | ``` 6 | { 7 | "path": "foo/bar", 8 | "color": "pink" 9 | } 10 | ``` 11 | 12 | * `path` / `path` (string): The path corresponding to the priority color. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 13 | * `color` / `color` (string): The priority color 14 | 15 | 16 | --- 17 | 18 | ## List Priorities 19 | 20 | ``` 21 | ListIterator priority = Priority.list( 22 | String path, 23 | HashMap parameters = null, 24 | HashMap options = null 25 | ) 26 | ``` 27 | 28 | ### Parameters 29 | 30 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 31 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 32 | * `path` (String): Required - The path to query for priorities 33 | -------------------------------------------------------------------------------- /docs/Project.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Project 2 | 3 | ## Example Project Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "global_access": "none" 9 | } 10 | ``` 11 | 12 | * `id` / `id` (int64): Project ID 13 | * `global_access` / `globalAccess` (string): Global access settings 14 | 15 | 16 | --- 17 | 18 | ## List Projects 19 | 20 | ``` 21 | ListIterator project = Project.list( 22 | 23 | HashMap parameters = null, 24 | HashMap options = null 25 | ) 26 | ``` 27 | 28 | ### Parameters 29 | 30 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 31 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 32 | 33 | 34 | --- 35 | 36 | ## Show Project 37 | 38 | ``` 39 | Project project = Project.find( 40 | Long id, 41 | HashMap parameters = null, 42 | HashMap options = null 43 | ) 44 | ``` 45 | 46 | ### Parameters 47 | 48 | * `id` (Long): Required - Project ID. 49 | 50 | 51 | --- 52 | 53 | ## Create Project 54 | 55 | ``` 56 | Project project = Project.create( 57 | 58 | HashMap parameters = null, 59 | HashMap options = null 60 | ) 61 | ``` 62 | 63 | ### Parameters 64 | 65 | * `global_access` (String): Required - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`. 66 | 67 | 68 | --- 69 | 70 | ## Update Project 71 | 72 | ``` 73 | Project project = Project.update( 74 | Long id, 75 | HashMap parameters = null, 76 | HashMap options = null 77 | ) 78 | ``` 79 | 80 | ### Parameters 81 | 82 | * `id` (Long): Required - Project ID. 83 | * `global_access` (String): Required - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`. 84 | 85 | 86 | --- 87 | 88 | ## Delete Project 89 | 90 | ``` 91 | void project = Project.delete( 92 | Long id, 93 | HashMap parameters = null, 94 | HashMap options = null 95 | ) 96 | ``` 97 | 98 | ### Parameters 99 | 100 | * `id` (Long): Required - Project ID. 101 | 102 | 103 | --- 104 | 105 | ## Update Project 106 | 107 | ``` 108 | Project project = Project.find(id); 109 | 110 | HashMap parameters = new HashMap<>(); 111 | parameters.put("global_access", "global_access"); 112 | 113 | project.update(parameters); 114 | ``` 115 | 116 | ### Parameters 117 | 118 | * `id` (Long): Required - Project ID. 119 | * `global_access` (String): Required - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`. 120 | 121 | 122 | --- 123 | 124 | ## Delete Project 125 | 126 | ``` 127 | Project project = Project.find(id); 128 | 129 | HashMap parameters = new HashMap<>(); 130 | 131 | project.delete(parameters); 132 | ``` 133 | 134 | ### Parameters 135 | 136 | * `id` (Long): Required - Project ID. 137 | -------------------------------------------------------------------------------- /docs/PublicHostingRequestLog.md: -------------------------------------------------------------------------------- 1 | # Files.Models.PublicHostingRequestLog 2 | 3 | ## Example PublicHostingRequestLog Object 4 | 5 | ``` 6 | { 7 | "timestamp": "2000-01-01T01:00:00Z", 8 | "remote_ip": "example", 9 | "server_ip": "example", 10 | "hostname": "example", 11 | "path": "example", 12 | "responseCode": 1, 13 | "success": true, 14 | "duration_ms": 1 15 | } 16 | ``` 17 | 18 | * `timestamp` / `timestamp` (date-time): Start Time of Action 19 | * `remote_ip` / `remoteIp` (string): IP Address of Public Hosting Client 20 | * `server_ip` / `serverIp` (string): IP Address of Public Hosting Server 21 | * `hostname` / `hostname` (string): HTTP Request Hostname 22 | * `path` / `path` (string): HTTP Request Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 23 | * `responseCode` / `responseCode` (int64): HTTP Response Code 24 | * `success` / `success` (boolean): Whether SFTP Action was successful. 25 | * `duration_ms` / `durationMs` (int64): Duration (in milliseconds) 26 | 27 | 28 | --- 29 | 30 | ## List Public Hosting Request Logs 31 | 32 | ``` 33 | ListIterator publicHostingRequestLog = PublicHostingRequestLog.list( 34 | 35 | HashMap parameters = null, 36 | HashMap options = null 37 | ) 38 | ``` 39 | 40 | ### Parameters 41 | 42 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 43 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 44 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `start_date`, `end_date`, `path`, `remote_ip` or `success`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ path ]`, `[ remote_ip ]`, `[ success ]`, `[ start_date, end_date ]`, `[ start_date, path ]`, `[ start_date, remote_ip ]`, `[ start_date, success ]`, `[ end_date, path ]`, `[ end_date, remote_ip ]`, `[ end_date, success ]`, `[ path, remote_ip ]`, `[ path, success ]`, `[ remote_ip, success ]`, `[ start_date, end_date, path ]`, `[ start_date, end_date, remote_ip ]`, `[ start_date, end_date, success ]`, `[ start_date, path, remote_ip ]`, `[ start_date, path, success ]`, `[ start_date, remote_ip, success ]`, `[ end_date, path, remote_ip ]`, `[ end_date, path, success ]`, `[ end_date, remote_ip, success ]`, `[ path, remote_ip, success ]`, `[ start_date, end_date, path, remote_ip ]`, `[ start_date, end_date, path, success ]`, `[ start_date, end_date, remote_ip, success ]`, `[ start_date, path, remote_ip, success ]` or `[ end_date, path, remote_ip, success ]`. 45 | * `filter_prefix` (Map): If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ path ]`, `[ remote_ip ]`, `[ success ]`, `[ start_date, end_date ]`, `[ start_date, path ]`, `[ start_date, remote_ip ]`, `[ start_date, success ]`, `[ end_date, path ]`, `[ end_date, remote_ip ]`, `[ end_date, success ]`, `[ path, remote_ip ]`, `[ path, success ]`, `[ remote_ip, success ]`, `[ start_date, end_date, path ]`, `[ start_date, end_date, remote_ip ]`, `[ start_date, end_date, success ]`, `[ start_date, path, remote_ip ]`, `[ start_date, path, success ]`, `[ start_date, remote_ip, success ]`, `[ end_date, path, remote_ip ]`, `[ end_date, path, success ]`, `[ end_date, remote_ip, success ]`, `[ path, remote_ip, success ]`, `[ start_date, end_date, path, remote_ip ]`, `[ start_date, end_date, path, success ]`, `[ start_date, end_date, remote_ip, success ]`, `[ start_date, path, remote_ip, success ]` or `[ end_date, path, remote_ip, success ]`. 46 | -------------------------------------------------------------------------------- /docs/PublicIpAddress.md: -------------------------------------------------------------------------------- 1 | # Files.Models.PublicIpAddress 2 | 3 | ## Example PublicIpAddress Object 4 | 5 | ``` 6 | { 7 | "ip_address": "1.1.1.1", 8 | "server_name": "server-1", 9 | "ftp_enabled": true, 10 | "sftp_enabled": true 11 | } 12 | ``` 13 | 14 | * `ip_address` / `ipAddress` (string): The public IP address. 15 | * `server_name` / `serverName` (string): The name of the frontend server. 16 | * `ftp_enabled` / `ftpEnabled` (boolean): 17 | * `sftp_enabled` / `sftpEnabled` (boolean): 18 | -------------------------------------------------------------------------------- /docs/RemoteBandwidthSnapshot.md: -------------------------------------------------------------------------------- 1 | # Files.Models.RemoteBandwidthSnapshot 2 | 3 | ## Example RemoteBandwidthSnapshot Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "sync_bytes_received": 1.0, 9 | "sync_bytes_sent": 1.0, 10 | "logged_at": "2000-01-01T01:00:00Z", 11 | "remote_server_id": 1 12 | } 13 | ``` 14 | 15 | * `id` / `id` (int64): Site bandwidth ID 16 | * `sync_bytes_received` / `syncBytesReceived` (double): Site sync bandwidth report bytes received 17 | * `sync_bytes_sent` / `syncBytesSent` (double): Site sync bandwidth report bytes sent 18 | * `logged_at` / `loggedAt` (date-time): Time the site bandwidth report was logged 19 | * `remote_server_id` / `remoteServerId` (int64): ID of related Remote Server 20 | 21 | 22 | --- 23 | 24 | ## List Remote Bandwidth Snapshots 25 | 26 | ``` 27 | ListIterator remoteBandwidthSnapshot = RemoteBandwidthSnapshot.list( 28 | 29 | HashMap parameters = null, 30 | HashMap options = null 31 | ) 32 | ``` 33 | 34 | ### Parameters 35 | 36 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 37 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 38 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `logged_at`. 39 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `logged_at`. 40 | * `filter_gt` (Map): If set, return records where the specified field is greater than the supplied value. Valid fields are `logged_at`. 41 | * `filter_gteq` (Map): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `logged_at`. 42 | * `filter_lt` (Map): If set, return records where the specified field is less than the supplied value. Valid fields are `logged_at`. 43 | * `filter_lteq` (Map): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `logged_at`. 44 | -------------------------------------------------------------------------------- /docs/RemoteServerConfigurationFile.md: -------------------------------------------------------------------------------- 1 | # Files.Models.RemoteServerConfigurationFile 2 | 3 | ## Example RemoteServerConfigurationFile Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "permission_set": "example", 9 | "private_key": "example", 10 | "subdomain": "example", 11 | "root": "C:\\Users\\", 12 | "follow_links": true, 13 | "prefer_protocol": "example", 14 | "dns": "example", 15 | "proxy_all_outbound": true, 16 | "endpoint_override": "example", 17 | "log_file": "example", 18 | "log_level": "example", 19 | "log_rotate_num": 1, 20 | "log_rotate_size": 1, 21 | "override_max_concurrent_jobs": 1, 22 | "graceful_shutdown_timeout": 1, 23 | "transfer_rate_limit": "example", 24 | "api_token": "example", 25 | "port": 1, 26 | "hostname": "example", 27 | "public_key": "example", 28 | "status": "example", 29 | "server_host_key": "example", 30 | "config_version": "example" 31 | } 32 | ``` 33 | 34 | * `id` / `id` (int64): The remote server ID of the agent 35 | * `permission_set` / `permissionSet` (string): The permission set for the agent ['read_write', 'read_only', 'write_only'] 36 | * `private_key` / `privateKey` (string): The private key for the agent 37 | * `subdomain` / `subdomain` (string): Files.com subdomain site name 38 | * `root` / `root` (string): The root directory for the agent 39 | * `follow_links` / `followLinks` (boolean): Follow symlinks when traversing directories 40 | * `prefer_protocol` / `preferProtocol` (string): Preferred network protocol ['udp', 'tcp'] (default udp) 41 | * `dns` / `dns` (string): DNS lookup method ['auto','doh','system'] (default auto) 42 | * `proxy_all_outbound` / `proxyAllOutbound` (boolean): Proxy all outbound traffic through files.com proxy server 43 | * `endpoint_override` / `endpointOverride` (string): Custom site endpoint URL 44 | * `log_file` / `logFile` (string): Log file name and location 45 | * `log_level` / `logLevel` (string): Log level for the agent logs ['debug', 'info', 'warn', 'error', 'fatal'] (default info) 46 | * `log_rotate_num` / `logRotateNum` (int64): Log route for agent logs. (default 5) 47 | * `log_rotate_size` / `logRotateSize` (int64): Log route size in MB for agent logs. (default 20) 48 | * `override_max_concurrent_jobs` / `overrideMaxConcurrentJobs` (int64): Maximum number of concurrent jobs (default 500) 49 | * `graceful_shutdown_timeout` / `gracefulShutdownTimeout` (int64): Graceful shutdown timeout in seconds (default 15) 50 | * `transfer_rate_limit` / `transferRateLimit` (string): File transfer (upload/download) rate limit 51 | `-`, with the given periods: 52 | * 'S': second 53 | * 'M': minute 54 | * 'H': hour 55 | * 'D': day 56 | Examples: 57 | * 5 requests/second: '5-S' 58 | * 10 requests/minute: '10-M' 59 | * 1000 requests/hour: '1000-H' 60 | * 2000 requests/day: '2000-D' 61 | * `api_token` / `apiToken` (string): Files Agent API Token 62 | * `port` / `port` (int64): Incoming port for files agent connections 63 | * `hostname` / `hostname` (string): 64 | * `public_key` / `publicKey` (string): public key 65 | * `status` / `status` (string): either running or shutdown 66 | * `server_host_key` / `serverHostKey` (string): 67 | * `config_version` / `configVersion` (string): agent config version 68 | -------------------------------------------------------------------------------- /docs/Session.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Session 2 | 3 | ## Example Session Object 4 | 5 | ``` 6 | { 7 | "id": "60525f92e859c4c3d74cb02fd176b1525901b525", 8 | "language": "en", 9 | "read_only": true, 10 | "sftp_insecure_ciphers": true 11 | } 12 | ``` 13 | 14 | * `id` / `id` (String): Session ID 15 | * `language` / `language` (string): Session language 16 | * `read_only` / `readOnly` (boolean): Is this session read only? 17 | * `sftp_insecure_ciphers` / `sftpInsecureCiphers` (boolean): Are insecure SFTP ciphers allowed for this user? (If this is set to true, the site administrator has signaled that it is ok to use less secure SSH ciphers for this user.) 18 | * `username` / `username` (string): Username to sign in as 19 | * `password` / `password` (string): Password for sign in 20 | * `otp` / `otp` (string): If this user has a 2FA device, provide its OTP or code here. 21 | * `partial_session_id` / `partialSessionId` (string): Identifier for a partially-completed login 22 | 23 | 24 | --- 25 | 26 | ## Create user session (log in) 27 | 28 | ``` 29 | Session session = Session.create( 30 | 31 | HashMap parameters = null, 32 | HashMap options = null 33 | ) 34 | ``` 35 | 36 | ### Parameters 37 | 38 | * `username` (String): Username to sign in as 39 | * `password` (String): Password for sign in 40 | * `otp` (String): If this user has a 2FA device, provide its OTP or code here. 41 | * `partial_session_id` (String): Identifier for a partially-completed login 42 | 43 | 44 | --- 45 | 46 | ## Delete user session (log out) 47 | 48 | ``` 49 | void session = Session.delete( 50 | 51 | HashMap parameters = null, 52 | HashMap options = null 53 | ) 54 | ``` 55 | -------------------------------------------------------------------------------- /docs/SettingsChange.md: -------------------------------------------------------------------------------- 1 | # Files.Models.SettingsChange 2 | 3 | ## Example SettingsChange Object 4 | 5 | ``` 6 | { 7 | "api_key_id": 1, 8 | "changes": [ 9 | "example" 10 | ], 11 | "created_at": "2000-01-01T01:00:00Z", 12 | "user_id": 1, 13 | "user_is_files_support": true, 14 | "user_is_from_parent_site": true, 15 | "username": "some_user" 16 | } 17 | ``` 18 | 19 | * `api_key_id` / `apiKeyId` (int64): The API key id responsible for this change. 20 | * `changes` / `changes` (array(string)): Markdown-formatted change messages. 21 | * `created_at` / `createdAt` (date-time): The time this change was made. 22 | * `user_id` / `userId` (int64): The user id responsible for this change. 23 | * `user_is_files_support` / `userIsFilesSupport` (boolean): true if this change was performed by Files.com support. 24 | * `user_is_from_parent_site` / `userIsFromParentSite` (boolean): true if this change was performed by a user on a parent site. 25 | * `username` / `username` (string): The username of the user responsible for this change. 26 | 27 | 28 | --- 29 | 30 | ## List Settings Changes 31 | 32 | ``` 33 | ListIterator settingsChange = SettingsChange.list( 34 | 35 | HashMap parameters = null, 36 | HashMap options = null 37 | ) 38 | ``` 39 | 40 | ### Parameters 41 | 42 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 43 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 44 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `created_at`, `api_key_id` or `user_id`. 45 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `api_key_id` and `user_id`. 46 | -------------------------------------------------------------------------------- /docs/SftpHostKey.md: -------------------------------------------------------------------------------- 1 | # Files.Models.SftpHostKey 2 | 3 | ## Example SftpHostKey Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "name": "My Key", 9 | "fingerprint_md5": "12:7e:f8:61:78:a4:b2:c2:ee:12:51:92:25:a7:42:cc", 10 | "fingerprint_sha256": "SHA256:5ANRkDpXWA+PgOquzZAG9RtQ1Bt8KXYAH2hecr7LQk8" 11 | } 12 | ``` 13 | 14 | * `id` / `id` (int64): SFTP Host Key ID 15 | * `name` / `name` (string): The friendly name of this SFTP Host Key. 16 | * `fingerprint_md5` / `fingerprintMd5` (string): MD5 Fingerprint of the public key 17 | * `fingerprint_sha256` / `fingerprintSha256` (string): SHA256 Fingerprint of the public key 18 | * `private_key` / `privateKey` (string): The private key data. 19 | 20 | 21 | --- 22 | 23 | ## List SFTP Host Keys 24 | 25 | ``` 26 | ListIterator sftpHostKey = SftpHostKey.list( 27 | 28 | HashMap parameters = null, 29 | HashMap options = null 30 | ) 31 | ``` 32 | 33 | ### Parameters 34 | 35 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 36 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 37 | 38 | 39 | --- 40 | 41 | ## Show SFTP Host Key 42 | 43 | ``` 44 | SftpHostKey sftpHostKey = SftpHostKey.find( 45 | Long id, 46 | HashMap parameters = null, 47 | HashMap options = null 48 | ) 49 | ``` 50 | 51 | ### Parameters 52 | 53 | * `id` (Long): Required - Sftp Host Key ID. 54 | 55 | 56 | --- 57 | 58 | ## Create SFTP Host Key 59 | 60 | ``` 61 | SftpHostKey sftpHostKey = SftpHostKey.create( 62 | 63 | HashMap parameters = null, 64 | HashMap options = null 65 | ) 66 | ``` 67 | 68 | ### Parameters 69 | 70 | * `name` (String): The friendly name of this SFTP Host Key. 71 | * `private_key` (String): The private key data. 72 | 73 | 74 | --- 75 | 76 | ## Update SFTP Host Key 77 | 78 | ``` 79 | SftpHostKey sftpHostKey = SftpHostKey.update( 80 | Long id, 81 | HashMap parameters = null, 82 | HashMap options = null 83 | ) 84 | ``` 85 | 86 | ### Parameters 87 | 88 | * `id` (Long): Required - Sftp Host Key ID. 89 | * `name` (String): The friendly name of this SFTP Host Key. 90 | * `private_key` (String): The private key data. 91 | 92 | 93 | --- 94 | 95 | ## Delete SFTP Host Key 96 | 97 | ``` 98 | void sftpHostKey = SftpHostKey.delete( 99 | Long id, 100 | HashMap parameters = null, 101 | HashMap options = null 102 | ) 103 | ``` 104 | 105 | ### Parameters 106 | 107 | * `id` (Long): Required - Sftp Host Key ID. 108 | 109 | 110 | --- 111 | 112 | ## Update SFTP Host Key 113 | 114 | ``` 115 | SftpHostKey sftpHostKey = SftpHostKey.find(id); 116 | 117 | HashMap parameters = new HashMap<>(); 118 | parameters.put("name", "My Key"); 119 | 120 | sftpHostKey.update(parameters); 121 | ``` 122 | 123 | ### Parameters 124 | 125 | * `id` (Long): Required - Sftp Host Key ID. 126 | * `name` (String): The friendly name of this SFTP Host Key. 127 | * `private_key` (String): The private key data. 128 | 129 | 130 | --- 131 | 132 | ## Delete SFTP Host Key 133 | 134 | ``` 135 | SftpHostKey sftpHostKey = SftpHostKey.find(id); 136 | 137 | HashMap parameters = new HashMap<>(); 138 | 139 | sftpHostKey.delete(parameters); 140 | ``` 141 | 142 | ### Parameters 143 | 144 | * `id` (Long): Required - Sftp Host Key ID. 145 | -------------------------------------------------------------------------------- /docs/ShareGroup.md: -------------------------------------------------------------------------------- 1 | # Files.Models.ShareGroup 2 | 3 | ## Example ShareGroup Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "name": "Test group 1", 9 | "notes": "This group is defined for testing purposes", 10 | "user_id": 1, 11 | "members": [ 12 | { 13 | "name": "John Doe", 14 | "company": "Acme Ltd", 15 | "email": "johndoe@gmail.com" 16 | } 17 | ] 18 | } 19 | ``` 20 | 21 | * `id` / `id` (int64): Share Group ID 22 | * `name` / `name` (string): Name of the share group 23 | * `notes` / `notes` (string): Additional notes of the share group 24 | * `user_id` / `userId` (int64): Owner User ID 25 | * `members` / `members` (array(object)): A list of share group members 26 | 27 | 28 | --- 29 | 30 | ## List Share Groups 31 | 32 | ``` 33 | ListIterator shareGroup = ShareGroup.list( 34 | 35 | HashMap parameters = null, 36 | HashMap options = null 37 | ) 38 | ``` 39 | 40 | ### Parameters 41 | 42 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 43 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 44 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 45 | 46 | 47 | --- 48 | 49 | ## Show Share Group 50 | 51 | ``` 52 | ShareGroup shareGroup = ShareGroup.find( 53 | Long id, 54 | HashMap parameters = null, 55 | HashMap options = null 56 | ) 57 | ``` 58 | 59 | ### Parameters 60 | 61 | * `id` (Long): Required - Share Group ID. 62 | 63 | 64 | --- 65 | 66 | ## Create Share Group 67 | 68 | ``` 69 | ShareGroup shareGroup = ShareGroup.create( 70 | 71 | HashMap parameters = null, 72 | HashMap options = null 73 | ) 74 | ``` 75 | 76 | ### Parameters 77 | 78 | * `user_id` (Long): User ID. Provide a value of `0` to operate the current session's user. 79 | * `notes` (String): Additional notes of the share group 80 | * `name` (String): Required - Name of the share group 81 | * `members` (Object[]): Required - A list of share group members. 82 | 83 | 84 | --- 85 | 86 | ## Update Share Group 87 | 88 | ``` 89 | ShareGroup shareGroup = ShareGroup.update( 90 | Long id, 91 | HashMap parameters = null, 92 | HashMap options = null 93 | ) 94 | ``` 95 | 96 | ### Parameters 97 | 98 | * `id` (Long): Required - Share Group ID. 99 | * `notes` (String): Additional notes of the share group 100 | * `name` (String): Name of the share group 101 | * `members` (Object[]): A list of share group members. 102 | 103 | 104 | --- 105 | 106 | ## Delete Share Group 107 | 108 | ``` 109 | void shareGroup = ShareGroup.delete( 110 | Long id, 111 | HashMap parameters = null, 112 | HashMap options = null 113 | ) 114 | ``` 115 | 116 | ### Parameters 117 | 118 | * `id` (Long): Required - Share Group ID. 119 | 120 | 121 | --- 122 | 123 | ## Update Share Group 124 | 125 | ``` 126 | ShareGroup shareGroup = ShareGroup.find(id); 127 | 128 | HashMap parameters = new HashMap<>(); 129 | parameters.put("notes", "This group is defined for testing purposes"); 130 | parameters.put("name", "Test group 1"); 131 | parameters.put("members", [{"name":"John Doe","company":"Acme Ltd","email":"johndoe@gmail.com"}]); 132 | 133 | shareGroup.update(parameters); 134 | ``` 135 | 136 | ### Parameters 137 | 138 | * `id` (Long): Required - Share Group ID. 139 | * `notes` (String): Additional notes of the share group 140 | * `name` (String): Name of the share group 141 | * `members` (Object[]): A list of share group members. 142 | 143 | 144 | --- 145 | 146 | ## Delete Share Group 147 | 148 | ``` 149 | ShareGroup shareGroup = ShareGroup.find(id); 150 | 151 | HashMap parameters = new HashMap<>(); 152 | 153 | shareGroup.delete(parameters); 154 | ``` 155 | 156 | ### Parameters 157 | 158 | * `id` (Long): Required - Share Group ID. 159 | -------------------------------------------------------------------------------- /docs/ShareGroupMember.md: -------------------------------------------------------------------------------- 1 | # Files.Models.ShareGroupMember 2 | 3 | ## Example ShareGroupMember Object 4 | 5 | ``` 6 | { 7 | "name": "John Doe", 8 | "company": "Acme Ltd", 9 | "email": "johndoe@gmail.com" 10 | } 11 | ``` 12 | 13 | * `name` / `name` (string): Name of the share group member 14 | * `company` / `company` (string): Company of the share group member 15 | * `email` / `email` (string): Email of the share group member 16 | -------------------------------------------------------------------------------- /docs/Status.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Status 2 | 3 | ## Example Status Object 4 | 5 | ``` 6 | { 7 | "code": 200, 8 | "message": "example", 9 | "status": "", 10 | "data": "example", 11 | "errors": [ 12 | { 13 | "fields": [ 14 | 15 | ], 16 | "messages": [ 17 | 18 | ] 19 | } 20 | ], 21 | "clickwrap_id": 1, 22 | "clickwrap_body": "example" 23 | } 24 | ``` 25 | 26 | * `code` / `code` (int64): Status HTTP code 27 | * `message` / `message` (string): Error message 28 | * `status` / `status` (string): Status message 29 | * `data` / `data` (auto): Additional data 30 | * `errors` / `errors` (array(object)): A list of api errors 31 | * `clickwrap_id` / `clickwrapId` (int64): Required Clickwrap id 32 | * `clickwrap_body` / `clickwrapBody` (string): Required Clickwrap body 33 | -------------------------------------------------------------------------------- /docs/Style.md: -------------------------------------------------------------------------------- 1 | # Files.Models.Style 2 | 3 | ## Example Style Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "path": "example", 9 | "logo": "https://mysite.files.com/...", 10 | "thumbnail": { 11 | "name": "My logo", 12 | "uri": "https://mysite.files.com/.../my_image.png" 13 | } 14 | } 15 | ``` 16 | 17 | * `id` / `id` (int64): Style ID 18 | * `path` / `path` (string): Folder path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 19 | * `logo` / `logo` (image): Logo 20 | * `thumbnail` / `thumbnail` (image): Logo thumbnail 21 | * `file` / `file` (file): Logo for custom branding. 22 | 23 | 24 | --- 25 | 26 | ## Show Style 27 | 28 | ``` 29 | Style style = Style.find( 30 | String path, 31 | HashMap parameters = null, 32 | HashMap options = null 33 | ) 34 | ``` 35 | 36 | ### Parameters 37 | 38 | * `path` (String): Required - Style path. 39 | 40 | 41 | --- 42 | 43 | ## Update Style 44 | 45 | ``` 46 | Style style = Style.update( 47 | String path, 48 | HashMap parameters = null, 49 | HashMap options = null 50 | ) 51 | ``` 52 | 53 | ### Parameters 54 | 55 | * `path` (String): Required - Style path. 56 | * `file` (byte[]): Required - Logo for custom branding. 57 | 58 | 59 | --- 60 | 61 | ## Delete Style 62 | 63 | ``` 64 | void style = Style.delete( 65 | String path, 66 | HashMap parameters = null, 67 | HashMap options = null 68 | ) 69 | ``` 70 | 71 | ### Parameters 72 | 73 | * `path` (String): Required - Style path. 74 | 75 | 76 | --- 77 | 78 | ## Update Style 79 | 80 | ``` 81 | Style style = Style.find(path); 82 | 83 | HashMap parameters = new HashMap<>(); 84 | parameters.put("file", "file"); 85 | 86 | style.update(parameters); 87 | ``` 88 | 89 | ### Parameters 90 | 91 | * `path` (String): Required - Style path. 92 | * `file` (byte[]): Required - Logo for custom branding. 93 | 94 | 95 | --- 96 | 97 | ## Delete Style 98 | 99 | ``` 100 | Style style = Style.find(path); 101 | 102 | HashMap parameters = new HashMap<>(); 103 | 104 | style.delete(parameters); 105 | ``` 106 | 107 | ### Parameters 108 | 109 | * `path` (String): Required - Style path. 110 | -------------------------------------------------------------------------------- /docs/UsageByTopLevelDir.md: -------------------------------------------------------------------------------- 1 | # Files.Models.UsageByTopLevelDir 2 | 3 | ## Example UsageByTopLevelDir Object 4 | 5 | ``` 6 | { 7 | "dir": "", 8 | "size": 1, 9 | "count": 1 10 | } 11 | ``` 12 | 13 | * `dir` / `dir` (string): Directory name 14 | * `size` / `size` (int64): Usage 15 | * `count` / `count` (int64): File count 16 | -------------------------------------------------------------------------------- /docs/UsageDailySnapshot.md: -------------------------------------------------------------------------------- 1 | # Files.Models.UsageDailySnapshot 2 | 3 | ## Example UsageDailySnapshot Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "date": "2000-01-01T01:00:00Z", 9 | "api_usage_available": true, 10 | "read_api_usage": 1, 11 | "write_api_usage": 1, 12 | "user_count": 1, 13 | "current_storage": 1.0, 14 | "deleted_files_storage": 1.0, 15 | "deleted_files_counted_in_minimum": 1.0, 16 | "root_storage": 1.0, 17 | "usage_by_top_level_dir": [ 18 | { 19 | "dir": "dir", 20 | "size": 100, 21 | "count": 10 22 | } 23 | ] 24 | } 25 | ``` 26 | 27 | * `id` / `id` (int64): ID of the usage record 28 | * `date` / `date` (date): The date of this usage record 29 | * `api_usage_available` / `apiUsageAvailable` (boolean): True if the API usage fields `read_api_usage` and `write_api_usage` can be relied upon. If this is false, we suggest hiding that value from any UI. 30 | * `read_api_usage` / `readApiUsage` (int64): Read API Calls used on this day. Note: only updated for days before the current day. 31 | * `write_api_usage` / `writeApiUsage` (int64): Write API Calls used on this day. Note: only updated for days before the current day. 32 | * `user_count` / `userCount` (int64): Number of billable users as of this day. 33 | * `current_storage` / `currentStorage` (double): GB of Files Native Storage used on this day. 34 | * `deleted_files_storage` / `deletedFilesStorage` (double): GB of Files Native Storage used on this day for files that have been deleted and are stored as backups. 35 | * `deleted_files_counted_in_minimum` / `deletedFilesCountedInMinimum` (double): GB of Files Native Storage used on this day for files that have been permanently deleted but were uploaded less than 30 days ago, and are still billable. 36 | * `root_storage` / `rootStorage` (double): GB of Files Native Storage used for the root folder. Included here because this value will not be part of `usage_by_top_level_dir` 37 | * `usage_by_top_level_dir` / `usageByTopLevelDir` (array(object)): Usage broken down by each top-level folder 38 | 39 | 40 | --- 41 | 42 | ## List Usage Daily Snapshots 43 | 44 | ``` 45 | ListIterator usageDailySnapshot = UsageDailySnapshot.list( 46 | 47 | HashMap parameters = null, 48 | HashMap options = null 49 | ) 50 | ``` 51 | 52 | ### Parameters 53 | 54 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 55 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 56 | * `sort_by` (Map): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `date`. 57 | * `filter` (Map): If set, return records where the specified field is equal to the supplied value. Valid fields are `date` and `usage_snapshot_id`. Valid field combinations are `[ usage_snapshot_id, date ]`. 58 | * `filter_gt` (Map): If set, return records where the specified field is greater than the supplied value. Valid fields are `date`. 59 | * `filter_gteq` (Map): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `date`. 60 | * `filter_lt` (Map): If set, return records where the specified field is less than the supplied value. Valid fields are `date`. 61 | * `filter_lteq` (Map): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `date`. 62 | -------------------------------------------------------------------------------- /docs/UsageSnapshot.md: -------------------------------------------------------------------------------- 1 | # Files.Models.UsageSnapshot 2 | 3 | ## Example UsageSnapshot Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "start_at": "2000-01-01T01:00:00Z", 9 | "end_at": "2000-01-01T01:00:00Z", 10 | "high_water_user_count": 1, 11 | "current_storage": 1.0, 12 | "high_water_storage": 1.0, 13 | "root_storage": 1.0, 14 | "deleted_files_counted_in_minimum": 1.0, 15 | "deleted_files_storage": 1.0, 16 | "total_billable_usage": 1.0, 17 | "total_billable_transfer_usage": 1.0, 18 | "bytes_sent": 1.0, 19 | "sync_bytes_received": 1.0, 20 | "sync_bytes_sent": 1.0, 21 | "usage_by_top_level_dir": [ 22 | { 23 | "dir": "dir", 24 | "size": 100, 25 | "count": 10 26 | } 27 | ] 28 | } 29 | ``` 30 | 31 | * `id` / `id` (int64): Usage snapshot ID 32 | * `start_at` / `startAt` (date-time): Usage snapshot start date/time 33 | * `end_at` / `endAt` (date-time): Usage snapshot end date/time 34 | * `high_water_user_count` / `highWaterUserCount` (int64): Highest user count number in time period 35 | * `current_storage` / `currentStorage` (double): Current total Storage Usage GB as of end date (not necessarily high water mark, which is used for billing) 36 | * `high_water_storage` / `highWaterStorage` (double): Highest Storage Usage GB recorded in time period (used for billing) 37 | * `root_storage` / `rootStorage` (double): Storage Usage for root folder as of end date (not necessarily high water mark, which is used for billing) 38 | * `deleted_files_counted_in_minimum` / `deletedFilesCountedInMinimum` (double): Storage Usage for files that are deleted but uploaded within last 30 days as of end date (not necessarily high water mark, which is used for billing) 39 | * `deleted_files_storage` / `deletedFilesStorage` (double): Storage Usage for files that are deleted but retained as backups as of end date (not necessarily high water mark, which is used for billing) 40 | * `total_billable_usage` / `totalBillableUsage` (double): Storage + Transfer Usage - Total Billable amount 41 | * `total_billable_transfer_usage` / `totalBillableTransferUsage` (double): Transfer usage for period - Total Billable amount 42 | * `bytes_sent` / `bytesSent` (double): Transfer Usage for period - Outbound GB from Files Native Storage 43 | * `sync_bytes_received` / `syncBytesReceived` (double): Transfer Usage for period - Inbound GB to Remote Servers (Sync/Mount) 44 | * `sync_bytes_sent` / `syncBytesSent` (double): Transfer Usage for period - Outbound GB from Remote Servers (Sync/Mount) 45 | * `usage_by_top_level_dir` / `usageByTopLevelDir` (array(object)): Storage Usage - map of root folders to their usage as of end date (not necessarily high water mark, which is used for billing) 46 | 47 | 48 | --- 49 | 50 | ## List Usage Snapshots 51 | 52 | ``` 53 | ListIterator usageSnapshot = UsageSnapshot.list( 54 | 55 | HashMap parameters = null, 56 | HashMap options = null 57 | ) 58 | ``` 59 | 60 | ### Parameters 61 | 62 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 63 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 64 | -------------------------------------------------------------------------------- /docs/UserCipherUse.md: -------------------------------------------------------------------------------- 1 | # Files.Models.UserCipherUse 2 | 3 | ## Example UserCipherUse Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "protocol_cipher": "TLSv1.2; ECDHE-RSA-AES256-GCM-SHA384", 9 | "created_at": "2000-01-01T01:00:00Z", 10 | "insecure": true, 11 | "interface": "restapi", 12 | "updated_at": "2000-01-01T01:00:00Z", 13 | "user_id": 1 14 | } 15 | ``` 16 | 17 | * `id` / `id` (int64): UserCipherUse ID 18 | * `protocol_cipher` / `protocolCipher` (string): The protocol and cipher employed 19 | * `created_at` / `createdAt` (date-time): The earliest recorded use of this combination of interface and protocol and cipher (for this user) 20 | * `insecure` / `insecure` (boolean): Is this cipher considered insecure? 21 | * `interface` / `interfaceName` (string): The interface accessed 22 | * `updated_at` / `updatedAt` (date-time): The most recent use of this combination of interface and protocol and cipher (for this user) 23 | * `user_id` / `userId` (int64): ID of the user who performed this access 24 | 25 | 26 | --- 27 | 28 | ## List User Cipher Uses 29 | 30 | ``` 31 | ListIterator userCipherUse = UserCipherUse.list( 32 | 33 | HashMap parameters = null, 34 | HashMap options = null 35 | ) 36 | ``` 37 | 38 | ### Parameters 39 | 40 | * `user_id` (Long): User ID. If provided, will return uses for this user. 41 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 42 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 43 | -------------------------------------------------------------------------------- /docs/UserRequest.md: -------------------------------------------------------------------------------- 1 | # Files.Models.UserRequest 2 | 3 | ## Example UserRequest Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "name": "John Doe", 9 | "email": "john.doe@files.com", 10 | "details": "Changed Departments", 11 | "company": "Acme Inc." 12 | } 13 | ``` 14 | 15 | * `id` / `id` (int64): ID 16 | * `name` / `name` (string): User's full name 17 | * `email` / `email` (email): User email address 18 | * `details` / `details` (string): Details of the user's request 19 | * `company` / `company` (string): User's company name 20 | 21 | 22 | --- 23 | 24 | ## List User Requests 25 | 26 | ``` 27 | ListIterator userRequest = UserRequest.list( 28 | 29 | HashMap parameters = null, 30 | HashMap options = null 31 | ) 32 | ``` 33 | 34 | ### Parameters 35 | 36 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 37 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 38 | 39 | 40 | --- 41 | 42 | ## Show User Request 43 | 44 | ``` 45 | UserRequest userRequest = UserRequest.find( 46 | Long id, 47 | HashMap parameters = null, 48 | HashMap options = null 49 | ) 50 | ``` 51 | 52 | ### Parameters 53 | 54 | * `id` (Long): Required - User Request ID. 55 | 56 | 57 | --- 58 | 59 | ## Create User Request 60 | 61 | ``` 62 | UserRequest userRequest = UserRequest.create( 63 | 64 | HashMap parameters = null, 65 | HashMap options = null 66 | ) 67 | ``` 68 | 69 | ### Parameters 70 | 71 | * `name` (String): Required - Name of user requested 72 | * `email` (String): Required - Email of user requested 73 | * `details` (String): Required - Details of the user request 74 | * `company` (String): Company of the user requested 75 | 76 | 77 | --- 78 | 79 | ## Delete User Request 80 | 81 | ``` 82 | void userRequest = UserRequest.delete( 83 | Long id, 84 | HashMap parameters = null, 85 | HashMap options = null 86 | ) 87 | ``` 88 | 89 | ### Parameters 90 | 91 | * `id` (Long): Required - User Request ID. 92 | 93 | 94 | --- 95 | 96 | ## Delete User Request 97 | 98 | ``` 99 | UserRequest userRequest = UserRequest.find(id); 100 | 101 | HashMap parameters = new HashMap<>(); 102 | 103 | userRequest.delete(parameters); 104 | ``` 105 | 106 | ### Parameters 107 | 108 | * `id` (Long): Required - User Request ID. 109 | -------------------------------------------------------------------------------- /docs/UserSftpClientUse.md: -------------------------------------------------------------------------------- 1 | # Files.Models.UserSftpClientUse 2 | 3 | ## Example UserSftpClientUse Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "sftp_client": "example", 9 | "created_at": "2000-01-01T01:00:00Z", 10 | "updated_at": "2000-01-01T01:00:00Z", 11 | "user_id": 1 12 | } 13 | ``` 14 | 15 | * `id` / `id` (int64): UserSftpClientUse ID 16 | * `sftp_client` / `sftpClient` (string): The SFTP client used 17 | * `created_at` / `createdAt` (date-time): The earliest recorded use of this SFTP client (for this user) 18 | * `updated_at` / `updatedAt` (date-time): The most recent use of this SFTP client (for this user) 19 | * `user_id` / `userId` (int64): ID of the user who performed this access 20 | 21 | 22 | --- 23 | 24 | ## List User SFTP Client Uses 25 | 26 | ``` 27 | ListIterator userSftpClientUse = UserSftpClientUse.list( 28 | 29 | HashMap parameters = null, 30 | HashMap options = null 31 | ) 32 | ``` 33 | 34 | ### Parameters 35 | 36 | * `user_id` (Long): User ID. If provided, will return uses for this user. 37 | * `cursor` (String): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. 38 | * `per_page` (Long): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 39 | -------------------------------------------------------------------------------- /docs/WebhookTest.md: -------------------------------------------------------------------------------- 1 | # Files.Models.WebhookTest 2 | 3 | ## Example WebhookTest Object 4 | 5 | ``` 6 | { 7 | "code": 200, 8 | "message": "", 9 | "status": "", 10 | "data": "example", 11 | "success": true 12 | } 13 | ``` 14 | 15 | * `code` / `code` (int64): Status HTTP code 16 | * `message` / `message` (string): Error message 17 | * `status` / `status` (string): Status message 18 | * `data` / `data` (auto): Additional data 19 | * `success` / `success` (boolean): The success status of the webhook test 20 | * `url` / `url` (string): URL for testing the webhook. 21 | * `method` / `method` (string): HTTP method(GET or POST). 22 | * `encoding` / `encoding` (string): HTTP encoding method. Can be JSON, XML, or RAW (form data). 23 | * `headers` / `headers` (object): Additional request headers. 24 | * `body` / `body` (object): Additional body parameters. 25 | * `raw_body` / `rawBody` (string): raw body text 26 | * `file_as_body` / `fileAsBody` (boolean): Send the file data as the request body? 27 | * `file_form_field` / `fileFormField` (string): Send the file data as a named parameter in the request POST body 28 | * `action` / `action` (string): action for test body 29 | * `use_dedicated_ips` / `useDedicatedIps` (boolean): Use dedicated IPs for sending the webhook? 30 | 31 | 32 | --- 33 | 34 | ## Create Webhook Test 35 | 36 | ``` 37 | WebhookTest webhookTest = WebhookTest.create( 38 | 39 | HashMap parameters = null, 40 | HashMap options = null 41 | ) 42 | ``` 43 | 44 | ### Parameters 45 | 46 | * `url` (String): Required - URL for testing the webhook. 47 | * `method` (String): HTTP method(GET or POST). 48 | * `encoding` (String): HTTP encoding method. Can be JSON, XML, or RAW (form data). 49 | * `headers` (Map): Additional request headers. 50 | * `body` (Map): Additional body parameters. 51 | * `raw_body` (String): raw body text 52 | * `file_as_body` (Boolean): Send the file data as the request body? 53 | * `file_form_field` (String): Send the file data as a named parameter in the request POST body 54 | * `action` (String): action for test body 55 | * `use_dedicated_ips` (Boolean): Use dedicated IPs for sending the webhook? 56 | -------------------------------------------------------------------------------- /rewrite.yml: -------------------------------------------------------------------------------- 1 | --- 2 | styleConfigs: 3 | - org.openrewrite.java.style.TabsAndIndentsStyle: 4 | useTabCharacter: false 5 | tabSize: 2 6 | indentSize: 2 7 | continuationIndent: 4 8 | indentsRelativeToExpressionStart: true # or false 9 | methodDeclarationParameters: 10 | alignWhenMultiple: false 11 | - org.openrewrite.java.style.ImportLayoutStyle: 12 | classCountToUseStarImport: 9999 -------------------------------------------------------------------------------- /shared/header_test_data.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "headers": {}, 4 | "result": null 5 | }, 6 | { 7 | "headers": { 8 | "Retry-After": ["aaaaaa"] 9 | }, 10 | "result": null 11 | }, 12 | { 13 | "headers": { 14 | "Retry-After": ["5"] 15 | }, 16 | "result": 5 17 | }, 18 | { 19 | "headers": { 20 | "Retry-After": ["60"] 21 | }, 22 | "result": null 23 | }, 24 | { 25 | "headers": { 26 | "Retry-After": ["5", "10"] 27 | }, 28 | "result": 5 29 | }, 30 | { 31 | "headers": { 32 | "Retry-After": ["5", "aaaaaa"] 33 | }, 34 | "result": 5 35 | }, 36 | { 37 | "headers": { 38 | "Retry-After": ["%s"] 39 | }, 40 | "result": 8 41 | } 42 | ] -------------------------------------------------------------------------------- /shared/normalization_for_comparison_test_data.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ "filename.txt", "filename.txt" ], 3 | [ "FiLeNaMe.TxT", "filename.txt" ], 4 | [ "FILENAME.TXT", "filename.txt" ], 5 | [ "FÎŁĘÑÂMÉ.TXT", "filename.txt" ], 6 | [ "Fïłèńämê.Txt", "filename.txt" ], 7 | [ "a/b/c.txt", "a/b/c.txt" ], 8 | [ "A\\B\\C.TXT", "a/b/c.txt" ], 9 | [ "A/B\\C.TXT", "a/b/c.txt" ], 10 | [ "//a/b//c.txt", "a/b/c.txt" ], 11 | [ "a/b/c.txt ", "a/b/c.txt" ], 12 | [ "a/b/c.txt\t", "a/b/c.txt" ], 13 | [ "a/b/c.txt\n", "a/b/c.txt" ], 14 | [ "a/b/c.txt\r", "a/b/c.txt" ], 15 | [ " space_at_beginning", " space_at_beginning"], 16 | [ "space_at_end ", "space_at_end"], 17 | [ "tab\tseparated", "tab\tseparated"], 18 | [ "hello</hello>", "<title>hello</hello>"], 19 | [ "안녕하세요", "안녕하세요" ], 20 | [ "こんにちは", "こんにちは" ], 21 | [ "今日は", "今日は" ], 22 | [ "longest_unicode_character_﷽", "longest_unicode_character_﷽"], 23 | [ "invalid_null_byte_before\u0000after", "invalid_null_byte_beforeafter" ], 24 | [ "a/b/c/../../hello", "a/b/c/hello" ], 25 | [ "a/b/c/././hello", "a/b/c/hello" ], 26 | [ "one_code_point_ą", "one_code_point_a" ], 27 | [ "two_code_points_ą", "two_code_points_a" ], 28 | [ "one_code_point_훯", "one_code_point_훯"], 29 | [ "three_code_points_훯", "three_code_points_훯" ], 30 | [ "ÞþŊŋŦŧ", "þþŋŋŧŧ" ], 31 | [ "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ", "aaaaaaaeceeeeiiiidnoooooouuuuyssaaaaaaaeceeeeiiiidnoooooouuuuyy" ], 32 | [ "ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİIJij", "aaaaaaccccccccddddeeeeeeeeeegggggggghhhhiiiiiiiiiijij" ], 33 | [ "ĴĵĶķĹĺĻļĽľŁłŃńŅņŇňʼnŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤť", "jjkkllllllllnnnnnnʼnoooooooeoerrrrrrsssssssstttt" ], 34 | [ "ŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽž", "uuuuuuuuuuuuwwyyyzzzzzz" ], 35 | [ "😂❤️😍🤣😊🙏💕😭😘👍😅👏😁♥️🔥💔💖💙😢🤔😆🙄💪😉☺️👌🤗", "😂❤️😍🤣😊🙏💕😭😘👍😅👏😁♥️🔥💔💖💙😢🤔😆🙄💪😉☺️👌🤗" ], 36 | [ "💜😔😎😇🌹🤦🎉💞✌️✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣️", "💜😔😎😇🌹🤦🎉💞✌️✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣️" ], 37 | [ "emoji_‼️", "emoji_!!️" ], 38 | [ "<title>hello<:hello>.txt", "<title>hello<:hello>.txt" ], 39 | [ "twodotfile..txt", "twodotfile..txt" ], 40 | [ "three/.../dots_path", "three/.../dots_path" ], 41 | [ ".", "" ], 42 | [ "..", ""], 43 | [ "./..", "" ], 44 | [ "../..", ""], 45 | [ "./.", "" ], 46 | [ "../.", ""], 47 | [ "./../.", "" ], 48 | [ ".././..", ""] 49 | ] -------------------------------------------------------------------------------- /shared/url_test_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "substitute_urls": [ 3 | "https://storage.googleapis.com/example-bucket/cat.jpeg?X-Goog-Date=%s&X-Goog-Expires=%s&X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-SignedHeaders=host", 4 | "https://s3.amazonaws.com/test.example.com/metadata/1234/00000000-0000-0000-0001-00000000?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=%s&X-Amz-Expires=%s", 5 | "https://filescomtests.blob.core.windows.net/testazureremote/ntie3buw/file-to-download.txt?sp=se=%s" 6 | ], 7 | "error_urls": [ 8 | "https://storage.googleapis.com/example-bucket/cat.jpeg?X-Goog-Date=20220101T120000Z", 9 | "https://storage.googleapis.com/example-bucket/cat.jpeg?X-Goog-Date=20220101T120000Z&X-Goog-Date=20220202T120000Z", 10 | "https://storage.googleapis.com/example-bucket/cat.jpeg?X-Goog-Expires=900&X-Goog-Expires=600", 11 | "https://filescomtests.blob.core.windows.net/testazureremote/ntie3buw/file-to-download.txt?sp=se=20220101T120000Z&sp=se=20220202T120000Z", 12 | "https://filescomtests.blob.core.windows.net/testazureremote/ntie3buw/file-to-download.txt?sp=20220101T120000Z", 13 | "https://storage.googleapis.com/example-bucket/cat.jpeg?X-Goog-Date=20220101&X-Goog-Expires=900", 14 | "https://storage.googleapis.com/example-bucket/cat.jpeg?X-Goog-Date=asdf&X-Goog-Expires=900", 15 | "https://storage.googleapis.com/example-bucket/cat.jpeg?X-Goog-Date=20220101T120000Z&&X-Goog-Expires=900", 16 | "https://s3.amazonaws.com/test.example.com/metadata/1234/00000000-0000-0000-0001-00000000?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=asdf&X-Amz-Expires=900" 17 | ] 18 | } -------------------------------------------------------------------------------- /src/main/java/com/files/FilesClient.java: -------------------------------------------------------------------------------- 1 | package com.files; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | import com.files.ListIterator; 5 | import com.files.models.ModelInterface; 6 | import com.files.models.Session; 7 | import com.files.net.ApacheHttpEvictor; 8 | import com.files.net.FilesApacheHttpApi; 9 | import com.files.net.FilesApiInterface; 10 | import com.files.net.FilesResponse; 11 | import com.files.net.HttpMethods; 12 | import com.files.net.HttpMethods.RequestMethods; 13 | import com.files.util.FilesInputStream; 14 | import java.io.BufferedInputStream; 15 | import java.io.IOException; 16 | import java.util.HashMap; 17 | import java.util.List; 18 | import java.util.concurrent.TimeUnit; 19 | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | 23 | public abstract class FilesClient { 24 | private static final Logger log = LoggerFactory.getLogger(FilesClient.class); 25 | 26 | private static final FilesApiInterface filesApi = new FilesApacheHttpApi(); 27 | public static String apiKey; 28 | public static String language; 29 | public static Session session; 30 | public static PoolingHttpClientConnectionManager connectionManager; 31 | private static final ApacheHttpEvictor evictor; 32 | 33 | static { 34 | connectionManager = new PoolingHttpClientConnectionManager(); 35 | connectionManager.setMaxTotal(FilesConfig.getInstance().getUpstreamMaxConnections()); 36 | connectionManager.setDefaultMaxPerRoute(20); 37 | evictor = new ApacheHttpEvictor(connectionManager, FilesConfig.getInstance().getUpstreamTimeout()); 38 | } 39 | 40 | public static FilesResponse apiRequest(String url, HttpMethods.RequestMethods requestType, HashMap<String, Object> parameters, HashMap<String, Object> options) throws RuntimeException { 41 | return filesApi.apiRequest(url, requestType, parameters, options); 42 | } 43 | 44 | public static <T> ListIterator<T> requestList(String url, RequestMethods requestType, TypeReference<List<T>> className, HashMap<String, Object> parameters, HashMap<String, Object> options) throws RuntimeException { 45 | return filesApi.apiRequestList(url, requestType, className, parameters, options); 46 | } 47 | 48 | public static <T> T requestItem(String url, RequestMethods requestType, TypeReference<T> className, HashMap<String, Object> parameters, HashMap<String, Object> options) throws RuntimeException { 49 | final T item = filesApi.apiRequestItem(url, requestType, className, parameters, options); 50 | if (item instanceof ModelInterface) { 51 | ((ModelInterface) item).setOptions(options); 52 | } 53 | return item; 54 | } 55 | 56 | public static FilesInputStream getFileInputStream(String url, long start, long end) throws IOException { 57 | return filesApi.getFileInputStream(url, start, end); 58 | } 59 | 60 | public static long putBuffer(String url, RequestMethods requestType, String name, byte[] buffer, long length) throws IOException { 61 | return filesApi.putBuffer(url, requestType, name, buffer, length); 62 | } 63 | 64 | public static long putBufferedInputStream(String url, RequestMethods requestType, String name, BufferedInputStream inputStream, long length) throws IOException { 65 | return filesApi.putBufferedInputStream(url, requestType, name, inputStream, length); 66 | } 67 | 68 | public static void setProperty(String property, String value) { 69 | FilesConfig.getInstance().setProperty(property, value); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/files/ListIterator.java: -------------------------------------------------------------------------------- 1 | package com.files; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.core.type.TypeReference; 5 | import com.fasterxml.jackson.databind.MapperFeature; 6 | import com.fasterxml.jackson.databind.ObjectMapper; 7 | import com.fasterxml.jackson.databind.json.JsonMapper; 8 | import com.files.models.ModelInterface; 9 | import com.files.net.FilesResponse; 10 | import com.files.net.HttpMethods.RequestMethods; 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | import java.util.Iterator; 14 | import java.util.List; 15 | import java.util.Optional; 16 | import org.apache.http.Header; 17 | 18 | public class ListIterator<T> implements Iterable<T> { 19 | private final String url; 20 | private final RequestMethods requestType; 21 | private final TypeReference<List<T>> className; 22 | private final HashMap<String, Object> parameters; 23 | private final HashMap<String, Object> options; 24 | private String cursor; 25 | private final ObjectMapper objectMapper = JsonMapper 26 | .builder() 27 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 28 | .build(); 29 | public List<T> data = new ArrayList<T>(); 30 | 31 | public ListIterator(String url, RequestMethods requestType, TypeReference<List<T>> className, 32 | HashMap<String, Object> parameters, HashMap<String, Object> options) { 33 | this.url = url; 34 | this.requestType = requestType; 35 | this.className = className; 36 | this.parameters = parameters; 37 | this.options = options; 38 | } 39 | 40 | public Boolean hasNextPage() { 41 | return this.cursor != null; 42 | } 43 | 44 | @Override 45 | public Iterator<T> iterator() { 46 | return this.data.iterator(); 47 | } 48 | 49 | public ListIterator<T> loadNextPage() throws RuntimeException { 50 | if (this.cursor != null) { 51 | this.parameters.put("cursor", this.cursor); 52 | } 53 | 54 | FilesResponse response = FilesClient.apiRequest(this.url, this.requestType, this.parameters, this.options); 55 | try { 56 | this.data = objectMapper.readValue(response.getBody(), this.className); 57 | this.data.forEach(item -> { 58 | if (item instanceof ModelInterface) { 59 | ((ModelInterface) item).setOptions(this.options); 60 | } 61 | }); 62 | } catch (JsonProcessingException e) { 63 | throw new RuntimeException(e); 64 | } 65 | 66 | Optional<Header> cursorHeader = response.getHeaders().stream() 67 | .filter(header -> "X-Files-Cursor".equalsIgnoreCase(header.getName())) 68 | .findFirst(); 69 | 70 | this.cursor = cursorHeader.map(Header::getValue).orElse(null); 71 | 72 | return this; 73 | } 74 | 75 | public ListIteratorIterable<T> listAutoPaging() { 76 | return new ListIteratorIterable<T>(this); 77 | } 78 | 79 | public List<T> all() throws RuntimeException { 80 | List<T> allData = new ArrayList<T>(); 81 | 82 | // Force starting from the beginning 83 | this.cursor = null; 84 | 85 | do { 86 | this.loadNextPage(); 87 | allData.addAll(data); 88 | } while (this.cursor != null); 89 | 90 | return allData; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/files/ListIteratorIterable.java: -------------------------------------------------------------------------------- 1 | package com.files; 2 | 3 | import java.util.Iterator; 4 | import java.util.NoSuchElementException; 5 | 6 | public class ListIteratorIterable<T> implements Iterable<T> { 7 | private final ListIterator<T> listIterator; 8 | 9 | public ListIteratorIterable(ListIterator<T> listIterator) { 10 | this.listIterator = listIterator; 11 | listIterator.loadNextPage(); 12 | } 13 | 14 | @Override 15 | public Iterator<T> iterator() { 16 | return new Iterator<T>() { 17 | private int index = -1; 18 | 19 | @Override 20 | public boolean hasNext() { 21 | return listIterator.hasNextPage() || this.index < listIterator.data.size() - 1; 22 | } 23 | 24 | @Override 25 | public T next() { 26 | this.index++; 27 | if (this.index >= listIterator.data.size()) { 28 | if (listIterator.hasNextPage()) { 29 | listIterator.loadNextPage(); 30 | this.index = 0; 31 | } else { 32 | throw new NoSuchElementException("There are no more items in the list."); 33 | } 34 | } 35 | 36 | return listIterator.data.get(index); 37 | } 38 | 39 | @Override 40 | public void remove() { 41 | throw new UnsupportedOperationException(); 42 | } 43 | }; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/files/ResponseError.java: -------------------------------------------------------------------------------- 1 | package com.files; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import java.util.HashMap; 5 | 6 | public class ResponseError { 7 | public String detail; 8 | public String error; 9 | public String[] errors; 10 | @JsonProperty("http-code") 11 | public int httpCode; 12 | public String instance; 13 | @JsonProperty("model_errors") 14 | public HashMap<String, String[]> modelErrors; 15 | @JsonProperty("model_error_keys") 16 | public HashMap<String, String[]> modelErrorKeys; 17 | public String title; 18 | public String type; 19 | public HashMap<String, Object> data; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/files/exceptions/SdkException.java: -------------------------------------------------------------------------------- 1 | package com.files.exceptions; 2 | 3 | public class SdkException extends RuntimeException { 4 | private final String message; 5 | 6 | public SdkException(String message) { 7 | this.message = message; 8 | } 9 | 10 | @Override 11 | public String getMessage() { 12 | return message; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/files/exceptions/StackSuppressedRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.files.exceptions; 2 | 3 | public class StackSuppressedRuntimeException extends RuntimeException { 4 | @Override 5 | public synchronized Throwable fillInStackTrace() { 6 | // Do nothing to prevent stack trace generation. 7 | return this; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/Auto.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.type.TypeReference; 9 | import com.fasterxml.jackson.databind.MapperFeature; 10 | import com.fasterxml.jackson.databind.ObjectMapper; 11 | import com.fasterxml.jackson.databind.ObjectReader; 12 | import com.fasterxml.jackson.databind.SerializationFeature; 13 | import com.fasterxml.jackson.databind.json.JsonMapper; 14 | import com.files.FilesClient; 15 | import com.files.FilesConfig; 16 | import com.files.ListIterator; 17 | import com.files.net.HttpMethods.RequestMethods; 18 | import com.files.util.FilesInputStream; 19 | import com.files.util.ModelUtils; 20 | import java.io.BufferedInputStream; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.net.URI; 27 | import java.net.URISyntaxException; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Date; 30 | import java.util.HashMap; 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | public class Auto implements ModelInterface { 37 | private HashMap<String, Object> options; 38 | 39 | public void setOptions(HashMap<String, Object> options) { 40 | this.options = options; 41 | } 42 | 43 | private ObjectMapper objectMapper = JsonMapper 44 | .builder() 45 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 46 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 47 | .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")) 48 | .build(); 49 | 50 | 51 | public Auto() { 52 | this(null, null); 53 | } 54 | 55 | public Auto(HashMap<String, Object> parameters) { 56 | this(parameters, null); 57 | } 58 | 59 | public Auto(HashMap<String, Object> parameters, HashMap<String, Object> options) { 60 | this.options = options; 61 | try { 62 | ObjectReader objectReader = objectMapper.readerForUpdating(this); 63 | objectReader.readValue(objectMapper.writeValueAsString(parameters)); 64 | } catch (JsonProcessingException e) { 65 | // TODO: error generation on constructor 66 | } 67 | } 68 | 69 | 70 | /** 71 | */ 72 | @JsonProperty("dynamic") 73 | public Map<String, String> dynamic; 74 | 75 | public Map<String, String> getDynamic() { 76 | return dynamic; 77 | } 78 | 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/BundlePath.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.type.TypeReference; 9 | import com.fasterxml.jackson.databind.MapperFeature; 10 | import com.fasterxml.jackson.databind.ObjectMapper; 11 | import com.fasterxml.jackson.databind.ObjectReader; 12 | import com.fasterxml.jackson.databind.SerializationFeature; 13 | import com.fasterxml.jackson.databind.json.JsonMapper; 14 | import com.files.FilesClient; 15 | import com.files.FilesConfig; 16 | import com.files.ListIterator; 17 | import com.files.net.HttpMethods.RequestMethods; 18 | import com.files.util.FilesInputStream; 19 | import com.files.util.ModelUtils; 20 | import java.io.BufferedInputStream; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.net.URI; 27 | import java.net.URISyntaxException; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Date; 30 | import java.util.HashMap; 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | public class BundlePath implements ModelInterface { 37 | private HashMap<String, Object> options; 38 | 39 | public void setOptions(HashMap<String, Object> options) { 40 | this.options = options; 41 | } 42 | 43 | private ObjectMapper objectMapper = JsonMapper 44 | .builder() 45 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 46 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 47 | .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")) 48 | .build(); 49 | 50 | 51 | public BundlePath() { 52 | this(null, null); 53 | } 54 | 55 | public BundlePath(HashMap<String, Object> parameters) { 56 | this(parameters, null); 57 | } 58 | 59 | public BundlePath(HashMap<String, Object> parameters, HashMap<String, Object> options) { 60 | this.options = options; 61 | try { 62 | ObjectReader objectReader = objectMapper.readerForUpdating(this); 63 | objectReader.readValue(objectMapper.writeValueAsString(parameters)); 64 | } catch (JsonProcessingException e) { 65 | // TODO: error generation on constructor 66 | } 67 | } 68 | 69 | 70 | /** 71 | * Allow access to subfolders content? 72 | */ 73 | @JsonProperty("recursive") 74 | public Boolean recursive; 75 | 76 | public Boolean getRecursive() { 77 | return recursive; 78 | } 79 | 80 | /** 81 | * The path to the resource relative to filesystem. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 82 | */ 83 | @JsonProperty("path") 84 | public String path; 85 | 86 | public String getPath() { 87 | return path; 88 | } 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/Errors.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.type.TypeReference; 9 | import com.fasterxml.jackson.databind.MapperFeature; 10 | import com.fasterxml.jackson.databind.ObjectMapper; 11 | import com.fasterxml.jackson.databind.ObjectReader; 12 | import com.fasterxml.jackson.databind.SerializationFeature; 13 | import com.fasterxml.jackson.databind.json.JsonMapper; 14 | import com.files.FilesClient; 15 | import com.files.FilesConfig; 16 | import com.files.ListIterator; 17 | import com.files.net.HttpMethods.RequestMethods; 18 | import com.files.util.FilesInputStream; 19 | import com.files.util.ModelUtils; 20 | import java.io.BufferedInputStream; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.net.URI; 27 | import java.net.URISyntaxException; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Date; 30 | import java.util.HashMap; 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | public class Errors implements ModelInterface { 37 | private HashMap<String, Object> options; 38 | 39 | public void setOptions(HashMap<String, Object> options) { 40 | this.options = options; 41 | } 42 | 43 | private ObjectMapper objectMapper = JsonMapper 44 | .builder() 45 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 46 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 47 | .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")) 48 | .build(); 49 | 50 | 51 | public Errors() { 52 | this(null, null); 53 | } 54 | 55 | public Errors(HashMap<String, Object> parameters) { 56 | this(parameters, null); 57 | } 58 | 59 | public Errors(HashMap<String, Object> parameters, HashMap<String, Object> options) { 60 | this.options = options; 61 | try { 62 | ObjectReader objectReader = objectMapper.readerForUpdating(this); 63 | objectReader.readValue(objectMapper.writeValueAsString(parameters)); 64 | } catch (JsonProcessingException e) { 65 | // TODO: error generation on constructor 66 | } 67 | } 68 | 69 | 70 | /** 71 | * A list of fields where errors occur 72 | */ 73 | @JsonProperty("fields") 74 | public String[] fields; 75 | 76 | public String[] getFields() { 77 | return fields; 78 | } 79 | 80 | /** 81 | * A list of error messages 82 | */ 83 | @JsonProperty("messages") 84 | public String[] messages; 85 | 86 | public String[] getMessages() { 87 | return messages; 88 | } 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/FileAction.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.type.TypeReference; 9 | import com.fasterxml.jackson.databind.MapperFeature; 10 | import com.fasterxml.jackson.databind.ObjectMapper; 11 | import com.fasterxml.jackson.databind.ObjectReader; 12 | import com.fasterxml.jackson.databind.SerializationFeature; 13 | import com.fasterxml.jackson.databind.json.JsonMapper; 14 | import com.files.FilesClient; 15 | import com.files.FilesConfig; 16 | import com.files.ListIterator; 17 | import com.files.net.HttpMethods.RequestMethods; 18 | import com.files.util.FilesInputStream; 19 | import com.files.util.ModelUtils; 20 | import java.io.BufferedInputStream; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.net.URI; 27 | import java.net.URISyntaxException; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Date; 30 | import java.util.HashMap; 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | public class FileAction implements ModelInterface { 37 | private HashMap<String, Object> options; 38 | 39 | public void setOptions(HashMap<String, Object> options) { 40 | this.options = options; 41 | } 42 | 43 | private ObjectMapper objectMapper = JsonMapper 44 | .builder() 45 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 46 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 47 | .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")) 48 | .build(); 49 | 50 | 51 | public FileAction() { 52 | this(null, null); 53 | } 54 | 55 | public FileAction(HashMap<String, Object> parameters) { 56 | this(parameters, null); 57 | } 58 | 59 | public FileAction(HashMap<String, Object> parameters, HashMap<String, Object> options) { 60 | this.options = options; 61 | try { 62 | ObjectReader objectReader = objectMapper.readerForUpdating(this); 63 | objectReader.readValue(objectMapper.writeValueAsString(parameters)); 64 | } catch (JsonProcessingException e) { 65 | // TODO: error generation on constructor 66 | } 67 | } 68 | 69 | 70 | /** 71 | * Status of file operation. 72 | */ 73 | @JsonProperty("status") 74 | public String status; 75 | 76 | public String getStatus() { 77 | return status; 78 | } 79 | 80 | /** 81 | * If status is pending, this is the id of the File Migration to check for status updates. 82 | */ 83 | @JsonProperty("file_migration_id") 84 | public Long fileMigrationId; 85 | 86 | public Long getFileMigrationId() { 87 | return fileMigrationId; 88 | } 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/Image.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.type.TypeReference; 9 | import com.fasterxml.jackson.databind.MapperFeature; 10 | import com.fasterxml.jackson.databind.ObjectMapper; 11 | import com.fasterxml.jackson.databind.ObjectReader; 12 | import com.fasterxml.jackson.databind.SerializationFeature; 13 | import com.fasterxml.jackson.databind.json.JsonMapper; 14 | import com.files.FilesClient; 15 | import com.files.FilesConfig; 16 | import com.files.ListIterator; 17 | import com.files.net.HttpMethods.RequestMethods; 18 | import com.files.util.FilesInputStream; 19 | import com.files.util.ModelUtils; 20 | import java.io.BufferedInputStream; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.net.URI; 27 | import java.net.URISyntaxException; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Date; 30 | import java.util.HashMap; 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | public class Image implements ModelInterface { 37 | private HashMap<String, Object> options; 38 | 39 | public void setOptions(HashMap<String, Object> options) { 40 | this.options = options; 41 | } 42 | 43 | private ObjectMapper objectMapper = JsonMapper 44 | .builder() 45 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 46 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 47 | .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")) 48 | .build(); 49 | 50 | 51 | public Image() { 52 | this(null, null); 53 | } 54 | 55 | public Image(HashMap<String, Object> parameters) { 56 | this(parameters, null); 57 | } 58 | 59 | public Image(HashMap<String, Object> parameters, HashMap<String, Object> options) { 60 | this.options = options; 61 | try { 62 | ObjectReader objectReader = objectMapper.readerForUpdating(this); 63 | objectReader.readValue(objectMapper.writeValueAsString(parameters)); 64 | } catch (JsonProcessingException e) { 65 | // TODO: error generation on constructor 66 | } 67 | } 68 | 69 | 70 | /** 71 | * Image name 72 | */ 73 | @JsonProperty("name") 74 | public String name; 75 | 76 | public String getName() { 77 | return name; 78 | } 79 | 80 | /** 81 | * Image URI 82 | */ 83 | @JsonProperty("uri") 84 | public String uri; 85 | 86 | public String getUri() { 87 | return uri; 88 | } 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/ModelInterface.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import java.util.HashMap; 4 | 5 | public interface ModelInterface { 6 | public void setOptions(HashMap<String, Object> options); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/PaymentLineItem.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.type.TypeReference; 9 | import com.fasterxml.jackson.databind.MapperFeature; 10 | import com.fasterxml.jackson.databind.ObjectMapper; 11 | import com.fasterxml.jackson.databind.ObjectReader; 12 | import com.fasterxml.jackson.databind.SerializationFeature; 13 | import com.fasterxml.jackson.databind.json.JsonMapper; 14 | import com.files.FilesClient; 15 | import com.files.FilesConfig; 16 | import com.files.ListIterator; 17 | import com.files.net.HttpMethods.RequestMethods; 18 | import com.files.util.FilesInputStream; 19 | import com.files.util.ModelUtils; 20 | import java.io.BufferedInputStream; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.net.URI; 27 | import java.net.URISyntaxException; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Date; 30 | import java.util.HashMap; 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | public class PaymentLineItem implements ModelInterface { 37 | private HashMap<String, Object> options; 38 | 39 | public void setOptions(HashMap<String, Object> options) { 40 | this.options = options; 41 | } 42 | 43 | private ObjectMapper objectMapper = JsonMapper 44 | .builder() 45 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 46 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 47 | .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")) 48 | .build(); 49 | 50 | 51 | public PaymentLineItem() { 52 | this(null, null); 53 | } 54 | 55 | public PaymentLineItem(HashMap<String, Object> parameters) { 56 | this(parameters, null); 57 | } 58 | 59 | public PaymentLineItem(HashMap<String, Object> parameters, HashMap<String, Object> options) { 60 | this.options = options; 61 | try { 62 | ObjectReader objectReader = objectMapper.readerForUpdating(this); 63 | objectReader.readValue(objectMapper.writeValueAsString(parameters)); 64 | } catch (JsonProcessingException e) { 65 | // TODO: error generation on constructor 66 | } 67 | } 68 | 69 | 70 | /** 71 | * Payment line item amount 72 | */ 73 | @JsonProperty("amount") 74 | public Double amount; 75 | 76 | public Double getAmount() { 77 | return amount; 78 | } 79 | 80 | /** 81 | * Payment line item created at date/time 82 | */ 83 | @JsonProperty("created_at") 84 | public Date createdAt; 85 | 86 | public Date getCreatedAt() { 87 | return createdAt; 88 | } 89 | 90 | /** 91 | * Invoice ID 92 | */ 93 | @JsonProperty("invoice_id") 94 | public Long invoiceId; 95 | 96 | public Long getInvoiceId() { 97 | return invoiceId; 98 | } 99 | 100 | /** 101 | * Payment ID 102 | */ 103 | @JsonProperty("payment_id") 104 | public Long paymentId; 105 | 106 | public Long getPaymentId() { 107 | return paymentId; 108 | } 109 | 110 | 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/Preview.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.type.TypeReference; 9 | import com.fasterxml.jackson.databind.MapperFeature; 10 | import com.fasterxml.jackson.databind.ObjectMapper; 11 | import com.fasterxml.jackson.databind.ObjectReader; 12 | import com.fasterxml.jackson.databind.SerializationFeature; 13 | import com.fasterxml.jackson.databind.json.JsonMapper; 14 | import com.files.FilesClient; 15 | import com.files.FilesConfig; 16 | import com.files.ListIterator; 17 | import com.files.net.HttpMethods.RequestMethods; 18 | import com.files.util.FilesInputStream; 19 | import com.files.util.ModelUtils; 20 | import java.io.BufferedInputStream; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.net.URI; 27 | import java.net.URISyntaxException; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Date; 30 | import java.util.HashMap; 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | public class Preview implements ModelInterface { 37 | private HashMap<String, Object> options; 38 | 39 | public void setOptions(HashMap<String, Object> options) { 40 | this.options = options; 41 | } 42 | 43 | private ObjectMapper objectMapper = JsonMapper 44 | .builder() 45 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 46 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 47 | .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")) 48 | .build(); 49 | 50 | 51 | public Preview() { 52 | this(null, null); 53 | } 54 | 55 | public Preview(HashMap<String, Object> parameters) { 56 | this(parameters, null); 57 | } 58 | 59 | public Preview(HashMap<String, Object> parameters, HashMap<String, Object> options) { 60 | this.options = options; 61 | try { 62 | ObjectReader objectReader = objectMapper.readerForUpdating(this); 63 | objectReader.readValue(objectMapper.writeValueAsString(parameters)); 64 | } catch (JsonProcessingException e) { 65 | // TODO: error generation on constructor 66 | } 67 | } 68 | 69 | 70 | /** 71 | * Preview ID 72 | */ 73 | @JsonProperty("id") 74 | public Long id; 75 | 76 | public Long getId() { 77 | return id; 78 | } 79 | 80 | /** 81 | * Preview status. Can be invalid, not_generated, generating, complete, or file_too_large 82 | */ 83 | @JsonProperty("status") 84 | public String status; 85 | 86 | public String getStatus() { 87 | return status; 88 | } 89 | 90 | /** 91 | * Link to download preview 92 | */ 93 | @JsonProperty("download_uri") 94 | public String downloadUri; 95 | 96 | public String getDownloadUri() { 97 | return downloadUri; 98 | } 99 | 100 | /** 101 | * Preview type. Can be image, pdf, pdf_native, video, or audio 102 | */ 103 | @JsonProperty("type") 104 | public String type; 105 | 106 | public String getType() { 107 | return type; 108 | } 109 | 110 | /** 111 | * Preview size 112 | */ 113 | @JsonProperty("size") 114 | public String size; 115 | 116 | public String getSize() { 117 | return size; 118 | } 119 | 120 | 121 | } 122 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/PublicIpAddress.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.type.TypeReference; 9 | import com.fasterxml.jackson.databind.MapperFeature; 10 | import com.fasterxml.jackson.databind.ObjectMapper; 11 | import com.fasterxml.jackson.databind.ObjectReader; 12 | import com.fasterxml.jackson.databind.SerializationFeature; 13 | import com.fasterxml.jackson.databind.json.JsonMapper; 14 | import com.files.FilesClient; 15 | import com.files.FilesConfig; 16 | import com.files.ListIterator; 17 | import com.files.net.HttpMethods.RequestMethods; 18 | import com.files.util.FilesInputStream; 19 | import com.files.util.ModelUtils; 20 | import java.io.BufferedInputStream; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.net.URI; 27 | import java.net.URISyntaxException; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Date; 30 | import java.util.HashMap; 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | public class PublicIpAddress implements ModelInterface { 37 | private HashMap<String, Object> options; 38 | 39 | public void setOptions(HashMap<String, Object> options) { 40 | this.options = options; 41 | } 42 | 43 | private ObjectMapper objectMapper = JsonMapper 44 | .builder() 45 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 46 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 47 | .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")) 48 | .build(); 49 | 50 | 51 | public PublicIpAddress() { 52 | this(null, null); 53 | } 54 | 55 | public PublicIpAddress(HashMap<String, Object> parameters) { 56 | this(parameters, null); 57 | } 58 | 59 | public PublicIpAddress(HashMap<String, Object> parameters, HashMap<String, Object> options) { 60 | this.options = options; 61 | try { 62 | ObjectReader objectReader = objectMapper.readerForUpdating(this); 63 | objectReader.readValue(objectMapper.writeValueAsString(parameters)); 64 | } catch (JsonProcessingException e) { 65 | // TODO: error generation on constructor 66 | } 67 | } 68 | 69 | 70 | /** 71 | * The public IP address. 72 | */ 73 | @JsonProperty("ip_address") 74 | public String ipAddress; 75 | 76 | public String getIpAddress() { 77 | return ipAddress; 78 | } 79 | 80 | /** 81 | * The name of the frontend server. 82 | */ 83 | @JsonProperty("server_name") 84 | public String serverName; 85 | 86 | public String getServerName() { 87 | return serverName; 88 | } 89 | 90 | /** 91 | */ 92 | @JsonProperty("ftp_enabled") 93 | public Boolean ftpEnabled; 94 | 95 | public Boolean getFtpEnabled() { 96 | return ftpEnabled; 97 | } 98 | 99 | /** 100 | */ 101 | @JsonProperty("sftp_enabled") 102 | public Boolean sftpEnabled; 103 | 104 | public Boolean getSftpEnabled() { 105 | return sftpEnabled; 106 | } 107 | 108 | 109 | } 110 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/ShareGroupMember.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.type.TypeReference; 9 | import com.fasterxml.jackson.databind.MapperFeature; 10 | import com.fasterxml.jackson.databind.ObjectMapper; 11 | import com.fasterxml.jackson.databind.ObjectReader; 12 | import com.fasterxml.jackson.databind.SerializationFeature; 13 | import com.fasterxml.jackson.databind.json.JsonMapper; 14 | import com.files.FilesClient; 15 | import com.files.FilesConfig; 16 | import com.files.ListIterator; 17 | import com.files.net.HttpMethods.RequestMethods; 18 | import com.files.util.FilesInputStream; 19 | import com.files.util.ModelUtils; 20 | import java.io.BufferedInputStream; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.net.URI; 27 | import java.net.URISyntaxException; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Date; 30 | import java.util.HashMap; 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | public class ShareGroupMember implements ModelInterface { 37 | private HashMap<String, Object> options; 38 | 39 | public void setOptions(HashMap<String, Object> options) { 40 | this.options = options; 41 | } 42 | 43 | private ObjectMapper objectMapper = JsonMapper 44 | .builder() 45 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 46 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 47 | .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")) 48 | .build(); 49 | 50 | 51 | public ShareGroupMember() { 52 | this(null, null); 53 | } 54 | 55 | public ShareGroupMember(HashMap<String, Object> parameters) { 56 | this(parameters, null); 57 | } 58 | 59 | public ShareGroupMember(HashMap<String, Object> parameters, HashMap<String, Object> options) { 60 | this.options = options; 61 | try { 62 | ObjectReader objectReader = objectMapper.readerForUpdating(this); 63 | objectReader.readValue(objectMapper.writeValueAsString(parameters)); 64 | } catch (JsonProcessingException e) { 65 | // TODO: error generation on constructor 66 | } 67 | } 68 | 69 | 70 | /** 71 | * Name of the share group member 72 | */ 73 | @JsonProperty("name") 74 | public String name; 75 | 76 | public String getName() { 77 | return name; 78 | } 79 | 80 | /** 81 | * Company of the share group member 82 | */ 83 | @JsonProperty("company") 84 | public String company; 85 | 86 | public String getCompany() { 87 | return company; 88 | } 89 | 90 | /** 91 | * Email of the share group member 92 | */ 93 | @JsonProperty("email") 94 | public String email; 95 | 96 | public String getEmail() { 97 | return email; 98 | } 99 | 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/Status.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.type.TypeReference; 9 | import com.fasterxml.jackson.databind.MapperFeature; 10 | import com.fasterxml.jackson.databind.ObjectMapper; 11 | import com.fasterxml.jackson.databind.ObjectReader; 12 | import com.fasterxml.jackson.databind.SerializationFeature; 13 | import com.fasterxml.jackson.databind.json.JsonMapper; 14 | import com.files.FilesClient; 15 | import com.files.FilesConfig; 16 | import com.files.ListIterator; 17 | import com.files.net.HttpMethods.RequestMethods; 18 | import com.files.util.FilesInputStream; 19 | import com.files.util.ModelUtils; 20 | import java.io.BufferedInputStream; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.net.URI; 27 | import java.net.URISyntaxException; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Date; 30 | import java.util.HashMap; 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | public class Status implements ModelInterface { 37 | private HashMap<String, Object> options; 38 | 39 | public void setOptions(HashMap<String, Object> options) { 40 | this.options = options; 41 | } 42 | 43 | private ObjectMapper objectMapper = JsonMapper 44 | .builder() 45 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 46 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 47 | .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")) 48 | .build(); 49 | 50 | 51 | public Status() { 52 | this(null, null); 53 | } 54 | 55 | public Status(HashMap<String, Object> parameters) { 56 | this(parameters, null); 57 | } 58 | 59 | public Status(HashMap<String, Object> parameters, HashMap<String, Object> options) { 60 | this.options = options; 61 | try { 62 | ObjectReader objectReader = objectMapper.readerForUpdating(this); 63 | objectReader.readValue(objectMapper.writeValueAsString(parameters)); 64 | } catch (JsonProcessingException e) { 65 | // TODO: error generation on constructor 66 | } 67 | } 68 | 69 | 70 | /** 71 | * Status HTTP code 72 | */ 73 | @JsonProperty("code") 74 | public Long code; 75 | 76 | public Long getCode() { 77 | return code; 78 | } 79 | 80 | /** 81 | * Error message 82 | */ 83 | @JsonProperty("message") 84 | public String message; 85 | 86 | public String getMessage() { 87 | return message; 88 | } 89 | 90 | /** 91 | * Status message 92 | */ 93 | @JsonProperty("status") 94 | public String status; 95 | 96 | public String getStatus() { 97 | return status; 98 | } 99 | 100 | /** 101 | * Additional data 102 | */ 103 | @JsonProperty("data") 104 | public Auto data; 105 | 106 | public Auto getData() { 107 | return data; 108 | } 109 | 110 | /** 111 | * A list of api errors 112 | */ 113 | @JsonProperty("errors") 114 | public Object[] errors; 115 | 116 | public Object[] getErrors() { 117 | return errors; 118 | } 119 | 120 | /** 121 | * Required Clickwrap id 122 | */ 123 | @JsonProperty("clickwrap_id") 124 | public Long clickwrapId; 125 | 126 | public Long getClickwrapId() { 127 | return clickwrapId; 128 | } 129 | 130 | /** 131 | * Required Clickwrap body 132 | */ 133 | @JsonProperty("clickwrap_body") 134 | public String clickwrapBody; 135 | 136 | public String getClickwrapBody() { 137 | return clickwrapBody; 138 | } 139 | 140 | 141 | } 142 | -------------------------------------------------------------------------------- /src/main/java/com/files/models/UsageByTopLevelDir.java: -------------------------------------------------------------------------------- 1 | package com.files.models; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.type.TypeReference; 9 | import com.fasterxml.jackson.databind.MapperFeature; 10 | import com.fasterxml.jackson.databind.ObjectMapper; 11 | import com.fasterxml.jackson.databind.ObjectReader; 12 | import com.fasterxml.jackson.databind.SerializationFeature; 13 | import com.fasterxml.jackson.databind.json.JsonMapper; 14 | import com.files.FilesClient; 15 | import com.files.FilesConfig; 16 | import com.files.ListIterator; 17 | import com.files.net.HttpMethods.RequestMethods; 18 | import com.files.util.FilesInputStream; 19 | import com.files.util.ModelUtils; 20 | import java.io.BufferedInputStream; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.io.InputStream; 25 | import java.io.OutputStream; 26 | import java.net.URI; 27 | import java.net.URISyntaxException; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Date; 30 | import java.util.HashMap; 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | @JsonIgnoreProperties(ignoreUnknown = true) 35 | @JsonInclude(JsonInclude.Include.NON_NULL) 36 | public class UsageByTopLevelDir implements ModelInterface { 37 | private HashMap<String, Object> options; 38 | 39 | public void setOptions(HashMap<String, Object> options) { 40 | this.options = options; 41 | } 42 | 43 | private ObjectMapper objectMapper = JsonMapper 44 | .builder() 45 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 46 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 47 | .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX")) 48 | .build(); 49 | 50 | 51 | public UsageByTopLevelDir() { 52 | this(null, null); 53 | } 54 | 55 | public UsageByTopLevelDir(HashMap<String, Object> parameters) { 56 | this(parameters, null); 57 | } 58 | 59 | public UsageByTopLevelDir(HashMap<String, Object> parameters, HashMap<String, Object> options) { 60 | this.options = options; 61 | try { 62 | ObjectReader objectReader = objectMapper.readerForUpdating(this); 63 | objectReader.readValue(objectMapper.writeValueAsString(parameters)); 64 | } catch (JsonProcessingException e) { 65 | // TODO: error generation on constructor 66 | } 67 | } 68 | 69 | 70 | /** 71 | * Directory name 72 | */ 73 | @JsonProperty("dir") 74 | public String dir; 75 | 76 | public String getDir() { 77 | return dir; 78 | } 79 | 80 | /** 81 | * Usage 82 | */ 83 | @JsonProperty("size") 84 | public Long size; 85 | 86 | public Long getSize() { 87 | return size; 88 | } 89 | 90 | /** 91 | * File count 92 | */ 93 | @JsonProperty("count") 94 | public Long count; 95 | 96 | public Long getCount() { 97 | return count; 98 | } 99 | 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/files/net/ApacheHttpEvictor.java: -------------------------------------------------------------------------------- 1 | package com.files.net; 2 | 3 | import java.util.concurrent.Executors; 4 | import java.util.concurrent.ScheduledExecutorService; 5 | import java.util.concurrent.TimeUnit; 6 | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; 7 | 8 | public class ApacheHttpEvictor { 9 | private final ScheduledExecutorService scheduler; 10 | private final PoolingHttpClientConnectionManager connectionManager; 11 | 12 | public ApacheHttpEvictor(PoolingHttpClientConnectionManager connectionManager, long idleTimeoutMillis) { 13 | this.connectionManager = connectionManager; 14 | this.scheduler = Executors.newSingleThreadScheduledExecutor(r -> { 15 | Thread t = new Thread(r); 16 | t.setName("http-connection-evictor"); 17 | t.setDaemon(true); 18 | return t; 19 | }); 20 | 21 | scheduler.scheduleAtFixedRate(() -> { 22 | try { 23 | connectionManager.closeExpiredConnections(); 24 | connectionManager.closeIdleConnections(idleTimeoutMillis, TimeUnit.MILLISECONDS); 25 | } catch (Exception e) { 26 | // Should never be here 27 | } 28 | }, 30, 30, TimeUnit.SECONDS); 29 | } 30 | 31 | public void shutdown() { 32 | scheduler.shutdown(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/files/net/FilesApacheHttpInputStream.java: -------------------------------------------------------------------------------- 1 | package com.files.net; 2 | 3 | import com.files.util.FilesInputStream; 4 | import com.files.util.StreamTransfer; 5 | import java.io.Closeable; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.io.OutputStream; 9 | import org.apache.http.HttpResponse; 10 | 11 | public class FilesApacheHttpInputStream extends FilesInputStream implements Closeable { 12 | private static final int DEFAULT_BUFFER_SIZE = 8192; 13 | private final HttpResponse response; 14 | private InputStream upstreamInputStream; 15 | 16 | public FilesApacheHttpInputStream(HttpResponse response) { 17 | this.response = response; 18 | } 19 | 20 | @Override 21 | public int read() throws IOException { 22 | if (upstreamInputStream == null) { 23 | loadInputStream(); 24 | } 25 | return upstreamInputStream.read(); 26 | } 27 | 28 | @Override 29 | public int read(byte[] b) throws IOException { 30 | if (upstreamInputStream == null) { 31 | loadInputStream(); 32 | } 33 | return upstreamInputStream.read(b); 34 | } 35 | 36 | @Override 37 | public int read(byte[] b, int off, int len) throws IOException { 38 | if (upstreamInputStream == null) { 39 | loadInputStream(); 40 | } 41 | return upstreamInputStream.read(b, off, len); 42 | } 43 | 44 | @Override 45 | public long skip(long n) throws IOException { 46 | if (upstreamInputStream == null) { 47 | loadInputStream(); 48 | } 49 | return upstreamInputStream.skip(n); 50 | } 51 | 52 | @Override 53 | public int available() throws IOException { 54 | if (upstreamInputStream == null) { 55 | loadInputStream(); 56 | } 57 | return upstreamInputStream.available(); 58 | } 59 | 60 | @Override 61 | public void close() throws IOException { 62 | if (upstreamInputStream != null) { 63 | upstreamInputStream.close(); 64 | } 65 | if (response.getEntity() != null) { 66 | response.getEntity().getContent().close(); 67 | } 68 | } 69 | 70 | @Override 71 | public synchronized void mark(int readLimit) { 72 | if (upstreamInputStream == null) { 73 | try { 74 | loadInputStream(); 75 | } catch (IOException e) { 76 | throw new RuntimeException("Failed to load input stream", e); 77 | } 78 | } 79 | upstreamInputStream.mark(readLimit); 80 | } 81 | 82 | @Override 83 | public synchronized void reset() throws IOException { 84 | if (upstreamInputStream == null) { 85 | loadInputStream(); 86 | } 87 | upstreamInputStream.reset(); 88 | } 89 | 90 | @Override 91 | public boolean markSupported() { 92 | if (upstreamInputStream == null) { 93 | try { 94 | loadInputStream(); 95 | } catch (IOException e) { 96 | throw new RuntimeException("Failed to load input stream", e); 97 | } 98 | } 99 | return upstreamInputStream.markSupported(); 100 | } 101 | 102 | @Override 103 | public long transferTo(OutputStream out) throws IOException { 104 | if (upstreamInputStream == null) { 105 | loadInputStream(); 106 | } 107 | long transferred = StreamTransfer.smartCopy(response.getEntity().getContentLength(), this, out); 108 | this.close(); 109 | return transferred; 110 | } 111 | 112 | private void loadInputStream() throws IOException { 113 | upstreamInputStream = response.getEntity().getContent(); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/com/files/net/FilesApiInterface.java: -------------------------------------------------------------------------------- 1 | package com.files.net; 2 | 3 | import com.fasterxml.jackson.core.type.TypeReference; 4 | import com.files.ListIterator; 5 | import com.files.util.FilesInputStream; 6 | import java.io.BufferedInputStream; 7 | import java.io.IOException; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | 11 | public interface FilesApiInterface { 12 | public FilesResponse apiRequest(String url, HttpMethods.RequestMethods requestType, HashMap<String, Object> parameters, HashMap<String, Object> options) throws RuntimeException; 13 | 14 | public <T> ListIterator<T> apiRequestList(String url, HttpMethods.RequestMethods requestType, TypeReference<List<T>> className, 15 | HashMap<String, Object> parameters, HashMap<String, Object> options) throws RuntimeException; 16 | 17 | public <T> T apiRequestItem(String url, HttpMethods.RequestMethods requestType, TypeReference<T> className, 18 | HashMap<String, Object> parameters, HashMap<String, Object> options) throws RuntimeException; 19 | 20 | public FilesInputStream getFileInputStream(String url, long start, long end) throws IOException; 21 | 22 | public long putBuffer(String url, HttpMethods.RequestMethods requestType, String name, byte[] buffer, long length) throws IOException; 23 | 24 | public long putBufferedInputStream(String url, HttpMethods.RequestMethods requestType, String name, BufferedInputStream inputStream, long length) throws IOException; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/files/net/FilesHttpClient.java: -------------------------------------------------------------------------------- 1 | package com.files.net; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.core.type.TypeReference; 5 | import com.fasterxml.jackson.databind.MapperFeature; 6 | import com.fasterxml.jackson.databind.ObjectMapper; 7 | import com.fasterxml.jackson.databind.json.JsonMapper; 8 | import com.files.FilesClient; 9 | import com.files.FilesConfig; 10 | import com.files.ListIterator; 11 | import com.files.exceptions.ApiErrorException; 12 | import com.files.util.FilesInputStream; 13 | import com.files.util.ModelUtils; 14 | import java.io.BufferedInputStream; 15 | import java.io.IOException; 16 | import java.util.HashMap; 17 | import java.util.List; 18 | import java.util.Map; 19 | import java.util.concurrent.TimeUnit; 20 | import org.apache.http.HttpEntity; 21 | import org.apache.http.HttpResponse; 22 | import org.apache.http.client.config.RequestConfig; 23 | import org.apache.http.entity.ContentType; 24 | import org.apache.http.entity.StringEntity; 25 | import org.apache.http.entity.mime.MultipartEntityBuilder; 26 | import org.apache.http.impl.client.CloseableHttpClient; 27 | import org.apache.http.impl.client.HttpClients; 28 | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; 29 | import org.apache.http.util.EntityUtils; 30 | import org.slf4j.Logger; 31 | import org.slf4j.LoggerFactory; 32 | 33 | public class FilesHttpClient { 34 | private static final Logger log = LoggerFactory.getLogger(FilesHttpClient.class); 35 | 36 | private static FilesHttpClient instance; 37 | protected CloseableHttpClient httpClient; 38 | protected FilesHttpExecutor httpExecutor; 39 | 40 | protected FilesHttpClient() { 41 | FilesConfig filesConfig = FilesConfig.getInstance(); 42 | PoolingHttpClientConnectionManager connectionManager = FilesClient.connectionManager; 43 | 44 | RequestConfig requestConfig = RequestConfig.custom() 45 | .setConnectTimeout((int) TimeUnit.SECONDS.toMillis(10))// Connection timeout 46 | .setSocketTimeout((int) TimeUnit.SECONDS.toMillis(30))// Socket timeout 47 | .setConnectionRequestTimeout((int) TimeUnit.SECONDS.toMillis(10))// Request timeout 48 | .build(); 49 | 50 | try { 51 | httpClient = HttpClients.custom() 52 | .setConnectionManager(connectionManager) 53 | .setDefaultRequestConfig(requestConfig) 54 | .build(); 55 | httpExecutor = new FilesHttpExecutor(httpClient); 56 | } catch (Exception e) { 57 | log.error("Error initializing Apache HTTP Client", e); 58 | } 59 | } 60 | 61 | public static FilesHttpClient getInstance() { 62 | if (instance == null) { 63 | synchronized (FilesHttpClient.class) { 64 | if (instance == null) { 65 | instance = new FilesHttpClient(); 66 | } 67 | } 68 | } 69 | return instance; 70 | } 71 | 72 | public FilesHttpExecutor getHttpExecutor() { 73 | return httpExecutor; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/files/net/FilesResponse.java: -------------------------------------------------------------------------------- 1 | package com.files.net; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | import org.apache.http.Header; 7 | 8 | public class FilesResponse { 9 | private final int statusCode; 10 | private final List<Header> headers; 11 | private final String body; 12 | 13 | public FilesResponse(int statusCode, List<Header> headers, String body) { 14 | this.statusCode = statusCode; 15 | this.headers = headers; 16 | this.body = body; 17 | } 18 | 19 | public int getStatusCode() { 20 | return this.statusCode; 21 | } 22 | 23 | public List<Header> getHeaders() { 24 | return this.headers; 25 | } 26 | 27 | public String getBody() { 28 | return this.body; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/files/net/HttpMethods.java: -------------------------------------------------------------------------------- 1 | package com.files.net; 2 | 3 | public class HttpMethods { 4 | public enum RequestMethods { 5 | GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/files/util/FilesInputStream.java: -------------------------------------------------------------------------------- 1 | package com.files.util; 2 | 3 | import java.io.Closeable; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.OutputStream; 7 | 8 | public abstract class FilesInputStream extends InputStream implements Closeable { 9 | @Override 10 | public int read() throws IOException { 11 | return 0; 12 | } 13 | 14 | public long transferTo(OutputStream out) throws IOException { 15 | throw new IOException("transferTo not implemented"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/files/util/HeaderUtils.java: -------------------------------------------------------------------------------- 1 | package com.files.util; 2 | 3 | import com.files.FilesConfig; 4 | import java.text.DateFormat; 5 | import java.text.ParseException; 6 | import java.text.SimpleDateFormat; 7 | import java.time.Instant; 8 | import java.util.Date; 9 | import java.util.List; 10 | import java.util.Map; 11 | import java.util.concurrent.TimeUnit; 12 | 13 | public class HeaderUtils { 14 | // This is NOT an ISO Date format, but an HTTP Date per https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Date 15 | public static final DateFormat HTTP_DATE_FORMAT = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z"); 16 | 17 | private static Integer cappedRetrySeconds(int retrySeconds) { 18 | return retrySeconds <= FilesConfig.getInstance().getMaximumRetrySeconds() ? retrySeconds : null; 19 | } 20 | 21 | public static Integer retryAfterSeconds(Map<String, List<String>> headers) { 22 | if (headers.containsKey("Retry-After")) { 23 | String retryValue = headers.get("Retry-After").get(0); 24 | try { 25 | return cappedRetrySeconds(Integer.parseInt(retryValue)); 26 | } catch (NumberFormatException e) { 27 | try { 28 | // `toSeconds` rounds toward zero, so add 1 to round up and always delay enough time 29 | return cappedRetrySeconds((int) TimeUnit.MILLISECONDS.toSeconds(HTTP_DATE_FORMAT.parse(retryValue).getTime() - Date.from(Instant.now()).getTime()) + 1); 30 | } catch (ParseException e2) { 31 | return null; 32 | } 33 | } 34 | } 35 | 36 | return null; 37 | } 38 | 39 | private HeaderUtils() { 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/files/util/ModelUtils.java: -------------------------------------------------------------------------------- 1 | package com.files.util; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.core.type.TypeReference; 5 | import com.fasterxml.jackson.databind.MapperFeature; 6 | import com.fasterxml.jackson.databind.ObjectMapper; 7 | import com.fasterxml.jackson.databind.json.JsonMapper; 8 | import java.util.HashMap; 9 | 10 | public class ModelUtils { 11 | private ModelUtils() { 12 | } 13 | 14 | public static HashMap<String, Object> toParameterMap(String object) { 15 | ObjectMapper mapper = JsonMapper 16 | .builder() 17 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 18 | .build(); 19 | 20 | TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {}; 21 | HashMap<String, Object> parameters; 22 | try { 23 | parameters = mapper.readValue(object, typeRef); 24 | } catch (JsonProcessingException e) { 25 | parameters = null; 26 | } 27 | return parameters; 28 | } 29 | 30 | public static String forceMandatoryUriEncode(String uri) { 31 | return uri.replaceAll(";", "%3B"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/files/util/StreamTransfer.java: -------------------------------------------------------------------------------- 1 | package com.files.util; 2 | 3 | import com.files.util.BufferPool.Buffer; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.OutputStream; 7 | import java.util.function.IntConsumer; 8 | 9 | public class StreamTransfer { 10 | private static final int INITIAL_BUFFER_SIZE = Math.min(1024 * 8, BufferPool.T_BUFFER_SIZE); 11 | 12 | private StreamTransfer() { 13 | } 14 | 15 | public static long smartCopy(long knownSize, InputStream in, OutputStream out) throws IOException { 16 | return smartCopy(knownSize, in, out, null); 17 | } 18 | 19 | public static long smartCopy(long knownSize, InputStream in, OutputStream out, 20 | IntConsumer progressConsumer) throws IOException { 21 | // in the future full duplex and other copies may be possible 22 | return bufferedCopy(knownSize, in, out, progressConsumer); 23 | } 24 | 25 | public static long bufferedCopy(long knownSize, InputStream in, OutputStream out, 26 | IntConsumer progressConsumer) throws IOException { 27 | long total = 0; 28 | try (Buffer b = BufferPool.needBuffer(INITIAL_BUFFER_SIZE)) { 29 | int c; 30 | byte[] buffer = b.getBuffer(); 31 | long remaining = Long.MAX_VALUE; 32 | while ((knownSize < 1 || (remaining = knownSize - total) > 0) 33 | && (c = in.read(buffer, 0, (int) Math.min(remaining, INITIAL_BUFFER_SIZE))) >= 0) { 34 | if (c > 0) { 35 | out.write(buffer, 0, c); 36 | total += c; 37 | if (progressConsumer != null) { 38 | progressConsumer.accept(c); 39 | } 40 | } else { 41 | Thread.yield(); 42 | } 43 | } 44 | } 45 | return total; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/files/util/UrlUtils.java: -------------------------------------------------------------------------------- 1 | package com.files.util; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import java.net.URL; 5 | import java.net.URLDecoder; 6 | import java.nio.charset.StandardCharsets; 7 | import java.text.DateFormat; 8 | import java.text.ParseException; 9 | import java.text.SimpleDateFormat; 10 | import java.time.Instant; 11 | import java.util.AbstractMap.SimpleImmutableEntry; 12 | import java.util.ArrayList; 13 | import java.util.Arrays; 14 | import java.util.Collections; 15 | import java.util.Date; 16 | import java.util.LinkedHashMap; 17 | import java.util.List; 18 | import java.util.Map; 19 | import java.util.stream.Collectors; 20 | 21 | public class UrlUtils { 22 | private static class Expire { 23 | public String expiresStartDate; 24 | public String expiresDuration; 25 | public String expiresDate; 26 | 27 | public Expire(String expiresStartDate, String expiresDuration, String expiresDate) { 28 | this.expiresStartDate = expiresStartDate; 29 | this.expiresDuration = expiresDuration; 30 | this.expiresDate = expiresDate; 31 | } 32 | } 33 | 34 | public static final DateFormat TIME_DATE_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); 35 | 36 | private static final List<Expire> EXPIRE_LIST = Collections.unmodifiableList( 37 | new ArrayList<Expire>() { 38 | { 39 | add(new Expire("X-Amz-Date", "X-Amz-Expires", null)); 40 | add(new Expire("X-Files-Date", "X-Files-Expires", null)); 41 | add(new Expire("X-Goog-Date", "X-Goog-Expires", null)); 42 | add(new Expire("sp", null, "se")); 43 | } 44 | }); 45 | 46 | protected UrlUtils() { 47 | } 48 | 49 | private static Map<String, List<String>> splitQuery(URL url) { 50 | if (url.getQuery().isEmpty() || url.getQuery() == null) { 51 | return Collections.emptyMap(); 52 | } 53 | return Arrays.stream(url.getQuery().split("&")) 54 | .map(UrlUtils::splitQueryParameter) 55 | .collect(Collectors.groupingBy(SimpleImmutableEntry::getKey, LinkedHashMap::new, 56 | Collectors.mapping(Map.Entry::getValue, Collectors.toList()))); 57 | } 58 | 59 | private static SimpleImmutableEntry<String, String> splitQueryParameter(String parameter) { 60 | final String[] parts = parameter.split("=", 2); 61 | 62 | try { 63 | return new SimpleImmutableEntry<>( 64 | URLDecoder.decode(parts[0], StandardCharsets.UTF_8.name()), 65 | URLDecoder.decode(parts[1], StandardCharsets.UTF_8.name())); 66 | } catch (UnsupportedEncodingException e) { 67 | return new SimpleImmutableEntry<>(parts[0], parts[1]); 68 | } 69 | } 70 | 71 | private static Instant expirationDate(URL url) { 72 | Map<String, List<String>> queryParams = splitQuery(url); 73 | 74 | Date startDate = null; 75 | for (Expire expire : EXPIRE_LIST) { 76 | if (expire.expiresDate != null && queryParams.containsKey(expire.expiresStartDate) 77 | && queryParams.get(expire.expiresStartDate).size() == 1) { 78 | try { 79 | return TIME_DATE_FORMAT.parse(queryParams.get(expire.expiresStartDate).get(0).split("=", 2)[1]).toInstant(); 80 | } catch (ParseException e) { 81 | continue; 82 | } 83 | } else if (queryParams.containsKey(expire.expiresStartDate) 84 | && queryParams.get(expire.expiresStartDate).size() == 1) { 85 | try { 86 | startDate = TIME_DATE_FORMAT.parse(queryParams.get(expire.expiresStartDate).get(0)); 87 | } catch (ParseException e) { 88 | continue; 89 | } 90 | } 91 | 92 | if (startDate != null && expire.expiresDuration != null && queryParams.get(expire.expiresDuration).size() == 1) { 93 | return startDate.toInstant().plusSeconds(Long.parseLong(queryParams.get(expire.expiresDuration).get(0))); 94 | } 95 | } 96 | 97 | return null; 98 | } 99 | 100 | public static boolean isExpired(URL url) { 101 | try { 102 | Instant expDate = expirationDate(url); 103 | return expDate == null ? false : Instant.now().isAfter(expDate); 104 | } catch (Exception e) { 105 | return false; 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/main/resources/files-sdk.properties: -------------------------------------------------------------------------------- 1 | sdkVersion=${project.version} 2 | -------------------------------------------------------------------------------- /src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Configuration> 3 | <Appenders> 4 | <Console name="Console" target="SYSTEM_OUT"> 5 | <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> 6 | </Console> 7 | </Appenders> 8 | <Loggers> 9 | <Logger name="com.files" level="OFF"/> 10 | </Loggers> 11 | </Configuration> -------------------------------------------------------------------------------- /src/test/java/com/files/FilesFileTest.java: -------------------------------------------------------------------------------- 1 | package com.files; 2 | 3 | import com.files.models.File; 4 | import org.junit.Before; 5 | import org.junit.Ignore; 6 | import org.junit.Test; 7 | 8 | import java.io.*; 9 | import java.nio.charset.StandardCharsets; 10 | import java.util.Date; 11 | import java.util.stream.Collectors; 12 | 13 | public class FilesFileTest { 14 | private static final String apiKey = "mock-server-api-key"; 15 | 16 | @Before 17 | public void setApiRoot() { 18 | FilesClient.apiKey = apiKey; 19 | FilesClient.setProperty("apiRoot", TestSettingsHelper.getInstance().getMockServerApiRoot()); 20 | } 21 | 22 | @Test 23 | @Ignore // Not currently working with files-mock-server 24 | public void getFileStream() throws IOException { 25 | File file = File.download("test.txt", null); 26 | try (InputStream inputStream = file.getInputStream()) { 27 | String text = new BufferedReader( 28 | new InputStreamReader(inputStream, StandardCharsets.UTF_8)) 29 | .lines() 30 | .collect(Collectors.joining("\n")); 31 | System.out.println(text); 32 | } 33 | } 34 | 35 | @Test 36 | @Ignore // Not currently working with files-mock-server 37 | public void saveLocalFile() throws IOException { 38 | File file = File.download("test.txt", null); 39 | file.saveAsLocalFile("/tmp/"); 40 | } 41 | 42 | @Test 43 | @Ignore // Not currently working with files-mock-server 44 | public void putInputStream() throws IOException, InterruptedException { 45 | String exampleString = "Sample Test Data"; 46 | InputStream inputStream = new ByteArrayInputStream(exampleString.getBytes()); 47 | File transferred = File.create("testUpload.txt", null).putInputStream(inputStream, new Date()); 48 | assert(transferred.getSize() == exampleString.getBytes().length); 49 | } 50 | 51 | @Test 52 | @Ignore // Not currently working with files-mock-server 53 | public void putBufferedInputStream() throws IOException { 54 | String exampleString = "Sample Test Data"; 55 | InputStream inputStream = new ByteArrayInputStream(exampleString.getBytes()); 56 | BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); 57 | File transferred = File.create("testUpload2.txt", null).putBufferedInputStream(bufferedInputStream, exampleString.getBytes().length, new Date()); 58 | assert(transferred.getSize() == exampleString.getBytes().length); 59 | } 60 | 61 | @Test 62 | @Ignore // Not currently working with files-mock-server 63 | public void putFile() throws IOException { 64 | File transferred = File.create("README-test.md", null).putLocalFile("README.md"); 65 | assert(transferred.getSize() == new java.io.File("README.md").getAbsoluteFile().length()); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/test/java/com/files/HeaderUtilsTest.java: -------------------------------------------------------------------------------- 1 | package com.files; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertNull; 5 | import static org.junit.Assert.fail; 6 | 7 | import java.io.File; 8 | import java.io.IOException; 9 | import java.time.Instant; 10 | import java.util.ArrayList; 11 | import java.util.Date; 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | import com.fasterxml.jackson.databind.MapperFeature; 17 | import com.fasterxml.jackson.databind.ObjectMapper; 18 | import com.fasterxml.jackson.databind.json.JsonMapper; 19 | import com.files.util.HeaderUtils; 20 | 21 | import org.junit.Before; 22 | import org.junit.Test; 23 | 24 | 25 | public class HeaderUtilsTest { 26 | private List<Map<String, Object>> testData; 27 | private final ObjectMapper objectMapper = JsonMapper 28 | .builder() 29 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 30 | .build(); 31 | 32 | @Before 33 | public void before() { 34 | try { 35 | testData = objectMapper.readValue(new File("shared/header_test_data.json"), List.class); 36 | } catch (IOException e) { 37 | fail("No test data found"); 38 | } 39 | } 40 | 41 | @Test 42 | public void parsesHeaders() { 43 | for (Map<String, Object> data : testData) { 44 | Map<String, List<String>> headers = (Map<String, List<String>>)data.get("headers"); 45 | 46 | if (data.get("result") == null) { 47 | assertNull(HeaderUtils.retryAfterSeconds(headers)); 48 | } else { 49 | List<String> retryValues = headers.get("Retry-After"); 50 | String newValue = String.format(retryValues.get(0), HeaderUtils.HTTP_DATE_FORMAT.format(Date.from(Instant.now().plusSeconds((int)data.get("result"))))); 51 | retryValues.set(0, newValue); 52 | 53 | assertEquals((int)HeaderUtils.retryAfterSeconds(headers), (int)data.get("result")); 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/test/java/com/files/PathUtilsTest.java: -------------------------------------------------------------------------------- 1 | package com.files; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import com.files.util.PathUtils; 6 | import com.fasterxml.jackson.databind.JsonNode; 7 | import com.fasterxml.jackson.databind.ObjectMapper; 8 | import java.io.FileNotFoundException; 9 | import java.io.IOException; 10 | import java.nio.file.Files; 11 | import java.nio.file.Paths; 12 | import org.junit.Test; 13 | 14 | public class PathUtilsTest { 15 | @Test 16 | public void validateNormalizationForComparison() throws FileNotFoundException, IOException { 17 | String jsonTestPairs = new String(Files.readAllBytes(Paths.get("shared/normalization_for_comparison_test_data.json"))); 18 | 19 | ObjectMapper objectMapper = new ObjectMapper(); 20 | JsonNode pairList = objectMapper.readValue(jsonTestPairs, JsonNode.class); 21 | 22 | for (JsonNode pair : pairList) { 23 | String rawText = pair.get(0).asText(); 24 | String normalizedText = pair.get(1).asText(); 25 | assertEquals(PathUtils.normalize_for_comparison(rawText), normalizedText); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/com/files/TestSettingsHelper.java: -------------------------------------------------------------------------------- 1 | package com.files; 2 | 3 | import java.util.Optional; 4 | 5 | public class TestSettingsHelper { 6 | private static TestSettingsHelper instance; 7 | private String hostName; 8 | private String port; 9 | 10 | protected TestSettingsHelper() { 11 | hostName = Optional.ofNullable(System.getenv("FILES_MOCK_SERVER_HOST")).orElse("").toLowerCase(); 12 | port = Optional.ofNullable(System.getenv("FILES_MOCK_SERVER_PORT")).orElse("").toLowerCase(); 13 | if (hostName == null || "null".equals(hostName) || hostName.isEmpty()) { 14 | hostName = "localhost"; 15 | } 16 | if (port == null || "0".equals(port) || "null".equals(port) || port.isEmpty()) { 17 | port = "4041"; 18 | } 19 | } 20 | 21 | public static TestSettingsHelper getInstance() { 22 | if (instance == null) { 23 | synchronized (TestSettingsHelper.class) { 24 | if (instance == null) { 25 | instance = new TestSettingsHelper(); 26 | } 27 | } 28 | } 29 | return instance; 30 | } 31 | 32 | public String getMockServerApiRoot() { 33 | return "http://" + hostName + ":" + port; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/com/files/UrlUtilsTest.java: -------------------------------------------------------------------------------- 1 | package com.files; 2 | 3 | import static org.junit.Assert.assertFalse; 4 | import static org.junit.Assert.assertTrue; 5 | import static org.junit.Assert.fail; 6 | 7 | import java.io.File; 8 | import java.io.IOException; 9 | import java.net.MalformedURLException; 10 | import java.net.URL; 11 | import java.text.DateFormat; 12 | import java.text.SimpleDateFormat; 13 | import java.time.Instant; 14 | import java.time.format.DateTimeFormatter; 15 | import java.util.Date; 16 | import java.util.HashMap; 17 | import java.util.List; 18 | import java.util.Map; 19 | 20 | import com.fasterxml.jackson.databind.MapperFeature; 21 | import com.fasterxml.jackson.databind.ObjectMapper; 22 | import com.fasterxml.jackson.databind.json.JsonMapper; 23 | import com.files.util.UrlUtils; 24 | 25 | import org.junit.Before; 26 | import org.junit.Test; 27 | 28 | public class UrlUtilsTest { 29 | private Map<String, List<String>> testData; 30 | private final ObjectMapper objectMapper = JsonMapper 31 | .builder() 32 | .disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) 33 | .build(); 34 | 35 | @Before 36 | public void before() { 37 | try { 38 | testData = objectMapper.readValue(new File("shared/url_test_data.json"), HashMap.class); 39 | } catch (IOException e) { 40 | fail("No test data found"); 41 | } 42 | } 43 | 44 | @Test 45 | public void validLink() throws MalformedURLException { 46 | for (String url : testData.get("substitute_urls")) { 47 | assertFalse(UrlUtils.isExpired(new URL(String.format(url, UrlUtils.TIME_DATE_FORMAT.format(Date.from(Instant.now().plusSeconds(60))), 3 * 60)))); 48 | } 49 | } 50 | 51 | @Test 52 | public void expiredLink() throws MalformedURLException { 53 | for (String url : testData.get("substitute_urls")) { 54 | assertTrue(UrlUtils.isExpired(new URL(String.format(url, UrlUtils.TIME_DATE_FORMAT.format(Date.from(Instant.now().minusSeconds(3 * 60))), 60)))); 55 | } 56 | } 57 | 58 | @Test 59 | public void errorLink() throws MalformedURLException { 60 | for (String url : testData.get("error_urls")) { 61 | assertFalse(UrlUtils.isExpired(new URL(url))); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #set -e 4 | 5 | # Execute running tests from same directory as current script 6 | cd "$(dirname "$0")" 7 | 8 | # We may have switched to other versions before this build step 9 | if command -v jenv &> /dev/null; then 10 | if [ -d /usr/lib/jvm/java-8-openjdk-amd64 ]; then jenv add /usr/lib/jvm/java-8-openjdk-amd64; fi 11 | if [ -d /usr/lib/jvm/java-8-openjdk-arm64 ]; then jenv add /usr/lib/jvm/java-8-openjdk-arm64; fi 12 | if [ -d /opt/jdk-14.0.1 ]; then jenv add /opt/jdk-14.0.1; fi 13 | 14 | jenv local 1.8 # Force 1.8 with jenv 15 | fi 16 | mvn rewrite:run || exit 1 17 | mvn checkstyle:checkstyle || exit 1 18 | mvn test || exit 1 19 | 20 | --------------------------------------------------------------------------------