├── .gitattributes ├── .gitignore ├── LICENSE.txt ├── README.md ├── Samples └── ShareFile.Sample │ ├── ShareFile.Sample.Vb.Console │ ├── App.config │ ├── MainModule.vb │ ├── My Project │ │ ├── Application.Designer.vb │ │ ├── Application.myapp │ │ ├── AssemblyInfo.vb │ │ ├── Resources.Designer.vb │ │ ├── Resources.resx │ │ ├── Settings.Designer.vb │ │ └── Settings.settings │ ├── SampleFileUpload.txt │ ├── ShareFile.Sample.Vb.Console.vbproj │ └── packages.config │ ├── ShareFile.Sample.WebAuthentication │ ├── App.config │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ShareFile.Sample.WebAuthentication.csproj │ ├── ShareFileWebAuthentication.Designer.cs │ ├── ShareFileWebAuthentication.cs │ ├── ShareFileWebAuthentication.resx │ └── packages.config │ ├── ShareFile.Sample.sln │ └── ShareFile.Sample │ ├── App.config │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── SampleFileUpload.txt │ ├── ShareFile.Sample.Console.csproj │ └── packages.config ├── ShareFile.Api.Client.DotNet.sln └── src ├── NuGetInfo.props └── ShareFile.Api.Client ├── Configuration.cs ├── Converters ├── LoggingConverter.cs ├── ODataConverter.cs ├── ODataFactory.cs └── SafeEnumConverter.cs ├── Credentials ├── CredentialCache.cs ├── CredentialCacheFactory.cs ├── ICredentialCache.cs ├── OAuth2Credential.cs └── PlatformCredentialCache.cs ├── Entities ├── AccessControlsEntity.cs ├── AccountsEntity.cs ├── AppsEntity.cs ├── AsyncOperationsEntity.cs ├── CapabilitiesEntity.cs ├── ConnectorGroupsEntity.cs ├── DevicesEntity.cs ├── EncryptedEmailsEntity.cs ├── FavoriteFoldersEntity.cs ├── FavoritesEntity.cs ├── FileLockEntity.cs ├── FolderTemplatesEntity.cs ├── GroupsEntity.cs ├── ItemsEntity.cs ├── MetadataEntity.cs ├── PoliciesEntity.cs ├── RemoteUploadsEntity.cs ├── ReportsEntity.cs ├── SamlMetadataEntity.cs ├── SessionsEntity.cs ├── SharesEntity.cs ├── StorageCentersEntity.cs ├── UsersEntity.cs ├── WebhookClientsEntity.cs ├── WebhookSubscriptionsEntity.cs ├── WorkflowsEntity.cs └── ZonesEntity.cs ├── EntityBase.cs ├── Enums ├── AddressListType.cs ├── ItemAlias.cs ├── SafeEnum.cs └── UploadStatusCode.cs ├── Events ├── ChangeDomainCallback.cs ├── EventHandlerResponse.cs └── ExceptionCallback.cs ├── Exceptions ├── ApiDownException.cs ├── ApplicationException.cs ├── AsyncOperationScheduledException.cs ├── EntityNotFoundException.cs ├── HttpsExpectedException.cs ├── InvalidApiResponseException.cs ├── ODataRequestException.cs ├── UploadException.cs ├── WebAuthenticationException.cs └── ZoneUnavailableException.cs ├── Extensions ├── BoolExtensions.cs ├── ContactExtensions.cs ├── DictionaryExtensions.cs ├── HttpRequestMessageExtensions.cs ├── HttpResponseMessageExtensions.cs ├── ItemsEntityExtensions.cs ├── ODataObjectExtensions.cs ├── ObjectExtensions.cs ├── QueryExtensions.cs ├── StringExtensions.cs ├── TaskExtensions.cs ├── TypeExtensions.cs └── UriExtensions.cs ├── Logging ├── ActionStopwatch.cs ├── DefaultLoggingProvider.cs ├── ILogger.cs ├── LogLevel.cs └── LoggingProvider.cs ├── Models ├── AccessControl.cs ├── AccessControlBulkResult.cs ├── AccessControlDomains.cs ├── AccessControlFailedEntry.cs ├── AccessControlFilter.cs ├── AccessControlParam.cs ├── AccessControlsBulkParams.cs ├── AccessControlsCloneParams.cs ├── Account.cs ├── AccountMessageCode.cs ├── AccountPreferences.cs ├── AccountSubType.cs ├── AccountUser.cs ├── AccountZoneUsage.cs ├── ActivationToken.cs ├── ActivityReportFilter.cs ├── AdvancedSearchResults.cs ├── AppCodes.cs ├── AsyncOperation.cs ├── AsyncOperationState.cs ├── AsyncOperationType.cs ├── Bandwidth.cs ├── BaseAccountCreationParameters.cs ├── BaseCspAccountParameters.cs ├── BillingContact.cs ├── BillingInfo.cs ├── BrandingLinks.cs ├── Cancellation.cs ├── Capability.cs ├── CapabilityName.cs ├── ChunkType.cs ├── ClientCapability.cs ├── ClientUpgradeWeb.cs ├── CompanyContactInformation.cs ├── ConnectedApp.cs ├── ConnectorGroup.cs ├── ConnectorGroupAccessControl.cs ├── ConnectorGroupKind.cs ├── ConnectorGroupZone.cs ├── Contact.cs ├── CreateWorkflowParams.cs ├── CspTenantAccountParameters.cs ├── CustomMessage.cs ├── CustomWorkflowBundleType.cs ├── DailyAvailability.cs ├── Device.cs ├── DeviceActionInitiatorRole.cs ├── DeviceLogEntry.cs ├── DeviceLogEntryAction.cs ├── DeviceStatus.cs ├── DeviceUser.cs ├── DeviceUserWipe.cs ├── DeviceWipeReport.cs ├── DiskSpace.cs ├── DistributionMethod.cs ├── DlpStatus.cs ├── DocumentViewerPrinting.cs ├── DownloadSpecification.cs ├── ESignature.cs ├── ESignatureDocumentStatus.cs ├── EditingPlatform.cs ├── EditingPlatformInfo.cs ├── EmailAddress.cs ├── EmailSupport.cs ├── EncryptedEmail.cs ├── EncryptedEmailCreateParams.cs ├── EncryptedEmailParams.cs ├── EncryptedEmailRecipient.cs ├── EncryptedEmailReplyParams.cs ├── EncryptedEmailSendParams.cs ├── EnsEventType.cs ├── EnsSubscriberConfiguration.cs ├── EnsSubscriptionRequest.cs ├── EnsSubscriptionToken.cs ├── EntityTypeMap.cs ├── ExceptionReason.cs ├── Favorite.cs ├── FavoriteFolder.cs ├── File.cs ├── FileAndFolderPolicy.cs ├── FileAndFolderSettingOptions.cs ├── FileAndFolderSettings.cs ├── FileLock.cs ├── FileVirusStatus.cs ├── FindSubdomainParams.cs ├── FindSubdomainResult.cs ├── Folder.cs ├── FolderInvite.cs ├── FolderOption.cs ├── FolderTemplate.cs ├── FolderTemplateItem.cs ├── ForbiddenOAuthClientNameWords.cs ├── GenericConfig.cs ├── Group.cs ├── Image32Action.cs ├── InboxMetadata.cs ├── Industry.cs ├── IntegrationProvider.cs ├── IrmClassification.cs ├── IrmPrimaryAccessRightParams.cs ├── Item.cs ├── ItemAction.cs ├── ItemDlpInfo.cs ├── ItemInfo.cs ├── ItemOperations.cs ├── ItemOrderingMode.cs ├── ItemProtocolLink.cs ├── Link.cs ├── MarketAnalytics.cs ├── Metadata.cs ├── MobileSecuritySettings.cs ├── Note.cs ├── NotificationLocale.cs ├── NotifyUsersParams.cs ├── ODataFeed.cs ├── ODataObject.cs ├── ODataObjectType.cs ├── OutlookInformation.cs ├── OutlookInformationOptionBool.cs ├── OutlookInformationOptionInt.cs ├── OutlookInformationOptionString.cs ├── PasswordPolicy.cs ├── PhoneSupport.cs ├── PinLockType.cs ├── PlanFeatures.cs ├── Policy.cs ├── PolicyUsage.cs ├── PowerTools.cs ├── PreviewPlatform.cs ├── PreviewPlatformInfo.cs ├── PreviewStatus.cs ├── Principal.cs ├── ProductDefaults.cs ├── Query.cs ├── QueryPaging.cs ├── QuerySorting.cs ├── Redirection.cs ├── RemoteUpload.cs ├── RemoteUploadRequestParams.cs ├── Report.cs ├── ReportDateOption.cs ├── ReportFilter.cs ├── ReportObjectType.cs ├── ReportRecord.cs ├── ReportRunFrequency.cs ├── ReportRunStatus.cs ├── ReportType.cs ├── RequestedPlan.cs ├── RequireSubdomainResult.cs ├── RequireWebPopResult.cs ├── ResetPasswordRequest.cs ├── SFTool.cs ├── SSOAccountProvider.cs ├── SSOInfo.cs ├── SSOInfoEntry.cs ├── SalesTaxQuote.cs ├── SearchQuery.cs ├── SearchResult.cs ├── SearchResults.cs ├── SecurityQuestion.cs ├── SentNotification.cs ├── Service.cs ├── ServicesCollection.cs ├── Session.cs ├── Share.cs ├── ShareAccessRight.cs ├── ShareAccessRightType.cs ├── ShareActionType.cs ├── ShareAlias.cs ├── ShareFileAccessRights.cs ├── ShareItemHistory.cs ├── ShareRequestParams.cs ├── ShareResendParams.cs ├── ShareSendParams.cs ├── ShareSettings.cs ├── ShareSubType.cs ├── ShareType.cs ├── SimpleQuery.cs ├── SimpleSearchQuery.cs ├── SortDirection.cs ├── SortField.cs ├── StorageCenter.cs ├── StorageCenterUrls.cs ├── StoragePolicy.cs ├── StorageSettings.cs ├── SubdomainAvailabilityResult.cs ├── SubscribedResourceEvent.cs ├── SubscriptionContext.cs ├── Support.cs ├── SupportFeedback.cs ├── SupportMethod.cs ├── SymbolicLink.cs ├── TenantAccountCreationParameters.cs ├── TenantZoneUsageReport.cs ├── ToolInformation.cs ├── TreeMode.cs ├── TwoFactorAuthApp.cs ├── TwoFactorAuthPasscodeType.cs ├── TypeOfTour.cs ├── UXMode.cs ├── UploadMethod.cs ├── UploadRequestParams.cs ├── UploadSpecification.cs ├── User.cs ├── UserAccessPolicy.cs ├── UserAccessSettings.cs ├── UserAuthenticationType.cs ├── UserBulkDowngradeRequest.cs ├── UserBulkOperationRequest.cs ├── UserConfirmRequirement.cs ├── UserConfirmationSettings.cs ├── UserInfo.cs ├── UserPolicy.cs ├── UserPreferences.cs ├── UserRole.cs ├── UserSecurity.cs ├── UserSummaryReportFilter.cs ├── UserUsage.cs ├── VRootType.cs ├── Versioning.cs ├── WatermarkedDownloads.cs ├── WebhookCapabilities.cs ├── WebhookClient.cs ├── WebhookSignatureKeys.cs ├── WebhookSubscription.cs ├── WebhookSupportedContext.cs ├── WebhookSupportedEvents.cs ├── Workflow.cs ├── WorkflowParticipant.cs ├── WorkflowRole.cs ├── WorkflowStatus.cs ├── WorkflowType.cs ├── Zone.cs ├── ZoneService.cs ├── ZoneType.cs └── ZoneUsageBreakdown.cs ├── NotNullAttribute.cs ├── Primitives └── ShareFileId.cs ├── Properties └── AssemblyInfo.cs ├── Requests ├── Executors │ ├── AsyncRequestExecutor.cs │ ├── IAsyncRequestExecutor.cs │ ├── ISyncRequestExecutor.cs │ ├── RequestExecutorFactory.cs │ └── SyncRequestExecutor.cs ├── Filters │ ├── AndFilter.cs │ ├── BooleanFilter.cs │ ├── EndsWithFilter.cs │ ├── EqualToFilter.cs │ ├── Filter.cs │ ├── FunctionEqualityFilter.cs │ ├── GreaterThanFilter.cs │ ├── LessThanFilter.cs │ ├── NotEqualToFilter.cs │ ├── OrFilter.cs │ ├── StartsWithFilter.cs │ ├── SubstringFilter.cs │ └── TypeFilter.cs ├── IQuery.cs ├── ODataParameter.cs ├── ODataParameterCollection.cs ├── Providers │ ├── AsyncRequestProvider.cs │ ├── BaseRequestProvider.cs │ ├── IAsyncRequestProvider.cs │ ├── ISyncRequestProvider.cs │ ├── RequestProviderFactory.cs │ ├── Response.cs │ └── SyncRequestProvider.cs ├── Query.cs └── QueryMetadata.cs ├── Security ├── Authentication │ ├── OAuth2 │ │ ├── IOAuthResponse.cs │ │ ├── OAuth2AuthenticationHelper.cs │ │ ├── OAuthAuthorizationCode.cs │ │ ├── OAuthError.cs │ │ ├── OAuthResponseBase.cs │ │ ├── OAuthService.cs │ │ └── OAuthToken.cs │ └── WebAuthenticationHelper.cs ├── Cryptography │ ├── HmacSha256Provider.cs │ ├── HmacSha256ProviderFactory.cs │ ├── IHmacSha256Provider.cs │ ├── IMD5HashProvider.cs │ ├── MD5HashProviderFactory.cs │ └── PortableMD5HashProvider.cs └── CustomAuthentication.cs ├── ShareFile.Api.Client.csproj ├── ShareFileClient.Entities.cs ├── ShareFileClient.cs └── Transfers ├── Downloaders ├── AsyncDownloaderBase.cs ├── AsyncFileDownloader.cs ├── AsyncMemoryMappedFileDownloader.cs ├── DownloaderBase.cs ├── DownloaderConfig.cs ├── ExpectedLengthStream.cs ├── FileDownloader.cs └── SyncDownloaderBase.cs ├── ProgressStream.cs ├── ShareFileApiResponse.cs ├── StreamWrapper.cs ├── TransferEventArgs.cs ├── TransferProgress.cs ├── TransferProgressReporter.cs ├── TransfererBase.cs ├── UploadResponse.cs ├── UploadSpecificationRequest.cs └── Uploaders ├── ActiveUploadState.cs ├── AsyncMemoryMappedFileUploader.cs ├── AsyncScalingFileUploader.cs ├── AsyncSemaphone.cs ├── AsyncStandardFileUploader.cs ├── AsyncUploaderBase.cs ├── Buffers ├── NoncontiguousMemoryStream.cs ├── PooledBuffer.cs └── PooledBufferAllocator.cs ├── ByteArrayContentWithProgress.cs ├── CompletedBytes.cs ├── FilePart.cs ├── FileUploaderConfig.cs ├── NoDisposeStream.cs ├── PartSizeCalculator.cs ├── ScalingFileUploader.cs ├── ScalingPartUploader.cs ├── StandardFileUploader.cs ├── StreamContentWithProgress.cs ├── SyncUploaderBase.cs └── UploaderBase.cs /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014, Citrix 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 all 13 | 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 THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.Vb.Console/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.Vb.Console/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.Vb.Console/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.Vb.Console/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.Vb.Console/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.Vb.Console/SampleFileUpload.txt: -------------------------------------------------------------------------------- 1 | Uploaded file for ShareFile Sample app! -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.Vb.Console/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.WebAuthentication/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.WebAuthentication/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace ShareFile.Sample.WebAuthentication 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new ShareFileWebAuthentication()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.WebAuthentication/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ShareFile.Sample.WebAuthentication")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ShareFile.Sample.WebAuthentication")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("36fca9e5-9c4d-4541-9900-8480e0f89fb6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.WebAuthentication/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ShareFile.Sample.WebAuthentication.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.WebAuthentication/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample.WebAuthentication/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ShareFile.Sample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ShareFile.Sample")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("262c538a-4874-403f-8397-14d67231fd8b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample/SampleFileUpload.txt: -------------------------------------------------------------------------------- 1 | Uploaded file for ShareFile Sample app! -------------------------------------------------------------------------------- /Samples/ShareFile.Sample/ShareFile.Sample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ShareFile.Api.Client.DotNet.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27004.2005 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShareFile.Api.Client", "src\ShareFile.Api.Client\ShareFile.Api.Client.csproj", "{5B517B21-7981-4DF2-8989-EBE79A850416}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {5B517B21-7981-4DF2-8989-EBE79A850416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {5B517B21-7981-4DF2-8989-EBE79A850416}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {5B517B21-7981-4DF2-8989-EBE79A850416}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {5B517B21-7981-4DF2-8989-EBE79A850416}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {95B84D3C-EDB7-4E23-AB87-FB8DD03E558F} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /src/NuGetInfo.props: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharefile-org/ShareFile-NET/c5199e7764d87cff67eb0189944cbb1f92ed956f/src/NuGetInfo.props -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Credentials/CredentialCacheFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Credentials 4 | { 5 | public static class CredentialCacheFactory 6 | { 7 | private static Func _credentialCacheFunc; 8 | 9 | public static void RegisterCredentialCache(Func credentialCacheFunc) 10 | { 11 | _credentialCacheFunc = credentialCacheFunc; 12 | } 13 | 14 | public static ICredentialCache GetCredentialCache() 15 | { 16 | if (_credentialCacheFunc != null) 17 | { 18 | return _credentialCacheFunc(); 19 | } 20 | return new CredentialCache(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Credentials/ICredentialCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | 4 | namespace ShareFile.Api.Client.Credentials 5 | { 6 | public interface ICredentialCache : ICredentials 7 | { 8 | void Add(Uri uri, string authType, NetworkCredential credentials); 9 | void Remove(Uri uri, string authType); 10 | } 11 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Credentials/OAuth2Credential.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using ShareFile.Api.Client.Security.Authentication.OAuth2; 3 | 4 | namespace ShareFile.Api.Client.Credentials 5 | { 6 | public class OAuth2Credential : NetworkCredential 7 | { 8 | public OAuthToken OAuthToken { get; set; } 9 | 10 | public OAuth2Credential(string oauthToken) 11 | : base("", oauthToken) 12 | { 13 | 14 | } 15 | 16 | public OAuth2Credential(OAuthToken token) 17 | : base ("", token.AccessToken) 18 | { 19 | OAuthToken = token; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Credentials/PlatformCredentialCache.cs: -------------------------------------------------------------------------------- 1 | #if NET45 || NET462 2 | namespace ShareFile.Api.Client.Credentials 3 | { 4 | public class PlatformCredentialCache : System.Net.CredentialCache, ICredentialCache 5 | { 6 | public static void Register() 7 | { 8 | CredentialCacheFactory.RegisterCredentialCache(() => new PlatformCredentialCache()); 9 | } 10 | } 11 | } 12 | #endif -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Entities/SamlMetadataEntity.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using ShareFile.Api.Client; 14 | using ShareFile.Api.Client.Extensions; 15 | using ShareFile.Api.Client.Models; 16 | using ShareFile.Api.Client.Requests; 17 | 18 | 19 | namespace ShareFile.Api.Client.Entities 20 | { 21 | public interface ISamlMetadataEntity : IEntityBase 22 | { 23 | IQuery GetSamlMetadata(); 24 | } 25 | 26 | public class SamlMetadataEntity : EntityBase, ISamlMetadataEntity 27 | { 28 | public SamlMetadataEntity (IShareFileClient client) 29 | : base (client, "SamlMetadata") 30 | { } 31 | 32 | public IQuery GetSamlMetadata() 33 | { 34 | var sfApiQuery = new ShareFile.Api.Client.Requests.Query(Client); 35 | sfApiQuery.From("saml"); 36 | sfApiQuery.Action("metadata"); 37 | sfApiQuery.HttpMethod = "GET"; 38 | return sfApiQuery; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/EntityBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | // ReSharper disable once CheckNamespace 3 | 4 | 5 | namespace ShareFile.Api.Client.Entities 6 | { 7 | public interface IEntityBase 8 | { 9 | IShareFileClient Client { get; set; } 10 | string Entity { get; set; } 11 | 12 | Uri GetEntityUriFromId(string id); 13 | } 14 | 15 | public abstract class EntityBase : IEntityBase 16 | { 17 | protected EntityBase(IShareFileClient client, string entity) 18 | { 19 | Client = client; 20 | Entity = entity; 21 | } 22 | 23 | public IShareFileClient Client { get; set; } 24 | public string Entity { get; set; } 25 | 26 | private static readonly char[] TrimChars = { '/' }; 27 | 28 | /// 29 | /// Will return a composed Uri that will point to () for the BaseUri 30 | /// 31 | public Uri GetEntityUriFromId(string id) 32 | { 33 | string url = Client.BaseUri.ToString(); 34 | 35 | return new Uri(url.TrimEnd(TrimChars) + "/" + Entity + "(" + id + ")", UriKind.RelativeOrAbsolute); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Enums/AddressListType.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace ShareFile.Api.Client.Models 3 | { 4 | public enum AddressListType 5 | { 6 | Default, 7 | Personal, 8 | Shared, 9 | Group, 10 | AllWithGroup, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Enums/ItemAlias.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Enums 2 | { 3 | public enum ItemAlias 4 | { 5 | Connectors, 6 | Top, 7 | Home, 8 | Root, 9 | Box, 10 | Favorites, 11 | SharepointConnectors, 12 | NetworkShareConnectors 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Enums/UploadStatusCode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Enums 4 | { 5 | public enum UploadStatusCode 6 | { 7 | Ok = 0, 8 | Unknown = -1, 9 | Cancelled = -2, 10 | InvalidUploadId = 605 11 | } 12 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Events/ChangeDomainCallback.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using ShareFile.Api.Client.Models; 3 | 4 | namespace ShareFile.Api.Client.Events 5 | { 6 | public delegate EventHandlerResponse ChangeDomainCallback(HttpRequestMessage requestMessage, Redirection redirect); 7 | } 8 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Events/EventHandlerResponse.cs: -------------------------------------------------------------------------------- 1 | using ShareFile.Api.Client.Models; 2 | 3 | namespace ShareFile.Api.Client.Events 4 | { 5 | public enum EventHandlerResponseAction { Ignore, Throw, Retry, Redirect } 6 | 7 | public class EventHandlerResponse 8 | { 9 | public EventHandlerResponseAction Action { get; set; } 10 | public Redirection Redirection { get; set; } 11 | 12 | public static EventHandlerResponse Throw = new EventHandlerResponse {Action = EventHandlerResponseAction.Throw}; 13 | public static EventHandlerResponse Ignore = new EventHandlerResponse { Action = EventHandlerResponseAction.Ignore }; 14 | 15 | public static EventHandlerResponse Redirect(Redirection redirection) 16 | { 17 | return new EventHandlerResponse 18 | { 19 | Action = EventHandlerResponseAction.Redirect, 20 | Redirection = redirection 21 | }; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Events/ExceptionCallback.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | 3 | namespace ShareFile.Api.Client.Events 4 | { 5 | public delegate EventHandlerResponse ExceptionCallback(HttpResponseMessage responseMessage, int retryCount); 6 | } 7 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Exceptions/ApiDownException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Exceptions 4 | { 5 | public class ApiDownException : Exception 6 | { 7 | public ApiDownException() 8 | : base("The API is currently in maintenance mode. Try again later.") 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Exceptions/ApplicationException.cs: -------------------------------------------------------------------------------- 1 | #if NETFX_CORE 2 | using System; 3 | 4 | namespace ShareFile.Api.Client.Exceptions 5 | { 6 | public class ApplicationException : Exception 7 | { 8 | public ApplicationException(string message, Exception innerException = null) : 9 | base(message, innerException) 10 | { 11 | 12 | } 13 | } 14 | } 15 | #endif 16 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Exceptions/AsyncOperationScheduledException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ShareFile.Api.Client.Models; 3 | 4 | namespace ShareFile.Api.Client.Exceptions 5 | { 6 | public class AsyncOperationScheduledException : Exception 7 | { 8 | public AsyncOperationScheduledException(ODataFeed asyncOperation) 9 | { 10 | ScheduledOperations = asyncOperation; 11 | } 12 | 13 | public ODataFeed ScheduledOperations { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Exceptions/EntityNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Exceptions 4 | { 5 | public class EntityNotFoundException : Exception 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Exceptions/HttpsExpectedException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Exceptions 4 | { 5 | public class HttpsExpectedException : Exception 6 | { 7 | public Uri RedirectUri { get; set; } 8 | 9 | public HttpsExpectedException() 10 | : base("A redirect request will change a secure to a non-secure connection") 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Exceptions/InvalidApiResponseException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | 4 | namespace ShareFile.Api.Client.Exceptions 5 | { 6 | public class InvalidApiResponseException : Exception 7 | { 8 | public HttpStatusCode StatusCode { get; set; } 9 | 10 | public InvalidApiResponseException(HttpStatusCode code, string message, Exception innerException = null) 11 | : base (message, innerException) 12 | { 13 | StatusCode = code; 14 | } 15 | 16 | public override string ToString() 17 | { 18 | return string.Format("StatusCode: {0}{1}{2}", StatusCode, Environment.NewLine, base.ToString()); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Exceptions/ODataRequestException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net; 4 | using Newtonsoft.Json; 5 | using ShareFile.Api.Client.Models; 6 | 7 | namespace ShareFile.Api.Client.Exceptions 8 | { 9 | public class ODataRequestException 10 | { 11 | [JsonProperty("code")] 12 | public HttpStatusCode Code { get; set; } 13 | [JsonProperty("message")] 14 | public ODataExceptionMessage Message { get; set; } 15 | [JsonProperty("reason")] 16 | public SafeEnum ExceptionReason { get; set; } 17 | [JsonProperty("errorLog")] 18 | public List ErrorLog { get; set; } 19 | } 20 | 21 | public class ODataException : Exception 22 | { 23 | public HttpStatusCode Code { get; set; } 24 | public ODataExceptionMessage ODataExceptionMessage { get; set; } 25 | public SafeEnum ExceptionReason { get; set; } 26 | public List ErrorLog { get; set; } 27 | public override string Message 28 | { 29 | get 30 | { 31 | if (ODataExceptionMessage == null) 32 | return base.Message; 33 | return ODataExceptionMessage.Message; 34 | } 35 | } 36 | } 37 | 38 | public class ODataExceptionMessage 39 | { 40 | [JsonProperty("lang")] 41 | public string Language { get; set; } 42 | [JsonProperty("value")] 43 | public string Message { get; set; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Exceptions/UploadException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | 4 | using ShareFile.Api.Client.Enums; 5 | using ShareFile.Api.Client.Transfers; 6 | 7 | namespace ShareFile.Api.Client.Exceptions 8 | { 9 | public class UploadException : Exception 10 | { 11 | public readonly ActiveUploadState ActiveUploadState; 12 | 13 | public readonly UploadStatusCode StatusCode; 14 | 15 | public HttpStatusCode? HttpStatusCode { get; set; } 16 | 17 | public UploadException(string errorMessage, UploadStatusCode errorCode, Exception baseException = null) 18 | : base(string.Format("ErrorCode: {0}" + Environment.NewLine + "Message: {1}", errorCode, errorMessage), baseException) 19 | { 20 | StatusCode = errorCode; 21 | } 22 | 23 | public UploadException(string errorMessage, UploadStatusCode errorCode, ActiveUploadState activeUploadState, Exception baseException = null) 24 | : base(string.Format("ErrorCode: {0}" + Environment.NewLine + "Message: {1}", errorCode, errorMessage), baseException) 25 | { 26 | StatusCode = errorCode; 27 | ActiveUploadState = activeUploadState; 28 | } 29 | 30 | // 4.1.2016 - The string check is for older versions of SZC that do not return the error code 31 | public bool IsInvalidUploadId 32 | { 33 | get 34 | { 35 | const string BadUploadIdMessage = "Unrecognized Upload ID"; 36 | return StatusCode == UploadStatusCode.InvalidUploadId || Message.Contains(BadUploadIdMessage) 37 | || (InnerException != null && InnerException.Message.Contains(BadUploadIdMessage)); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Exceptions/ZoneUnavailableException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ShareFile.Api.Client.Exceptions 7 | { 8 | public class ZoneUnavailableException : Exception 9 | { 10 | public Uri RequestUri { get; set; } 11 | 12 | public ZoneUnavailableException(Uri requestUri, string message = null, Exception innerException = null) : base(message, innerException) 13 | { 14 | this.RequestUri = requestUri; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Extensions/BoolExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ShareFile.Api.Client.Extensions 7 | { 8 | public static class BoolExtensions 9 | { 10 | public static string ToLowerString(this bool value) 11 | { 12 | return value.ToString().ToLowerInvariant(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Extensions/ContactExtensions.cs: -------------------------------------------------------------------------------- 1 | using ShareFile.Api.Client.Models; 2 | 3 | namespace ShareFile.Api.Client.Extensions 4 | { 5 | public static class ContactExtensions 6 | { 7 | public static bool IsDistributionGroup(this Contact contact) 8 | { 9 | return contact.Id != null && contact.Id.StartsWith("g"); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Extensions/DictionaryExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using ShareFile.Api.Client.Security.Authentication.OAuth2; 3 | 4 | namespace ShareFile.Api.Client.Extensions 5 | { 6 | internal static class DictionaryExtensions 7 | { 8 | internal static IOAuthResponse ToOAuthResponse(this Dictionary value) 9 | { 10 | IOAuthResponse response; 11 | 12 | if (value.ContainsKey("code")) 13 | { 14 | response = new OAuthAuthorizationCode(); 15 | } 16 | else if (value.ContainsKey("access_token")) 17 | { 18 | response = new OAuthToken(); 19 | } 20 | else if (value.ContainsKey("error")) 21 | { 22 | response = new OAuthError(); 23 | } 24 | else response = new OAuthResponseBase(); 25 | 26 | response.Fill(value); 27 | return response; 28 | } 29 | 30 | internal static bool TryRemoveValue(this IDictionary values, string key, out string value) 31 | { 32 | if (values != null) 33 | { 34 | if (values.TryGetValue(key, out value)) 35 | { 36 | values.Remove(key); 37 | return true; 38 | } 39 | } 40 | value = string.Empty; 41 | return false; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Extensions/HttpResponseMessageExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Http; 4 | 5 | using ShareFile.Api.Client.Exceptions; 6 | 7 | namespace ShareFile.Api.Client.Extensions 8 | { 9 | public static class HttpResponseMessageExtensions 10 | { 11 | public static bool HasContent(this HttpResponseMessage message) 12 | { 13 | return message.Content != null && message.Content.Headers != null 14 | && message.Content.Headers.ContentLength > 0; 15 | } 16 | 17 | /// 18 | /// Gets the redirection if available. 19 | /// If an HTTP redirection is returned, then it throws. 20 | /// 21 | /// 22 | /// 23 | /// 24 | public static Uri GetSecureRedirect(this HttpResponseMessage message) 25 | { 26 | switch (message.StatusCode) 27 | { 28 | case HttpStatusCode.Moved: 29 | case HttpStatusCode.Redirect: 30 | Uri redirectTo = message.Headers.Location; 31 | if (!redirectTo.IsAbsoluteUri) 32 | { 33 | redirectTo = new Uri(message.RequestMessage.RequestUri, redirectTo); 34 | } 35 | if (!redirectTo.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase)) 36 | { 37 | if (string.Equals(redirectTo.Host, "maintenance.sharefile.com", StringComparison.OrdinalIgnoreCase)) 38 | { 39 | throw new ApiDownException(); 40 | } 41 | 42 | throw new HttpsExpectedException { RedirectUri = redirectTo }; 43 | } 44 | return redirectTo; 45 | } 46 | return null; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Extensions/ItemsEntityExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ShareFile.Api.Client.Entities; 3 | using ShareFile.Api.Client.Enums; 4 | 5 | namespace ShareFile.Api.Client.Extensions 6 | { 7 | public static class ItemsEntityExtensions 8 | { 9 | /// 10 | /// Will return a composed Uri that will point to Items(alias) for the BaseUri 11 | /// 12 | /// 13 | public static Uri GetAlias(this IItemsEntity items, ItemAlias alias) 14 | { 15 | string aliasString; 16 | switch (alias) 17 | { 18 | case ItemAlias.NetworkShareConnectors: 19 | aliasString = "c-cifs"; 20 | break; 21 | case ItemAlias.SharepointConnectors: 22 | aliasString = "c-sp"; 23 | break; 24 | default: 25 | aliasString = alias.ToString().ToLower(); 26 | break; 27 | } 28 | 29 | return items.GetEntityUriFromId(aliasString); 30 | } 31 | 32 | /// 33 | /// Will return a composed Uri that will point to Items(alias) for the BaseUri 34 | /// 35 | /// 36 | public static Uri GetAlias(this IItemsEntity items, string aliasOrId) 37 | { 38 | return items.GetEntityUriFromId(aliasOrId); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Extensions/ObjectExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using ShareFile.Api.Client.Models; 6 | 7 | namespace ShareFile.Api.Client.Extensions 8 | { 9 | public static class ObjectExtensions 10 | { 11 | public static SafeEnum ToSafeEnum(this object @enum) 12 | where TEnum : struct 13 | { 14 | var instance = Activator.CreateInstance>(); 15 | instance.Object = @enum; 16 | 17 | return instance; 18 | } 19 | 20 | public static TResult As(this object obj, Func map) 21 | { 22 | return As(obj, map, default(TResult)); 23 | } 24 | 25 | public static TResult As(this object obj, Func map, TResult defaultValue) 26 | { 27 | //check assignable from instead? 28 | if (obj is TCast) 29 | { 30 | return map((TCast)obj); 31 | } 32 | else 33 | { 34 | return defaultValue; 35 | } 36 | } 37 | 38 | public static T Bound(this T value, T upperBound, T lowerBound) where T : IComparable 39 | { 40 | if (value.CompareTo(upperBound) == 1) 41 | return upperBound; 42 | else if (value.CompareTo(lowerBound) == -1) 43 | return lowerBound; 44 | else 45 | return value; 46 | } 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Logging/ILogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Logging 4 | { 5 | public interface ILogger 6 | { 7 | #if !NO_CALLERMEMBER 8 | bool LogCallerMember { get; } 9 | #endif 10 | LogLevel LogLevel { get; set; } 11 | void Trace(string message); 12 | void Trace(Exception exception, string message); 13 | void Debug(string message); 14 | void Debug(Exception exception, string message); 15 | void Info(string message); 16 | void Info(Exception exception, string message); 17 | void Warn(string message); 18 | void Warn(Exception exception, string message); 19 | void Error(string message); 20 | void Error(Exception exception, string message); 21 | void Fatal(string message); 22 | void Fatal(Exception exception, string message); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Logging/LogLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Logging 4 | { 5 | [Flags] 6 | public enum LogLevel 7 | { 8 | None = 0, 9 | Trace = 1 << 0, 10 | Debug = 1 << 1, 11 | Info = 1 << 2, 12 | Warn = 1 << 3, 13 | Error = 1 << 4, 14 | Fatal = 1 << 5 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/AccessControlFilter.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Specifies whether an access control list is interpreted as a list of allowed or disallowed domains 17 | /// 18 | public enum AccessControlFilter 19 | { 20 | 21 | /// 22 | /// allow specified domains 23 | /// 24 | AllowDomains = 0, 25 | 26 | /// 27 | /// disallow specified domains 28 | /// 29 | DisallowDomains = 1 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/AccountSubType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum AccountSubType 15 | { 16 | None = 0, 17 | Partner = 1, 18 | Tenant = 2 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ActivationToken.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// User Activation Token 24 | /// 25 | public class ActivationToken : ODataObject 26 | { 27 | public string Token { get; set; } 28 | 29 | public override void Copy(ODataObject source, JsonSerializer serializer) 30 | { 31 | if(source == null || serializer == null) return; 32 | base.Copy(source, serializer); 33 | 34 | var typedSource = source as ActivationToken; 35 | if(typedSource != null) 36 | { 37 | Token = typedSource.Token; 38 | } 39 | else 40 | { 41 | JToken token; 42 | if(source.TryGetProperty("Token", out token) && token.Type != JTokenType.Null) 43 | { 44 | Token = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ActivityReportFilter.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class ActivityReportFilter : ReportFilter 23 | { 24 | /// 25 | /// The Activity Types to include in the Report 26 | /// 27 | public IEnumerable ActivityTypes { get; set; } 28 | 29 | public override void Copy(ODataObject source, JsonSerializer serializer) 30 | { 31 | if(source == null || serializer == null) return; 32 | base.Copy(source, serializer); 33 | 34 | var typedSource = source as ActivityReportFilter; 35 | if(typedSource != null) 36 | { 37 | ActivityTypes = typedSource.ActivityTypes; 38 | } 39 | else 40 | { 41 | JToken token; 42 | if(source.TryGetProperty("ActivityTypes", out token) && token.Type != JTokenType.Null) 43 | { 44 | ActivityTypes = (IEnumerable)serializer.Deserialize(token.CreateReader(), typeof(IEnumerable)); 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/AsyncOperationState.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Async Operation state 17 | /// 18 | public enum AsyncOperationState 19 | { 20 | Created = 0, 21 | Scheduled = 1, 22 | Success = 2, 23 | Failure = 3, 24 | Canceled = 4 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/BaseCspAccountParameters.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class BaseCspAccountParameters : BaseAccountCreationParameters 23 | { 24 | /// 25 | /// Support contact information for this account 26 | /// 27 | public Support SupportInfo { get; set; } 28 | 29 | public override void Copy(ODataObject source, JsonSerializer serializer) 30 | { 31 | if(source == null || serializer == null) return; 32 | base.Copy(source, serializer); 33 | 34 | var typedSource = source as BaseCspAccountParameters; 35 | if(typedSource != null) 36 | { 37 | SupportInfo = typedSource.SupportInfo; 38 | } 39 | else 40 | { 41 | JToken token; 42 | if(source.TryGetProperty("SupportInfo", out token) && token.Type != JTokenType.Null) 43 | { 44 | SupportInfo = (Support)serializer.Deserialize(token.CreateReader(), typeof(Support)); 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ChunkType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ChunkType 15 | { 16 | Alphanumeric = 0, 17 | Numeric = 1 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ClientCapability.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ClientCapability 15 | { 16 | HardLock = 0, 17 | 18 | /// 19 | /// If supplied, then calls to Items(favorites) will return all favorites (not just folders) 20 | /// 21 | ItemFavorites = 1, 22 | 23 | /// 24 | /// If supplied, then Personal Cloud and Office 365 connectors will be grouped under the c-pcc and c-o365 folders. 25 | /// 26 | CloudConnectorGroups = 2 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ClientUpgradeWeb.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class ClientUpgradeWeb : ODataObject 23 | { 24 | public string ClientUpgradeLink { get; set; } 25 | public string ClientUpgradeText { get; set; } 26 | 27 | public override void Copy(ODataObject source, JsonSerializer serializer) 28 | { 29 | if(source == null || serializer == null) return; 30 | base.Copy(source, serializer); 31 | 32 | var typedSource = source as ClientUpgradeWeb; 33 | if(typedSource != null) 34 | { 35 | ClientUpgradeLink = typedSource.ClientUpgradeLink; 36 | ClientUpgradeText = typedSource.ClientUpgradeText; 37 | } 38 | else 39 | { 40 | JToken token; 41 | if(source.TryGetProperty("ClientUpgradeLink", out token) && token.Type != JTokenType.Null) 42 | { 43 | ClientUpgradeLink = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 44 | } 45 | if(source.TryGetProperty("ClientUpgradeText", out token) && token.Type != JTokenType.Null) 46 | { 47 | ClientUpgradeText = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/CompanyContactInformation.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | #if !ShareFile 23 | public class CompanyContactInformation : ODataObject 24 | { 25 | /// 26 | /// Company Name 27 | /// 28 | public string CompanyName { get; set; } 29 | /// 30 | /// Company Phone number 31 | /// 32 | public string PhoneNumber { get; set; } 33 | 34 | public override void Copy(ODataObject source, JsonSerializer serializer) 35 | { 36 | if(source == null || serializer == null) return; 37 | base.Copy(source, serializer); 38 | 39 | var typedSource = source as CompanyContactInformation; 40 | if(typedSource != null) 41 | { 42 | CompanyName = typedSource.CompanyName; 43 | PhoneNumber = typedSource.PhoneNumber; 44 | } 45 | else 46 | { 47 | JToken token; 48 | if(source.TryGetProperty("CompanyName", out token) && token.Type != JTokenType.Null) 49 | { 50 | CompanyName = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 51 | } 52 | if(source.TryGetProperty("PhoneNumber", out token) && token.Type != JTokenType.Null) 53 | { 54 | PhoneNumber = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 55 | } 56 | } 57 | } 58 | } 59 | #endif 60 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ConnectorGroupKind.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ConnectorGroupKind 15 | { 16 | Cloud = 0, 17 | Zone = 1, 18 | SDK = 2, 19 | Agent = 3 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/CustomMessage.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class CustomMessage : ODataObject 23 | { 24 | public string Message { get; set; } 25 | 26 | public override void Copy(ODataObject source, JsonSerializer serializer) 27 | { 28 | if(source == null || serializer == null) return; 29 | base.Copy(source, serializer); 30 | 31 | var typedSource = source as CustomMessage; 32 | if(typedSource != null) 33 | { 34 | Message = typedSource.Message; 35 | } 36 | else 37 | { 38 | JToken token; 39 | if(source.TryGetProperty("Message", out token) && token.Type != JTokenType.Null) 40 | { 41 | Message = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 42 | } 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/CustomWorkflowBundleType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum CustomWorkflowBundleType 15 | { 16 | Form = 0, 17 | Template = 1, 18 | Workflow = 2 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/DeviceActionInitiatorRole.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum DeviceActionInitiatorRole 15 | { 16 | AccountAdmin = 0, 17 | DeviceOwner = 1, 18 | DeviceUser = 2 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/DeviceLogEntryAction.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Device Log Entry Action 17 | /// 18 | public enum DeviceLogEntryAction 19 | { 20 | OpenGeneric = 0, 21 | OpenExternal = 1, 22 | OpenPreview = 2, 23 | ShareSocial = 3 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/DistributionMethod.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum DistributionMethod 15 | { 16 | Managed = 0, 17 | Link = 1 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/DlpStatus.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Data Loss Prevention file scan status. 17 | /// 18 | public enum DlpStatus 19 | { 20 | 21 | /// 22 | /// The file has not been scanned for policy violations. 23 | /// 24 | Unscanned = 0, 25 | 26 | /// 27 | /// The file has been scanned and no policy violations were found. 28 | /// 29 | ScannedOK = 1, 30 | 31 | /// 32 | /// The file has been scanned and a policy violation was found. 33 | /// 34 | ScannedRejected = 2 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/DocumentViewerPrinting.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum DocumentViewerPrinting 15 | { 16 | Default = 0, 17 | Enabled = 1, 18 | Disabled = 2 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ESignatureDocumentStatus.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ESignatureDocumentStatus 15 | { 16 | SentToProvider = 0, 17 | SentForSignature = 1, 18 | Signed = 2, 19 | Complete = 3 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/EditingPlatform.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Platform(s) supported to edit document 17 | /// 18 | public enum EditingPlatform 19 | { 20 | MicrosoftOfficeOnline = 0 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/EditingPlatformInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Represents the info about editing platforms supported 24 | /// 25 | public class EditingPlatformInfo : ODataObject 26 | { 27 | public SafeEnum EditingPlatform { get; set; } 28 | public ItemProtocolLink ItemProtocolLink { get; set; } 29 | 30 | public override void Copy(ODataObject source, JsonSerializer serializer) 31 | { 32 | if(source == null || serializer == null) return; 33 | base.Copy(source, serializer); 34 | 35 | var typedSource = source as EditingPlatformInfo; 36 | if(typedSource != null) 37 | { 38 | EditingPlatform = typedSource.EditingPlatform; 39 | ItemProtocolLink = typedSource.ItemProtocolLink; 40 | } 41 | else 42 | { 43 | JToken token; 44 | if(source.TryGetProperty("EditingPlatform", out token) && token.Type != JTokenType.Null) 45 | { 46 | EditingPlatform = (SafeEnum)serializer.Deserialize(token.CreateReader(), typeof(SafeEnum)); 47 | } 48 | if(source.TryGetProperty("ItemProtocolLink", out token) && token.Type != JTokenType.Null) 49 | { 50 | ItemProtocolLink = (ItemProtocolLink)serializer.Deserialize(token.CreateReader(), typeof(ItemProtocolLink)); 51 | } 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/EmailAddress.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class EmailAddress : ODataObject 23 | { 24 | public string Email { get; set; } 25 | public bool? IsConfirmed { get; set; } 26 | public bool? IsPrimary { get; set; } 27 | 28 | public override void Copy(ODataObject source, JsonSerializer serializer) 29 | { 30 | if(source == null || serializer == null) return; 31 | base.Copy(source, serializer); 32 | 33 | var typedSource = source as EmailAddress; 34 | if(typedSource != null) 35 | { 36 | Email = typedSource.Email; 37 | IsConfirmed = typedSource.IsConfirmed; 38 | IsPrimary = typedSource.IsPrimary; 39 | } 40 | else 41 | { 42 | JToken token; 43 | if(source.TryGetProperty("Email", out token) && token.Type != JTokenType.Null) 44 | { 45 | Email = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 46 | } 47 | if(source.TryGetProperty("IsConfirmed", out token) && token.Type != JTokenType.Null) 48 | { 49 | IsConfirmed = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?)); 50 | } 51 | if(source.TryGetProperty("IsPrimary", out token) && token.Type != JTokenType.Null) 52 | { 53 | IsPrimary = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?)); 54 | } 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/EmailSupport.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class EmailSupport : SupportMethod 23 | { 24 | public string Email { get; set; } 25 | 26 | public override void Copy(ODataObject source, JsonSerializer serializer) 27 | { 28 | if(source == null || serializer == null) return; 29 | base.Copy(source, serializer); 30 | 31 | var typedSource = source as EmailSupport; 32 | if(typedSource != null) 33 | { 34 | Email = typedSource.Email; 35 | } 36 | else 37 | { 38 | JToken token; 39 | if(source.TryGetProperty("Email", out token) && token.Type != JTokenType.Null) 40 | { 41 | Email = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 42 | } 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/EnsEventType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Type of ENS Event 17 | /// 18 | [Flags] 19 | public enum EnsEventType 20 | { 21 | None = 0, 22 | Create = 1, 23 | Update = 2, 24 | Delete = 4, 25 | All = 7 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/FileAndFolderPolicy.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Represents a File and Folder Category Policy definition for use within ShareFile's Policy Based Administration 24 | /// 25 | public class FileAndFolderPolicy : Policy 26 | { 27 | /// 28 | /// The settings managed for this Policy 29 | /// 30 | public FileAndFolderSettings Settings { get; set; } 31 | 32 | public override void Copy(ODataObject source, JsonSerializer serializer) 33 | { 34 | if(source == null || serializer == null) return; 35 | base.Copy(source, serializer); 36 | 37 | var typedSource = source as FileAndFolderPolicy; 38 | if(typedSource != null) 39 | { 40 | Settings = typedSource.Settings; 41 | } 42 | else 43 | { 44 | JToken token; 45 | if(source.TryGetProperty("Settings", out token) && token.Type != JTokenType.Null) 46 | { 47 | Settings = (FileAndFolderSettings)serializer.Deserialize(token.CreateReader(), typeof(FileAndFolderSettings)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/FileVirusStatus.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Enumeration for Virus Scan status of an Item. 17 | /// 18 | public enum FileVirusStatus 19 | { 20 | 21 | /// 22 | /// File was scanned and an A/V warning was received 23 | /// 24 | VirusWarning = -1, 25 | 26 | /// 27 | /// File has not been scanned yet 28 | /// 29 | NotScanned = 0, 30 | 31 | /// 32 | /// File was scanned and no viruses were found 33 | /// 34 | Clean = 1 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/FolderOption.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum FolderOption 15 | { 16 | ForcedSort = 0, 17 | ForcedThumbnails = 1, 18 | EnableDisplayInline = 2, 19 | EnableDocViewerPrinting = 3, 20 | ViewOnlyWatermarkText = 4, 21 | IsVersioned = 5, 22 | EnableWatermarkedDownloads = 6, 23 | MaxVersions = 7 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ForbiddenOAuthClientNameWords.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// ForbiddenOAuthClientNameWords 24 | /// 25 | public class ForbiddenOAuthClientNameWords : ODataObject 26 | { 27 | public IEnumerable Words { get; set; } 28 | 29 | public override void Copy(ODataObject source, JsonSerializer serializer) 30 | { 31 | if(source == null || serializer == null) return; 32 | base.Copy(source, serializer); 33 | 34 | var typedSource = source as ForbiddenOAuthClientNameWords; 35 | if(typedSource != null) 36 | { 37 | Words = typedSource.Words; 38 | } 39 | else 40 | { 41 | JToken token; 42 | if(source.TryGetProperty("Words", out token) && token.Type != JTokenType.Null) 43 | { 44 | Words = (IEnumerable)serializer.Deserialize(token.CreateReader(), typeof(IEnumerable)); 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/Image32Action.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum Image32Action 15 | { 16 | View = 0, 17 | ViewThumbnail = 1 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/InboxMetadata.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// InboxMetadata contains metadata of the inbox for a user. 24 | /// 25 | public class InboxMetadata : ODataObject 26 | { 27 | public int UnreadSendUnarchived { get; set; } 28 | public int UnreadRequestUnarchived { get; set; } 29 | 30 | public override void Copy(ODataObject source, JsonSerializer serializer) 31 | { 32 | if(source == null || serializer == null) return; 33 | base.Copy(source, serializer); 34 | 35 | var typedSource = source as InboxMetadata; 36 | if(typedSource != null) 37 | { 38 | UnreadSendUnarchived = typedSource.UnreadSendUnarchived; 39 | UnreadRequestUnarchived = typedSource.UnreadRequestUnarchived; 40 | } 41 | else 42 | { 43 | JToken token; 44 | if(source.TryGetProperty("UnreadSendUnarchived", out token) && token.Type != JTokenType.Null) 45 | { 46 | UnreadSendUnarchived = (int)serializer.Deserialize(token.CreateReader(), typeof(int)); 47 | } 48 | if(source.TryGetProperty("UnreadRequestUnarchived", out token) && token.Type != JTokenType.Null) 49 | { 50 | UnreadRequestUnarchived = (int)serializer.Deserialize(token.CreateReader(), typeof(int)); 51 | } 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/Industry.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class Industry : ODataObject 23 | { 24 | public string Name { get; set; } 25 | 26 | public override void Copy(ODataObject source, JsonSerializer serializer) 27 | { 28 | if(source == null || serializer == null) return; 29 | base.Copy(source, serializer); 30 | 31 | var typedSource = source as Industry; 32 | if(typedSource != null) 33 | { 34 | Name = typedSource.Name; 35 | } 36 | else 37 | { 38 | JToken token; 39 | if(source.TryGetProperty("Name", out token) && token.Type != JTokenType.Null) 40 | { 41 | Name = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 42 | } 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/IntegrationProvider.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum IntegrationProvider 15 | { 16 | RightSignature = 0, 17 | RightSignature4 = 1, 18 | DocumentApprovalWorkflow = 2, 19 | Image32 = 3, 20 | ContentViewer = 4, 21 | ThirdPartyCloudSyncService = 5 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ItemAction.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ItemAction 15 | { 16 | Download = 0, 17 | Upload = 1, 18 | View = 2, 19 | WatermarkDownload = 3, 20 | Note = 4, 21 | Url = 5, 22 | DownloadESignature = 6, 23 | WOPI_View = 7, 24 | WOPI_Download = 8, 25 | UploadReceipt = 9, 26 | FileLock = 10, 27 | FileUnLock = 11, 28 | FileDiscardLock = 12, 29 | None = 13, 30 | ZipUpload = 14, 31 | Item_Delete = 15, 32 | Item_Edit = 16, 33 | Item_Restore = 17, 34 | Move = 18, 35 | NewFolder = 19, 36 | NewNote = 20, 37 | NewLink = 21, 38 | StreamLockCreate = 22, 39 | StreamLockDelete = 23, 40 | StreamLockUpdate = 24, 41 | StreamLockRelease = 25, 42 | DLP_Scan_Accept = 26, 43 | DLP_Scan_Reject = 27, 44 | DLP_Share_Allow = 28, 45 | DLP_Share_Deny = 29, 46 | Document_View = 30, 47 | Document_Edit = 31, 48 | Item_Archive = 32 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ItemDlpInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Data Loss Prevention information for a specific Item. 24 | /// 25 | public class ItemDlpInfo : ODataObject 26 | { 27 | /// 28 | /// File scan status 29 | /// 30 | public SafeEnum Status { get; set; } 31 | 32 | public override void Copy(ODataObject source, JsonSerializer serializer) 33 | { 34 | if(source == null || serializer == null) return; 35 | base.Copy(source, serializer); 36 | 37 | var typedSource = source as ItemDlpInfo; 38 | if(typedSource != null) 39 | { 40 | Status = typedSource.Status; 41 | } 42 | else 43 | { 44 | JToken token; 45 | if(source.TryGetProperty("Status", out token) && token.Type != JTokenType.Null) 46 | { 47 | Status = (SafeEnum)serializer.Deserialize(token.CreateReader(), typeof(SafeEnum)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ItemOperations.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | [Flags] 15 | public enum ItemOperations 16 | { 17 | None = 0, 18 | CanDownload = 1, 19 | CanShareEmail = 2, 20 | CanShareLink = 4, 21 | CanDelete = 8, 22 | CanEditMetadata = 16, 23 | CanMove = 32, 24 | CanCopy = 64, 25 | CanEditDocument = 128, 26 | CanSignRS3 = 256, 27 | CanSignRS4 = 512, 28 | CanCheckOut = 1024, 29 | CanCheckIn = 2048, 30 | CanDiscardCheckout = 4096, 31 | CanToggleFavorite = 8192, 32 | CanInitiateApproval = 16384, 33 | CanCreateOfficeDocuments = 32768, 34 | CanUnzipFiles = 65536, 35 | CanPreview = 131072, 36 | CanRequestFiles = 262144 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ItemOrderingMode.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ItemOrderingMode 15 | { 16 | 17 | /// 18 | /// Default ordering mode is to sort with the folders first if no $orderby is specified, otherwise obey the $orderby exclusively 19 | /// 20 | Default = 0, 21 | 22 | /// 23 | /// Sort folders to the top of result set prior to applying any $orderby 24 | /// 25 | FoldersFirst = 1, 26 | 27 | /// 28 | /// Sort folders based on the persisted folder sort options. If the folder options call for "UserPreferences", honor $orderby, otherwise override. 29 | /// 30 | UseFolderOptions = 2 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ItemProtocolLink.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class ItemProtocolLink : ODataObject 23 | { 24 | public string Link { get; set; } 25 | public Redirection Redirection { get; set; } 26 | 27 | public override void Copy(ODataObject source, JsonSerializer serializer) 28 | { 29 | if(source == null || serializer == null) return; 30 | base.Copy(source, serializer); 31 | 32 | var typedSource = source as ItemProtocolLink; 33 | if(typedSource != null) 34 | { 35 | Link = typedSource.Link; 36 | Redirection = typedSource.Redirection; 37 | } 38 | else 39 | { 40 | JToken token; 41 | if(source.TryGetProperty("Link", out token) && token.Type != JTokenType.Null) 42 | { 43 | Link = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 44 | } 45 | if(source.TryGetProperty("Redirection", out token) && token.Type != JTokenType.Null) 46 | { 47 | Redirection = (Redirection)serializer.Deserialize(token.CreateReader(), typeof(Redirection)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/Link.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Represents an URL object that can be added to a ShareFile Folder and shared with 24 | /// other users. 25 | /// 26 | /// Some Storage Zones providers do not support Link objects - for example CIFS providers. The 27 | /// ItemLink Capability indicates whether Links are supported in a provider 28 | /// 29 | public class Link : Item 30 | { 31 | /// 32 | /// Universal Reference Identifier for this Link object 33 | /// 34 | public Uri Uri { get; set; } 35 | 36 | public override void Copy(ODataObject source, JsonSerializer serializer) 37 | { 38 | if(source == null || serializer == null) return; 39 | base.Copy(source, serializer); 40 | 41 | var typedSource = source as Link; 42 | if(typedSource != null) 43 | { 44 | Uri = typedSource.Uri; 45 | } 46 | else 47 | { 48 | JToken token; 49 | if(source.TryGetProperty("Uri", out token) && token.Type != JTokenType.Null) 50 | { 51 | Uri = (Uri)serializer.Deserialize(token.CreateReader(), typeof(Uri)); 52 | } 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/Note.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Represents a Note object that can be added to a ShareFile Folder and shared with 24 | /// other users. 25 | /// 26 | /// Some Storage Zones providers do not support Note objects - for example CIFS providers. The 27 | /// ItemNote Capability indicates whether Notes are supported in a provider 28 | /// 29 | public class Note : Item 30 | { 31 | 32 | public override void Copy(ODataObject source, JsonSerializer serializer) 33 | { 34 | if(source == null || serializer == null) return; 35 | base.Copy(source, serializer); 36 | 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/NotificationLocale.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum NotificationLocale 15 | { 16 | Invariant = 0, 17 | English = 1, 18 | German = 2, 19 | Spanish = 3, 20 | French = 4, 21 | Dutch = 5, 22 | Chinese = 6, 23 | Russian = 7, 24 | Japanese = 8, 25 | Korean = 9, 26 | Portuguese = 10 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/NotifyUsersParams.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class NotifyUsersParams : ODataObject 23 | { 24 | public IEnumerable UserIds { get; set; } 25 | public string CustomMessage { get; set; } 26 | 27 | public override void Copy(ODataObject source, JsonSerializer serializer) 28 | { 29 | if(source == null || serializer == null) return; 30 | base.Copy(source, serializer); 31 | 32 | var typedSource = source as NotifyUsersParams; 33 | if(typedSource != null) 34 | { 35 | UserIds = typedSource.UserIds; 36 | CustomMessage = typedSource.CustomMessage; 37 | } 38 | else 39 | { 40 | JToken token; 41 | if(source.TryGetProperty("UserIds", out token) && token.Type != JTokenType.Null) 42 | { 43 | UserIds = (IEnumerable)serializer.Deserialize(token.CreateReader(), typeof(IEnumerable)); 44 | } 45 | if(source.TryGetProperty("CustomMessage", out token) && token.Type != JTokenType.Null) 46 | { 47 | CustomMessage = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ODataObject.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Base class for v2 Model classes that implement ODATA metadata and deferred links 24 | /// 25 | public class ODataObject : object 26 | { 27 | /// 28 | /// ODATA Metadata information about the model instance 29 | /// 30 | [JsonProperty(PropertyName = "odata.metadata")] 31 | public string MetadataUrl { get; set; } 32 | [JsonProperty(PropertyName = "odata.type")] 33 | public string __type { get; set; } 34 | /// 35 | /// Object Identifier 36 | /// 37 | public string Id { get; set; } 38 | public Uri url { get; set; } 39 | 40 | [JsonExtensionData] 41 | internal IDictionary Properties { get; set; } 42 | 43 | public virtual void Copy(ODataObject source, JsonSerializer serializer) 44 | { 45 | if(source == null || serializer == null) return; 46 | 47 | var typedSource = source as ODataObject; 48 | MetadataUrl = typedSource.MetadataUrl; 49 | __type = typedSource.__type; 50 | Id = typedSource.Id; 51 | url = typedSource.url; 52 | Dictionary properties; 53 | if (typedSource.TryGetProperty("Properties", out properties)) 54 | { 55 | this.AddProperty("Properties", properties); 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ODataObjectType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ODataObjectType 15 | { 16 | ComplexType = 0, 17 | Entity = 1 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/OutlookInformationOptionBool.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// OutlookInformationOptionBool 24 | /// 25 | public class OutlookInformationOptionBool : ODataObject 26 | { 27 | /// 28 | /// Setting is locked. 29 | /// 30 | public bool Locked { get; set; } 31 | /// 32 | /// Value 33 | /// 34 | public bool Value { get; set; } 35 | 36 | public override void Copy(ODataObject source, JsonSerializer serializer) 37 | { 38 | if(source == null || serializer == null) return; 39 | base.Copy(source, serializer); 40 | 41 | var typedSource = source as OutlookInformationOptionBool; 42 | if(typedSource != null) 43 | { 44 | Locked = typedSource.Locked; 45 | Value = typedSource.Value; 46 | } 47 | else 48 | { 49 | JToken token; 50 | if(source.TryGetProperty("Locked", out token) && token.Type != JTokenType.Null) 51 | { 52 | Locked = (bool)serializer.Deserialize(token.CreateReader(), typeof(bool)); 53 | } 54 | if(source.TryGetProperty("Value", out token) && token.Type != JTokenType.Null) 55 | { 56 | Value = (bool)serializer.Deserialize(token.CreateReader(), typeof(bool)); 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/OutlookInformationOptionInt.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// OutlookInformationOptionInt 24 | /// 25 | public class OutlookInformationOptionInt : ODataObject 26 | { 27 | /// 28 | /// Setting is locked. 29 | /// 30 | public bool Locked { get; set; } 31 | /// 32 | /// Value 33 | /// 34 | public int Value { get; set; } 35 | 36 | public override void Copy(ODataObject source, JsonSerializer serializer) 37 | { 38 | if(source == null || serializer == null) return; 39 | base.Copy(source, serializer); 40 | 41 | var typedSource = source as OutlookInformationOptionInt; 42 | if(typedSource != null) 43 | { 44 | Locked = typedSource.Locked; 45 | Value = typedSource.Value; 46 | } 47 | else 48 | { 49 | JToken token; 50 | if(source.TryGetProperty("Locked", out token) && token.Type != JTokenType.Null) 51 | { 52 | Locked = (bool)serializer.Deserialize(token.CreateReader(), typeof(bool)); 53 | } 54 | if(source.TryGetProperty("Value", out token) && token.Type != JTokenType.Null) 55 | { 56 | Value = (int)serializer.Deserialize(token.CreateReader(), typeof(int)); 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/OutlookInformationOptionString.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// OutlookInformationOptionString 24 | /// 25 | public class OutlookInformationOptionString : ODataObject 26 | { 27 | /// 28 | /// Setting is locked. 29 | /// 30 | public bool Locked { get; set; } 31 | /// 32 | /// Value 33 | /// 34 | public string Value { get; set; } 35 | 36 | public override void Copy(ODataObject source, JsonSerializer serializer) 37 | { 38 | if(source == null || serializer == null) return; 39 | base.Copy(source, serializer); 40 | 41 | var typedSource = source as OutlookInformationOptionString; 42 | if(typedSource != null) 43 | { 44 | Locked = typedSource.Locked; 45 | Value = typedSource.Value; 46 | } 47 | else 48 | { 49 | JToken token; 50 | if(source.TryGetProperty("Locked", out token) && token.Type != JTokenType.Null) 51 | { 52 | Locked = (bool)serializer.Deserialize(token.CreateReader(), typeof(bool)); 53 | } 54 | if(source.TryGetProperty("Value", out token) && token.Type != JTokenType.Null) 55 | { 56 | Value = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/PinLockType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum PinLockType 15 | { 16 | None = -1, 17 | UserSelected = 0, 18 | Numeric = 1, 19 | Alphanumeric = 2 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/PolicyUsage.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class PolicyUsage : ODataObject 23 | { 24 | public int? ActiveUsersCount { get; set; } 25 | public int? InactiveUsersCount { get; set; } 26 | 27 | public override void Copy(ODataObject source, JsonSerializer serializer) 28 | { 29 | if(source == null || serializer == null) return; 30 | base.Copy(source, serializer); 31 | 32 | var typedSource = source as PolicyUsage; 33 | if(typedSource != null) 34 | { 35 | ActiveUsersCount = typedSource.ActiveUsersCount; 36 | InactiveUsersCount = typedSource.InactiveUsersCount; 37 | } 38 | else 39 | { 40 | JToken token; 41 | if(source.TryGetProperty("ActiveUsersCount", out token) && token.Type != JTokenType.Null) 42 | { 43 | ActiveUsersCount = (int?)serializer.Deserialize(token.CreateReader(), typeof(int?)); 44 | } 45 | if(source.TryGetProperty("InactiveUsersCount", out token) && token.Type != JTokenType.Null) 46 | { 47 | InactiveUsersCount = (int?)serializer.Deserialize(token.CreateReader(), typeof(int?)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/PreviewPlatform.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum PreviewPlatform 15 | { 16 | Web = 0, 17 | WebAndMobile = 1, 18 | Mobile = 2, 19 | All = 3 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/PreviewStatus.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | [Flags] 15 | public enum PreviewStatus 16 | { 17 | None = 0, 18 | HasThumb = 1, 19 | HasPreview = 2, 20 | CanImgThumb = 4, 21 | CanDocThumb = 8, 22 | CanDocPreview = 16, 23 | RequiresPreview = 32, 24 | Processing = 64, 25 | Failed = 128 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/RemoteUploadRequestParams.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class RemoteUploadRequestParams : UploadRequestParams 23 | { 24 | public Contact Creator { get; set; } 25 | 26 | public override void Copy(ODataObject source, JsonSerializer serializer) 27 | { 28 | if(source == null || serializer == null) return; 29 | base.Copy(source, serializer); 30 | 31 | var typedSource = source as RemoteUploadRequestParams; 32 | if(typedSource != null) 33 | { 34 | Creator = typedSource.Creator; 35 | } 36 | else 37 | { 38 | JToken token; 39 | if(source.TryGetProperty("Creator", out token) && token.Type != JTokenType.Null) 40 | { 41 | Creator = (Contact)serializer.Deserialize(token.CreateReader(), typeof(Contact)); 42 | } 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ReportDateOption.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ReportDateOption 15 | { 16 | Specific = 0, 17 | Today = 1, 18 | Yesterday = 2, 19 | ThisWeek = 3, 20 | LastWeek = 4, 21 | ThisMonth = 5, 22 | LastMonth = 6, 23 | Last30Days = 7 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ReportFilter.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class ReportFilter : ODataObject 23 | { 24 | 25 | public override void Copy(ODataObject source, JsonSerializer serializer) 26 | { 27 | if(source == null || serializer == null) return; 28 | base.Copy(source, serializer); 29 | 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ReportObjectType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ReportObjectType 15 | { 16 | Account = 0, 17 | Folder = 1, 18 | User = 2, 19 | Group = 3 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ReportRunFrequency.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ReportRunFrequency 15 | { 16 | Once = 0, 17 | Daily = 1, 18 | Weekly = 2, 19 | Monthly = 3 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ReportRunStatus.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ReportRunStatus 15 | { 16 | Pending = 0, 17 | Running = 1, 18 | Success = 2, 19 | Failed = 3 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ReportType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ReportType 15 | { 16 | Access = 0, 17 | Activity = 1, 18 | Storage = 2, 19 | Messaging = 3, 20 | BandwidthDetail = 4, 21 | BandwidthSummary = 5, 22 | EncryptedEmail = 6, 23 | StorageSummary = 7, 24 | UserSummary = 8, 25 | AccessChange = 9, 26 | SharesSend = 10, 27 | SharesRequest = 11 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/RequireSubdomainResult.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Response object for RequestSubdomain requests. 24 | /// 25 | public class RequireSubdomainResult : ODataObject 26 | { 27 | /// 28 | /// Indicates if subdomain is required. 29 | /// 30 | public bool RequireSubdomain { get; set; } 31 | 32 | public override void Copy(ODataObject source, JsonSerializer serializer) 33 | { 34 | if(source == null || serializer == null) return; 35 | base.Copy(source, serializer); 36 | 37 | var typedSource = source as RequireSubdomainResult; 38 | if(typedSource != null) 39 | { 40 | RequireSubdomain = typedSource.RequireSubdomain; 41 | } 42 | else 43 | { 44 | JToken token; 45 | if(source.TryGetProperty("RequireSubdomain", out token) && token.Type != JTokenType.Null) 46 | { 47 | RequireSubdomain = (bool)serializer.Deserialize(token.CreateReader(), typeof(bool)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/RequireWebPopResult.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class RequireWebPopResult : ODataObject 23 | { 24 | /// 25 | /// Indicates if WebPop is required for authentication. 26 | /// 27 | public bool RequireWebPop { get; set; } 28 | 29 | public override void Copy(ODataObject source, JsonSerializer serializer) 30 | { 31 | if(source == null || serializer == null) return; 32 | base.Copy(source, serializer); 33 | 34 | var typedSource = source as RequireWebPopResult; 35 | if(typedSource != null) 36 | { 37 | RequireWebPop = typedSource.RequireWebPop; 38 | } 39 | else 40 | { 41 | JToken token; 42 | if(source.TryGetProperty("RequireWebPop", out token) && token.Type != JTokenType.Null) 43 | { 44 | RequireWebPop = (bool)serializer.Deserialize(token.CreateReader(), typeof(bool)); 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/SFTool.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum SFTool 15 | { 16 | DriveMapping = 1, 17 | EnterpriseSync = 2, 18 | FTP = 4, 19 | Outlook = 8, 20 | SFCLI = 16, 21 | SFTP = 32, 22 | SMTP = 64, 23 | Sync = 128, 24 | WebDAV = 256, 25 | Widget = 512, 26 | AndroidPhone = 536870913, 27 | AndroidTablet = 536870914, 28 | BlackberryPhone = 536870915, 29 | BlackberryTablet = 536870916, 30 | iPhone = 536870917, 31 | iPad = 536870918, 32 | ReceiverAndroid = 536870919, 33 | ReceiveriOS = 536870920, 34 | ReceiverMac = 536870921, 35 | ReceiverWindows = 536870922, 36 | WindowsPhone = 536870923, 37 | Unknown = 536870924 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/SSOInfoEntry.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// SSO Info Entry 24 | /// 25 | public class SSOInfoEntry : ODataObject 26 | { 27 | /// 28 | /// Key 29 | /// 30 | public string Key { get; set; } 31 | /// 32 | /// Value 33 | /// 34 | public string Value { get; set; } 35 | 36 | public override void Copy(ODataObject source, JsonSerializer serializer) 37 | { 38 | if(source == null || serializer == null) return; 39 | base.Copy(source, serializer); 40 | 41 | var typedSource = source as SSOInfoEntry; 42 | if(typedSource != null) 43 | { 44 | Key = typedSource.Key; 45 | Value = typedSource.Value; 46 | } 47 | else 48 | { 49 | JToken token; 50 | if(source.TryGetProperty("Key", out token) && token.Type != JTokenType.Null) 51 | { 52 | Key = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 53 | } 54 | if(source.TryGetProperty("Value", out token) && token.Type != JTokenType.Null) 55 | { 56 | Value = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/SentNotification.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class SentNotification : ODataObject 23 | { 24 | public DateTime? DateSent { get; set; } 25 | public string Subject { get; set; } 26 | public string To { get; set; } 27 | 28 | public override void Copy(ODataObject source, JsonSerializer serializer) 29 | { 30 | if(source == null || serializer == null) return; 31 | base.Copy(source, serializer); 32 | 33 | var typedSource = source as SentNotification; 34 | if(typedSource != null) 35 | { 36 | DateSent = typedSource.DateSent; 37 | Subject = typedSource.Subject; 38 | To = typedSource.To; 39 | } 40 | else 41 | { 42 | JToken token; 43 | if(source.TryGetProperty("DateSent", out token) && token.Type != JTokenType.Null) 44 | { 45 | DateSent = (DateTime?)serializer.Deserialize(token.CreateReader(), typeof(DateTime?)); 46 | } 47 | if(source.TryGetProperty("Subject", out token) && token.Type != JTokenType.Null) 48 | { 49 | Subject = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 50 | } 51 | if(source.TryGetProperty("To", out token) && token.Type != JTokenType.Null) 52 | { 53 | To = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 54 | } 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ShareAccessRightType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Share type 17 | /// 18 | public enum ShareAccessRightType 19 | { 20 | ViewOnline = 0, 21 | ViewWatermarked = 1, 22 | DownloadWatermarked = 2, 23 | IRM = 3, 24 | FullControl = 4 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ShareActionType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Share action type 17 | /// 18 | public enum ShareActionType 19 | { 20 | Link = 0, 21 | Email = 1 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ShareSettings.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class ShareSettings : ODataObject 23 | { 24 | /// 25 | /// Notify the creator when Share is used. 26 | /// 27 | public bool? NotifyOnUse { get; set; } 28 | 29 | public override void Copy(ODataObject source, JsonSerializer serializer) 30 | { 31 | if(source == null || serializer == null) return; 32 | base.Copy(source, serializer); 33 | 34 | var typedSource = source as ShareSettings; 35 | if(typedSource != null) 36 | { 37 | NotifyOnUse = typedSource.NotifyOnUse; 38 | } 39 | else 40 | { 41 | JToken token; 42 | if(source.TryGetProperty("NotifyOnUse", out token) && token.Type != JTokenType.Null) 43 | { 44 | NotifyOnUse = (bool?)serializer.Deserialize(token.CreateReader(), typeof(bool?)); 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ShareSubType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ShareSubType 15 | { 16 | None = 0, 17 | Email = 1, 18 | Connector = 2, 19 | ConnectorWithIrm = 3 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ShareType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ShareType 15 | { 16 | Request = 0, 17 | Send = 1, 18 | Both = 2 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/SortDirection.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum SortDirection 15 | { 16 | None = 0, 17 | Ascending = 1, 18 | Descending = 2 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/SortField.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum SortField 15 | { 16 | UsersPreferences = 0, 17 | Name = 1, 18 | FileSizeBytes = 2, 19 | CreationDate = 3, 20 | CreatorName = 4, 21 | Path = 5, 22 | Type = 6, 23 | None = 7 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/StorageCenterUrls.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class StorageCenterUrls : ODataObject 23 | { 24 | /// 25 | /// HealthStats endpoint url 26 | /// 27 | public Uri HealthStatsUrl { get; set; } 28 | 29 | public override void Copy(ODataObject source, JsonSerializer serializer) 30 | { 31 | if(source == null || serializer == null) return; 32 | base.Copy(source, serializer); 33 | 34 | var typedSource = source as StorageCenterUrls; 35 | if(typedSource != null) 36 | { 37 | HealthStatsUrl = typedSource.HealthStatsUrl; 38 | } 39 | else 40 | { 41 | JToken token; 42 | if(source.TryGetProperty("HealthStatsUrl", out token) && token.Type != JTokenType.Null) 43 | { 44 | HealthStatsUrl = (Uri)serializer.Deserialize(token.CreateReader(), typeof(Uri)); 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/StoragePolicy.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Represents a Storage Category Policy definition for use within ShareFile's Policy Based Administration 24 | /// 25 | public class StoragePolicy : Policy 26 | { 27 | /// 28 | /// The settings managed for this Policy 29 | /// 30 | public StorageSettings Settings { get; set; } 31 | 32 | public override void Copy(ODataObject source, JsonSerializer serializer) 33 | { 34 | if(source == null || serializer == null) return; 35 | base.Copy(source, serializer); 36 | 37 | var typedSource = source as StoragePolicy; 38 | if(typedSource != null) 39 | { 40 | Settings = typedSource.Settings; 41 | } 42 | else 43 | { 44 | JToken token; 45 | if(source.TryGetProperty("Settings", out token) && token.Type != JTokenType.Null) 46 | { 47 | Settings = (StorageSettings)serializer.Deserialize(token.CreateReader(), typeof(StorageSettings)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/StorageSettings.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Represents the settings applicable to a Storage Category Policy definition for use within ShareFile's Policy Based Administration 24 | /// 25 | public class StorageSettings : ODataObject 26 | { 27 | public string StorageZoneId { get; set; } 28 | 29 | public override void Copy(ODataObject source, JsonSerializer serializer) 30 | { 31 | if(source == null || serializer == null) return; 32 | base.Copy(source, serializer); 33 | 34 | var typedSource = source as StorageSettings; 35 | if(typedSource != null) 36 | { 37 | StorageZoneId = typedSource.StorageZoneId; 38 | } 39 | else 40 | { 41 | JToken token; 42 | if(source.TryGetProperty("StorageZoneId", out token) && token.Type != JTokenType.Null) 43 | { 44 | StorageZoneId = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/SubdomainAvailabilityResult.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Response object for SubdomainAvailability requests. 24 | /// 25 | public class SubdomainAvailabilityResult : ODataObject 26 | { 27 | /// 28 | /// Indicates if subdomain is available to claim for an account 29 | /// 30 | public bool IsSubdomainAvailable { get; set; } 31 | 32 | public override void Copy(ODataObject source, JsonSerializer serializer) 33 | { 34 | if(source == null || serializer == null) return; 35 | base.Copy(source, serializer); 36 | 37 | var typedSource = source as SubdomainAvailabilityResult; 38 | if(typedSource != null) 39 | { 40 | IsSubdomainAvailable = typedSource.IsSubdomainAvailable; 41 | } 42 | else 43 | { 44 | JToken token; 45 | if(source.TryGetProperty("IsSubdomainAvailable", out token) && token.Type != JTokenType.Null) 46 | { 47 | IsSubdomainAvailable = (bool)serializer.Deserialize(token.CreateReader(), typeof(bool)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/SupportFeedback.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class SupportFeedback : ODataObject 23 | { 24 | public int? Rating { get; set; } 25 | public string Comments { get; set; } 26 | 27 | public override void Copy(ODataObject source, JsonSerializer serializer) 28 | { 29 | if(source == null || serializer == null) return; 30 | base.Copy(source, serializer); 31 | 32 | var typedSource = source as SupportFeedback; 33 | if(typedSource != null) 34 | { 35 | Rating = typedSource.Rating; 36 | Comments = typedSource.Comments; 37 | } 38 | else 39 | { 40 | JToken token; 41 | if(source.TryGetProperty("Rating", out token) && token.Type != JTokenType.Null) 42 | { 43 | Rating = (int?)serializer.Deserialize(token.CreateReader(), typeof(int?)); 44 | } 45 | if(source.TryGetProperty("Comments", out token) && token.Type != JTokenType.Null) 46 | { 47 | Comments = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/TenantZoneUsageReport.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class TenantZoneUsageReport : ODataObject 23 | { 24 | public IDictionary TenantsToZones { get; set; } 25 | 26 | public override void Copy(ODataObject source, JsonSerializer serializer) 27 | { 28 | if(source == null || serializer == null) return; 29 | base.Copy(source, serializer); 30 | 31 | var typedSource = source as TenantZoneUsageReport; 32 | if(typedSource != null) 33 | { 34 | TenantsToZones = typedSource.TenantsToZones; 35 | } 36 | else 37 | { 38 | JToken token; 39 | if(source.TryGetProperty("TenantsToZones", out token) && token.Type != JTokenType.Null) 40 | { 41 | TenantsToZones = (IDictionary)serializer.Deserialize(token.CreateReader(), typeof(IDictionary)); 42 | } 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ToolInformation.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Outlook Information 24 | /// 25 | public class ToolInformation : ODataObject 26 | { 27 | /// 28 | /// Tool Name 29 | /// 30 | public string ToolName { get; set; } 31 | /// 32 | /// Tool Version 33 | /// 34 | public string Version { get; set; } 35 | 36 | public override void Copy(ODataObject source, JsonSerializer serializer) 37 | { 38 | if(source == null || serializer == null) return; 39 | base.Copy(source, serializer); 40 | 41 | var typedSource = source as ToolInformation; 42 | if(typedSource != null) 43 | { 44 | ToolName = typedSource.ToolName; 45 | Version = typedSource.Version; 46 | } 47 | else 48 | { 49 | JToken token; 50 | if(source.TryGetProperty("ToolName", out token) && token.Type != JTokenType.Null) 51 | { 52 | ToolName = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 53 | } 54 | if(source.TryGetProperty("Version", out token) && token.Type != JTokenType.Null) 55 | { 56 | Version = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/TreeMode.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum TreeMode 15 | { 16 | Standard = 0, 17 | Copy = 1, 18 | Move = 2, 19 | Sync = 3, 20 | Manage = 4 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/TwoFactorAuthPasscodeType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum TwoFactorAuthPasscodeType 15 | { 16 | OneTime = 0, 17 | ApplicationSpecific = 1, 18 | Cookie = 2 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/TypeOfTour.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum TypeOfTour 15 | { 16 | NoTour = 0, 17 | Welcome = 1, 18 | Sync = 2, 19 | WoolworthsLimited = 3, 20 | Radiant = 4, 21 | SuperUserAutoConvert = 5, 22 | SuperUserManualConvert = 6, 23 | NewFeature = 7, 24 | NewEmployee = 8, 25 | TFA = 9, 26 | GetApp = 10, 27 | ScanSnap = 11, 28 | CheckInCheckOut = 12 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/UXMode.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum UXMode 15 | { 16 | Classic = 0, 17 | TabView = 1 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/UploadMethod.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum UploadMethod 15 | { 16 | Standard = 0, 17 | Streamed = 1, 18 | Threaded = 2 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/UserAccessPolicy.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// Represents a User Access Category Policy definition for use within ShareFile's Policy Based Administration 24 | /// 25 | public class UserAccessPolicy : Policy 26 | { 27 | /// 28 | /// The settings managed for this Policy 29 | /// 30 | public UserAccessSettings Settings { get; set; } 31 | 32 | public override void Copy(ODataObject source, JsonSerializer serializer) 33 | { 34 | if(source == null || serializer == null) return; 35 | base.Copy(source, serializer); 36 | 37 | var typedSource = source as UserAccessPolicy; 38 | if(typedSource != null) 39 | { 40 | Settings = typedSource.Settings; 41 | } 42 | else 43 | { 44 | JToken token; 45 | if(source.TryGetProperty("Settings", out token) && token.Type != JTokenType.Null) 46 | { 47 | Settings = (UserAccessSettings)serializer.Deserialize(token.CreateReader(), typeof(UserAccessSettings)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/UserAuthenticationType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum UserAuthenticationType 15 | { 16 | Basic = 0, 17 | TwoFactor = 1, 18 | SAML = 2 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/UserBulkOperationRequest.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | /// 23 | /// User Bulk Operation Request 24 | /// 25 | public class UserBulkOperationRequest : ODataObject 26 | { 27 | /// 28 | /// List of user ids to perform this operation on 29 | /// 30 | public IEnumerable UserIds { get; set; } 31 | 32 | public override void Copy(ODataObject source, JsonSerializer serializer) 33 | { 34 | if(source == null || serializer == null) return; 35 | base.Copy(source, serializer); 36 | 37 | var typedSource = source as UserBulkOperationRequest; 38 | if(typedSource != null) 39 | { 40 | UserIds = typedSource.UserIds; 41 | } 42 | else 43 | { 44 | JToken token; 45 | if(source.TryGetProperty("UserIds", out token) && token.Type != JTokenType.Null) 46 | { 47 | UserIds = (IEnumerable)serializer.Deserialize(token.CreateReader(), typeof(IEnumerable)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/VRootType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum VRootType 15 | { 16 | Account = 0, 17 | Virtual = 1, 18 | ForcedVirtual = 2, 19 | ClassicVirtual = 3, 20 | ForcedClassicVirtual = 4, 21 | Home = 5, 22 | ForcedDefault = 254, 23 | Default = 255 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/Versioning.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum Versioning 15 | { 16 | Default = 0, 17 | Enabled = 1, 18 | Disabled = 2 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/WatermarkedDownloads.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum WatermarkedDownloads 15 | { 16 | Default = 0, 17 | Enabled = 1, 18 | Disabled = 2 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/WebhookCapabilities.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class WebhookCapabilities : ODataObject 23 | { 24 | public IEnumerable SupportedContexts { get; set; } 25 | 26 | public override void Copy(ODataObject source, JsonSerializer serializer) 27 | { 28 | if(source == null || serializer == null) return; 29 | base.Copy(source, serializer); 30 | 31 | var typedSource = source as WebhookCapabilities; 32 | if(typedSource != null) 33 | { 34 | SupportedContexts = typedSource.SupportedContexts; 35 | } 36 | else 37 | { 38 | JToken token; 39 | if(source.TryGetProperty("SupportedContexts", out token) && token.Type != JTokenType.Null) 40 | { 41 | SupportedContexts = (IEnumerable)serializer.Deserialize(token.CreateReader(), typeof(IEnumerable)); 42 | } 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/WebhookSupportedContext.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class WebhookSupportedContext : ODataObject 23 | { 24 | public string ResourceType { get; set; } 25 | public IEnumerable Events { get; set; } 26 | 27 | public override void Copy(ODataObject source, JsonSerializer serializer) 28 | { 29 | if(source == null || serializer == null) return; 30 | base.Copy(source, serializer); 31 | 32 | var typedSource = source as WebhookSupportedContext; 33 | if(typedSource != null) 34 | { 35 | ResourceType = typedSource.ResourceType; 36 | Events = typedSource.Events; 37 | } 38 | else 39 | { 40 | JToken token; 41 | if(source.TryGetProperty("ResourceType", out token) && token.Type != JTokenType.Null) 42 | { 43 | ResourceType = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 44 | } 45 | if(source.TryGetProperty("Events", out token) && token.Type != JTokenType.Null) 46 | { 47 | Events = (IEnumerable)serializer.Deserialize(token.CreateReader(), typeof(IEnumerable)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/WebhookSupportedEvents.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class WebhookSupportedEvents : ODataObject 23 | { 24 | public string ResourceType { get; set; } 25 | public string OperationName { get; set; } 26 | 27 | public override void Copy(ODataObject source, JsonSerializer serializer) 28 | { 29 | if(source == null || serializer == null) return; 30 | base.Copy(source, serializer); 31 | 32 | var typedSource = source as WebhookSupportedEvents; 33 | if(typedSource != null) 34 | { 35 | ResourceType = typedSource.ResourceType; 36 | OperationName = typedSource.OperationName; 37 | } 38 | else 39 | { 40 | JToken token; 41 | if(source.TryGetProperty("ResourceType", out token) && token.Type != JTokenType.Null) 42 | { 43 | ResourceType = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 44 | } 45 | if(source.TryGetProperty("OperationName", out token) && token.Type != JTokenType.Null) 46 | { 47 | OperationName = (string)serializer.Deserialize(token.CreateReader(), typeof(string)); 48 | } 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/WorkflowRole.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Participants role in a workflow. 17 | /// 18 | public enum WorkflowRole 19 | { 20 | Unknown = -1, 21 | Active = 0, 22 | 23 | /// 24 | /// Analogous to carbon copy. 25 | /// 26 | Passive = 1 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/WorkflowStatus.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Status of a workflow 17 | /// 18 | public enum WorkflowStatus 19 | { 20 | Unknown = -1, 21 | Draft = 0, 22 | InProgress = 1, 23 | Completed = 2, 24 | Rejected = 3, 25 | Cancelled = 4, 26 | RequestedChange = 5 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/WorkflowType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | 15 | /// 16 | /// Type of Workflow 17 | /// 18 | public enum WorkflowType 19 | { 20 | Approval = 0, 21 | Feedback = 1, 22 | RequestList = 2 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ZoneType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | namespace ShareFile.Api.Client.Models 13 | { 14 | public enum ZoneType 15 | { 16 | Private = 0, 17 | Public = 1, 18 | PrivateZeroKnowledge = 2, 19 | CitrixManaged = 3, 20 | PrivateCitrixManaged = 4 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Models/ZoneUsageBreakdown.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | // Copyright (c) 2018 Citrix ShareFile. All rights reserved. 9 | // 10 | // ------------------------------------------------------------------------------ 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Net; 14 | 15 | using Newtonsoft.Json; 16 | using Newtonsoft.Json.Linq; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Exceptions; 19 | 20 | namespace ShareFile.Api.Client.Models 21 | { 22 | public class ZoneUsageBreakdown : ODataObject 23 | { 24 | public IDictionary ZonesToUsage { get; set; } 25 | 26 | public override void Copy(ODataObject source, JsonSerializer serializer) 27 | { 28 | if(source == null || serializer == null) return; 29 | base.Copy(source, serializer); 30 | 31 | var typedSource = source as ZoneUsageBreakdown; 32 | if(typedSource != null) 33 | { 34 | ZonesToUsage = typedSource.ZonesToUsage; 35 | } 36 | else 37 | { 38 | JToken token; 39 | if(source.TryGetProperty("ZonesToUsage", out token) && token.Type != JTokenType.Null) 40 | { 41 | ZonesToUsage = (IDictionary)serializer.Deserialize(token.CreateReader(), typeof(IDictionary)); 42 | } 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | 5 | [assembly: AssemblyProductAttribute("ShareFile.Api.Client")] 6 | [assembly: AssemblyTitleAttribute("ShareFile Client SDK")] 7 | [assembly: AssemblyVersionAttribute("4.0.0")] 8 | [assembly: AssemblyFileVersionAttribute("4.0.0.0")] 9 | [assembly: AssemblyCopyrightAttribute("Copyright © Citrix ShareFile 2016")] 10 | 11 | [assembly: InternalsVisibleTo("ShareFile.Api.Client.Tests")] 12 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Executors/AsyncRequestExecutor.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace ShareFile.Api.Client.Requests.Executors 6 | { 7 | public class AsyncRequestExecutor : IAsyncRequestExecutor 8 | { 9 | public async Task SendAsync(HttpClient httpClient, HttpRequestMessage requestMessage, HttpCompletionOption httpCompletionOption, 10 | CancellationToken cancellationToken) 11 | { 12 | return await httpClient.SendAsync(requestMessage, httpCompletionOption, cancellationToken).ConfigureAwait(false); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Executors/IAsyncRequestExecutor.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace ShareFile.Api.Client.Requests.Executors 6 | { 7 | public interface IAsyncRequestExecutor 8 | { 9 | Task SendAsync(HttpClient httpClient, HttpRequestMessage requestMessage, HttpCompletionOption httpCompletionOption, CancellationToken cancellationToken); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Executors/ISyncRequestExecutor.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | 3 | namespace ShareFile.Api.Client.Requests.Executors 4 | { 5 | public interface ISyncRequestExecutor 6 | { 7 | HttpResponseMessage Send(HttpClient client, HttpRequestMessage requestMessage, HttpCompletionOption httpCompletionOption); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Executors/RequestExecutorFactory.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Requests.Executors 2 | { 3 | public class RequestExecutorFactory 4 | { 5 | private static ISyncRequestExecutor _syncRequestExecutor; 6 | 7 | public static void RegisterSyncRequestProvider(ISyncRequestExecutor syncRequestExecutor) 8 | { 9 | _syncRequestExecutor = syncRequestExecutor; 10 | } 11 | 12 | public static ISyncRequestExecutor GetSyncRequestExecutor() 13 | { 14 | return _syncRequestExecutor; 15 | } 16 | 17 | private static IAsyncRequestExecutor _asyncRequestExecutor; 18 | public static void RegisterAsyncRequestProvider(IAsyncRequestExecutor asyncRequestExecutor) 19 | { 20 | _asyncRequestExecutor = asyncRequestExecutor; 21 | } 22 | 23 | public static IAsyncRequestExecutor GetAsyncRequestExecutor() 24 | { 25 | return _asyncRequestExecutor; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Executors/SyncRequestExecutor.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using ShareFile.Api.Client.Extensions.Tasks; 3 | 4 | namespace ShareFile.Api.Client.Requests.Executors 5 | { 6 | public class SyncRequestExecutor : ISyncRequestExecutor 7 | { 8 | public HttpResponseMessage Send(HttpClient httpClient, HttpRequestMessage requestMessage, HttpCompletionOption httpCompletionOption) 9 | { 10 | return httpClient.SendAsync(requestMessage, httpCompletionOption).WaitForTask(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/AndFilter.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Requests.Filters 2 | { 3 | /// 4 | /// OData Filter for ANDing two filters 5 | /// 6 | public class AndFilter : BooleanFilter 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// Left hand side of the filter 12 | /// Right hand side of the filter 13 | public AndFilter(IFilter left, IFilter right) 14 | : base(left, right, "and") 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/BooleanFilter.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Requests.Filters 2 | { 3 | public abstract class BooleanFilter : IFilter 4 | { 5 | protected readonly string binaryOperator; 6 | public IFilter Left { get; private set; } 7 | public IFilter Right { get; private set; } 8 | 9 | /// 10 | /// Initializes a new instance of the class. 11 | /// 12 | /// Filter for the left hand side of binaryOperation 13 | /// Filter for the right hand side of binaryOperation 14 | /// Desired binary operator 15 | protected BooleanFilter(IFilter left, IFilter right, string binaryOperator) 16 | { 17 | this.Left = left; 18 | this.Right = right; 19 | this.binaryOperator = binaryOperator; 20 | } 21 | 22 | /// 23 | /// Compute the filter for use. 24 | /// 25 | /// Constructed filter with and filters applied 26 | public override string ToString() 27 | { 28 | return string.Format("{0} {1} {2}", this.Left, this.binaryOperator, this.Right); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/EndsWithFilter.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Requests.Filters 2 | { 3 | public class EndsWithFilter : FunctionEqualityFilter 4 | { 5 | public EndsWithFilter(string propertyName, string value, bool isEqual = true) : 6 | base ("endswith", propertyName, value, isEqual) 7 | { 8 | } 9 | 10 | public override string ToString() 11 | { 12 | return this.PropertyThenValue(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/EqualToFilter.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Requests.Filters 2 | { 3 | public class EqualToFilter : IFilter 4 | { 5 | public string PropertyName { get; set; } 6 | public string Value { get; set; } 7 | 8 | public EqualToFilter(string propertyName, string value) 9 | : this(propertyName, new Filter.Value(value)) 10 | { } 11 | 12 | public EqualToFilter(string propertyName, Filter.Value value) 13 | { 14 | PropertyName = propertyName; 15 | Value = value.ToString(); 16 | } 17 | 18 | public override string ToString() 19 | { 20 | return string.Format("{0} eq {1}", PropertyName, Value); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/Filter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using System.Linq; 5 | using System.Linq.Expressions; 6 | using ShareFile.Api.Client.Models; 7 | 8 | namespace ShareFile.Api.Client.Requests.Filters 9 | { 10 | public interface IFilter 11 | { 12 | 13 | } 14 | 15 | public static class Filter 16 | { 17 | public class Operator 18 | { 19 | public static Operator Equal = new Operator { Op = (p, v) => new EqualToFilter(p, v) }; 20 | public static Operator NotEqual = new Operator { Op = (p, v) => new NotEqualToFilter(p, v) }; 21 | public static Operator LessThan = new Operator { Op = (p, v) => new LessThanFilter(p, v) }; 22 | public static Operator GreaterThan = new Operator { Op = (p, v) => new GreaterThanFilter(p, v) }; 23 | 24 | internal Func Op { get; set; } 25 | } 26 | 27 | public class Function 28 | { 29 | public static Value Date(DateTime dt) 30 | { 31 | return new Value { String = string.Format("date({0})", new Value(dt)) }; 32 | } 33 | 34 | public static Value Time(DateTime dt) 35 | { 36 | return new Value { String = string.Format("time({0})", new Value(dt)) }; 37 | } 38 | } 39 | 40 | public class Value 41 | { 42 | internal string String { get; set; } 43 | 44 | internal Value() { } 45 | 46 | public Value(string unescaped) 47 | { 48 | String = string.Format("'{0}'", unescaped); 49 | } 50 | 51 | public Value(DateTime dt) 52 | { 53 | String = dt.ToUniversalTime().ToString("u"); 54 | } 55 | 56 | public override string ToString() 57 | { 58 | return String; 59 | } 60 | } 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/FunctionEqualityFilter.cs: -------------------------------------------------------------------------------- 1 | using ShareFile.Api.Client.Extensions; 2 | 3 | namespace ShareFile.Api.Client.Requests.Filters 4 | { 5 | public abstract class FunctionEqualityFilter : IFilter 6 | { 7 | public string PropertyName { get; set; } 8 | public string Value { get; set; } 9 | public bool IsEqual { get; set; } 10 | protected string Function { get; set; } 11 | 12 | protected FunctionEqualityFilter(string function, string propertyName, string value, bool isEqual = true) 13 | { 14 | Function = function; 15 | PropertyName = propertyName; 16 | Value = value; 17 | IsEqual = isEqual; 18 | } 19 | 20 | protected string PropertyThenValue() 21 | { 22 | return string.Format("{0}({1}, '{2}') eq {3}", Function, PropertyName, Value, IsEqual.ToLowerString()); 23 | } 24 | 25 | protected string ValueThenProperty() 26 | { 27 | return string.Format("{0}('{1}', {2}) eq {3}", Function, Value, PropertyName, IsEqual.ToLowerString()); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/GreaterThanFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ShareFile.Api.Client.Requests.Filters 8 | { 9 | public class GreaterThanFilter : IFilter 10 | { 11 | public string PropertyName { get; set; } 12 | public Filter.Value Value { get; set; } 13 | 14 | public GreaterThanFilter(string propertyName, string value) 15 | : this(propertyName, new Filter.Value(value)) 16 | { } 17 | 18 | public GreaterThanFilter(string propertyName, Filter.Value value) 19 | { 20 | PropertyName = propertyName; 21 | Value = value; 22 | } 23 | 24 | public override string ToString() 25 | { 26 | return string.Format("{0} gt {1}", PropertyName, Value); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/LessThanFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ShareFile.Api.Client.Requests.Filters 8 | { 9 | public class LessThanFilter : IFilter 10 | { 11 | public string PropertyName { get; set; } 12 | public Filter.Value Value { get; set; } 13 | 14 | public LessThanFilter(string propertyName, string value) 15 | : this(propertyName, new Filter.Value(value)) 16 | { } 17 | 18 | public LessThanFilter(string propertyName, Filter.Value value) 19 | { 20 | PropertyName = propertyName; 21 | Value = value; 22 | } 23 | 24 | public override string ToString() 25 | { 26 | return string.Format("{0} lt {1}", PropertyName, Value); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/NotEqualToFilter.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Requests.Filters 2 | { 3 | public class NotEqualToFilter : IFilter 4 | { 5 | public string PropertyName { get; set; } 6 | public string Value { get; set; } 7 | 8 | public NotEqualToFilter(string propertyName, string value) 9 | : this(propertyName, new Filter.Value(value)) 10 | { } 11 | 12 | public NotEqualToFilter(string propertyName, Filter.Value value) 13 | { 14 | PropertyName = propertyName; 15 | Value = value.ToString(); 16 | } 17 | 18 | public override string ToString() 19 | { 20 | return string.Format("{0} ne {1}", PropertyName, Value); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/OrFilter.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Requests.Filters 2 | { 3 | /// 4 | /// OData Filter for ORing two filters 5 | /// 6 | public class OrFilter : BooleanFilter 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// Left hand side of the filter 12 | /// Right hand side of the filter 13 | public OrFilter(IFilter left, IFilter right) 14 | : base(left, right, "or") 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/StartsWithFilter.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Requests.Filters 2 | { 3 | public class StartsWithFilter : FunctionEqualityFilter 4 | { 5 | public StartsWithFilter(string propertyName, string value, bool isEqual = true) : 6 | base("startswith", propertyName, value, isEqual) 7 | { 8 | } 9 | 10 | public override string ToString() 11 | { 12 | return this.PropertyThenValue(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/SubstringFilter.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Requests.Filters 2 | { 3 | public class SubstringFilter : FunctionEqualityFilter 4 | { 5 | public SubstringFilter(string propertyName, string value, bool isEqual = true) : 6 | base("substringof", propertyName, value, isEqual) 7 | { 8 | } 9 | 10 | public override string ToString() 11 | { 12 | return this.ValueThenProperty(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Filters/TypeFilter.cs: -------------------------------------------------------------------------------- 1 | using ShareFile.Api.Client.Converters; 2 | using ShareFile.Api.Client.Models; 3 | 4 | namespace ShareFile.Api.Client.Requests.Filters 5 | { 6 | public class TypeFilter : IFilter 7 | { 8 | public string Type { get; set; } 9 | 10 | public TypeFilter(string type) 11 | { 12 | Type = type; 13 | } 14 | 15 | public override string ToString() 16 | { 17 | return string.Format("isof('{0}')", Type); 18 | } 19 | } 20 | 21 | public class TypeFilter : IFilter 22 | where T : ODataObject 23 | { 24 | public override string ToString() 25 | { 26 | string fullName = typeof(T).FullName; 27 | if(fullName.Contains(ODataFactory.ClientODataObjectNamespace)) 28 | { 29 | fullName = fullName.Replace(ODataFactory.ClientODataObjectNamespace, ODataFactory.PlaftormODataObjectNamespace); 30 | } 31 | return $"isof('{fullName}')"; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/ODataParameterCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ShareFile.Api.Client.Requests 7 | { 8 | public class ODataAction 9 | { 10 | public string ActionName { get; set; } 11 | 12 | public ODataParameterCollection Parameters { get; set; } 13 | 14 | public ODataAction() 15 | { 16 | Parameters = new ODataParameterCollection(); 17 | } 18 | } 19 | 20 | public class ODataParameterCollection : HashSet 21 | { 22 | public string ToStringForUri() 23 | { 24 | if (Count == 0) return string.Empty; 25 | 26 | var stringBuilder = new StringBuilder(); 27 | foreach (var parameter in this) 28 | { 29 | stringBuilder.AppendFormat("{0},", parameter.ToStringForUri()); 30 | } 31 | 32 | return stringBuilder.Remove(stringBuilder.Length - 1, 1).ToString(); 33 | } 34 | 35 | public override string ToString() 36 | { 37 | if (Count == 0) return string.Empty; 38 | 39 | var stringBuilder = new StringBuilder(); 40 | foreach (var parameter in this) 41 | { 42 | stringBuilder.AppendFormat("{0},", parameter); 43 | } 44 | 45 | return stringBuilder.Remove(stringBuilder.Length - 1, 1).ToString(); 46 | } 47 | 48 | internal void AddOrUpdate(ODataParameter parameter) 49 | { 50 | if (Contains(parameter)) 51 | { 52 | Remove(parameter); 53 | } 54 | 55 | Add(parameter); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Providers/IAsyncRequestProvider.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace ShareFile.Api.Client.Requests.Providers 6 | { 7 | public interface IAsyncRequestProvider : IRequestProvider 8 | { 9 | [NotNull] 10 | Task ExecuteAsync(IQuery query, CancellationToken token = default(CancellationToken)); 11 | [NotNull] 12 | Task ExecuteAsync(IQuery query, CancellationToken token = default(CancellationToken)) where T : class; 13 | [NotNull] 14 | Task ExecuteAsync(IFormQuery query, CancellationToken token = default(CancellationToken)) where T : class; 15 | [NotNull] 16 | Task ExecuteAsync(IStreamQuery query, CancellationToken token = default(CancellationToken)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Providers/ISyncRequestProvider.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ShareFile.Api.Client.Requests.Providers 4 | { 5 | public interface ISyncRequestProvider : IRequestProvider 6 | { 7 | void Execute(IQuery query); 8 | T Execute(IQuery query) where T : class; 9 | T Execute(IFormQuery query) where T : class; 10 | Stream Execute(IStreamQuery query); 11 | } 12 | 13 | public interface IRequestProvider 14 | { 15 | ShareFileClient ShareFileClient { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Providers/RequestProviderFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Requests.Providers 4 | { 5 | internal class RequestProviderFactory 6 | { 7 | private Func _syncRequestProviderFunc; 8 | private Func _asyncRequestProviderFunc; 9 | 10 | internal void RegisterSyncRequestProvider(Func syncRequestProvider) 11 | { 12 | _syncRequestProviderFunc = syncRequestProvider; 13 | } 14 | 15 | public void RegisterAsyncRequestProvider(Func asyncRequestProvider) 16 | { 17 | _asyncRequestProviderFunc = asyncRequestProvider; 18 | } 19 | 20 | public ISyncRequestProvider GetSyncRequestProvider() 21 | { 22 | return _syncRequestProviderFunc(); 23 | } 24 | 25 | public IAsyncRequestProvider GetAsyncRequestProvider() 26 | { 27 | return _asyncRequestProviderFunc(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/Providers/Response.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Net; 7 | using System.Net.Http; 8 | using System.Net.Http.Headers; 9 | using System.Text; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | using Newtonsoft.Json; 13 | using Newtonsoft.Json.Linq; 14 | using ShareFile.Api.Client.Credentials; 15 | using ShareFile.Api.Client.Events; 16 | using ShareFile.Api.Client.Exceptions; 17 | using ShareFile.Api.Client.Extensions; 18 | using ShareFile.Api.Client.Logging; 19 | using ShareFile.Api.Client.Security.Authentication.OAuth2; 20 | using ShareFile.Api.Client.Security.Cryptography; 21 | using ShareFile.Api.Client.Models; 22 | 23 | namespace ShareFile.Api.Client.Requests.Providers 24 | { 25 | public class Response : Response 26 | { 27 | public T Value { get; set; } 28 | } 29 | 30 | public class Response 31 | { 32 | public EventHandlerResponse Action { get; set; } 33 | public static Response CreateSuccess(TSuccess value) 34 | { 35 | return new Response 36 | { 37 | Value = value 38 | }; 39 | } 40 | 41 | public static Response CreateAction(EventHandlerResponse response) 42 | { 43 | return new Response 44 | { 45 | Action = response 46 | }; 47 | } 48 | 49 | public static Response CreateAction(EventHandlerResponse response) 50 | { 51 | return new Response 52 | { 53 | Action = response 54 | }; 55 | } 56 | 57 | public static Response Success = new Response(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Requests/QueryMetadata.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Requests 4 | { 5 | /// 6 | /// Used to store metadata about the query. 7 | /// This metadata is for internal use and is not actually sent as part of the API request. 8 | /// 9 | public class QueryMetadata 10 | { 11 | /// 12 | /// Gets or sets a value indicating whether or not the request is expected to throw. 13 | /// 14 | public bool IsExpectedToThrow { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/Authentication/OAuth2/IOAuthResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ShareFile.Api.Client.Security.Authentication.OAuth2 4 | { 5 | public interface IOAuthResponse 6 | { 7 | void Fill(IDictionary values); 8 | IDictionary Properties { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/Authentication/OAuth2/OAuth2AuthenticationHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ShareFile.Api.Client.Extensions; 3 | 4 | namespace ShareFile.Api.Client.Security.Authentication.OAuth2 5 | { 6 | public class OAuth2AuthenticationHelper 7 | { 8 | private readonly string _completionUrl; 9 | 10 | public OAuth2AuthenticationHelper(Uri completionUri) 11 | { 12 | _completionUrl = completionUri.ToString(); 13 | } 14 | 15 | public bool IsComplete(Uri navigationUri, out IOAuthResponse response) 16 | { 17 | response = null; 18 | if (navigationUri.ToString().StartsWith(_completionUrl)) 19 | { 20 | var queryString = navigationUri.Query.ToQueryStringCollection(); 21 | if (queryString == null) return false; 22 | 23 | response = queryString.ToOAuthResponse(); 24 | return true; 25 | } 26 | 27 | return false; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/Authentication/OAuth2/OAuthAuthorizationCode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using ShareFile.Api.Client.Extensions; 3 | 4 | namespace ShareFile.Api.Client.Security.Authentication.OAuth2 5 | { 6 | public class OAuthAuthorizationCode : OAuthResponseBase 7 | { 8 | public string Code { get; set; } 9 | public string State { get; set; } 10 | 11 | public override void Fill(IDictionary values) 12 | { 13 | string value; 14 | if (values.TryRemoveValue("code", out value)) 15 | { 16 | Code = value; 17 | } 18 | if (values.TryRemoveValue("state", out value)) 19 | { 20 | State = value; 21 | } 22 | 23 | base.Fill(values); 24 | } 25 | 26 | public static OAuthAuthorizationCode CreateFromDictionary(IDictionary values) 27 | { 28 | var authorizationCode = new OAuthAuthorizationCode(); 29 | authorizationCode.Fill(values); 30 | return authorizationCode; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/Authentication/OAuth2/OAuthError.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Newtonsoft.Json; 4 | using ShareFile.Api.Client.Extensions; 5 | 6 | namespace ShareFile.Api.Client.Security.Authentication.OAuth2 7 | { 8 | public class OAuthError : IOAuthResponse 9 | { 10 | [JsonProperty("error")] 11 | public string Error { get; set; } 12 | 13 | [JsonProperty("error_description")] 14 | public string ErrorDescription { get; set; } 15 | 16 | public void Fill(IDictionary values) 17 | { 18 | string value; 19 | if (values.TryRemoveValue("error", out value)) 20 | { 21 | Error = value != null ? Uri.UnescapeDataString(value.Replace('+', ' ')) : string.Empty; 22 | } 23 | else Error = string.Empty; 24 | if (values.TryRemoveValue("error_description", out value)) 25 | { 26 | ErrorDescription = value != null ? Uri.UnescapeDataString(value.Replace('+', ' ')) : string.Empty; 27 | } 28 | else ErrorDescription = string.Empty; 29 | 30 | Properties = values; 31 | } 32 | 33 | public IDictionary Properties { get; protected set; } 34 | 35 | public OAuthError(IDictionary values) 36 | { 37 | Fill(values); 38 | } 39 | 40 | public OAuthError() 41 | { 42 | 43 | } 44 | } 45 | 46 | public class OAuthErrorException : Exception 47 | { 48 | public OAuthError Error { get; set; } 49 | 50 | public override string Message 51 | { 52 | get 53 | { 54 | if (Error == null) 55 | return base.Message; 56 | return string.Format("Error: {0} | Description: {1}", Error.Error, Error.ErrorDescription); 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/Authentication/OAuth2/OAuthToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Newtonsoft.Json; 4 | using ShareFile.Api.Client.Extensions; 5 | 6 | namespace ShareFile.Api.Client.Security.Authentication.OAuth2 7 | { 8 | public class OAuthToken : OAuthResponseBase 9 | { 10 | [JsonProperty("access_token")] 11 | public string AccessToken { get; set; } 12 | 13 | [JsonProperty("refresh_token")] 14 | public string RefreshToken { get; set; } 15 | 16 | [JsonProperty("token_type")] 17 | public string TokenType { get; set; } 18 | 19 | public override void Fill(IDictionary values) 20 | { 21 | string value; 22 | if (values.TryRemoveValue("access_token", out value)) 23 | { 24 | AccessToken = value; 25 | } 26 | if (values.TryRemoveValue("refresh_token", out value)) 27 | { 28 | RefreshToken = value; 29 | } 30 | if (values.TryRemoveValue("token_type", out value)) 31 | { 32 | TokenType = value; 33 | } 34 | base.Fill(values); 35 | } 36 | 37 | public Uri GetUri() 38 | { 39 | return new Uri(string.Format("https://{0}.{1}/sf/v3/", Subdomain, ApiControlPlane)); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/Authentication/WebAuthenticationHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ShareFile.Api.Client.Extensions; 4 | 5 | namespace ShareFile.Api.Client.Security.Authentication 6 | { 7 | public class WebAuthenticationHelper 8 | { 9 | private readonly string _completionUrl; 10 | 11 | public WebAuthenticationHelper(Uri completionUri) 12 | { 13 | _completionUrl = completionUri.ToString(); 14 | } 15 | 16 | public bool IsComplete(Uri navigationUri, out Dictionary results) 17 | { 18 | results = null; 19 | if (navigationUri.ToString().StartsWith(_completionUrl)) 20 | { 21 | results = navigationUri.Query.ToQueryStringCollection(); 22 | return true; 23 | } 24 | return false; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/Cryptography/HmacSha256Provider.cs: -------------------------------------------------------------------------------- 1 | #if !PORTABLE 2 | using System.Security.Cryptography; 3 | 4 | namespace ShareFile.Api.Client.Security.Cryptography 5 | { 6 | public class HmacSha256Provider : IHmacSha256Provider 7 | { 8 | static HmacSha256Provider() 9 | { 10 | Register(); 11 | } 12 | 13 | public static void Register() 14 | { 15 | HmacSha256ProviderFactory.Register(bytes => new HmacSha256Provider 16 | { 17 | Key = bytes 18 | }); 19 | } 20 | 21 | public byte[] Key { get; set; } 22 | public byte[] ComputeHash(byte[] buffer) 23 | { 24 | var hmac = new HMACSHA256(Key); 25 | 26 | return hmac.ComputeHash(buffer); 27 | } 28 | } 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/Cryptography/HmacSha256ProviderFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Security.Cryptography 4 | { 5 | public class HmacSha256ProviderFactory 6 | { 7 | private static Func _providerFunc; 8 | public static void Register(Func providerFunc) 9 | { 10 | _providerFunc = providerFunc; 11 | } 12 | 13 | public static IHmacSha256Provider GetProvider(byte[] key) 14 | { 15 | return _providerFunc(key); 16 | } 17 | 18 | public static bool HasProvider() 19 | { 20 | return _providerFunc != null; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/Cryptography/IHmacSha256Provider.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Security.Cryptography 2 | { 3 | public interface IHmacSha256Provider 4 | { 5 | byte[] Key { get; set; } 6 | byte[] ComputeHash(byte[] buffer); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/Cryptography/IMD5HashProvider.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Security.Cryptography 2 | { 3 | // ReSharper disable InconsistentNaming 4 | public interface IMD5HashProvider 5 | // ReSharper restore InconsistentNaming 6 | { 7 | IMD5HashProvider CreateHash(); 8 | void Append(byte[] buffer, int offset, int size); 9 | void Finalize(byte[] buffer, int offset, int size); 10 | string ComputeHash(byte[] buffer); 11 | string GetComputedHashAsString(); 12 | byte[] GetComputedHash(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/Cryptography/MD5HashProviderFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Security.Cryptography 4 | { 5 | // ReSharper disable InconsistentNaming 6 | public static class MD5HashProviderFactory 7 | // ReSharper restore InconsistentNaming 8 | { 9 | private static Func _hashProviderFunc; 10 | 11 | public static void RegisterHashProvider(Func hashProviderFunc) 12 | { 13 | _hashProviderFunc = hashProviderFunc; 14 | } 15 | 16 | public static IMD5HashProvider GetHashProvider() 17 | { 18 | if (_hashProviderFunc == null) 19 | { 20 | return new PortableMD5HashProvider(); 21 | } 22 | 23 | return _hashProviderFunc(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Security/CustomAuthentication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Http; 3 | 4 | namespace ShareFile.Api.Client.Security 5 | { 6 | public abstract class CustomAuthentication 7 | { 8 | public abstract Uri SignUri(Uri uri); 9 | public abstract HttpRequestMessage SignBody(object body, HttpRequestMessage requestMessage); 10 | 11 | public virtual bool UsesHmacSha256 12 | { 13 | get { return true; } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/Downloaders/DownloaderConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Transfers.Downloaders 4 | { 5 | public class DownloaderConfig 6 | { 7 | public RangeRequest RangeRequest { get; set; } 8 | [Obsolete] 9 | public int BufferSize { get => Configuration.BufferSize; set { return; } } 10 | public TimeSpan ProgressReportInterval { get; set; } 11 | public bool AllowRangeRequestOffByOne { get; set; } 12 | 13 | public DownloaderConfig() 14 | { 15 | RangeRequest = null; 16 | ProgressReportInterval = TimeSpan.FromMilliseconds(100); 17 | AllowRangeRequestOffByOne = true; 18 | } 19 | 20 | public static DownloaderConfig Default 21 | { 22 | get 23 | { 24 | return new DownloaderConfig(); 25 | } 26 | } 27 | } 28 | 29 | public class RangeRequest 30 | { 31 | public long? Begin { get; set; } 32 | public long? End { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/Downloaders/SyncDownloaderBase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using ShareFile.Api.Client.Models; 4 | using System.Threading; 5 | 6 | namespace ShareFile.Api.Client.Transfers.Downloaders 7 | { 8 | public abstract class SyncDownloaderBase : DownloaderBase 9 | { 10 | protected SyncDownloaderBase(Item item, IShareFileClient client, DownloaderConfig config = null) 11 | : base(item, client, config) 12 | { 13 | } 14 | 15 | protected SyncDownloaderBase(DownloadSpecification downloadSpecification, IShareFileClient client, DownloaderConfig config = null) 16 | : base(downloadSpecification, client, config) 17 | { 18 | } 19 | 20 | /// 21 | /// Prepares the downloader instance. 22 | /// 23 | public void PrepareDownload(CancellationToken cancellationToken = default(CancellationToken)) 24 | { 25 | DownloadSpecification = CreateDownloadSpecification(); 26 | } 27 | 28 | /// 29 | /// Downloads the file to the provided Stream. 30 | /// 31 | /// 32 | /// 33 | /// 34 | /// 35 | /// Overrides Config.RangeRequest. ShareFile may have some restrictions on the number of times a range request can be issued for a given download session. 36 | /// There is a chance that providing this can result in failures. 37 | /// 38 | public abstract void DownloadTo(Stream stream, 39 | Dictionary transferMetadata = null, 40 | CancellationToken cancellationToken = default(CancellationToken), 41 | RangeRequest rangeRequest = null); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/ProgressStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | namespace ShareFile.Api.Client.Transfers 10 | { 11 | internal class ProgressStream : StreamWrapper 12 | { 13 | private readonly Action progressCallback; 14 | 15 | public ProgressStream(Stream stream, Action progressCallback) 16 | : base(stream) 17 | { 18 | this.progressCallback = progressCallback; 19 | } 20 | 21 | public override int Read(byte[] buffer, int offset, int count) 22 | { 23 | int read = base.Read(buffer, offset, count); 24 | progressCallback(read); 25 | return read; 26 | } 27 | 28 | public override void Write(byte[] buffer, int offset, int count) 29 | { 30 | base.Write(buffer, offset, count); 31 | progressCallback(count); 32 | } 33 | 34 | public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) 35 | { 36 | int read = await base.ReadAsync(buffer, offset, count, cancellationToken); 37 | progressCallback(read); 38 | return read; 39 | } 40 | 41 | public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) 42 | { 43 | await base.WriteAsync(buffer, offset, count, cancellationToken); 44 | progressCallback(count); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/ShareFileApiResponse.cs: -------------------------------------------------------------------------------- 1 | namespace ShareFile.Api.Client.Transfers 2 | { 3 | internal interface ISFApiErrorResponse 4 | { 5 | bool? Error { get; set; } 6 | string ErrorMessage { get; set; } 7 | int ErrorCode { get; set; } 8 | } 9 | 10 | internal class ShareFileApiResponse : ISFApiErrorResponse 11 | { 12 | public bool? Error { get; set; } 13 | public string ErrorMessage { get; set; } 14 | public int ErrorCode { get; set; } 15 | public T Value { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/TransferEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ShareFile.Api.Client.Transfers 4 | { 5 | #if Net40 6 | public class TransferEventArgs : EventArgs 7 | 8 | #else 9 | public struct TransferEventArgs 10 | #endif 11 | { 12 | public TransferProgress Progress; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/TransferProgress.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ShareFile.Api.Client.Transfers 4 | { 5 | public struct TransferProgress 6 | { 7 | public long BytesTransferred; 8 | public long BytesRemaining; 9 | public bool Complete; 10 | public long TotalBytes; 11 | public string TransferId; 12 | public IDictionary TransferMetadata; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/TransfererBase.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace ShareFile.Api.Client.Transfers 5 | { 6 | public abstract class TransfererBase 7 | { 8 | public void Pause() 9 | { 10 | SetState(TransfererState.Paused); 11 | } 12 | 13 | public void Resume() 14 | { 15 | SetState(TransfererState.Active); 16 | } 17 | 18 | private TransfererState _state; 19 | public TransfererState GetState() 20 | { 21 | lock (_stateLock) 22 | { 23 | return _state; 24 | } 25 | } 26 | 27 | private readonly object _stateLock = new object(); 28 | protected void SetState(TransfererState state) 29 | { 30 | lock (_stateLock) 31 | { 32 | _state = state; 33 | } 34 | } 35 | 36 | protected bool ShouldPause(CancellationToken cancellationToken) 37 | { 38 | return GetState() == TransfererState.Paused && !cancellationToken.IsCancellationRequested; 39 | } 40 | 41 | protected bool ShouldPause() 42 | { 43 | return GetState() == TransfererState.Paused; 44 | } 45 | 46 | protected async Task TryPauseAsync(CancellationToken cancellationToken) 47 | { 48 | while (ShouldPause(cancellationToken)) 49 | { 50 | await Task.Delay(1000).ConfigureAwait(false); 51 | } 52 | } 53 | 54 | // Seems like something we should eliminate entirely with no non-async consumers. 55 | protected void TryPause() 56 | { 57 | while (ShouldPause()) 58 | { 59 | TryPauseAsync(default(CancellationToken)).Wait(); 60 | } 61 | } 62 | } 63 | 64 | public enum TransfererState 65 | { 66 | Active, 67 | Paused 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/UploadResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | 4 | namespace ShareFile.Api.Client.Transfers 5 | { 6 | public class UploadResponse : List 7 | { 8 | 9 | } 10 | 11 | public class UploadedFile 12 | { 13 | public string DisplayName { get; set; } 14 | public string Filename { get; set; } 15 | public string Id { get; set; } 16 | public string ParentId { get; set; } 17 | 18 | [JsonProperty("md5")] 19 | public string Hash { get; set; } 20 | /// 21 | /// The locally computed file hash. 22 | /// Note: we don't compute this value for all uploads (namely Standard uploads). It will be null in that case. 23 | /// 24 | public string LocalHash { get; set; } 25 | public long Size { get; set; } 26 | public string UploadId { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/Uploaders/ActiveUploadState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using ShareFile.Api.Client.Models; 4 | 5 | namespace ShareFile.Api.Client.Transfers 6 | { 7 | public class ActiveUploadState 8 | { 9 | public readonly UploadSpecification UploadSpecification; 10 | 11 | public readonly long BytesUploaded; 12 | 13 | public ActiveUploadState(UploadSpecification uploadSpecification, long bytesUploaded) 14 | { 15 | UploadSpecification = uploadSpecification; 16 | BytesUploaded = bytesUploaded; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/Uploaders/Buffers/PooledBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Buffers; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ShareFile.Api.Client.Transfers.Uploaders.Buffers 10 | { 11 | public interface IBuffer : IDisposable 12 | { 13 | int Length { get; } 14 | Stream GetStream(); 15 | } 16 | 17 | internal class PooledBuffer : IBuffer 18 | { 19 | public int Length { get; } 20 | private readonly List> blocks; 21 | private readonly ArrayPool pool; 22 | private bool disposed = false; 23 | 24 | public PooledBuffer(ArrayPool pool, List> blocks) 25 | { 26 | this.blocks = blocks; 27 | this.pool = pool; 28 | Length = blocks.Sum(b => b.Count); 29 | } 30 | 31 | public Stream GetStream() 32 | { 33 | if (disposed) 34 | throw new ObjectDisposedException(nameof(PooledBuffer)); 35 | return new NoncontiguousMemoryStream(blocks); 36 | } 37 | 38 | public void Dispose() 39 | { 40 | if (disposed) 41 | return; 42 | 43 | foreach (var arraySegment in blocks) 44 | { 45 | pool.Return(arraySegment.Array); 46 | } 47 | blocks.Clear(); 48 | disposed = true; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/Uploaders/ByteArrayContentWithProgress.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net; 4 | using System.Net.Http; 5 | using System.Threading.Tasks; 6 | 7 | namespace ShareFile.Api.Client.Transfers.Uploaders 8 | { 9 | internal class ByteArrayContentWithProgress : ByteArrayContent 10 | { 11 | private readonly byte[] content; 12 | private readonly Action progressCallback; 13 | 14 | 15 | public ByteArrayContentWithProgress(byte[] content, Action progressCallback) 16 | : base(content) 17 | { 18 | this.content = content; 19 | this.progressCallback = progressCallback; 20 | } 21 | 22 | protected override async Task SerializeToStreamAsync(Stream stream, TransportContext context) 23 | { 24 | for (var totalBytesRead = 0; totalBytesRead < this.content.Length; totalBytesRead += Configuration.BufferSize) 25 | { 26 | var bytesToWrite = Math.Min(Configuration.BufferSize, this.content.Length - totalBytesRead); 27 | await stream.WriteAsync(this.content, totalBytesRead, bytesToWrite).ConfigureAwait(false); 28 | 29 | progressCallback?.Invoke(bytesToWrite); 30 | } 31 | } 32 | 33 | protected override bool TryComputeLength(out long length) 34 | { 35 | length = this.content.Length; 36 | return true; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/Uploaders/FilePart.cs: -------------------------------------------------------------------------------- 1 | using ShareFile.Api.Client.Transfers.Uploaders.Buffers; 2 | 3 | namespace ShareFile.Api.Client.Transfers.Uploaders 4 | { 5 | internal class FilePart 6 | { 7 | public readonly IBuffer Bytes; 8 | public readonly int Index; 9 | public readonly long Offset; 10 | public readonly int Length; 11 | public readonly string Hash; 12 | public readonly bool IsLastPart; 13 | 14 | public FilePart( 15 | IBuffer bytes, 16 | int index, 17 | long offset, 18 | int length, 19 | string hash, 20 | bool isLastPart) 21 | { 22 | this.Bytes = bytes; 23 | this.Index = index; 24 | this.Offset = offset; 25 | this.Length = length; 26 | this.Hash = hash; 27 | this.IsLastPart = isLastPart; 28 | } 29 | 30 | public string GetComposedUploadUrl(string uploadUrl) 31 | { 32 | return $"{uploadUrl}&index={Index}&byteOffset={Offset}&hash={Hash}"; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/Uploaders/NoDisposeStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | 8 | namespace ShareFile.Api.Client.Transfers.Uploaders 9 | { 10 | internal class NoDisposeStream : Stream 11 | { 12 | private Stream stream; 13 | 14 | public NoDisposeStream(Stream stream) 15 | { 16 | this.stream = stream; 17 | } 18 | 19 | protected override void Dispose(bool disposing) 20 | { 21 | // do nothing - leave the underlying stream open 22 | } 23 | 24 | public override bool CanRead { get { return stream.CanRead; } } 25 | public override bool CanSeek { get { return stream.CanSeek; } } 26 | public override bool CanWrite { get { return stream.CanWrite; } } 27 | 28 | public override void Flush() 29 | { 30 | stream.Flush(); 31 | } 32 | 33 | public override long Length { get { return stream.Length; } } 34 | public override long Position 35 | { 36 | get { return stream.Position; } 37 | set { stream.Position = value; } 38 | } 39 | 40 | public override int Read(byte[] buffer, int offset, int count) 41 | { 42 | return stream.Read(buffer, offset, count); 43 | } 44 | 45 | public override long Seek(long offset, SeekOrigin origin) 46 | { 47 | return stream.Seek(offset, origin); 48 | } 49 | 50 | public override void SetLength(long value) 51 | { 52 | stream.SetLength(value); 53 | } 54 | 55 | public override void Write(byte[] buffer, int offset, int count) 56 | { 57 | stream.Write(buffer, offset, count); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/ShareFile.Api.Client/Transfers/Uploaders/PartSizeCalculator.cs: -------------------------------------------------------------------------------- 1 | using ShareFile.Api.Client.Extensions; 2 | using System; 3 | 4 | namespace ShareFile.Api.Client.Transfers.Uploaders 5 | { 6 | internal class PartSizeCalculator 7 | { 8 | private FilePartConfig partConfig; 9 | private int concurrentWorkers; 10 | 11 | public PartSizeCalculator(int concurrentWorkers, FilePartConfig partConfig) 12 | { 13 | this.concurrentWorkers = concurrentWorkers; 14 | this.partConfig = partConfig; 15 | } 16 | 17 | public long NextPartSize(long lastPartSize, long completedPartSize, TimeSpan elapsedTime) 18 | { 19 | //connection speed values are bytes/second 20 | double estimatedConnectionSpeed = completedPartSize / elapsedTime.TotalSeconds; 21 | double targetPartSize = estimatedConnectionSpeed * partConfig.TargetPartUploadTime.TotalSeconds; 22 | double partSizeDelta = targetPartSize - completedPartSize; 23 | 24 | //initial batch of workers will all calculate ~same delta; penalize for >1 25 | double penalty = concurrentWorkers > 1 ? concurrentWorkers / 2.0 : 1.0; 26 | partSizeDelta = partSizeDelta / penalty; 27 | 28 | //bound the delta to a multiple of partsize in case of extreme result 29 | double maxDelta = completedPartSize * (partConfig.MaxPartSizeIncreaseFactor - 1.0); 30 | double minDelta = completedPartSize * (-1.0 * (partConfig.MaxPartSizeDecreaseFactor - 1.0) / partConfig.MaxPartSizeDecreaseFactor); 31 | partSizeDelta = partSizeDelta.Bound(maxDelta, minDelta); 32 | 33 | // bound partsize too because we probably got something wrong 34 | long nextPartSize = lastPartSize; 35 | nextPartSize += Convert.ToInt64(partSizeDelta); 36 | nextPartSize = nextPartSize.Bound(partConfig.MaxPartSize, partConfig.MinPartSize); 37 | return nextPartSize; 38 | } 39 | } 40 | } --------------------------------------------------------------------------------