├── tests ├── __init__.py ├── test_auto.py ├── test_image.py ├── test_action.py ├── test_errors.py ├── test_status.py ├── test_preview.py ├── test_form_field.py ├── test_bundle_path.py ├── test_file_action.py ├── test_file_upload_part.py ├── test_account_line_item.py ├── test_invoice_line_item.py ├── test_payment_line_item.py ├── test_public_ip_address.py ├── test_share_group_member.py ├── test_usage_by_top_level_dir.py ├── test_remote_server_configuration_file.py ├── test_app.py ├── test_sync_log.py ├── test_email_log.py ├── test_dns_record.py ├── test_inbox_upload.py ├── test_bundle_action.py ├── test_automation_log.py ├── test_ftp_action_log.py ├── test_inbound_s3_log.py ├── test_usage_snapshot.py ├── test_api_request_log.py ├── test_sftp_action_log.py ├── test_user_cipher_use.py ├── test_bundle_download.py ├── test_settings_change.py ├── test_web_dav_action_log.py ├── test_bandwidth_snapshot.py ├── test_file_migration_log.py ├── test_inbox_registration.py ├── test_bundle_registration.py ├── test_holiday_region.py ├── test_as2_incoming_message.py ├── test_as2_outgoing_message.py ├── test_usage_daily_snapshot.py ├── test_user_sftp_client_use.py ├── test_email_incoming_message.py ├── test_outbound_connection_log.py ├── test_exavault_api_request_log.py ├── test_remote_bandwidth_snapshot.py ├── test_webhook_test.py ├── test_priority.py ├── test_public_hosting_request_log.py ├── test_file_migration.py ├── test_history_export_result.py ├── test_session.py ├── test_action_notification_export_result.py ├── test_restore.py ├── test_invoice.py ├── test_payment.py ├── test_scim_log.py ├── test_sync_run.py ├── test_history_export.py ├── test_site.py ├── test_path_util.py ├── test_folder.py ├── test_automation_run.py ├── test_action_notification_export.py ├── test_inbox_recipient.py ├── test_bundle_recipient.py ├── base.py ├── test_connection_adapter.py ├── test_external_event.py ├── test_ip_address.py ├── test_style.py ├── test_sso_strategy.py ├── test_file_comment_reaction.py ├── test_permission.py ├── test_lock.py ├── test_history.py ├── test_request.py ├── test_user_request.py ├── test_message_reaction.py ├── test_bundle.py ├── test_message_comment_reaction.py ├── test_group.py ├── test_clickwrap.py ├── test_gpg_key.py ├── test_partner.py ├── test_file_comment.py ├── test_notification.py ├── test_sftp_host_key.py ├── test_form_field_set.py ├── test_project.py ├── test_group_user.py ├── test_share_group.py ├── test_public_key.py ├── test_as2_station.py ├── test_user_lifecycle_rule.py ├── test_as2_partner.py ├── test_bundle_notification.py ├── test_message_comment.py └── test_message.py ├── _VERSION ├── .gitignore ├── docs ├── auto.md ├── image.md ├── usage_by_top_level_dir.md ├── errors.md ├── file_action.md ├── share_group_member.md ├── bundle_path.md ├── public_ip_address.md ├── payment_line_item.md ├── preview.md ├── status.md ├── form_field.md ├── holiday_region.md ├── priority.md ├── file_migration.md ├── dns_record.md ├── user_sftp_client_use.md ├── file_comment_reaction.md ├── action.md ├── invoice_line_item.md ├── session.md ├── style.md ├── settings_change.md ├── scim_log.md ├── account_line_item.md ├── file_upload_part.md ├── inbox_registration.md ├── remote_bandwidth_snapshot.md ├── webhook_test.md ├── user_request.md ├── message_reaction.md ├── action_notification_export_result.md ├── bundle_registration.md ├── inbox_recipient.md ├── bandwidth_snapshot.md ├── message_comment_reaction.md ├── file_comment.md ├── project.md ├── inbox_upload.md └── user_cipher_use.md ├── CONTRIBUTORS ├── test.sh ├── .flake8 ├── shared ├── header_test_data.json ├── url_test_data.json └── normalization_for_comparison_test_data.json ├── SECURITY.md ├── pyproject.toml ├── files_sdk ├── util.py ├── models │ ├── auto.py │ ├── image.py │ ├── errors.py │ ├── usage_by_top_level_dir.py │ ├── file_action.py │ ├── bundle_path.py │ ├── share_group_member.py │ ├── public_ip_address.py │ ├── payment_line_item.py │ ├── preview.py │ ├── status.py │ ├── form_field.py │ ├── account_line_item.py │ ├── action.py │ ├── invoice_line_item.py │ ├── holiday_region.py │ ├── dns_record.py │ └── file_migration.py ├── list_obj.py ├── path_util.py └── api.py └── LICENSE /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_VERSION: -------------------------------------------------------------------------------- 1 | 1.6.154 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | *.pyc 3 | -------------------------------------------------------------------------------- /docs/auto.md: -------------------------------------------------------------------------------- 1 | # Auto 2 | 3 | ## Example Auto Object 4 | 5 | ``` 6 | { 7 | "dynamic": null 8 | } 9 | ``` 10 | 11 | * `dynamic` (object): 12 | -------------------------------------------------------------------------------- /docs/image.md: -------------------------------------------------------------------------------- 1 | # 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` (string): Image name 13 | * `uri` (string): Image URI 14 | -------------------------------------------------------------------------------- /docs/usage_by_top_level_dir.md: -------------------------------------------------------------------------------- 1 | # UsageByTopLevelDir 2 | 3 | ## Example UsageByTopLevelDir Object 4 | 5 | ``` 6 | { 7 | "dir": "", 8 | "size": 1, 9 | "count": 1 10 | } 11 | ``` 12 | 13 | * `dir` (string): Directory name 14 | * `size` (int64): Usage 15 | * `count` (int64): File count 16 | -------------------------------------------------------------------------------- /docs/errors.md: -------------------------------------------------------------------------------- 1 | # Errors 2 | 3 | ## Example Errors Object 4 | 5 | ``` 6 | { 7 | "fields": [ 8 | 9 | ], 10 | "messages": [ 11 | 12 | ] 13 | } 14 | ``` 15 | 16 | * `fields` (array(string)): A list of fields where errors occur 17 | * `messages` (array(string)): A list of error messages 18 | -------------------------------------------------------------------------------- /tests/test_auto.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Auto 6 | from files_sdk import auto 7 | 8 | class AutoTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /docs/file_action.md: -------------------------------------------------------------------------------- 1 | # FileAction 2 | 3 | ## Example FileAction Object 4 | 5 | ``` 6 | { 7 | "status": "pending", 8 | "file_migration_id": 1 9 | } 10 | ``` 11 | 12 | * `status` (string): Status of file operation. 13 | * `file_migration_id` (int64): If status is pending, this is the id of the File Migration to check for status updates. 14 | -------------------------------------------------------------------------------- /tests/test_image.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Image 6 | from files_sdk import image 7 | 8 | class ImageTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /tests/test_action.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Action 6 | from files_sdk import action 7 | 8 | class ActionTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /tests/test_errors.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Errors 6 | from files_sdk import errors 7 | 8 | class ErrorsTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /tests/test_status.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Status 6 | from files_sdk import status 7 | 8 | class StatusTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /tests/test_preview.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Preview 6 | from files_sdk import preview 7 | 8 | class PreviewTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tests/test_form_field.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import FormField 6 | from files_sdk import form_field 7 | 8 | class FormFieldTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /tests/test_bundle_path.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import BundlePath 6 | from files_sdk import bundle_path 7 | 8 | class BundlePathTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /tests/test_file_action.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import FileAction 6 | from files_sdk import file_action 7 | 8 | class FileActionTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /tests/test_file_upload_part.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import FileUploadPart 6 | from files_sdk import file_upload_part 7 | 8 | class FileUploadPartTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Execute running tests from same directory as current script 4 | cd "$(dirname "$0")" 5 | 6 | # Install dependencies 7 | pip3 install --user "flake8~=6.1.0" "requests>=2.20" "black~=23.9.0" "pyright==1.1.347" "requests-toolbelt==1.0.0" 8 | 9 | python3 -m black . 10 | python3 -m flake8 files_sdk && python3 -m pyright && python3 -m unittest discover 11 | -------------------------------------------------------------------------------- /tests/test_account_line_item.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import AccountLineItem 6 | from files_sdk import account_line_item 7 | 8 | class AccountLineItemTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /tests/test_invoice_line_item.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import InvoiceLineItem 6 | from files_sdk import invoice_line_item 7 | 8 | class InvoiceLineItemTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /tests/test_payment_line_item.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import PaymentLineItem 6 | from files_sdk import payment_line_item 7 | 8 | class PaymentLineItemTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /tests/test_public_ip_address.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import PublicIpAddress 6 | from files_sdk import public_ip_address 7 | 8 | class PublicIpAddressTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /docs/share_group_member.md: -------------------------------------------------------------------------------- 1 | # 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` (string): Name of the share group member 14 | * `company` (string): Company of the share group member 15 | * `email` (string): Email of the share group member 16 | -------------------------------------------------------------------------------- /tests/test_share_group_member.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import ShareGroupMember 6 | from files_sdk import share_group_member 7 | 8 | class ShareGroupMemberTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /docs/bundle_path.md: -------------------------------------------------------------------------------- 1 | # BundlePath 2 | 3 | ## Example BundlePath Object 4 | 5 | ``` 6 | { 7 | "recursive": True, 8 | "path": "example" 9 | } 10 | ``` 11 | 12 | * `recursive` (boolean): Allow access to subfolders content? 13 | * `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 | -------------------------------------------------------------------------------- /tests/test_usage_by_top_level_dir.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import UsageByTopLevelDir 6 | from files_sdk import usage_by_top_level_dir 7 | 8 | class UsageByTopLevelDirTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /docs/public_ip_address.md: -------------------------------------------------------------------------------- 1 | # 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` (string): The public IP address. 15 | * `server_name` (string): The name of the frontend server. 16 | * `ftp_enabled` (boolean): 17 | * `sftp_enabled` (boolean): 18 | -------------------------------------------------------------------------------- /docs/payment_line_item.md: -------------------------------------------------------------------------------- 1 | # 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` (double): Payment line item amount 15 | * `created_at` (date-time): Payment line item created at date/time 16 | * `invoice_id` (int64): Invoice ID 17 | * `payment_id` (int64): Payment ID 18 | -------------------------------------------------------------------------------- /tests/test_remote_server_configuration_file.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import RemoteServerConfigurationFile 6 | from files_sdk import remote_server_configuration_file 7 | 8 | class RemoteServerConfigurationFileTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | if __name__ == '__main__': 14 | unittest.main() -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | 3 | # E501 is the "Line too long" error. We disable it because we use Black for 4 | # code formatting. Black makes a best effort to keep lines under the max 5 | # length, but can go over in some cases. 6 | # W503 goes against PEP8 rules. It's disabled by default, but must be disabled 7 | # explicitly when using `ignore`. 8 | ignore = E501, W503 9 | per-file-ignores = 10 | files_sdk/__init__.py: F401,F811 11 | files_sdk/models/__init__.py: F401,F811 -------------------------------------------------------------------------------- /tests/test_app.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import App 6 | from files_sdk import app 7 | 8 | class AppTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/apps"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = app.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_sync_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import SyncLog 6 | from files_sdk import sync_log 7 | 8 | class SyncLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/sync_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = sync_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_email_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import EmailLog 6 | from files_sdk import email_log 7 | 8 | class EmailLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/email_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = email_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_dns_record.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import DnsRecord 6 | from files_sdk import dns_record 7 | 8 | class DnsRecordTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/dns_records"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = dns_record.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_inbox_upload.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import InboxUpload 6 | from files_sdk import inbox_upload 7 | 8 | class InboxUploadTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/inbox_uploads"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = inbox_upload.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_bundle_action.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import BundleAction 6 | from files_sdk import bundle_action 7 | 8 | class BundleActionTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/bundle_actions"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = bundle_action.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /docs/preview.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): Preview ID 16 | * `status` (string): Preview status. Can be invalid, not_generated, generating, complete, or file_too_large 17 | * `download_uri` (string): Link to download preview 18 | * `type` (string): Preview type. Can be image, pdf, pdf_native, video, or audio 19 | * `size` (string): Preview size 20 | -------------------------------------------------------------------------------- /tests/test_automation_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import AutomationLog 6 | from files_sdk import automation_log 7 | 8 | class AutomationLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/automation_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = automation_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_ftp_action_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import FtpActionLog 6 | from files_sdk import ftp_action_log 7 | 8 | class FtpActionLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/ftp_action_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = ftp_action_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_inbound_s3_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import InboundS3Log 6 | from files_sdk import inbound_s3_log 7 | 8 | class InboundS3LogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/inbound_s3_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = inbound_s3_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_usage_snapshot.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import UsageSnapshot 6 | from files_sdk import usage_snapshot 7 | 8 | class UsageSnapshotTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/usage_snapshots"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = usage_snapshot.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_api_request_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import ApiRequestLog 6 | from files_sdk import api_request_log 7 | 8 | class ApiRequestLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/api_request_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = api_request_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_sftp_action_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import SftpActionLog 6 | from files_sdk import sftp_action_log 7 | 8 | class SftpActionLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/sftp_action_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = sftp_action_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_user_cipher_use.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import UserCipherUse 6 | from files_sdk import user_cipher_use 7 | 8 | class UserCipherUseTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/user_cipher_uses"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = user_cipher_use.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_bundle_download.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import BundleDownload 6 | from files_sdk import bundle_download 7 | 8 | class BundleDownloadTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/bundle_downloads"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = bundle_download.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_settings_change.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import SettingsChange 6 | from files_sdk import settings_change 7 | 8 | class SettingsChangeTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/settings_changes"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = settings_change.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_web_dav_action_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import WebDavActionLog 6 | from files_sdk import web_dav_action_log 7 | 8 | class WebDavActionLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/web_dav_action_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = web_dav_action_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_bandwidth_snapshot.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import BandwidthSnapshot 6 | from files_sdk import bandwidth_snapshot 7 | 8 | class BandwidthSnapshotTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/bandwidth_snapshots"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = bandwidth_snapshot.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_file_migration_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import FileMigrationLog 6 | from files_sdk import file_migration_log 7 | 8 | class FileMigrationLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/file_migration_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = file_migration_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_inbox_registration.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import InboxRegistration 6 | from files_sdk import inbox_registration 7 | 8 | class InboxRegistrationTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/inbox_registrations"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = inbox_registration.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_bundle_registration.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import BundleRegistration 6 | from files_sdk import bundle_registration 7 | 8 | class BundleRegistrationTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/bundle_registrations"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = bundle_registration.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_holiday_region.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import HolidayRegion 6 | from files_sdk import holiday_region 7 | 8 | class HolidayRegionTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/holiday_regions/supported"), "Mock path does not exist") 14 | def test_get_supported(self): 15 | resp = holiday_region.get_supported() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_as2_incoming_message.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import As2IncomingMessage 6 | from files_sdk import as2_incoming_message 7 | 8 | class As2IncomingMessageTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/as2_incoming_messages"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = as2_incoming_message.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_as2_outgoing_message.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import As2OutgoingMessage 6 | from files_sdk import as2_outgoing_message 7 | 8 | class As2OutgoingMessageTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/as2_outgoing_messages"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = as2_outgoing_message.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_usage_daily_snapshot.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import UsageDailySnapshot 6 | from files_sdk import usage_daily_snapshot 7 | 8 | class UsageDailySnapshotTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/usage_daily_snapshots"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = usage_daily_snapshot.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_user_sftp_client_use.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import UserSftpClientUse 6 | from files_sdk import user_sftp_client_use 7 | 8 | class UserSftpClientUseTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/user_sftp_client_uses"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = user_sftp_client_use.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_email_incoming_message.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import EmailIncomingMessage 6 | from files_sdk import email_incoming_message 7 | 8 | class EmailIncomingMessageTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/email_incoming_messages"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = email_incoming_message.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_outbound_connection_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import OutboundConnectionLog 6 | from files_sdk import outbound_connection_log 7 | 8 | class OutboundConnectionLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/outbound_connection_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = outbound_connection_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_exavault_api_request_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import ExavaultApiRequestLog 6 | from files_sdk import exavault_api_request_log 7 | 8 | class ExavaultApiRequestLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/exavault_api_request_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = exavault_api_request_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_remote_bandwidth_snapshot.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import RemoteBandwidthSnapshot 6 | from files_sdk import remote_bandwidth_snapshot 7 | 8 | class RemoteBandwidthSnapshotTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/remote_bandwidth_snapshots"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = remote_bandwidth_snapshot.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_webhook_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import WebhookTest 6 | from files_sdk import webhook_test 7 | 8 | class WebhookTestTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/webhook_tests"), "Mock path does not exist") 14 | def test_create(self): 15 | params = { 16 | "url" : "foo", 17 | } 18 | webhook_test.create(params) 19 | 20 | if __name__ == '__main__': 21 | unittest.main() -------------------------------------------------------------------------------- /tests/test_priority.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Priority 6 | from files_sdk import priority 7 | 8 | class PriorityTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/priorities"), "Mock path does not exist") 14 | def test_list(self): 15 | path = "foo" 16 | params = { 17 | "path" : "foo", 18 | } 19 | priority.list(path, params) 20 | 21 | if __name__ == '__main__': 22 | unittest.main() -------------------------------------------------------------------------------- /tests/test_public_hosting_request_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import PublicHostingRequestLog 6 | from files_sdk import public_hosting_request_log 7 | 8 | class PublicHostingRequestLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/public_hosting_request_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = public_hosting_request_log.list() 16 | 17 | if __name__ == '__main__': 18 | unittest.main() -------------------------------------------------------------------------------- /tests/test_file_migration.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import FileMigration 6 | from files_sdk import file_migration 7 | 8 | class FileMigrationTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/file_migrations/{id}"), "Mock path does not exist") 14 | def test_find(self): 15 | id = 12345 16 | params = { 17 | "id" : 12345, 18 | } 19 | file_migration.find(id, params) 20 | 21 | if __name__ == '__main__': 22 | unittest.main() -------------------------------------------------------------------------------- /tests/test_history_export_result.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import HistoryExportResult 6 | from files_sdk import history_export_result 7 | 8 | class HistoryExportResultTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/history_export_results"), "Mock path does not exist") 14 | def test_list(self): 15 | params = { 16 | "history_export_id" : 12345, 17 | } 18 | history_export_result.list(params) 19 | 20 | if __name__ == '__main__': 21 | unittest.main() -------------------------------------------------------------------------------- /docs/status.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): Status HTTP code 27 | * `message` (string): Error message 28 | * `status` (string): Status message 29 | * `data` (Auto): Additional data 30 | * `errors` (array(object)): A list of api errors 31 | * `clickwrap_id` (int64): Required Clickwrap id 32 | * `clickwrap_body` (string): Required Clickwrap body 33 | -------------------------------------------------------------------------------- /tests/test_session.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Session 6 | from files_sdk import session 7 | 8 | class SessionTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/sessions"), "Mock path does not exist") 14 | def test_create(self): 15 | resp = session.create() 16 | 17 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/sessions"), "Mock path does not exist") 18 | def test_delete(self): 19 | resp = session.delete() 20 | 21 | if __name__ == '__main__': 22 | unittest.main() -------------------------------------------------------------------------------- /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 | ] -------------------------------------------------------------------------------- /tests/test_action_notification_export_result.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import ActionNotificationExportResult 6 | from files_sdk import action_notification_export_result 7 | 8 | class ActionNotificationExportResultTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/action_notification_export_results"), "Mock path does not exist") 14 | def test_list(self): 15 | params = { 16 | "action_notification_export_id" : 12345, 17 | } 18 | action_notification_export_result.list(params) 19 | 20 | if __name__ == '__main__': 21 | unittest.main() -------------------------------------------------------------------------------- /tests/test_restore.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Restore 6 | from files_sdk import restore 7 | 8 | class RestoreTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/restores"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = restore.list() 16 | 17 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/restores"), "Mock path does not exist") 18 | def test_create(self): 19 | params = { 20 | "earliest_date" : "foo", 21 | } 22 | restore.create(params) 23 | 24 | if __name__ == '__main__': 25 | unittest.main() -------------------------------------------------------------------------------- /tests/test_invoice.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Invoice 6 | from files_sdk import invoice 7 | 8 | class InvoiceTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/invoices"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = invoice.list() 16 | 17 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/invoices/{id}"), "Mock path does not exist") 18 | def test_find(self): 19 | id = 12345 20 | params = { 21 | "id" : 12345, 22 | } 23 | invoice.find(id, params) 24 | 25 | if __name__ == '__main__': 26 | unittest.main() -------------------------------------------------------------------------------- /tests/test_payment.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Payment 6 | from files_sdk import payment 7 | 8 | class PaymentTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/payments"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = payment.list() 16 | 17 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/payments/{id}"), "Mock path does not exist") 18 | def test_find(self): 19 | id = 12345 20 | params = { 21 | "id" : 12345, 22 | } 23 | payment.find(id, params) 24 | 25 | if __name__ == '__main__': 26 | unittest.main() -------------------------------------------------------------------------------- /tests/test_scim_log.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import ScimLog 6 | from files_sdk import scim_log 7 | 8 | class ScimLogTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/scim_logs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = scim_log.list() 16 | 17 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/scim_logs/{id}"), "Mock path does not exist") 18 | def test_find(self): 19 | id = 12345 20 | params = { 21 | "id" : 12345, 22 | } 23 | scim_log.find(id, params) 24 | 25 | if __name__ == '__main__': 26 | unittest.main() -------------------------------------------------------------------------------- /tests/test_sync_run.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import SyncRun 6 | from files_sdk import sync_run 7 | 8 | class SyncRunTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/sync_runs"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = sync_run.list() 16 | 17 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/sync_runs/{id}"), "Mock path does not exist") 18 | def test_find(self): 19 | id = 12345 20 | params = { 21 | "id" : 12345, 22 | } 23 | sync_run.find(id, params) 24 | 25 | if __name__ == '__main__': 26 | unittest.main() -------------------------------------------------------------------------------- /docs/form_field.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): Form field id 23 | * `label` (string): Label to be displayed 24 | * `required` (boolean): Is this a required field? 25 | * `help_text` (string): Help text to be displayed 26 | * `field_type` (string): Type of Field 27 | * `options_for_select` (array(string)): Options to display for radio and dropdown 28 | * `default_option` (string): Default option for radio and dropdown 29 | * `form_field_set_id` (int64): Form field set id 30 | -------------------------------------------------------------------------------- /tests/test_history_export.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import HistoryExport 6 | from files_sdk import history_export 7 | 8 | class HistoryExportTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/history_exports/{id}"), "Mock path does not exist") 14 | def test_find(self): 15 | id = 12345 16 | params = { 17 | "id" : 12345, 18 | } 19 | history_export.find(id, params) 20 | 21 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/history_exports"), "Mock path does not exist") 22 | def test_create(self): 23 | resp = history_export.create() 24 | 25 | if __name__ == '__main__': 26 | unittest.main() -------------------------------------------------------------------------------- /tests/test_site.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Site 6 | from files_sdk import site 7 | 8 | class SiteTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/site"), "Mock path does not exist") 14 | def test_get(self): 15 | resp = site.get() 16 | 17 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/site/usage"), "Mock path does not exist") 18 | def test_get_usage(self): 19 | resp = site.get_usage() 20 | 21 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/site"), "Mock path does not exist") 22 | def test_update(self): 23 | resp = site.update() 24 | 25 | if __name__ == '__main__': 26 | unittest.main() -------------------------------------------------------------------------------- /tests/test_path_util.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import logging 3 | import json 4 | 5 | import files_sdk 6 | 7 | class TestPathUtil(unittest.TestCase): 8 | @classmethod 9 | def setUpClass(cls): 10 | # Suppress logging to stdout/stderr, we will see errors at the end 11 | logging.getLogger("files_sdk").addHandler(logging.NullHandler()) 12 | logging.getLogger("files_sdk").propagate = False 13 | 14 | def test_normalization_for_comparison(self): 15 | with open("shared/normalization_for_comparison_test_data.json") as json_file: 16 | for entry in json.load(json_file): 17 | self.assertEqual(files_sdk.path_util.normalize_for_comparison(entry[0]), entry[-1]) 18 | 19 | if __name__ == '__main__': 20 | unittest.main() 21 | 22 | # json_str = File.read("shared/normalization_for_comparison_test_data.json") 23 | # test_cases = JSON.parse json_str -------------------------------------------------------------------------------- /tests/test_folder.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Folder 6 | from files_sdk import folder 7 | 8 | class FolderTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/folders/{path}"), "Mock path does not exist") 14 | def test_list_for(self): 15 | path = "foo" 16 | params = { 17 | "path" : "foo", 18 | } 19 | folder.list_for(path, params) 20 | 21 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/folders/{path}"), "Mock path does not exist") 22 | def test_create(self): 23 | path = "foo" 24 | params = { 25 | "path" : "foo", 26 | } 27 | folder.create(path, params) 28 | 29 | if __name__ == '__main__': 30 | unittest.main() -------------------------------------------------------------------------------- /tests/test_automation_run.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import AutomationRun 6 | from files_sdk import automation_run 7 | 8 | class AutomationRunTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/automation_runs"), "Mock path does not exist") 14 | def test_list(self): 15 | params = { 16 | "automation_id" : 12345, 17 | } 18 | automation_run.list(params) 19 | 20 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/automation_runs/{id}"), "Mock path does not exist") 21 | def test_find(self): 22 | id = 12345 23 | params = { 24 | "id" : 12345, 25 | } 26 | automation_run.find(id, params) 27 | 28 | if __name__ == '__main__': 29 | unittest.main() -------------------------------------------------------------------------------- /docs/holiday_region.md: -------------------------------------------------------------------------------- 1 | # HolidayRegion 2 | 3 | ## Example HolidayRegion Object 4 | 5 | ``` 6 | { 7 | "code": "us_dc", 8 | "name": "United States - District of Columbia" 9 | } 10 | ``` 11 | 12 | * `code` (string): The code representing a region 13 | * `name` (string): The name of the region 14 | 15 | 16 | --- 17 | 18 | ## List all possible holiday regions 19 | 20 | ``` 21 | files_sdk.holiday_region.get_supported() 22 | ``` 23 | 24 | ### Parameters 25 | 26 | * `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. 27 | * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 28 | -------------------------------------------------------------------------------- /tests/test_action_notification_export.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import ActionNotificationExport 6 | from files_sdk import action_notification_export 7 | 8 | class ActionNotificationExportTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/action_notification_exports/{id}"), "Mock path does not exist") 14 | def test_find(self): 15 | id = 12345 16 | params = { 17 | "id" : 12345, 18 | } 19 | action_notification_export.find(id, params) 20 | 21 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/action_notification_exports"), "Mock path does not exist") 22 | def test_create(self): 23 | resp = action_notification_export.create() 24 | 25 | if __name__ == '__main__': 26 | unittest.main() -------------------------------------------------------------------------------- /tests/test_inbox_recipient.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import InboxRecipient 6 | from files_sdk import inbox_recipient 7 | 8 | class InboxRecipientTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/inbox_recipients"), "Mock path does not exist") 14 | def test_list(self): 15 | params = { 16 | "inbox_id" : 12345, 17 | } 18 | inbox_recipient.list(params) 19 | 20 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/inbox_recipients"), "Mock path does not exist") 21 | def test_create(self): 22 | params = { 23 | "inbox_id" : 12345, 24 | "recipient" : "foo", 25 | } 26 | inbox_recipient.create(params) 27 | 28 | if __name__ == '__main__': 29 | unittest.main() -------------------------------------------------------------------------------- /tests/test_bundle_recipient.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import BundleRecipient 6 | from files_sdk import bundle_recipient 7 | 8 | class BundleRecipientTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/bundle_recipients"), "Mock path does not exist") 14 | def test_list(self): 15 | params = { 16 | "bundle_id" : 12345, 17 | } 18 | bundle_recipient.list(params) 19 | 20 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/bundle_recipients"), "Mock path does not exist") 21 | def test_create(self): 22 | params = { 23 | "bundle_id" : 12345, 24 | "recipient" : "foo", 25 | } 26 | bundle_recipient.create(params) 27 | 28 | if __name__ == '__main__': 29 | unittest.main() -------------------------------------------------------------------------------- /tests/base.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import logging 3 | import requests 4 | import re 5 | import files_sdk 6 | 7 | BASE_URL = "http://localhost:4042" 8 | 9 | class TestBase(unittest.TestCase): 10 | @classmethod 11 | def setUpClass(cls): 12 | # Suppress logging to stdout/stderr, we will see errors at the end 13 | logging.getLogger("files_sdk").addHandler(logging.NullHandler()) 14 | logging.getLogger("files_sdk").propagate = False 15 | 16 | def setUp(self): 17 | files_sdk.set_api_key("placeholderKey") 18 | files_sdk.base_url = BASE_URL 19 | 20 | @staticmethod 21 | def mock_server_path_exists(verb, path): 22 | populated_path = re.sub(r"\{.*\}", "1", path) 23 | response = requests.request(verb, url=BASE_URL + "/" + files_sdk.base_path + populated_path) 24 | 25 | if response.status_code > 400: 26 | return False 27 | return True 28 | 29 | if __name__ == '__main__': 30 | unittest.main() 31 | -------------------------------------------------------------------------------- /tests/test_connection_adapter.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import files_sdk 4 | from requests_toolbelt.adapters import source 5 | 6 | 7 | import files_sdk.api as Api 8 | 9 | class TestConnectionAdapters(unittest.TestCase): 10 | def setUp(self): 11 | super().setUp() 12 | files_sdk.set_api_key("testkey") 13 | 14 | def test_bind_to_source_ip(self): 15 | files_sdk.set_source_ip("127.0.0.1") 16 | session_adapter = Api.ApiClient().session.adapters[files_sdk.base_url] 17 | self.assertIsInstance(session_adapter, source.SourceAddressAdapter) 18 | self.assertEqual(session_adapter.source_address, ("127.0.0.1", 0)) 19 | 20 | def test_does_not_autobind_to_source_ip(self): 21 | files_sdk.set_source_ip(None) 22 | api_client = Api.ApiClient() 23 | 24 | self.assertIsNone(files_sdk.get_source_ip()) 25 | session_adapter = api_client.session.adapters.get(files_sdk.base_url, None) 26 | self.assertIsNone(session_adapter) 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools>=42", "wheel"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | [project] 6 | name = "files_com" 7 | version = "1.6.154" 8 | description = "Python bindings for the Files.com API" 9 | readme = "README.md" 10 | license = { text = "MIT" } 11 | requires-python = ">=3.5" 12 | dependencies = [ 13 | "requests >= 2.20", 14 | "requests-toolbelt >= 1.0.0", 15 | ] 16 | 17 | [tool.setuptools] 18 | include-package-data = true 19 | 20 | [tool.setuptools.packages.find] 21 | exclude = ["tests", "tests.*", "doc"] 22 | 23 | [tool.setuptools.package-data] 24 | files_sdk = ["../_VERSION", "../README.md"] 25 | 26 | [tool.black] 27 | line-length=79 28 | include="files_sdk/" 29 | [tool.pyright] 30 | include=["files_sdk"] 31 | reportMissingTypeArgument=true 32 | reportUnnecessaryCast=true 33 | reportUnnecessaryComparison=true 34 | reportUnnecessaryContains=true 35 | reportUnnecessaryIsInstance=true 36 | # The project currently uses dynamic types 37 | reportGeneralTypeIssues=false -------------------------------------------------------------------------------- /docs/priority.md: -------------------------------------------------------------------------------- 1 | # Priority 2 | 3 | ## Example Priority Object 4 | 5 | ``` 6 | { 7 | "path": "foo/bar", 8 | "color": "pink" 9 | } 10 | ``` 11 | 12 | * `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` (string): The priority color 14 | 15 | 16 | --- 17 | 18 | ## List Priorities 19 | 20 | ``` 21 | files_sdk.priority.list(path) 22 | ``` 23 | 24 | ### Parameters 25 | 26 | * `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. 27 | * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 28 | * `path` (string): Required - The path to query for priorities 29 | -------------------------------------------------------------------------------- /docs/file_migration.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): File migration ID 20 | * `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` (string): Destination path 22 | * `files_moved` (int64): Number of files processed 23 | * `files_total` (int64): 24 | * `operation` (string): The type of operation 25 | * `region` (string): Region 26 | * `status` (string): Status 27 | * `log_url` (string): Link to download the log file for this migration. 28 | 29 | 30 | --- 31 | 32 | ## Show File Migration 33 | 34 | ``` 35 | files_sdk.file_migration.find(id) 36 | ``` 37 | 38 | ### Parameters 39 | 40 | * `id` (int64): Required - File Migration ID. 41 | -------------------------------------------------------------------------------- /docs/dns_record.md: -------------------------------------------------------------------------------- 1 | # 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` (string): Unique label for DNS record; used by Zapier and other integrations. 15 | * `domain` (string): DNS record domain name 16 | * `rrtype` (string): DNS record type 17 | * `value` (string): DNS record value 18 | 19 | 20 | --- 21 | 22 | ## Show Site DNS Configuration 23 | 24 | ``` 25 | files_sdk.dns_record.list() 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 32 | -------------------------------------------------------------------------------- /files_sdk/util.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import sys 3 | 4 | import files_sdk 5 | 6 | logger = logging.getLogger("files_sdk") 7 | 8 | 9 | def _logfmt(data): 10 | def fmt(key, val): 11 | return "{key}={val}".format(key=key, val=val) 12 | 13 | return " ".join([fmt(key, val) for key, val in sorted(data.items())]) 14 | 15 | 16 | def log_debug(message, **params): 17 | msg = "message={} ".format(message) + _logfmt(dict(**params)) 18 | if files_sdk.console_log_level.lower() == "debug": 19 | print("DEBUG " + msg, file=sys.stderr) 20 | logger.debug(msg) 21 | 22 | 23 | def log_info(message, **params): 24 | msg = "message={} ".format(message) + _logfmt(dict(**params)) 25 | if files_sdk.console_log_level.lower() in ["debug", "info"]: 26 | print("INFO " + msg, file=sys.stderr) 27 | logger.info(msg) 28 | 29 | 30 | def log_error(message, **params): 31 | msg = "message={} ".format(message) + _logfmt(dict(**params)) 32 | if files_sdk.console_log_level.lower() in ["debug", "info", "error"]: 33 | print("ERROR " + msg, file=sys.stderr) 34 | logger.error(msg) 35 | -------------------------------------------------------------------------------- /tests/test_external_event.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import ExternalEvent 6 | from files_sdk import external_event 7 | 8 | class ExternalEventTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/external_events"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = external_event.list() 16 | 17 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/external_events/{id}"), "Mock path does not exist") 18 | def test_find(self): 19 | id = 12345 20 | params = { 21 | "id" : 12345, 22 | } 23 | external_event.find(id, params) 24 | 25 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/external_events"), "Mock path does not exist") 26 | def test_create(self): 27 | params = { 28 | "status" : "foo", 29 | "body" : "foo", 30 | } 31 | external_event.create(params) 32 | 33 | if __name__ == '__main__': 34 | unittest.main() -------------------------------------------------------------------------------- /files_sdk/models/auto.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class Auto: 11 | default_attributes = { 12 | "dynamic": None, # object 13 | } 14 | 15 | def __init__(self, attributes=None, options=None): 16 | if not isinstance(attributes, dict): 17 | attributes = {} 18 | if not isinstance(options, dict): 19 | options = {} 20 | self.set_attributes(attributes) 21 | self.options = options 22 | 23 | def set_attributes(self, attributes): 24 | for attribute, default_value in Auto.default_attributes.items(): 25 | setattr(self, attribute, attributes.get(attribute, default_value)) 26 | 27 | def get_attributes(self): 28 | return { 29 | k: getattr(self, k, None) 30 | for k in Auto.default_attributes 31 | if getattr(self, k, None) is not None 32 | } 33 | 34 | 35 | def new(*args, **kwargs): 36 | return Auto(*args, **kwargs) 37 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /files_sdk/models/image.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class Image: 11 | default_attributes = { 12 | "name": None, # string - Image name 13 | "uri": None, # string - Image URI 14 | } 15 | 16 | def __init__(self, attributes=None, options=None): 17 | if not isinstance(attributes, dict): 18 | attributes = {} 19 | if not isinstance(options, dict): 20 | options = {} 21 | self.set_attributes(attributes) 22 | self.options = options 23 | 24 | def set_attributes(self, attributes): 25 | for attribute, default_value in Image.default_attributes.items(): 26 | setattr(self, attribute, attributes.get(attribute, default_value)) 27 | 28 | def get_attributes(self): 29 | return { 30 | k: getattr(self, k, None) 31 | for k in Image.default_attributes 32 | if getattr(self, k, None) is not None 33 | } 34 | 35 | 36 | def new(*args, **kwargs): 37 | return Image(*args, **kwargs) 38 | -------------------------------------------------------------------------------- /tests/test_ip_address.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import IpAddress 6 | from files_sdk import ip_address 7 | 8 | class IpAddressTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/ip_addresses"), "Mock path does not exist") 14 | def test_list(self): 15 | resp = ip_address.list() 16 | 17 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/ip_addresses/smartfile-reserved"), "Mock path does not exist") 18 | def test_get_smartfile_reserved(self): 19 | resp = ip_address.get_smartfile_reserved() 20 | 21 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/ip_addresses/exavault-reserved"), "Mock path does not exist") 22 | def test_get_exavault_reserved(self): 23 | resp = ip_address.get_exavault_reserved() 24 | 25 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/ip_addresses/reserved"), "Mock path does not exist") 26 | def test_get_reserved(self): 27 | resp = ip_address.get_reserved() 28 | 29 | if __name__ == '__main__': 30 | unittest.main() -------------------------------------------------------------------------------- /tests/test_style.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Style 6 | from files_sdk import style 7 | 8 | class StyleTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/styles/{path}"), "Mock path does not exist") 12 | def test_delete(self): 13 | params = { 14 | "path" : "foo", 15 | } 16 | style = Style(params) 17 | style.delete(params) 18 | 19 | # Alias of delete 20 | def test_destroy(self): 21 | pass 22 | 23 | # Static Methods 24 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/styles/{path}"), "Mock path does not exist") 25 | def test_find(self): 26 | path = "foo" 27 | params = { 28 | "path" : "foo", 29 | } 30 | style.find(path, params) 31 | 32 | 33 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/styles/{path}"), "Mock path does not exist") 34 | def test_delete(self): 35 | path = "foo" 36 | params = { 37 | "path" : "foo", 38 | } 39 | style.delete(path, params) 40 | 41 | if __name__ == '__main__': 42 | unittest.main() -------------------------------------------------------------------------------- /files_sdk/models/errors.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class Errors: 11 | default_attributes = { 12 | "fields": None, # array(string) - A list of fields where errors occur 13 | "messages": None, # array(string) - A list of error messages 14 | } 15 | 16 | def __init__(self, attributes=None, options=None): 17 | if not isinstance(attributes, dict): 18 | attributes = {} 19 | if not isinstance(options, dict): 20 | options = {} 21 | self.set_attributes(attributes) 22 | self.options = options 23 | 24 | def set_attributes(self, attributes): 25 | for attribute, default_value in Errors.default_attributes.items(): 26 | setattr(self, attribute, attributes.get(attribute, default_value)) 27 | 28 | def get_attributes(self): 29 | return { 30 | k: getattr(self, k, None) 31 | for k in Errors.default_attributes 32 | if getattr(self, k, None) is not None 33 | } 34 | 35 | 36 | def new(*args, **kwargs): 37 | return Errors(*args, **kwargs) 38 | -------------------------------------------------------------------------------- /files_sdk/list_obj.py: -------------------------------------------------------------------------------- 1 | from files_sdk.api import Api 2 | 3 | 4 | class ListObj: 5 | def __init__(self, klass, path, method, params, options): 6 | self.klass = klass 7 | self.path = path 8 | self.method = method 9 | self.params = params 10 | self.options = options 11 | self.data = [] 12 | self.cursor = None 13 | 14 | self.load_next_page() 15 | 16 | def load_next_page(self): 17 | if self.cursor is not None: 18 | self.params["cursor"] = self.cursor 19 | response, _options = Api.send_request( 20 | self.path, self.method, self.params, self.options 21 | ) 22 | self.data = [self.klass(d, self.options) for d in response.data] 23 | self.cursor = response.headers.get("X-Files-Cursor", None) 24 | return self 25 | 26 | def __iter__(self): 27 | return self.data.__iter__() 28 | 29 | def __len__(self): 30 | return self.data.__len__() 31 | 32 | def auto_paging_iter(self): 33 | while True: 34 | for item in self.data: 35 | yield item 36 | if not self.has_next_page: 37 | break 38 | self.load_next_page() 39 | 40 | @property 41 | def has_next_page(self): 42 | return True if self.cursor is not None else False 43 | -------------------------------------------------------------------------------- /docs/user_sftp_client_use.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): UserSftpClientUse ID 16 | * `sftp_client` (string): The SFTP client used 17 | * `created_at` (date-time): The earliest recorded use of this SFTP client (for this user) 18 | * `updated_at` (date-time): The most recent use of this SFTP client (for this user) 19 | * `user_id` (int64): ID of the user who performed this access 20 | 21 | 22 | --- 23 | 24 | ## List User SFTP Client Uses 25 | 26 | ``` 27 | files_sdk.user_sftp_client_use.list({ 28 | "user_id": 1 29 | }) 30 | ``` 31 | 32 | ### Parameters 33 | 34 | * `user_id` (int64): User ID. If provided, will return uses for this user. 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 37 | -------------------------------------------------------------------------------- /docs/file_comment_reaction.md: -------------------------------------------------------------------------------- 1 | # FileCommentReaction 2 | 3 | ## Example FileCommentReaction Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "emoji": "👍" 9 | } 10 | ``` 11 | 12 | * `id` (int64): Reaction ID 13 | * `emoji` (string): Emoji used in the reaction. 14 | * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user. 15 | * `file_comment_id` (int64): ID of file comment to attach reaction to. 16 | 17 | 18 | --- 19 | 20 | ## Create File Comment Reaction 21 | 22 | ``` 23 | files_sdk.file_comment_reaction.create({ 24 | "user_id": 1, 25 | "file_comment_id": 1, 26 | "emoji": "emoji" 27 | }) 28 | ``` 29 | 30 | ### Parameters 31 | 32 | * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user. 33 | * `file_comment_id` (int64): 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 | files_sdk.file_comment_reaction.delete(id) 43 | ``` 44 | 45 | ### Parameters 46 | 47 | * `id` (int64): Required - File Comment Reaction ID. 48 | 49 | 50 | --- 51 | 52 | ## Delete File Comment Reaction 53 | 54 | ``` 55 | file_comment_reaction = file_comment_reaction() 56 | file_comment_reaction.delete() 57 | ``` 58 | 59 | ### Parameters 60 | 61 | * `id` (int64): Required - File Comment Reaction ID. 62 | -------------------------------------------------------------------------------- /files_sdk/models/usage_by_top_level_dir.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class UsageByTopLevelDir: 11 | default_attributes = { 12 | "dir": None, # string - Directory name 13 | "size": None, # int64 - Usage 14 | "count": None, # int64 - File count 15 | } 16 | 17 | def __init__(self, attributes=None, options=None): 18 | if not isinstance(attributes, dict): 19 | attributes = {} 20 | if not isinstance(options, dict): 21 | options = {} 22 | self.set_attributes(attributes) 23 | self.options = options 24 | 25 | def set_attributes(self, attributes): 26 | for ( 27 | attribute, 28 | default_value, 29 | ) in UsageByTopLevelDir.default_attributes.items(): 30 | setattr(self, attribute, attributes.get(attribute, default_value)) 31 | 32 | def get_attributes(self): 33 | return { 34 | k: getattr(self, k, None) 35 | for k in UsageByTopLevelDir.default_attributes 36 | if getattr(self, k, None) is not None 37 | } 38 | 39 | 40 | def new(*args, **kwargs): 41 | return UsageByTopLevelDir(*args, **kwargs) 42 | -------------------------------------------------------------------------------- /docs/action.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): Action ID 25 | * `path` (string): Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 26 | * `when` (date-time): Action occurrence date/time 27 | * `destination` (string): The destination path for this action, if applicable 28 | * `display` (string): Friendly displayed output 29 | * `ip` (string): IP Address that performed this action 30 | * `source` (string): The source path for this action, if applicable 31 | * `targets` (object): Targets 32 | * `user_id` (int64): User ID 33 | * `username` (string): Username 34 | * `user_is_from_parent_site` (boolean): true if this change was performed by a user on a parent site. 35 | * `action` (string): Type of action 36 | * `failure_type` (string): Failure type. If action was a user login or session failure, why did it fail? 37 | * `interface` (string): Interface on which this action occurred. 38 | -------------------------------------------------------------------------------- /files_sdk/models/file_action.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class FileAction: 11 | default_attributes = { 12 | "status": None, # string - Status of file operation. 13 | "file_migration_id": None, # int64 - If status is pending, this is the id of the File Migration to check for status updates. 14 | "path": None, 15 | "destination": None, 16 | } 17 | 18 | def __init__(self, attributes=None, options=None): 19 | if not isinstance(attributes, dict): 20 | attributes = {} 21 | if not isinstance(options, dict): 22 | options = {} 23 | self.set_attributes(attributes) 24 | self.options = options 25 | 26 | def set_attributes(self, attributes): 27 | for attribute, default_value in FileAction.default_attributes.items(): 28 | setattr(self, attribute, attributes.get(attribute, default_value)) 29 | 30 | def get_attributes(self): 31 | return { 32 | k: getattr(self, k, None) 33 | for k in FileAction.default_attributes 34 | if getattr(self, k, None) is not None 35 | } 36 | 37 | 38 | def new(*args, **kwargs): 39 | return FileAction(*args, **kwargs) 40 | -------------------------------------------------------------------------------- /docs/invoice_line_item.md: -------------------------------------------------------------------------------- 1 | # InvoiceLineItem 2 | 3 | ## Example InvoiceLineItem Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "amount": 1.0, 9 | "created_at": "2000-01-01T01:00:00Z", 10 | "description": "Service from 2019-01-01 through 2019-12-31", 11 | "type": "invoice", 12 | "service_end_at": "2000-01-01T01:00:00Z", 13 | "service_start_at": "2000-01-01T01:00:00Z", 14 | "plan": "Premier", 15 | "site": "My site", 16 | "prepaid_bytes": 1, 17 | "prepaid_bytes_expire_at": "2000-01-01T01:00:00Z", 18 | "prepaid_bytes_used": 1, 19 | "prepaid_bytes_available": 1 20 | } 21 | ``` 22 | 23 | * `id` (int64): Invoice Line item Id 24 | * `amount` (double): Invoice line item amount 25 | * `created_at` (date-time): Invoice line item created at date/time 26 | * `description` (string): Invoice line item description 27 | * `type` (string): Invoice line item type 28 | * `service_end_at` (date-time): Invoice line item service end date/time 29 | * `service_start_at` (date-time): Invoice line item service start date/time 30 | * `plan` (string): Plan name 31 | * `site` (string): Site name 32 | * `prepaid_bytes` (int64): Prepaid bytes purchased for this invoice line item 33 | * `prepaid_bytes_expire_at` (date-time): When the prepaid bytes expire 34 | * `prepaid_bytes_used` (int64): Total prepaid bytes used for this invoice line item 35 | * `prepaid_bytes_available` (int64): Available prepaid bytes for this invoice line item 36 | -------------------------------------------------------------------------------- /files_sdk/models/bundle_path.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class BundlePath: 11 | default_attributes = { 12 | "recursive": None, # boolean - Allow access to subfolders content? 13 | "path": None, # 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 | } 15 | 16 | def __init__(self, attributes=None, options=None): 17 | if not isinstance(attributes, dict): 18 | attributes = {} 19 | if not isinstance(options, dict): 20 | options = {} 21 | self.set_attributes(attributes) 22 | self.options = options 23 | 24 | def set_attributes(self, attributes): 25 | for attribute, default_value in BundlePath.default_attributes.items(): 26 | setattr(self, attribute, attributes.get(attribute, default_value)) 27 | 28 | def get_attributes(self): 29 | return { 30 | k: getattr(self, k, None) 31 | for k in BundlePath.default_attributes 32 | if getattr(self, k, None) is not None 33 | } 34 | 35 | 36 | def new(*args, **kwargs): 37 | return BundlePath(*args, **kwargs) 38 | -------------------------------------------------------------------------------- /files_sdk/models/share_group_member.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class ShareGroupMember: 11 | default_attributes = { 12 | "name": None, # string - Name of the share group member 13 | "company": None, # string - Company of the share group member 14 | "email": None, # string - Email of the share group member 15 | } 16 | 17 | def __init__(self, attributes=None, options=None): 18 | if not isinstance(attributes, dict): 19 | attributes = {} 20 | if not isinstance(options, dict): 21 | options = {} 22 | self.set_attributes(attributes) 23 | self.options = options 24 | 25 | def set_attributes(self, attributes): 26 | for ( 27 | attribute, 28 | default_value, 29 | ) in ShareGroupMember.default_attributes.items(): 30 | setattr(self, attribute, attributes.get(attribute, default_value)) 31 | 32 | def get_attributes(self): 33 | return { 34 | k: getattr(self, k, None) 35 | for k in ShareGroupMember.default_attributes 36 | if getattr(self, k, None) is not None 37 | } 38 | 39 | 40 | def new(*args, **kwargs): 41 | return ShareGroupMember(*args, **kwargs) 42 | -------------------------------------------------------------------------------- /tests/test_sso_strategy.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import SsoStrategy 6 | from files_sdk import sso_strategy 7 | 8 | class SsoStrategyTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/sso_strategies/{id}/sync"), "Mock path does not exist") 12 | def test_sync(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | sso_strategy = SsoStrategy(params) 17 | sso_strategy.sync(params) 18 | 19 | 20 | # Static Methods 21 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/sso_strategies"), "Mock path does not exist") 22 | def test_list(self): 23 | resp = sso_strategy.list() 24 | 25 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/sso_strategies/{id}"), "Mock path does not exist") 26 | def test_find(self): 27 | id = 12345 28 | params = { 29 | "id" : 12345, 30 | } 31 | sso_strategy.find(id, params) 32 | 33 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/sso_strategies/{id}/sync"), "Mock path does not exist") 34 | def test_sync(self): 35 | id = 12345 36 | params = { 37 | "id" : 12345, 38 | } 39 | sso_strategy.sync(id, params) 40 | 41 | if __name__ == '__main__': 42 | unittest.main() -------------------------------------------------------------------------------- /docs/session.md: -------------------------------------------------------------------------------- 1 | # 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` (string): Session ID 15 | * `language` (string): Session language 16 | * `read_only` (boolean): Is this session read only? 17 | * `sftp_insecure_ciphers` (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` (string): Username to sign in as 19 | * `password` (string): Password for sign in 20 | * `otp` (string): If this user has a 2FA device, provide its OTP or code here. 21 | * `partial_session_id` (string): Identifier for a partially-completed login 22 | 23 | 24 | --- 25 | 26 | ## Create user session (log in) 27 | 28 | ``` 29 | files_sdk.session.create({ 30 | "username": "username", 31 | "password": "password", 32 | "otp": "123456" 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 | files_sdk.session.delete() 50 | ``` 51 | -------------------------------------------------------------------------------- /files_sdk/models/public_ip_address.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class PublicIpAddress: 11 | default_attributes = { 12 | "ip_address": None, # string - The public IP address. 13 | "server_name": None, # string - The name of the frontend server. 14 | "ftp_enabled": None, # boolean 15 | "sftp_enabled": None, # boolean 16 | } 17 | 18 | def __init__(self, attributes=None, options=None): 19 | if not isinstance(attributes, dict): 20 | attributes = {} 21 | if not isinstance(options, dict): 22 | options = {} 23 | self.set_attributes(attributes) 24 | self.options = options 25 | 26 | def set_attributes(self, attributes): 27 | for ( 28 | attribute, 29 | default_value, 30 | ) in PublicIpAddress.default_attributes.items(): 31 | setattr(self, attribute, attributes.get(attribute, default_value)) 32 | 33 | def get_attributes(self): 34 | return { 35 | k: getattr(self, k, None) 36 | for k in PublicIpAddress.default_attributes 37 | if getattr(self, k, None) is not None 38 | } 39 | 40 | 41 | def new(*args, **kwargs): 42 | return PublicIpAddress(*args, **kwargs) 43 | -------------------------------------------------------------------------------- /tests/test_file_comment_reaction.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import FileCommentReaction 6 | from files_sdk import file_comment_reaction 7 | 8 | class FileCommentReactionTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/file_comment_reactions/{id}"), "Mock path does not exist") 12 | def test_delete(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | file_comment_reaction = FileCommentReaction(params) 17 | file_comment_reaction.delete(params) 18 | 19 | # Alias of delete 20 | def test_destroy(self): 21 | pass 22 | 23 | # Static Methods 24 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/file_comment_reactions"), "Mock path does not exist") 25 | def test_create(self): 26 | params = { 27 | "file_comment_id" : 12345, 28 | "emoji" : "foo", 29 | } 30 | file_comment_reaction.create(params) 31 | 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/file_comment_reactions/{id}"), "Mock path does not exist") 33 | def test_delete(self): 34 | id = 12345 35 | params = { 36 | "id" : 12345, 37 | } 38 | file_comment_reaction.delete(id, params) 39 | 40 | if __name__ == '__main__': 41 | unittest.main() -------------------------------------------------------------------------------- /tests/test_permission.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Permission 6 | from files_sdk import permission 7 | 8 | class PermissionTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/permissions/{id}"), "Mock path does not exist") 12 | def test_delete(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | permission = Permission(params) 17 | permission.delete(params) 18 | 19 | # Alias of delete 20 | def test_destroy(self): 21 | pass 22 | 23 | # Static Methods 24 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/permissions"), "Mock path does not exist") 25 | def test_list(self): 26 | resp = permission.list() 27 | 28 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/permissions"), "Mock path does not exist") 29 | def test_create(self): 30 | params = { 31 | "path" : "foo", 32 | } 33 | permission.create(params) 34 | 35 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/permissions/{id}"), "Mock path does not exist") 36 | def test_delete(self): 37 | id = 12345 38 | params = { 39 | "id" : 12345, 40 | } 41 | permission.delete(id, params) 42 | 43 | if __name__ == '__main__': 44 | unittest.main() -------------------------------------------------------------------------------- /files_sdk/models/payment_line_item.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class PaymentLineItem: 11 | default_attributes = { 12 | "amount": None, # double - Payment line item amount 13 | "created_at": None, # date-time - Payment line item created at date/time 14 | "invoice_id": None, # int64 - Invoice ID 15 | "payment_id": None, # int64 - Payment ID 16 | } 17 | 18 | def __init__(self, attributes=None, options=None): 19 | if not isinstance(attributes, dict): 20 | attributes = {} 21 | if not isinstance(options, dict): 22 | options = {} 23 | self.set_attributes(attributes) 24 | self.options = options 25 | 26 | def set_attributes(self, attributes): 27 | for ( 28 | attribute, 29 | default_value, 30 | ) in PaymentLineItem.default_attributes.items(): 31 | setattr(self, attribute, attributes.get(attribute, default_value)) 32 | 33 | def get_attributes(self): 34 | return { 35 | k: getattr(self, k, None) 36 | for k in PaymentLineItem.default_attributes 37 | if getattr(self, k, None) is not None 38 | } 39 | 40 | 41 | def new(*args, **kwargs): 42 | return PaymentLineItem(*args, **kwargs) 43 | -------------------------------------------------------------------------------- /files_sdk/models/preview.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class Preview: 11 | default_attributes = { 12 | "id": None, # int64 - Preview ID 13 | "status": None, # string - Preview status. Can be invalid, not_generated, generating, complete, or file_too_large 14 | "download_uri": None, # string - Link to download preview 15 | "type": None, # string - Preview type. Can be image, pdf, pdf_native, video, or audio 16 | "size": None, # string - Preview size 17 | } 18 | 19 | def __init__(self, attributes=None, options=None): 20 | if not isinstance(attributes, dict): 21 | attributes = {} 22 | if not isinstance(options, dict): 23 | options = {} 24 | self.set_attributes(attributes) 25 | self.options = options 26 | 27 | def set_attributes(self, attributes): 28 | for attribute, default_value in Preview.default_attributes.items(): 29 | setattr(self, attribute, attributes.get(attribute, default_value)) 30 | 31 | def get_attributes(self): 32 | return { 33 | k: getattr(self, k, None) 34 | for k in Preview.default_attributes 35 | if getattr(self, k, None) is not None 36 | } 37 | 38 | 39 | def new(*args, **kwargs): 40 | return Preview(*args, **kwargs) 41 | -------------------------------------------------------------------------------- /files_sdk/models/status.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class Status: 11 | default_attributes = { 12 | "code": None, # int64 - Status HTTP code 13 | "message": None, # string - Error message 14 | "status": None, # string - Status message 15 | "data": None, # Auto - Additional data 16 | "errors": None, # array(object) - A list of api errors 17 | "clickwrap_id": None, # int64 - Required Clickwrap id 18 | "clickwrap_body": None, # string - Required Clickwrap body 19 | } 20 | 21 | def __init__(self, attributes=None, options=None): 22 | if not isinstance(attributes, dict): 23 | attributes = {} 24 | if not isinstance(options, dict): 25 | options = {} 26 | self.set_attributes(attributes) 27 | self.options = options 28 | 29 | def set_attributes(self, attributes): 30 | for attribute, default_value in Status.default_attributes.items(): 31 | setattr(self, attribute, attributes.get(attribute, default_value)) 32 | 33 | def get_attributes(self): 34 | return { 35 | k: getattr(self, k, None) 36 | for k in Status.default_attributes 37 | if getattr(self, k, None) is not None 38 | } 39 | 40 | 41 | def new(*args, **kwargs): 42 | return Status(*args, **kwargs) 43 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /tests/test_lock.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Lock 6 | from files_sdk import lock 7 | 8 | class LockTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/locks/{path}"), "Mock path does not exist") 12 | def test_delete(self): 13 | params = { 14 | "path" : "foo", 15 | "token" : "foo", 16 | } 17 | lock = Lock(params) 18 | lock.delete(params) 19 | 20 | # Alias of delete 21 | def test_destroy(self): 22 | pass 23 | 24 | # Static Methods 25 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/locks/{path}"), "Mock path does not exist") 26 | def test_list_for(self): 27 | path = "foo" 28 | params = { 29 | "path" : "foo", 30 | } 31 | lock.list_for(path, params) 32 | 33 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/locks/{path}"), "Mock path does not exist") 34 | def test_create(self): 35 | path = "foo" 36 | params = { 37 | "path" : "foo", 38 | } 39 | lock.create(path, params) 40 | 41 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/locks/{path}"), "Mock path does not exist") 42 | def test_delete(self): 43 | path = "foo" 44 | params = { 45 | "path" : "foo", 46 | "token" : "foo", 47 | } 48 | lock.delete(path, params) 49 | 50 | if __name__ == '__main__': 51 | unittest.main() -------------------------------------------------------------------------------- /tests/test_history.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import History 6 | from files_sdk import history 7 | 8 | class HistoryTest(TestBase): 9 | pass 10 | # Instance Methods 11 | 12 | # Static Methods 13 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/history/files/{path}"), "Mock path does not exist") 14 | def test_list_for_file(self): 15 | path = "foo" 16 | params = { 17 | "path" : "foo", 18 | } 19 | history.list_for_file(path, params) 20 | 21 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/history/folders/{path}"), "Mock path does not exist") 22 | def test_list_for_folder(self): 23 | path = "foo" 24 | params = { 25 | "path" : "foo", 26 | } 27 | history.list_for_folder(path, params) 28 | 29 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/history/users/{user_id}"), "Mock path does not exist") 30 | def test_list_for_user(self): 31 | user_id = 12345 32 | params = { 33 | "user_id" : 12345, 34 | } 35 | history.list_for_user(user_id, params) 36 | 37 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/history/login"), "Mock path does not exist") 38 | def test_list_logins(self): 39 | resp = history.list_logins() 40 | 41 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/history"), "Mock path does not exist") 42 | def test_list(self): 43 | resp = history.list() 44 | 45 | if __name__ == '__main__': 46 | unittest.main() -------------------------------------------------------------------------------- /files_sdk/path_util.py: -------------------------------------------------------------------------------- 1 | import unicodedata 2 | 3 | TRANSLIT_MAP = { 4 | entry[0]: entry[1:] 5 | for entry in "ÀA,ÁA,ÂA,ÃA,ÄA,ÅA,ÆAE,ÇC,ÈE,ÉE,ÊE,ËE,ÌI,ÍI,ÎI,ÏI,ÐD,ÑN,ÒO,ÓO,ÔO,ÕO,ÖO,ØO,ÙU,ÚU,ÛU,ÜU,ÝY,ßss,àa,áa,âa,ãa,äa,åa,æae,çc,èe,ée,êe,ëe,ìi,íi,îi,ïi,ðd,ñn,òo,óo,ôo,õo,öo,øo,ùu,úu,ûu,üu,ýy,ÿy,ĀA,āa,ĂA,ăa,ĄA,ąa,ĆC,ćc,ĈC,ĉc,ĊC,ċc,ČC,čc,ĎD,ďd,ĐD,đd,ĒE,ēe,ĔE,ĕe,ĖE,ėe,ĘE,ęe,ĚE,ěe,ĜG,ĝg,ĞG,ğg,ĠG,ġg,ĢG,ģg,ĤH,ĥh,ĦH,ħh,ĨI,ĩi,ĪI,īi,ĬI,ĭi,ĮI,įi,İI,IJIJ,ijij,ĴJ,ĵj,ĶK,ķk,ĹL,ĺl,ĻL,ļl,ĽL,ľl,ŁL,łl,ŃN,ńn,ŅN,ņn,ŇN,ňn,ʼn'n,ŌO,ōo,ŎO,ŏo,ŐO,őo,ŒOE,œoe,ŔR,ŕr,ŖR,ŗr,ŘR,řr,ŚS,śs,ŜS,ŝs,ŞS,şs,ŠS,šs,ŢT,ţt,ŤT,ťt,ŨU,ũu,ŪU,ūu,ŬU,ŭu,ŮU,ůu,ŰU,űu,ŲU,ųu,ŴW,ŵw,ŶY,ŷy,ŸY,ŹZ,źz,ŻZ,żz,ŽZ,žz".split( 6 | "," 7 | ) 8 | } 9 | 10 | 11 | def _cleanpath(path_element: str) -> bool: 12 | return path_element not in ["", ".", ".."] 13 | 14 | 15 | def is_same(a: str, b: str) -> bool: 16 | return normalize_for_comparison(a) == normalize_for_comparison(b) 17 | 18 | 19 | def normalize_for_comparison(path_str: str) -> str: 20 | return ( 21 | unicode_normalize_and_transliterate(normalize(path_str)) 22 | .lower() 23 | .rstrip() 24 | ) 25 | 26 | 27 | def normalize(path_str: str) -> str: 28 | return "/".join( 29 | filter( 30 | _cleanpath, 31 | path_str.replace("\x00", "").replace("\\", "/").split("/"), 32 | ) 33 | ) 34 | 35 | 36 | def unicode_normalize_and_transliterate(path_str: str) -> str: 37 | # convert multi-code-point characters into single-code-point characters 38 | normalized_string = unicodedata.normalize("NFKC", path_str) 39 | 40 | return "".join( 41 | [TRANSLIT_MAP.get(char, char) for char in normalized_string] 42 | ) 43 | -------------------------------------------------------------------------------- /files_sdk/models/form_field.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class FormField: 11 | default_attributes = { 12 | "id": None, # int64 - Form field id 13 | "label": None, # string - Label to be displayed 14 | "required": None, # boolean - Is this a required field? 15 | "help_text": None, # string - Help text to be displayed 16 | "field_type": None, # string - Type of Field 17 | "options_for_select": None, # array(string) - Options to display for radio and dropdown 18 | "default_option": None, # string - Default option for radio and dropdown 19 | "form_field_set_id": None, # int64 - Form field set id 20 | } 21 | 22 | def __init__(self, attributes=None, options=None): 23 | if not isinstance(attributes, dict): 24 | attributes = {} 25 | if not isinstance(options, dict): 26 | options = {} 27 | self.set_attributes(attributes) 28 | self.options = options 29 | 30 | def set_attributes(self, attributes): 31 | for attribute, default_value in FormField.default_attributes.items(): 32 | setattr(self, attribute, attributes.get(attribute, default_value)) 33 | 34 | def get_attributes(self): 35 | return { 36 | k: getattr(self, k, None) 37 | for k in FormField.default_attributes 38 | if getattr(self, k, None) is not None 39 | } 40 | 41 | 42 | def new(*args, **kwargs): 43 | return FormField(*args, **kwargs) 44 | -------------------------------------------------------------------------------- /docs/style.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): Style ID 18 | * `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` (Image): Logo 20 | * `thumbnail` (Image): Logo thumbnail 21 | * `file` (file): Logo for custom branding. 22 | 23 | 24 | --- 25 | 26 | ## Show Style 27 | 28 | ``` 29 | files_sdk.style.find(path) 30 | ``` 31 | 32 | ### Parameters 33 | 34 | * `path` (string): Required - Style path. 35 | 36 | 37 | --- 38 | 39 | ## Update Style 40 | 41 | ``` 42 | files_sdk.style.update(path, { 43 | "file": "file" 44 | }) 45 | ``` 46 | 47 | ### Parameters 48 | 49 | * `path` (string): Required - Style path. 50 | * `file` (file): Required - Logo for custom branding. 51 | 52 | 53 | --- 54 | 55 | ## Delete Style 56 | 57 | ``` 58 | files_sdk.style.delete(path) 59 | ``` 60 | 61 | ### Parameters 62 | 63 | * `path` (string): Required - Style path. 64 | 65 | 66 | --- 67 | 68 | ## Update Style 69 | 70 | ``` 71 | style = files_sdk.style.find(path) 72 | style.update({ 73 | "file": "file" 74 | }) 75 | ``` 76 | 77 | ### Parameters 78 | 79 | * `path` (string): Required - Style path. 80 | * `file` (file): Required - Logo for custom branding. 81 | 82 | 83 | --- 84 | 85 | ## Delete Style 86 | 87 | ``` 88 | style = files_sdk.style.find(path) 89 | style.delete() 90 | ``` 91 | 92 | ### Parameters 93 | 94 | * `path` (string): Required - Style path. 95 | -------------------------------------------------------------------------------- /tests/test_request.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Request 6 | from files_sdk import request 7 | 8 | class RequestTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/requests/{id}"), "Mock path does not exist") 12 | def test_delete(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | request = Request(params) 17 | request.delete(params) 18 | 19 | # Alias of delete 20 | def test_destroy(self): 21 | pass 22 | 23 | # Static Methods 24 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/requests"), "Mock path does not exist") 25 | def test_list(self): 26 | resp = request.list() 27 | 28 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/requests/folders/{path}"), "Mock path does not exist") 29 | def test_get_folder(self): 30 | path = "foo" 31 | params = { 32 | "path" : "foo", 33 | } 34 | request.get_folder(path, params) 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/requests"), "Mock path does not exist") 37 | def test_create(self): 38 | params = { 39 | "path" : "foo", 40 | "destination" : "foo", 41 | } 42 | request.create(params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/requests/{id}"), "Mock path does not exist") 45 | def test_delete(self): 46 | id = 12345 47 | params = { 48 | "id" : 12345, 49 | } 50 | request.delete(id, params) 51 | 52 | if __name__ == '__main__': 53 | unittest.main() -------------------------------------------------------------------------------- /docs/settings_change.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): The API key id responsible for this change. 20 | * `changes` (array(string)): Markdown-formatted change messages. 21 | * `created_at` (date-time): The time this change was made. 22 | * `user_id` (int64): The user id responsible for this change. 23 | * `user_is_files_support` (boolean): true if this change was performed by Files.com support. 24 | * `user_is_from_parent_site` (boolean): true if this change was performed by a user on a parent site. 25 | * `username` (string): The username of the user responsible for this change. 26 | 27 | 28 | --- 29 | 30 | ## List Settings Changes 31 | 32 | ``` 33 | files_sdk.settings_change.list() 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 40 | * `sort_by` (object): 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`. 41 | * `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `api_key_id` and `user_id`. 42 | -------------------------------------------------------------------------------- /tests/test_user_request.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import UserRequest 6 | from files_sdk import user_request 7 | 8 | class UserRequestTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/user_requests/{id}"), "Mock path does not exist") 12 | def test_delete(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | user_request = UserRequest(params) 17 | user_request.delete(params) 18 | 19 | # Alias of delete 20 | def test_destroy(self): 21 | pass 22 | 23 | # Static Methods 24 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/user_requests"), "Mock path does not exist") 25 | def test_list(self): 26 | resp = user_request.list() 27 | 28 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/user_requests/{id}"), "Mock path does not exist") 29 | def test_find(self): 30 | id = 12345 31 | params = { 32 | "id" : 12345, 33 | } 34 | user_request.find(id, params) 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/user_requests"), "Mock path does not exist") 37 | def test_create(self): 38 | params = { 39 | "name" : "foo", 40 | "email" : "foo", 41 | "details" : "foo", 42 | } 43 | user_request.create(params) 44 | 45 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/user_requests/{id}"), "Mock path does not exist") 46 | def test_delete(self): 47 | id = 12345 48 | params = { 49 | "id" : 12345, 50 | } 51 | user_request.delete(id, params) 52 | 53 | if __name__ == '__main__': 54 | unittest.main() -------------------------------------------------------------------------------- /docs/scim_log.md: -------------------------------------------------------------------------------- 1 | # ScimLog 2 | 3 | ## Example ScimLog Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "created_at": "2023-01-01T12:00:00Z", 9 | "request_path": "/api/scim/Users", 10 | "request_method": "POST", 11 | "http_response_code": "200", 12 | "user_agent": "Okta", 13 | "request_json": "example", 14 | "response_json": "example" 15 | } 16 | ``` 17 | 18 | * `id` (int64): The unique ID of this SCIM request. 19 | * `created_at` (string): The date and time when this SCIM request occurred. 20 | * `request_path` (string): The path portion of the URL requested. 21 | * `request_method` (string): The HTTP method used for this request. 22 | * `http_response_code` (string): The HTTP response code returned for this request. 23 | * `user_agent` (string): The User-Agent header sent with the request. 24 | * `request_json` (string): The JSON payload sent with the request. 25 | * `response_json` (string): The JSON payload returned in the response. 26 | 27 | 28 | --- 29 | 30 | ## List Scim Logs 31 | 32 | ``` 33 | files_sdk.scim_log.list() 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 40 | * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `created_at`. 41 | 42 | 43 | --- 44 | 45 | ## Show Scim Log 46 | 47 | ``` 48 | files_sdk.scim_log.find(id) 49 | ``` 50 | 51 | ### Parameters 52 | 53 | * `id` (int64): Required - Scim Log ID. 54 | -------------------------------------------------------------------------------- /tests/test_message_reaction.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import MessageReaction 6 | from files_sdk import message_reaction 7 | 8 | class MessageReactionTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/message_reactions/{id}"), "Mock path does not exist") 12 | def test_delete(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | message_reaction = MessageReaction(params) 17 | message_reaction.delete(params) 18 | 19 | # Alias of delete 20 | def test_destroy(self): 21 | pass 22 | 23 | # Static Methods 24 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/message_reactions"), "Mock path does not exist") 25 | def test_list(self): 26 | params = { 27 | "message_id" : 12345, 28 | } 29 | message_reaction.list(params) 30 | 31 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/message_reactions/{id}"), "Mock path does not exist") 32 | def test_find(self): 33 | id = 12345 34 | params = { 35 | "id" : 12345, 36 | } 37 | message_reaction.find(id, params) 38 | 39 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/message_reactions"), "Mock path does not exist") 40 | def test_create(self): 41 | params = { 42 | "emoji" : "foo", 43 | } 44 | message_reaction.create(params) 45 | 46 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/message_reactions/{id}"), "Mock path does not exist") 47 | def test_delete(self): 48 | id = 12345 49 | params = { 50 | "id" : 12345, 51 | } 52 | message_reaction.delete(id, params) 53 | 54 | if __name__ == '__main__': 55 | unittest.main() -------------------------------------------------------------------------------- /docs/account_line_item.md: -------------------------------------------------------------------------------- 1 | # 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 | "id": 1, 16 | "amount": 1.0, 17 | "created_at": "2000-01-01T01:00:00Z", 18 | "description": "Service from 2019-01-01 through 2019-12-31", 19 | "type": "invoice", 20 | "service_end_at": "2000-01-01T01:00:00Z", 21 | "service_start_at": "2000-01-01T01:00:00Z", 22 | "plan": "Premier", 23 | "site": "My site", 24 | "prepaid_bytes": 1, 25 | "prepaid_bytes_expire_at": "2000-01-01T01:00:00Z", 26 | "prepaid_bytes_used": 1, 27 | "prepaid_bytes_available": 1 28 | } 29 | ], 30 | "method": "paypal", 31 | "payment_line_items": [ 32 | { 33 | "amount": 1.0, 34 | "created_at": "2000-01-01T01:00:00Z", 35 | "invoice_id": 1, 36 | "payment_id": 1 37 | } 38 | ], 39 | "payment_reversed_at": "2000-01-01T01:00:00Z", 40 | "payment_type": "example", 41 | "site_name": "My Site", 42 | "type": "invoice" 43 | } 44 | ``` 45 | 46 | * `id` (int64): Line item Id 47 | * `amount` (double): Line item amount 48 | * `balance` (double): Line item balance 49 | * `created_at` (date-time): Line item created at 50 | * `currency` (string): Line item currency 51 | * `download_uri` (string): Line item download uri 52 | * `invoice_line_items` (array(object)): Associated invoice line items 53 | * `method` (string): Line item payment method 54 | * `payment_line_items` (array(object)): Associated payment line items 55 | * `payment_reversed_at` (date-time): Date/time payment was reversed if applicable 56 | * `payment_type` (string): Type of payment if applicable 57 | * `site_name` (string): Site name this line item is for 58 | * `type` (string): Type of line item, either payment or invoice 59 | -------------------------------------------------------------------------------- /docs/file_upload_part.md: -------------------------------------------------------------------------------- 1 | # 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` (object): Content-Type and File to send 33 | * `action` (string): Type of upload 34 | * `ask_about_overwrites` (boolean): If `true`, this file exists and you may wish to ask the user for overwrite confirmation 35 | * `available_parts` (int64): Number of parts in the upload 36 | * `expires` (string): Date/time of when this Upload part expires and the URL cannot be used any more 37 | * `headers` (object): Additional upload headers to provide as part of the upload 38 | * `http_method` (string): HTTP Method to use for uploading the part, usually `PUT` 39 | * `next_partsize` (int64): Size in bytes for this part 40 | * `parallel_parts` (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` (boolean): If `true`, parts may be retried. If `false`, a part cannot be retried and the upload should be restarted. 42 | * `parameters` (object): Additional HTTP parameters to send with the upload 43 | * `part_number` (int64): Number of this upload part 44 | * `partsize` (int64): Size in bytes for the next upload part 45 | * `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` (string): Reference name for this upload part 47 | * `upload_uri` (string): URI to upload this part to 48 | -------------------------------------------------------------------------------- /tests/test_bundle.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Bundle 6 | from files_sdk import bundle 7 | 8 | class BundleTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/bundles/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | bundle = Bundle(params) 17 | bundle.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/bundles/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | bundle = Bundle(params) 25 | bundle.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/bundles"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = bundle.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/bundles/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | bundle.find(id, params) 43 | 44 | 45 | 46 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/bundles/{id}"), "Mock path does not exist") 47 | def test_update(self): 48 | id = 12345 49 | params = { 50 | "id" : 12345, 51 | } 52 | bundle.update(id, params) 53 | 54 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/bundles/{id}"), "Mock path does not exist") 55 | def test_delete(self): 56 | id = 12345 57 | params = { 58 | "id" : 12345, 59 | } 60 | bundle.delete(id, params) 61 | 62 | if __name__ == '__main__': 63 | unittest.main() -------------------------------------------------------------------------------- /docs/inbox_registration.md: -------------------------------------------------------------------------------- 1 | # 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` (string): Registration cookie code 25 | * `name` (string): Registrant name 26 | * `company` (string): Registrant company name 27 | * `email` (string): Registrant email address 28 | * `ip` (string): Registrant IP Address 29 | * `clickwrap_body` (string): Clickwrap text that was shown to the registrant 30 | * `form_field_set_id` (int64): Id of associated form field set 31 | * `form_field_data` (object): Data for form field set with form field ids as keys and user data as values 32 | * `inbox_id` (int64): Id of associated inbox 33 | * `inbox_recipient_id` (int64): Id of associated inbox recipient 34 | * `inbox_title` (string): Title of associated inbox 35 | * `created_at` (date-time): Registration creation date/time 36 | 37 | 38 | --- 39 | 40 | ## List Inbox Registrations 41 | 42 | ``` 43 | files_sdk.inbox_registration.list({ 44 | "folder_behavior_id": 1 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 52 | * `folder_behavior_id` (int64): ID of the associated Inbox. This is required if the user is not a site admin. 53 | -------------------------------------------------------------------------------- /tests/test_message_comment_reaction.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import MessageCommentReaction 6 | from files_sdk import message_comment_reaction 7 | 8 | class MessageCommentReactionTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/message_comment_reactions/{id}"), "Mock path does not exist") 12 | def test_delete(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | message_comment_reaction = MessageCommentReaction(params) 17 | message_comment_reaction.delete(params) 18 | 19 | # Alias of delete 20 | def test_destroy(self): 21 | pass 22 | 23 | # Static Methods 24 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/message_comment_reactions"), "Mock path does not exist") 25 | def test_list(self): 26 | params = { 27 | "message_comment_id" : 12345, 28 | } 29 | message_comment_reaction.list(params) 30 | 31 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/message_comment_reactions/{id}"), "Mock path does not exist") 32 | def test_find(self): 33 | id = 12345 34 | params = { 35 | "id" : 12345, 36 | } 37 | message_comment_reaction.find(id, params) 38 | 39 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/message_comment_reactions"), "Mock path does not exist") 40 | def test_create(self): 41 | params = { 42 | "emoji" : "foo", 43 | } 44 | message_comment_reaction.create(params) 45 | 46 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/message_comment_reactions/{id}"), "Mock path does not exist") 47 | def test_delete(self): 48 | id = 12345 49 | params = { 50 | "id" : 12345, 51 | } 52 | message_comment_reaction.delete(id, params) 53 | 54 | if __name__ == '__main__': 55 | unittest.main() -------------------------------------------------------------------------------- /files_sdk/api.py: -------------------------------------------------------------------------------- 1 | import copy 2 | import sys 3 | import files_sdk 4 | from files_sdk.api_client import ApiClient 5 | 6 | 7 | class Api: 8 | __singleton_instance = None 9 | 10 | @staticmethod 11 | def client(): 12 | if not Api.__singleton_instance: 13 | Api.__singleton_instance = ApiClient() 14 | 15 | return Api.__singleton_instance 16 | 17 | @staticmethod 18 | def send_request(verb, path, params, options=None): 19 | if not isinstance(options, dict): 20 | options = {} 21 | Api.warn_on_options_in_params(params) 22 | 23 | headers = copy.deepcopy(options) 24 | api_key = headers.pop("api_key", None) 25 | session_id = headers.pop("session_id", None) 26 | language = headers.pop("language", None) 27 | 28 | session = headers.pop("session", None) 29 | if session: 30 | if session.id: 31 | session.save 32 | session_id = str(session.id) 33 | 34 | response = Api.client().send_request( 35 | verb, 36 | path, 37 | api_key=api_key, 38 | session_id=session_id, 39 | language=language, 40 | params=params, 41 | ) 42 | 43 | # Remove options not in the allow list 44 | options = {k: options[k] for k in files_sdk.OPTS if k in options} 45 | 46 | return response, options 47 | 48 | # Hash#select returns an array before 1.9 49 | # options_to_persist = {} 50 | # options.each do |k, v| 51 | # options_to_persist[k] = v if Util::OPTS.include?(k) 52 | # end 53 | 54 | @staticmethod 55 | def warn_on_options_in_params(params): 56 | for opt in files_sdk.OPTS: 57 | if opt in params: 58 | print( 59 | "WARNING: {opt} should be in the options dictionary, not the params dictionary. You may need to create a second dictionary that goes after params.)".format( 60 | opt=opt 61 | ), 62 | file=sys.stderr, 63 | ) 64 | -------------------------------------------------------------------------------- /docs/remote_bandwidth_snapshot.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): Site bandwidth ID 16 | * `sync_bytes_received` (double): Site sync bandwidth report bytes received 17 | * `sync_bytes_sent` (double): Site sync bandwidth report bytes sent 18 | * `logged_at` (date-time): Time the site bandwidth report was logged 19 | * `remote_server_id` (int64): ID of related Remote Server 20 | 21 | 22 | --- 23 | 24 | ## List Remote Bandwidth Snapshots 25 | 26 | ``` 27 | files_sdk.remote_bandwidth_snapshot.list() 28 | ``` 29 | 30 | ### Parameters 31 | 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 34 | * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `logged_at`. 35 | * `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `logged_at`. 36 | * `filter_gt` (object): If set, return records where the specified field is greater than the supplied value. Valid fields are `logged_at`. 37 | * `filter_gteq` (object): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `logged_at`. 38 | * `filter_lt` (object): If set, return records where the specified field is less than the supplied value. Valid fields are `logged_at`. 39 | * `filter_lteq` (object): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `logged_at`. 40 | -------------------------------------------------------------------------------- /files_sdk/models/account_line_item.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class AccountLineItem: 11 | default_attributes = { 12 | "id": None, # int64 - Line item Id 13 | "amount": None, # double - Line item amount 14 | "balance": None, # double - Line item balance 15 | "created_at": None, # date-time - Line item created at 16 | "currency": None, # string - Line item currency 17 | "download_uri": None, # string - Line item download uri 18 | "invoice_line_items": None, # array(object) - Associated invoice line items 19 | "method": None, # string - Line item payment method 20 | "payment_line_items": None, # array(object) - Associated payment line items 21 | "payment_reversed_at": None, # date-time - Date/time payment was reversed if applicable 22 | "payment_type": None, # string - Type of payment if applicable 23 | "site_name": None, # string - Site name this line item is for 24 | "type": None, # string - Type of line item, either payment or invoice 25 | } 26 | 27 | def __init__(self, attributes=None, options=None): 28 | if not isinstance(attributes, dict): 29 | attributes = {} 30 | if not isinstance(options, dict): 31 | options = {} 32 | self.set_attributes(attributes) 33 | self.options = options 34 | 35 | def set_attributes(self, attributes): 36 | for ( 37 | attribute, 38 | default_value, 39 | ) in AccountLineItem.default_attributes.items(): 40 | setattr(self, attribute, attributes.get(attribute, default_value)) 41 | 42 | def get_attributes(self): 43 | return { 44 | k: getattr(self, k, None) 45 | for k in AccountLineItem.default_attributes 46 | if getattr(self, k, None) is not None 47 | } 48 | 49 | 50 | def new(*args, **kwargs): 51 | return AccountLineItem(*args, **kwargs) 52 | -------------------------------------------------------------------------------- /docs/webhook_test.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): Status HTTP code 16 | * `message` (string): Error message 17 | * `status` (string): Status message 18 | * `data` (Auto): Additional data 19 | * `success` (boolean): The success status of the webhook test 20 | * `url` (string): URL for testing the webhook. 21 | * `method` (string): HTTP method(GET or POST). 22 | * `encoding` (string): HTTP encoding method. Can be JSON, XML, or RAW (form data). 23 | * `headers` (object): Additional request headers. 24 | * `body` (object): Additional body parameters. 25 | * `raw_body` (string): raw body text 26 | * `file_as_body` (boolean): Send the file data as the request body? 27 | * `file_form_field` (string): Send the file data as a named parameter in the request POST body 28 | * `action` (string): action for test body 29 | * `use_dedicated_ips` (boolean): Use dedicated IPs for sending the webhook? 30 | 31 | 32 | --- 33 | 34 | ## Create Webhook Test 35 | 36 | ``` 37 | files_sdk.webhook_test.create({ 38 | "url": "https://www.site.com/...", 39 | "method": "GET", 40 | "encoding": "RAW", 41 | "headers": {"x-test-header":"testvalue"}, 42 | "body": {"test-param":"testvalue"}, 43 | "raw_body": "test body", 44 | "file_as_body": False, 45 | "file_form_field": "upload_file_data", 46 | "use_dedicated_ips": False 47 | }) 48 | ``` 49 | 50 | ### Parameters 51 | 52 | * `url` (string): Required - URL for testing the webhook. 53 | * `method` (string): HTTP method(GET or POST). 54 | * `encoding` (string): HTTP encoding method. Can be JSON, XML, or RAW (form data). 55 | * `headers` (object): Additional request headers. 56 | * `body` (object): Additional body parameters. 57 | * `raw_body` (string): raw body text 58 | * `file_as_body` (boolean): Send the file data as the request body? 59 | * `file_form_field` (string): Send the file data as a named parameter in the request POST body 60 | * `action` (string): action for test body 61 | * `use_dedicated_ips` (boolean): Use dedicated IPs for sending the webhook? 62 | -------------------------------------------------------------------------------- /docs/user_request.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): ID 16 | * `name` (string): User's full name 17 | * `email` (email): User email address 18 | * `details` (string): Details of the user's request 19 | * `company` (string): User's company name 20 | 21 | 22 | --- 23 | 24 | ## List User Requests 25 | 26 | ``` 27 | files_sdk.user_request.list() 28 | ``` 29 | 30 | ### Parameters 31 | 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 34 | 35 | 36 | --- 37 | 38 | ## Show User Request 39 | 40 | ``` 41 | files_sdk.user_request.find(id) 42 | ``` 43 | 44 | ### Parameters 45 | 46 | * `id` (int64): Required - User Request ID. 47 | 48 | 49 | --- 50 | 51 | ## Create User Request 52 | 53 | ``` 54 | files_sdk.user_request.create({ 55 | "name": "name", 56 | "email": "email", 57 | "details": "details", 58 | "company": "Acme Inc." 59 | }) 60 | ``` 61 | 62 | ### Parameters 63 | 64 | * `name` (string): Required - Name of user requested 65 | * `email` (string): Required - Email of user requested 66 | * `details` (string): Required - Details of the user request 67 | * `company` (string): Company of the user requested 68 | 69 | 70 | --- 71 | 72 | ## Delete User Request 73 | 74 | ``` 75 | files_sdk.user_request.delete(id) 76 | ``` 77 | 78 | ### Parameters 79 | 80 | * `id` (int64): Required - User Request ID. 81 | 82 | 83 | --- 84 | 85 | ## Delete User Request 86 | 87 | ``` 88 | user_request = files_sdk.user_request.find(id) 89 | user_request.delete() 90 | ``` 91 | 92 | ### Parameters 93 | 94 | * `id` (int64): Required - User Request ID. 95 | -------------------------------------------------------------------------------- /docs/message_reaction.md: -------------------------------------------------------------------------------- 1 | # MessageReaction 2 | 3 | ## Example MessageReaction Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "emoji": "👍" 9 | } 10 | ``` 11 | 12 | * `id` (int64): Reaction ID 13 | * `emoji` (string): Emoji used in the reaction. 14 | * `user_id` (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 | files_sdk.message_reaction.list({ 23 | "user_id": 1, 24 | "message_id": 1 25 | }) 26 | ``` 27 | 28 | ### Parameters 29 | 30 | * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user. 31 | * `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. 32 | * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 33 | * `message_id` (int64): Required - Message to return reactions for. 34 | 35 | 36 | --- 37 | 38 | ## Show Message Reaction 39 | 40 | ``` 41 | files_sdk.message_reaction.find(id) 42 | ``` 43 | 44 | ### Parameters 45 | 46 | * `id` (int64): Required - Message Reaction ID. 47 | 48 | 49 | --- 50 | 51 | ## Create Message Reaction 52 | 53 | ``` 54 | files_sdk.message_reaction.create({ 55 | "user_id": 1, 56 | "emoji": "emoji" 57 | }) 58 | ``` 59 | 60 | ### Parameters 61 | 62 | * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user. 63 | * `emoji` (string): Required - Emoji to react with. 64 | 65 | 66 | --- 67 | 68 | ## Delete Message Reaction 69 | 70 | ``` 71 | files_sdk.message_reaction.delete(id) 72 | ``` 73 | 74 | ### Parameters 75 | 76 | * `id` (int64): Required - Message Reaction ID. 77 | 78 | 79 | --- 80 | 81 | ## Delete Message Reaction 82 | 83 | ``` 84 | message_reaction = files_sdk.message_reaction.find(id) 85 | message_reaction.delete() 86 | ``` 87 | 88 | ### Parameters 89 | 90 | * `id` (int64): Required - Message Reaction ID. 91 | -------------------------------------------------------------------------------- /files_sdk/models/action.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class Action: 11 | default_attributes = { 12 | "id": None, # int64 - Action ID 13 | "path": None, # string - Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 14 | "when": None, # date-time - Action occurrence date/time 15 | "destination": None, # string - The destination path for this action, if applicable 16 | "display": None, # string - Friendly displayed output 17 | "ip": None, # string - IP Address that performed this action 18 | "source": None, # string - The source path for this action, if applicable 19 | "targets": None, # object - Targets 20 | "user_id": None, # int64 - User ID 21 | "username": None, # string - Username 22 | "user_is_from_parent_site": None, # boolean - true if this change was performed by a user on a parent site. 23 | "action": None, # string - Type of action 24 | "failure_type": None, # string - Failure type. If action was a user login or session failure, why did it fail? 25 | "interface": None, # string - Interface on which this action occurred. 26 | } 27 | 28 | def __init__(self, attributes=None, options=None): 29 | if not isinstance(attributes, dict): 30 | attributes = {} 31 | if not isinstance(options, dict): 32 | options = {} 33 | self.set_attributes(attributes) 34 | self.options = options 35 | 36 | def set_attributes(self, attributes): 37 | for attribute, default_value in Action.default_attributes.items(): 38 | setattr(self, attribute, attributes.get(attribute, default_value)) 39 | 40 | def get_attributes(self): 41 | return { 42 | k: getattr(self, k, None) 43 | for k in Action.default_attributes 44 | if getattr(self, k, None) is not None 45 | } 46 | 47 | 48 | def new(*args, **kwargs): 49 | return Action(*args, **kwargs) 50 | -------------------------------------------------------------------------------- /files_sdk/models/invoice_line_item.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class InvoiceLineItem: 11 | default_attributes = { 12 | "id": None, # int64 - Invoice Line item Id 13 | "amount": None, # double - Invoice line item amount 14 | "created_at": None, # date-time - Invoice line item created at date/time 15 | "description": None, # string - Invoice line item description 16 | "type": None, # string - Invoice line item type 17 | "service_end_at": None, # date-time - Invoice line item service end date/time 18 | "service_start_at": None, # date-time - Invoice line item service start date/time 19 | "plan": None, # string - Plan name 20 | "site": None, # string - Site name 21 | "prepaid_bytes": None, # int64 - Prepaid bytes purchased for this invoice line item 22 | "prepaid_bytes_expire_at": None, # date-time - When the prepaid bytes expire 23 | "prepaid_bytes_used": None, # int64 - Total prepaid bytes used for this invoice line item 24 | "prepaid_bytes_available": None, # int64 - Available prepaid bytes for this invoice line item 25 | } 26 | 27 | def __init__(self, attributes=None, options=None): 28 | if not isinstance(attributes, dict): 29 | attributes = {} 30 | if not isinstance(options, dict): 31 | options = {} 32 | self.set_attributes(attributes) 33 | self.options = options 34 | 35 | def set_attributes(self, attributes): 36 | for ( 37 | attribute, 38 | default_value, 39 | ) in InvoiceLineItem.default_attributes.items(): 40 | setattr(self, attribute, attributes.get(attribute, default_value)) 41 | 42 | def get_attributes(self): 43 | return { 44 | k: getattr(self, k, None) 45 | for k in InvoiceLineItem.default_attributes 46 | if getattr(self, k, None) is not None 47 | } 48 | 49 | 50 | def new(*args, **kwargs): 51 | return InvoiceLineItem(*args, **kwargs) 52 | -------------------------------------------------------------------------------- /tests/test_group.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Group 6 | from files_sdk import group 7 | 8 | class GroupTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/groups/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | group = Group(params) 17 | group.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/groups/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | group = Group(params) 25 | group.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/groups"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = group.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/groups/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | group.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/groups"), "Mock path does not exist") 45 | def test_create(self): 46 | params = { 47 | "name" : "foo", 48 | } 49 | group.create(params) 50 | 51 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/groups/{id}"), "Mock path does not exist") 52 | def test_update(self): 53 | id = 12345 54 | params = { 55 | "id" : 12345, 56 | } 57 | group.update(id, params) 58 | 59 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/groups/{id}"), "Mock path does not exist") 60 | def test_delete(self): 61 | id = 12345 62 | params = { 63 | "id" : 12345, 64 | } 65 | group.delete(id, params) 66 | 67 | if __name__ == '__main__': 68 | unittest.main() -------------------------------------------------------------------------------- /tests/test_clickwrap.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Clickwrap 6 | from files_sdk import clickwrap 7 | 8 | class ClickwrapTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/clickwraps/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | clickwrap = Clickwrap(params) 17 | clickwrap.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/clickwraps/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | clickwrap = Clickwrap(params) 25 | clickwrap.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/clickwraps"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = clickwrap.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/clickwraps/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | clickwrap.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/clickwraps"), "Mock path does not exist") 45 | def test_create(self): 46 | resp = clickwrap.create() 47 | 48 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/clickwraps/{id}"), "Mock path does not exist") 49 | def test_update(self): 50 | id = 12345 51 | params = { 52 | "id" : 12345, 53 | } 54 | clickwrap.update(id, params) 55 | 56 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/clickwraps/{id}"), "Mock path does not exist") 57 | def test_delete(self): 58 | id = 12345 59 | params = { 60 | "id" : 12345, 61 | } 62 | clickwrap.delete(id, params) 63 | 64 | if __name__ == '__main__': 65 | unittest.main() -------------------------------------------------------------------------------- /tests/test_gpg_key.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import GpgKey 6 | from files_sdk import gpg_key 7 | 8 | class GpgKeyTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/gpg_keys/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | gpg_key = GpgKey(params) 17 | gpg_key.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/gpg_keys/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | gpg_key = GpgKey(params) 25 | gpg_key.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/gpg_keys"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = gpg_key.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/gpg_keys/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | gpg_key.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/gpg_keys"), "Mock path does not exist") 45 | def test_create(self): 46 | params = { 47 | "name" : "foo", 48 | } 49 | gpg_key.create(params) 50 | 51 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/gpg_keys/{id}"), "Mock path does not exist") 52 | def test_update(self): 53 | id = 12345 54 | params = { 55 | "id" : 12345, 56 | } 57 | gpg_key.update(id, params) 58 | 59 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/gpg_keys/{id}"), "Mock path does not exist") 60 | def test_delete(self): 61 | id = 12345 62 | params = { 63 | "id" : 12345, 64 | } 65 | gpg_key.delete(id, params) 66 | 67 | if __name__ == '__main__': 68 | unittest.main() -------------------------------------------------------------------------------- /tests/test_partner.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Partner 6 | from files_sdk import partner 7 | 8 | class PartnerTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/partners/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | partner = Partner(params) 17 | partner.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/partners/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | partner = Partner(params) 25 | partner.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/partners"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = partner.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/partners/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | partner.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/partners"), "Mock path does not exist") 45 | def test_create(self): 46 | params = { 47 | "name" : "foo", 48 | } 49 | partner.create(params) 50 | 51 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/partners/{id}"), "Mock path does not exist") 52 | def test_update(self): 53 | id = 12345 54 | params = { 55 | "id" : 12345, 56 | } 57 | partner.update(id, params) 58 | 59 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/partners/{id}"), "Mock path does not exist") 60 | def test_delete(self): 61 | id = 12345 62 | params = { 63 | "id" : 12345, 64 | } 65 | partner.delete(id, params) 66 | 67 | if __name__ == '__main__': 68 | unittest.main() -------------------------------------------------------------------------------- /docs/action_notification_export_result.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): Notification ID 21 | * `created_at` (int64): When the notification was sent. 22 | * `status` (int64): HTTP status code returned in the webhook response. 23 | * `message` (string): A message indicating the overall status of the webhook notification. 24 | * `success` (boolean): `true` if the webhook succeeded by receiving a 200 or 204 response. 25 | * `request_headers` (string): A JSON-encoded string with headers that were sent with the webhook. 26 | * `request_method` (string): The HTTP verb used to perform the webhook. 27 | * `request_url` (string): The webhook request URL. 28 | * `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` (string): The folder associated with the triggering action for this notification. 30 | 31 | 32 | --- 33 | 34 | ## List Action Notification Export Results 35 | 36 | ``` 37 | files_sdk.action_notification_export_result.list({ 38 | "user_id": 1, 39 | "action_notification_export_id": 1 40 | }) 41 | ``` 42 | 43 | ### Parameters 44 | 45 | * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user. 46 | * `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. 47 | * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 48 | * `action_notification_export_id` (int64): Required - ID of the associated action notification export. 49 | -------------------------------------------------------------------------------- /tests/test_file_comment.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import FileComment 6 | from files_sdk import file_comment 7 | 8 | class FileCommentTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/file_comments/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | "body" : "foo", 16 | } 17 | file_comment = FileComment(params) 18 | file_comment.update(params) 19 | 20 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/file_comments/{id}"), "Mock path does not exist") 21 | def test_delete(self): 22 | params = { 23 | "id" : 12345, 24 | } 25 | file_comment = FileComment(params) 26 | file_comment.delete(params) 27 | 28 | # Alias of delete 29 | def test_destroy(self): 30 | pass 31 | 32 | # Static Methods 33 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/file_comments/files/{path}"), "Mock path does not exist") 34 | def test_list_for(self): 35 | path = "foo" 36 | params = { 37 | "path" : "foo", 38 | } 39 | file_comment.list_for(path, params) 40 | 41 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/file_comments"), "Mock path does not exist") 42 | def test_create(self): 43 | params = { 44 | "body" : "foo", 45 | "path" : "foo", 46 | } 47 | file_comment.create(params) 48 | 49 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/file_comments/{id}"), "Mock path does not exist") 50 | def test_update(self): 51 | id = 12345 52 | params = { 53 | "id" : 12345, 54 | "body" : "foo", 55 | } 56 | file_comment.update(id, params) 57 | 58 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/file_comments/{id}"), "Mock path does not exist") 59 | def test_delete(self): 60 | id = 12345 61 | params = { 62 | "id" : 12345, 63 | } 64 | file_comment.delete(id, params) 65 | 66 | if __name__ == '__main__': 67 | unittest.main() -------------------------------------------------------------------------------- /tests/test_notification.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Notification 6 | from files_sdk import notification 7 | 8 | class NotificationTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/notifications/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | notification = Notification(params) 17 | notification.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/notifications/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | notification = Notification(params) 25 | notification.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/notifications"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = notification.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/notifications/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | notification.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/notifications"), "Mock path does not exist") 45 | def test_create(self): 46 | resp = notification.create() 47 | 48 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/notifications/{id}"), "Mock path does not exist") 49 | def test_update(self): 50 | id = 12345 51 | params = { 52 | "id" : 12345, 53 | } 54 | notification.update(id, params) 55 | 56 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/notifications/{id}"), "Mock path does not exist") 57 | def test_delete(self): 58 | id = 12345 59 | params = { 60 | "id" : 12345, 61 | } 62 | notification.delete(id, params) 63 | 64 | if __name__ == '__main__': 65 | unittest.main() -------------------------------------------------------------------------------- /tests/test_sftp_host_key.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import SftpHostKey 6 | from files_sdk import sftp_host_key 7 | 8 | class SftpHostKeyTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/sftp_host_keys/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | sftp_host_key = SftpHostKey(params) 17 | sftp_host_key.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/sftp_host_keys/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | sftp_host_key = SftpHostKey(params) 25 | sftp_host_key.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/sftp_host_keys"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = sftp_host_key.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/sftp_host_keys/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | sftp_host_key.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/sftp_host_keys"), "Mock path does not exist") 45 | def test_create(self): 46 | resp = sftp_host_key.create() 47 | 48 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/sftp_host_keys/{id}"), "Mock path does not exist") 49 | def test_update(self): 50 | id = 12345 51 | params = { 52 | "id" : 12345, 53 | } 54 | sftp_host_key.update(id, params) 55 | 56 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/sftp_host_keys/{id}"), "Mock path does not exist") 57 | def test_delete(self): 58 | id = 12345 59 | params = { 60 | "id" : 12345, 61 | } 62 | sftp_host_key.delete(id, params) 63 | 64 | if __name__ == '__main__': 65 | unittest.main() -------------------------------------------------------------------------------- /tests/test_form_field_set.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import FormFieldSet 6 | from files_sdk import form_field_set 7 | 8 | class FormFieldSetTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/form_field_sets/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | form_field_set = FormFieldSet(params) 17 | form_field_set.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/form_field_sets/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | form_field_set = FormFieldSet(params) 25 | form_field_set.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/form_field_sets"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = form_field_set.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/form_field_sets/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | form_field_set.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/form_field_sets"), "Mock path does not exist") 45 | def test_create(self): 46 | resp = form_field_set.create() 47 | 48 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/form_field_sets/{id}"), "Mock path does not exist") 49 | def test_update(self): 50 | id = 12345 51 | params = { 52 | "id" : 12345, 53 | } 54 | form_field_set.update(id, params) 55 | 56 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/form_field_sets/{id}"), "Mock path does not exist") 57 | def test_delete(self): 58 | id = 12345 59 | params = { 60 | "id" : 12345, 61 | } 62 | form_field_set.delete(id, params) 63 | 64 | if __name__ == '__main__': 65 | unittest.main() -------------------------------------------------------------------------------- /docs/bundle_registration.md: -------------------------------------------------------------------------------- 1 | # 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` (string): Registration cookie code 26 | * `name` (string): Registrant name 27 | * `company` (string): Registrant company name 28 | * `email` (string): Registrant email address 29 | * `ip` (string): Registrant IP Address 30 | * `inbox_code` (string): InboxRegistration cookie code, if there is an associated InboxRegistration 31 | * `clickwrap_body` (string): Clickwrap text that was shown to the registrant 32 | * `form_field_set_id` (int64): Id of associated form field set 33 | * `form_field_data` (object): Data for form field set with form field ids as keys and user data as values 34 | * `bundle_code` (string): Bundle URL code 35 | * `bundle_id` (int64): Id of associated bundle 36 | * `bundle_recipient_id` (int64): Id of associated bundle recipient 37 | * `created_at` (date-time): Registration creation date/time 38 | 39 | 40 | --- 41 | 42 | ## List Share Link Registrations 43 | 44 | ``` 45 | files_sdk.bundle_registration.list({ 46 | "user_id": 1, 47 | "bundle_id": 1 48 | }) 49 | ``` 50 | 51 | ### Parameters 52 | 53 | * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user. 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 56 | * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `bundle_id` and `created_at`. 57 | * `bundle_id` (int64): ID of the associated Bundle 58 | -------------------------------------------------------------------------------- /tests/test_project.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Project 6 | from files_sdk import project 7 | 8 | class ProjectTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/projects/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | "global_access" : "foo", 16 | } 17 | project = Project(params) 18 | project.update(params) 19 | 20 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/projects/{id}"), "Mock path does not exist") 21 | def test_delete(self): 22 | params = { 23 | "id" : 12345, 24 | } 25 | project = Project(params) 26 | project.delete(params) 27 | 28 | # Alias of delete 29 | def test_destroy(self): 30 | pass 31 | 32 | # Static Methods 33 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/projects"), "Mock path does not exist") 34 | def test_list(self): 35 | resp = project.list() 36 | 37 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/projects/{id}"), "Mock path does not exist") 38 | def test_find(self): 39 | id = 12345 40 | params = { 41 | "id" : 12345, 42 | } 43 | project.find(id, params) 44 | 45 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/projects"), "Mock path does not exist") 46 | def test_create(self): 47 | params = { 48 | "global_access" : "foo", 49 | } 50 | project.create(params) 51 | 52 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/projects/{id}"), "Mock path does not exist") 53 | def test_update(self): 54 | id = 12345 55 | params = { 56 | "id" : 12345, 57 | "global_access" : "foo", 58 | } 59 | project.update(id, params) 60 | 61 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/projects/{id}"), "Mock path does not exist") 62 | def test_delete(self): 63 | id = 12345 64 | params = { 65 | "id" : 12345, 66 | } 67 | project.delete(id, params) 68 | 69 | if __name__ == '__main__': 70 | unittest.main() -------------------------------------------------------------------------------- /tests/test_group_user.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import GroupUser 6 | from files_sdk import group_user 7 | 8 | class GroupUserTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/group_users/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | "group_id" : 12345, 16 | "user_id" : 12345, 17 | } 18 | group_user = GroupUser(params) 19 | group_user.update(params) 20 | 21 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/group_users/{id}"), "Mock path does not exist") 22 | def test_delete(self): 23 | params = { 24 | "id" : 12345, 25 | "group_id" : 12345, 26 | "user_id" : 12345, 27 | } 28 | group_user = GroupUser(params) 29 | group_user.delete(params) 30 | 31 | # Alias of delete 32 | def test_destroy(self): 33 | pass 34 | 35 | # Static Methods 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/group_users"), "Mock path does not exist") 37 | def test_list(self): 38 | resp = group_user.list() 39 | 40 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/group_users"), "Mock path does not exist") 41 | def test_create(self): 42 | params = { 43 | "group_id" : 12345, 44 | "user_id" : 12345, 45 | } 46 | group_user.create(params) 47 | 48 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/group_users/{id}"), "Mock path does not exist") 49 | def test_update(self): 50 | id = 12345 51 | params = { 52 | "id" : 12345, 53 | "group_id" : 12345, 54 | "user_id" : 12345, 55 | } 56 | group_user.update(id, params) 57 | 58 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/group_users/{id}"), "Mock path does not exist") 59 | def test_delete(self): 60 | id = 12345 61 | params = { 62 | "id" : 12345, 63 | "group_id" : 12345, 64 | "user_id" : 12345, 65 | } 66 | group_user.delete(id, params) 67 | 68 | if __name__ == '__main__': 69 | unittest.main() -------------------------------------------------------------------------------- /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 | ] -------------------------------------------------------------------------------- /tests/test_share_group.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import ShareGroup 6 | from files_sdk import share_group 7 | 8 | class ShareGroupTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/share_groups/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | share_group = ShareGroup(params) 17 | share_group.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/share_groups/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | share_group = ShareGroup(params) 25 | share_group.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/share_groups"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = share_group.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/share_groups/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | share_group.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/share_groups"), "Mock path does not exist") 45 | def test_create(self): 46 | params = { 47 | "name" : "foo", 48 | "members" : [{}], 49 | } 50 | share_group.create(params) 51 | 52 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/share_groups/{id}"), "Mock path does not exist") 53 | def test_update(self): 54 | id = 12345 55 | params = { 56 | "id" : 12345, 57 | } 58 | share_group.update(id, params) 59 | 60 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/share_groups/{id}"), "Mock path does not exist") 61 | def test_delete(self): 62 | id = 12345 63 | params = { 64 | "id" : 12345, 65 | } 66 | share_group.delete(id, params) 67 | 68 | if __name__ == '__main__': 69 | unittest.main() -------------------------------------------------------------------------------- /tests/test_public_key.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import PublicKey 6 | from files_sdk import public_key 7 | 8 | class PublicKeyTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/public_keys/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | "title" : "foo", 16 | } 17 | public_key = PublicKey(params) 18 | public_key.update(params) 19 | 20 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/public_keys/{id}"), "Mock path does not exist") 21 | def test_delete(self): 22 | params = { 23 | "id" : 12345, 24 | } 25 | public_key = PublicKey(params) 26 | public_key.delete(params) 27 | 28 | # Alias of delete 29 | def test_destroy(self): 30 | pass 31 | 32 | # Static Methods 33 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/public_keys"), "Mock path does not exist") 34 | def test_list(self): 35 | resp = public_key.list() 36 | 37 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/public_keys/{id}"), "Mock path does not exist") 38 | def test_find(self): 39 | id = 12345 40 | params = { 41 | "id" : 12345, 42 | } 43 | public_key.find(id, params) 44 | 45 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/public_keys"), "Mock path does not exist") 46 | def test_create(self): 47 | params = { 48 | "title" : "foo", 49 | } 50 | public_key.create(params) 51 | 52 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/public_keys/{id}"), "Mock path does not exist") 53 | def test_update(self): 54 | id = 12345 55 | params = { 56 | "id" : 12345, 57 | "title" : "foo", 58 | } 59 | public_key.update(id, params) 60 | 61 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/public_keys/{id}"), "Mock path does not exist") 62 | def test_delete(self): 63 | id = 12345 64 | params = { 65 | "id" : 12345, 66 | } 67 | public_key.delete(id, params) 68 | 69 | if __name__ == '__main__': 70 | unittest.main() -------------------------------------------------------------------------------- /docs/inbox_recipient.md: -------------------------------------------------------------------------------- 1 | # 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` (string): The recipient's company. 16 | * `name` (string): The recipient's name. 17 | * `note` (string): A note sent to the recipient with the inbox. 18 | * `recipient` (string): The recipient's email address. 19 | * `sent_at` (date-time): When the Inbox was shared with this recipient. 20 | * `inbox_id` (int64): Inbox to share. 21 | * `share_after_create` (boolean): Set to true to share the link with the recipient upon creation. 22 | 23 | 24 | --- 25 | 26 | ## List Inbox Recipients 27 | 28 | ``` 29 | files_sdk.inbox_recipient.list({ 30 | "inbox_id": 1 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 38 | * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are . 39 | * `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `has_registrations`. 40 | * `inbox_id` (int64): Required - List recipients for the inbox with this ID. 41 | 42 | 43 | --- 44 | 45 | ## Create Inbox Recipient 46 | 47 | ``` 48 | files_sdk.inbox_recipient.create({ 49 | "inbox_id": 1, 50 | "recipient": "johndoe@gmail.com", 51 | "name": "John Smith", 52 | "company": "Acme Ltd", 53 | "note": "Just a note.", 54 | "share_after_create": False 55 | }) 56 | ``` 57 | 58 | ### Parameters 59 | 60 | * `inbox_id` (int64): Required - Inbox to share. 61 | * `recipient` (string): Required - Email address to share this inbox with. 62 | * `name` (string): Name of recipient. 63 | * `company` (string): Company of recipient. 64 | * `note` (string): Note to include in email. 65 | * `share_after_create` (boolean): Set to true to share the link with the recipient upon creation. 66 | -------------------------------------------------------------------------------- /tests/test_as2_station.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import As2Station 6 | from files_sdk import as2_station 7 | 8 | class As2StationTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/as2_stations/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | as2_station = As2Station(params) 17 | as2_station.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/as2_stations/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | as2_station = As2Station(params) 25 | as2_station.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/as2_stations"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = as2_station.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/as2_stations/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | as2_station.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/as2_stations"), "Mock path does not exist") 45 | def test_create(self): 46 | params = { 47 | "name" : "foo", 48 | "public_certificate" : "foo", 49 | "private_key" : "foo", 50 | } 51 | as2_station.create(params) 52 | 53 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/as2_stations/{id}"), "Mock path does not exist") 54 | def test_update(self): 55 | id = 12345 56 | params = { 57 | "id" : 12345, 58 | } 59 | as2_station.update(id, params) 60 | 61 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/as2_stations/{id}"), "Mock path does not exist") 62 | def test_delete(self): 63 | id = 12345 64 | params = { 65 | "id" : 12345, 66 | } 67 | as2_station.delete(id, params) 68 | 69 | if __name__ == '__main__': 70 | unittest.main() -------------------------------------------------------------------------------- /docs/bandwidth_snapshot.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): Site bandwidth ID 20 | * `bytes_received` (double): Site bandwidth report bytes received 21 | * `bytes_sent` (double): Site bandwidth report bytes sent 22 | * `sync_bytes_received` (double): Site sync bandwidth report bytes received 23 | * `sync_bytes_sent` (double): Site sync bandwidth report bytes sent 24 | * `requests_get` (double): Site bandwidth report get requests 25 | * `requests_put` (double): Site bandwidth report put requests 26 | * `requests_other` (double): Site bandwidth report other requests 27 | * `logged_at` (date-time): Time the site bandwidth report was logged 28 | 29 | 30 | --- 31 | 32 | ## List Bandwidth Snapshots 33 | 34 | ``` 35 | files_sdk.bandwidth_snapshot.list() 36 | ``` 37 | 38 | ### Parameters 39 | 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 42 | * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `logged_at`. 43 | * `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `logged_at`. 44 | * `filter_gt` (object): If set, return records where the specified field is greater than the supplied value. Valid fields are `logged_at`. 45 | * `filter_gteq` (object): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `logged_at`. 46 | * `filter_lt` (object): If set, return records where the specified field is less than the supplied value. Valid fields are `logged_at`. 47 | * `filter_lteq` (object): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `logged_at`. 48 | -------------------------------------------------------------------------------- /tests/test_user_lifecycle_rule.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import UserLifecycleRule 6 | from files_sdk import user_lifecycle_rule 7 | 8 | class UserLifecycleRuleTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/user_lifecycle_rules/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | user_lifecycle_rule = UserLifecycleRule(params) 17 | user_lifecycle_rule.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/user_lifecycle_rules/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | user_lifecycle_rule = UserLifecycleRule(params) 25 | user_lifecycle_rule.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/user_lifecycle_rules"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = user_lifecycle_rule.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/user_lifecycle_rules/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | user_lifecycle_rule.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/user_lifecycle_rules"), "Mock path does not exist") 45 | def test_create(self): 46 | resp = user_lifecycle_rule.create() 47 | 48 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/user_lifecycle_rules/{id}"), "Mock path does not exist") 49 | def test_update(self): 50 | id = 12345 51 | params = { 52 | "id" : 12345, 53 | } 54 | user_lifecycle_rule.update(id, params) 55 | 56 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/user_lifecycle_rules/{id}"), "Mock path does not exist") 57 | def test_delete(self): 58 | id = 12345 59 | params = { 60 | "id" : 12345, 61 | } 62 | user_lifecycle_rule.delete(id, params) 63 | 64 | if __name__ == '__main__': 65 | unittest.main() -------------------------------------------------------------------------------- /docs/message_comment_reaction.md: -------------------------------------------------------------------------------- 1 | # MessageCommentReaction 2 | 3 | ## Example MessageCommentReaction Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "emoji": "👍" 9 | } 10 | ``` 11 | 12 | * `id` (int64): Reaction ID 13 | * `emoji` (string): Emoji used in the reaction. 14 | * `user_id` (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 | files_sdk.message_comment_reaction.list({ 23 | "user_id": 1, 24 | "message_comment_id": 1 25 | }) 26 | ``` 27 | 28 | ### Parameters 29 | 30 | * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user. 31 | * `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. 32 | * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 33 | * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are . 34 | * `message_comment_id` (int64): Required - Message comment to return reactions for. 35 | 36 | 37 | --- 38 | 39 | ## Show Message Comment Reaction 40 | 41 | ``` 42 | files_sdk.message_comment_reaction.find(id) 43 | ``` 44 | 45 | ### Parameters 46 | 47 | * `id` (int64): Required - Message Comment Reaction ID. 48 | 49 | 50 | --- 51 | 52 | ## Create Message Comment Reaction 53 | 54 | ``` 55 | files_sdk.message_comment_reaction.create({ 56 | "user_id": 1, 57 | "emoji": "emoji" 58 | }) 59 | ``` 60 | 61 | ### Parameters 62 | 63 | * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user. 64 | * `emoji` (string): Required - Emoji to react with. 65 | 66 | 67 | --- 68 | 69 | ## Delete Message Comment Reaction 70 | 71 | ``` 72 | files_sdk.message_comment_reaction.delete(id) 73 | ``` 74 | 75 | ### Parameters 76 | 77 | * `id` (int64): Required - Message Comment Reaction ID. 78 | 79 | 80 | --- 81 | 82 | ## Delete Message Comment Reaction 83 | 84 | ``` 85 | message_comment_reaction = files_sdk.message_comment_reaction.find(id) 86 | message_comment_reaction.delete() 87 | ``` 88 | 89 | ### Parameters 90 | 91 | * `id` (int64): Required - Message Comment Reaction ID. 92 | -------------------------------------------------------------------------------- /tests/test_as2_partner.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import As2Partner 6 | from files_sdk import as2_partner 7 | 8 | class As2PartnerTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/as2_partners/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | as2_partner = As2Partner(params) 17 | as2_partner.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/as2_partners/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | as2_partner = As2Partner(params) 25 | as2_partner.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/as2_partners"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = as2_partner.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/as2_partners/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | as2_partner.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/as2_partners"), "Mock path does not exist") 45 | def test_create(self): 46 | params = { 47 | "as2_station_id" : 12345, 48 | "name" : "foo", 49 | "uri" : "foo", 50 | "public_certificate" : "foo", 51 | } 52 | as2_partner.create(params) 53 | 54 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/as2_partners/{id}"), "Mock path does not exist") 55 | def test_update(self): 56 | id = 12345 57 | params = { 58 | "id" : 12345, 59 | } 60 | as2_partner.update(id, params) 61 | 62 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/as2_partners/{id}"), "Mock path does not exist") 63 | def test_delete(self): 64 | id = 12345 65 | params = { 66 | "id" : 12345, 67 | } 68 | as2_partner.delete(id, params) 69 | 70 | if __name__ == '__main__': 71 | unittest.main() -------------------------------------------------------------------------------- /files_sdk/models/holiday_region.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.list_obj import ListObj 4 | from files_sdk.error import ( # noqa: F401 5 | InvalidParameterError, 6 | MissingParameterError, 7 | NotImplementedError, 8 | ) 9 | 10 | 11 | class HolidayRegion: 12 | default_attributes = { 13 | "code": None, # string - The code representing a region 14 | "name": None, # string - The name of the region 15 | } 16 | 17 | def __init__(self, attributes=None, options=None): 18 | if not isinstance(attributes, dict): 19 | attributes = {} 20 | if not isinstance(options, dict): 21 | options = {} 22 | self.set_attributes(attributes) 23 | self.options = options 24 | 25 | def set_attributes(self, attributes): 26 | for ( 27 | attribute, 28 | default_value, 29 | ) in HolidayRegion.default_attributes.items(): 30 | setattr(self, attribute, attributes.get(attribute, default_value)) 31 | 32 | def get_attributes(self): 33 | return { 34 | k: getattr(self, k, None) 35 | for k in HolidayRegion.default_attributes 36 | if getattr(self, k, None) is not None 37 | } 38 | 39 | 40 | # Parameters: 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 - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 43 | def get_supported(params=None, options=None): 44 | if not isinstance(params, dict): 45 | params = {} 46 | if not isinstance(options, dict): 47 | options = {} 48 | if "cursor" in params and not isinstance(params["cursor"], str): 49 | raise InvalidParameterError("Bad parameter: cursor must be an str") 50 | if "per_page" in params and not isinstance(params["per_page"], int): 51 | raise InvalidParameterError("Bad parameter: per_page must be an int") 52 | return ListObj( 53 | HolidayRegion, "GET", "/holiday_regions/supported", params, options 54 | ) 55 | 56 | 57 | def new(*args, **kwargs): 58 | return HolidayRegion(*args, **kwargs) 59 | -------------------------------------------------------------------------------- /docs/file_comment.md: -------------------------------------------------------------------------------- 1 | # 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` (int64): File Comment ID 19 | * `body` (string): Comment body. 20 | * `reactions` (array(object)): Reactions to this comment. 21 | * `path` (string): File path. 22 | 23 | 24 | --- 25 | 26 | ## List File Comments by Path 27 | 28 | ``` 29 | files_sdk.file_comment.list_for(path) 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 36 | * `path` (string): Required - Path to operate on. 37 | 38 | 39 | --- 40 | 41 | ## Create File Comment 42 | 43 | ``` 44 | files_sdk.file_comment.create({ 45 | "body": "body", 46 | "path": "path" 47 | }) 48 | ``` 49 | 50 | ### Parameters 51 | 52 | * `body` (string): Required - Comment body. 53 | * `path` (string): Required - File path. 54 | 55 | 56 | --- 57 | 58 | ## Update File Comment 59 | 60 | ``` 61 | files_sdk.file_comment.update(id, { 62 | "body": "body" 63 | }) 64 | ``` 65 | 66 | ### Parameters 67 | 68 | * `id` (int64): Required - File Comment ID. 69 | * `body` (string): Required - Comment body. 70 | 71 | 72 | --- 73 | 74 | ## Delete File Comment 75 | 76 | ``` 77 | files_sdk.file_comment.delete(id) 78 | ``` 79 | 80 | ### Parameters 81 | 82 | * `id` (int64): Required - File Comment ID. 83 | 84 | 85 | --- 86 | 87 | ## Update File Comment 88 | 89 | ``` 90 | file_comment = files_sdk.file_comment.list.first 91 | file_comment.update({ 92 | "body": "body" 93 | }) 94 | ``` 95 | 96 | ### Parameters 97 | 98 | * `id` (int64): Required - File Comment ID. 99 | * `body` (string): Required - Comment body. 100 | 101 | 102 | --- 103 | 104 | ## Delete File Comment 105 | 106 | ``` 107 | file_comment = files_sdk.file_comment.list.first 108 | file_comment.delete() 109 | ``` 110 | 111 | ### Parameters 112 | 113 | * `id` (int64): Required - File Comment ID. 114 | -------------------------------------------------------------------------------- /docs/project.md: -------------------------------------------------------------------------------- 1 | # Project 2 | 3 | ## Example Project Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "global_access": "none" 9 | } 10 | ``` 11 | 12 | * `id` (int64): Project ID 13 | * `global_access` (string): Global access settings 14 | 15 | 16 | --- 17 | 18 | ## List Projects 19 | 20 | ``` 21 | files_sdk.project.list() 22 | ``` 23 | 24 | ### Parameters 25 | 26 | * `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. 27 | * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 28 | 29 | 30 | --- 31 | 32 | ## Show Project 33 | 34 | ``` 35 | files_sdk.project.find(id) 36 | ``` 37 | 38 | ### Parameters 39 | 40 | * `id` (int64): Required - Project ID. 41 | 42 | 43 | --- 44 | 45 | ## Create Project 46 | 47 | ``` 48 | files_sdk.project.create({ 49 | "global_access": "global_access" 50 | }) 51 | ``` 52 | 53 | ### Parameters 54 | 55 | * `global_access` (string): Required - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`. 56 | 57 | 58 | --- 59 | 60 | ## Update Project 61 | 62 | ``` 63 | files_sdk.project.update(id, { 64 | "global_access": "global_access" 65 | }) 66 | ``` 67 | 68 | ### Parameters 69 | 70 | * `id` (int64): Required - Project ID. 71 | * `global_access` (string): Required - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`. 72 | 73 | 74 | --- 75 | 76 | ## Delete Project 77 | 78 | ``` 79 | files_sdk.project.delete(id) 80 | ``` 81 | 82 | ### Parameters 83 | 84 | * `id` (int64): Required - Project ID. 85 | 86 | 87 | --- 88 | 89 | ## Update Project 90 | 91 | ``` 92 | project = files_sdk.project.find(id) 93 | project.update({ 94 | "global_access": "global_access" 95 | }) 96 | ``` 97 | 98 | ### Parameters 99 | 100 | * `id` (int64): Required - Project ID. 101 | * `global_access` (string): Required - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`. 102 | 103 | 104 | --- 105 | 106 | ## Delete Project 107 | 108 | ``` 109 | project = files_sdk.project.find(id) 110 | project.delete() 111 | ``` 112 | 113 | ### Parameters 114 | 115 | * `id` (int64): Required - Project ID. 116 | -------------------------------------------------------------------------------- /tests/test_bundle_notification.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import BundleNotification 6 | from files_sdk import bundle_notification 7 | 8 | class BundleNotificationTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/bundle_notifications/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | } 16 | bundle_notification = BundleNotification(params) 17 | bundle_notification.update(params) 18 | 19 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/bundle_notifications/{id}"), "Mock path does not exist") 20 | def test_delete(self): 21 | params = { 22 | "id" : 12345, 23 | } 24 | bundle_notification = BundleNotification(params) 25 | bundle_notification.delete(params) 26 | 27 | # Alias of delete 28 | def test_destroy(self): 29 | pass 30 | 31 | # Static Methods 32 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/bundle_notifications"), "Mock path does not exist") 33 | def test_list(self): 34 | resp = bundle_notification.list() 35 | 36 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/bundle_notifications/{id}"), "Mock path does not exist") 37 | def test_find(self): 38 | id = 12345 39 | params = { 40 | "id" : 12345, 41 | } 42 | bundle_notification.find(id, params) 43 | 44 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/bundle_notifications"), "Mock path does not exist") 45 | def test_create(self): 46 | params = { 47 | "bundle_id" : 12345, 48 | } 49 | bundle_notification.create(params) 50 | 51 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/bundle_notifications/{id}"), "Mock path does not exist") 52 | def test_update(self): 53 | id = 12345 54 | params = { 55 | "id" : 12345, 56 | } 57 | bundle_notification.update(id, params) 58 | 59 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/bundle_notifications/{id}"), "Mock path does not exist") 60 | def test_delete(self): 61 | id = 12345 62 | params = { 63 | "id" : 12345, 64 | } 65 | bundle_notification.delete(id, params) 66 | 67 | if __name__ == '__main__': 68 | unittest.main() -------------------------------------------------------------------------------- /tests/test_message_comment.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import MessageComment 6 | from files_sdk import message_comment 7 | 8 | class MessageCommentTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/message_comments/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | "body" : "foo", 16 | } 17 | message_comment = MessageComment(params) 18 | message_comment.update(params) 19 | 20 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/message_comments/{id}"), "Mock path does not exist") 21 | def test_delete(self): 22 | params = { 23 | "id" : 12345, 24 | } 25 | message_comment = MessageComment(params) 26 | message_comment.delete(params) 27 | 28 | # Alias of delete 29 | def test_destroy(self): 30 | pass 31 | 32 | # Static Methods 33 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/message_comments"), "Mock path does not exist") 34 | def test_list(self): 35 | params = { 36 | "message_id" : 12345, 37 | } 38 | message_comment.list(params) 39 | 40 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/message_comments/{id}"), "Mock path does not exist") 41 | def test_find(self): 42 | id = 12345 43 | params = { 44 | "id" : 12345, 45 | } 46 | message_comment.find(id, params) 47 | 48 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/message_comments"), "Mock path does not exist") 49 | def test_create(self): 50 | params = { 51 | "body" : "foo", 52 | } 53 | message_comment.create(params) 54 | 55 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/message_comments/{id}"), "Mock path does not exist") 56 | def test_update(self): 57 | id = 12345 58 | params = { 59 | "id" : 12345, 60 | "body" : "foo", 61 | } 62 | message_comment.update(id, params) 63 | 64 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/message_comments/{id}"), "Mock path does not exist") 65 | def test_delete(self): 66 | id = 12345 67 | params = { 68 | "id" : 12345, 69 | } 70 | message_comment.delete(id, params) 71 | 72 | if __name__ == '__main__': 73 | unittest.main() -------------------------------------------------------------------------------- /files_sdk/models/dns_record.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.list_obj import ListObj 4 | from files_sdk.error import ( # noqa: F401 5 | InvalidParameterError, 6 | MissingParameterError, 7 | NotImplementedError, 8 | ) 9 | 10 | 11 | class DnsRecord: 12 | default_attributes = { 13 | "id": None, # string - Unique label for DNS record; used by Zapier and other integrations. 14 | "domain": None, # string - DNS record domain name 15 | "rrtype": None, # string - DNS record type 16 | "value": None, # string - DNS record value 17 | } 18 | 19 | def __init__(self, attributes=None, options=None): 20 | if not isinstance(attributes, dict): 21 | attributes = {} 22 | if not isinstance(options, dict): 23 | options = {} 24 | self.set_attributes(attributes) 25 | self.options = options 26 | 27 | def set_attributes(self, attributes): 28 | for attribute, default_value in DnsRecord.default_attributes.items(): 29 | setattr(self, attribute, attributes.get(attribute, default_value)) 30 | 31 | def get_attributes(self): 32 | return { 33 | k: getattr(self, k, None) 34 | for k in DnsRecord.default_attributes 35 | if getattr(self, k, None) is not None 36 | } 37 | 38 | 39 | # Parameters: 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 - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 42 | def list(params=None, options=None): 43 | if not isinstance(params, dict): 44 | params = {} 45 | if not isinstance(options, dict): 46 | options = {} 47 | if "cursor" in params and not isinstance(params["cursor"], str): 48 | raise InvalidParameterError("Bad parameter: cursor must be an str") 49 | if "per_page" in params and not isinstance(params["per_page"], int): 50 | raise InvalidParameterError("Bad parameter: per_page must be an int") 51 | return ListObj(DnsRecord, "GET", "/dns_records", params, options) 52 | 53 | 54 | def all(params=None, options=None): 55 | list(params, options) 56 | 57 | 58 | def new(*args, **kwargs): 59 | return DnsRecord(*args, **kwargs) 60 | -------------------------------------------------------------------------------- /docs/inbox_upload.md: -------------------------------------------------------------------------------- 1 | # 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): 29 | * `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` (date-time): Upload date/time 31 | 32 | 33 | --- 34 | 35 | ## List Inbox Uploads 36 | 37 | ``` 38 | files_sdk.inbox_upload.list() 39 | ``` 40 | 41 | ### Parameters 42 | 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 45 | * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `created_at`. 46 | * `filter` (object): 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 ]`. 47 | * `filter_gt` (object): If set, return records where the specified field is greater than the supplied value. Valid fields are `created_at`. 48 | * `filter_gteq` (object): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`. 49 | * `filter_lt` (object): If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`. 50 | * `filter_lteq` (object): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`. 51 | -------------------------------------------------------------------------------- /files_sdk/models/file_migration.py: -------------------------------------------------------------------------------- 1 | import builtins # noqa: F401 2 | from files_sdk.api import Api # noqa: F401 3 | from files_sdk.error import ( # noqa: F401 4 | InvalidParameterError, 5 | MissingParameterError, 6 | NotImplementedError, 7 | ) 8 | 9 | 10 | class FileMigration: 11 | default_attributes = { 12 | "id": None, # int64 - File migration ID 13 | "path": None, # string - Source path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters. 14 | "dest_path": None, # string - Destination path 15 | "files_moved": None, # int64 - Number of files processed 16 | "files_total": None, # int64 17 | "operation": None, # string - The type of operation 18 | "region": None, # string - Region 19 | "status": None, # string - Status 20 | "log_url": None, # string - Link to download the log file for this migration. 21 | } 22 | 23 | def __init__(self, attributes=None, options=None): 24 | if not isinstance(attributes, dict): 25 | attributes = {} 26 | if not isinstance(options, dict): 27 | options = {} 28 | self.set_attributes(attributes) 29 | self.options = options 30 | 31 | def set_attributes(self, attributes): 32 | for ( 33 | attribute, 34 | default_value, 35 | ) in FileMigration.default_attributes.items(): 36 | setattr(self, attribute, attributes.get(attribute, default_value)) 37 | 38 | def get_attributes(self): 39 | return { 40 | k: getattr(self, k, None) 41 | for k in FileMigration.default_attributes 42 | if getattr(self, k, None) is not None 43 | } 44 | 45 | 46 | # Parameters: 47 | # id (required) - int64 - File Migration ID. 48 | def find(id, params=None, options=None): 49 | if not isinstance(params, dict): 50 | params = {} 51 | if not isinstance(options, dict): 52 | options = {} 53 | params["id"] = id 54 | if "id" in params and not isinstance(params["id"], int): 55 | raise InvalidParameterError("Bad parameter: id must be an int") 56 | if "id" not in params: 57 | raise MissingParameterError("Parameter missing: id") 58 | response, options = Api.send_request( 59 | "GET", "/file_migrations/{id}".format(id=params["id"]), params, options 60 | ) 61 | return FileMigration(response.data, options) 62 | 63 | 64 | def get(id, params=None, options=None): 65 | find(id, params, options) 66 | 67 | 68 | def new(*args, **kwargs): 69 | return FileMigration(*args, **kwargs) 70 | -------------------------------------------------------------------------------- /tests/test_message.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import inspect 3 | import files_sdk 4 | from tests.base import TestBase 5 | from files_sdk.models import Message 6 | from files_sdk import message 7 | 8 | class MessageTest(TestBase): 9 | pass 10 | # Instance Methods 11 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/messages/{id}"), "Mock path does not exist") 12 | def test_update(self): 13 | params = { 14 | "id" : 12345, 15 | "project_id" : 12345, 16 | "subject" : "foo", 17 | "body" : "foo", 18 | } 19 | message = Message(params) 20 | message.update(params) 21 | 22 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/messages/{id}"), "Mock path does not exist") 23 | def test_delete(self): 24 | params = { 25 | "id" : 12345, 26 | } 27 | message = Message(params) 28 | message.delete(params) 29 | 30 | # Alias of delete 31 | def test_destroy(self): 32 | pass 33 | 34 | # Static Methods 35 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/messages"), "Mock path does not exist") 36 | def test_list(self): 37 | params = { 38 | "project_id" : 12345, 39 | } 40 | message.list(params) 41 | 42 | @unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/messages/{id}"), "Mock path does not exist") 43 | def test_find(self): 44 | id = 12345 45 | params = { 46 | "id" : 12345, 47 | } 48 | message.find(id, params) 49 | 50 | @unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/messages"), "Mock path does not exist") 51 | def test_create(self): 52 | params = { 53 | "project_id" : 12345, 54 | "subject" : "foo", 55 | "body" : "foo", 56 | } 57 | message.create(params) 58 | 59 | @unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/messages/{id}"), "Mock path does not exist") 60 | def test_update(self): 61 | id = 12345 62 | params = { 63 | "id" : 12345, 64 | "project_id" : 12345, 65 | "subject" : "foo", 66 | "body" : "foo", 67 | } 68 | message.update(id, params) 69 | 70 | @unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/messages/{id}"), "Mock path does not exist") 71 | def test_delete(self): 72 | id = 12345 73 | params = { 74 | "id" : 12345, 75 | } 76 | message.delete(id, params) 77 | 78 | if __name__ == '__main__': 79 | unittest.main() -------------------------------------------------------------------------------- /docs/user_cipher_use.md: -------------------------------------------------------------------------------- 1 | # UserCipherUse 2 | 3 | ## Example UserCipherUse Object 4 | 5 | ``` 6 | { 7 | "id": 1, 8 | "user_id": 1, 9 | "username": "example", 10 | "protocol_cipher": "TLSv1.2; ECDHE-RSA-AES256-GCM-SHA384", 11 | "created_at": "2000-01-01T01:00:00Z", 12 | "insecure": True, 13 | "interface": "restapi", 14 | "updated_at": "2000-01-01T01:00:00Z" 15 | } 16 | ``` 17 | 18 | * `id` (int64): UserCipherUse ID 19 | * `user_id` (int64): ID of the user who performed this access 20 | * `username` (string): Username of the user who performed this access 21 | * `protocol_cipher` (string): The protocol and cipher employed 22 | * `created_at` (date-time): The earliest recorded use of this combination of interface and protocol and cipher (for this user) 23 | * `insecure` (boolean): Is this cipher considered insecure? 24 | * `interface` (string): The interface accessed 25 | * `updated_at` (date-time): The most recent use of this combination of interface and protocol and cipher (for this user) 26 | 27 | 28 | --- 29 | 30 | ## List User Cipher Uses 31 | 32 | ``` 33 | files_sdk.user_cipher_use.list({ 34 | "user_id": 1 35 | }) 36 | ``` 37 | 38 | ### Parameters 39 | 40 | * `user_id` (int64): 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` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). 43 | * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `updated_at`. 44 | * `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `insecure` and `updated_at`. Valid field combinations are `[ insecure, updated_at ]`. 45 | * `filter_gt` (object): If set, return records where the specified field is greater than the supplied value. Valid fields are `updated_at`. 46 | * `filter_gteq` (object): If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `updated_at`. 47 | * `filter_lt` (object): If set, return records where the specified field is less than the supplied value. Valid fields are `updated_at`. 48 | * `filter_lteq` (object): If set, return records where the specified field is less than or equal the supplied value. Valid fields are `updated_at`. 49 | --------------------------------------------------------------------------------