├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── pull_request_template.md ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── CloudinaryDotNet.IntegrationTests ├── AdminApi │ ├── BrowseResourcesTest.cs │ ├── BrowseResourcesWithStructuredMetadataTest.cs │ ├── ConfigTest.cs │ ├── DeleteResourcesTest.cs │ ├── ManageFoldersTest.cs │ ├── ManageStreamingProfilesTest.cs │ ├── ManageTransformationsTest.cs │ ├── ManageUploadMappingsTest.cs │ ├── ManageUploadPresetsTest.cs │ ├── MetaDataTest.cs │ ├── OAuthTest.cs │ ├── ReorderMetadataTest.cs │ ├── RestoreResourcesTest.cs │ ├── UpdateAccessModeTest.cs │ ├── UpdateResourcesTest.cs │ └── UsageReportTest.cs ├── CloudinaryDotNet.IntegrationTests.csproj ├── IntegrationTestBase.cs ├── Provisioning │ ├── AccountApi │ │ ├── AccountProvisioningAsyncTest.cs │ │ └── AccountProvisioningTest.cs │ └── ProvisioningIntegrationTestBase.cs ├── Resources │ ├── TestImage.jpg │ ├── TestLargeImage.jpg │ ├── favicon.ico │ ├── movie.mp4 │ └── multipage.pdf ├── RetryWithDelayAttribute.cs ├── SearchApi │ └── SearchApiTest.cs ├── Settings.cs ├── UploadApi │ ├── ArchiveMethodsTest.cs │ ├── ContextMethodsTest.cs │ ├── DestroyMethodsTest.cs │ ├── ExplicitMethodsTest.cs │ ├── ExplodeMethodsTest.cs │ ├── MultiMethodsTest.cs │ ├── PublishMethodsTest.cs │ ├── RenameMethodsTest.cs │ ├── SpriteMethodsTest.cs │ ├── TagMethodsTest.cs │ ├── TextMethodsTest.cs │ └── UploadMethodsTest.cs └── appsettings.json.sample ├── CloudinaryDotNet.Tests ├── AdminApi │ ├── AnalysisTest.cs │ ├── GetResourceTest.cs │ ├── RelatedAssetsTest.cs │ ├── UsageReportResponseTest.cs │ └── VisualSearchTest.cs ├── ApiAuthorizationTest.cs ├── ApiShared.ProxyTest.cs ├── Asset │ ├── AuthTokenTest.cs │ ├── SignatureTest.cs │ ├── UrlBuilderTest.cs │ └── UrlSuffixTest.cs ├── CloudinaryDotNet.Tests.csproj ├── Configuration │ └── ConfigurationTest.cs ├── Constants.cs ├── MetaDataTest.cs ├── MockedCloudinary.cs ├── Parameters │ ├── DeserializationTests.cs │ ├── MetadataFieldParamsTest.cs │ ├── MetadataUpdateParamsTest.cs │ └── ParametersTest.cs ├── Provisioning │ ├── AccountProvisioningParamsTest.cs │ └── AccountProvisioningTest.cs ├── SearchApi │ ├── SearchFoldersTest.cs │ └── SearchTest.cs ├── Tag │ ├── ImageTagTest.cs │ └── VideoTagTest.cs ├── Transformations │ ├── Common │ │ ├── CustomFunctionTest.cs │ │ ├── ExpressionTest.cs │ │ └── TransformationTest.cs │ ├── Image │ │ ├── GravityTest.cs │ │ ├── ImageTransformationTest.cs │ │ ├── RadiusTest.cs │ │ └── SpriteTest.cs │ └── Video │ │ ├── VideoCodecTest.cs │ │ └── VideoTransformationTest.cs ├── UploadApi │ ├── CreateSlideshowMethodsTest.cs │ └── UploadTest.cs ├── UploadPresetsTest.cs ├── UrlBuilderTest.cs └── Util │ ├── StringDictionaryTest.cs │ └── UtilsTest.cs ├── CloudinaryDotNet ├── Account.cs ├── Actions │ ├── Analysis │ │ ├── AnalysisPayload.cs │ │ ├── AnalyzeParams.cs │ │ ├── AnalyzeResult.cs │ │ ├── AnalyzeUriRequestParameters.cs │ │ └── CustomParameters.cs │ ├── AssetsManagement │ │ ├── AddRelatedResourcesByAssetIdsParams.cs │ │ ├── AddRelatedResourcesParams.cs │ │ ├── AddRelatedResourcesResult.cs │ │ ├── ConfigParams.cs │ │ ├── ConfigResult.cs │ │ ├── DelDerivedResParams.cs │ │ ├── DelDerivedResResult.cs │ │ ├── DelResParams.cs │ │ ├── DelResResult.cs │ │ ├── DeleteRelatedResourcesByAssetIdsParams.cs │ │ ├── DeleteRelatedResourcesParams.cs │ │ ├── DeleteRelatedResourcesResult.cs │ │ ├── GetResourceParams.cs │ │ ├── GetResourceParamsAssetId.cs │ │ ├── GetResourceParamsBase.cs │ │ ├── GetResourceResult.cs │ │ ├── ListResourceTypesResult.cs │ │ ├── ListResourcesByAssetFolderParams.cs │ │ ├── ListResourcesByContextParams.cs │ │ ├── ListResourcesByModerationParams.cs │ │ ├── ListResourcesByPrefixParams.cs │ │ ├── ListResourcesByTagParams.cs │ │ ├── ListResourcesParams.cs │ │ ├── ListResourcesResult.cs │ │ ├── ListSpecificResourcesParams.cs │ │ ├── ListTagsParams.cs │ │ ├── ListTagsResult.cs │ │ ├── NestedTypes │ │ │ ├── AccessibilityAnalysis.cs │ │ │ ├── AccountSettings.cs │ │ │ ├── AdvOcr.cs │ │ │ ├── AdvOcrData.cs │ │ │ ├── AssetVersion.cs │ │ │ ├── Block.cs │ │ │ ├── BoundingBlock.cs │ │ │ ├── BoundingBox.cs │ │ │ ├── CinemagraphAnalysis.cs │ │ │ ├── ColorblindAccessibilityAnalysis.cs │ │ │ ├── Coordinates.cs │ │ │ ├── DeletedDataStatistics.cs │ │ │ ├── Derived.cs │ │ │ ├── DetectedLanguage.cs │ │ │ ├── Detection.cs │ │ │ ├── Face.cs │ │ │ ├── FullTextAnnotation.cs │ │ │ ├── Info.cs │ │ │ ├── LastUpdated.cs │ │ │ ├── Ocr.cs │ │ │ ├── Page.cs │ │ │ ├── PageProperty.cs │ │ │ ├── Paragraph.cs │ │ │ ├── Point.cs │ │ │ ├── Predominant.cs │ │ │ ├── QualityAnalysis.cs │ │ │ ├── RekognitionFace.cs │ │ │ ├── RelatedResource.cs │ │ │ ├── Resource.cs │ │ │ ├── RestoredResource.cs │ │ │ ├── Size.cs │ │ │ ├── Symbol.cs │ │ │ ├── TextAnnotation.cs │ │ │ ├── TextBlock.cs │ │ │ ├── Usage.cs │ │ │ └── Word.cs │ │ ├── RelatedResourcesByAssetIdsParams.cs │ │ ├── RelatedResourcesParams.cs │ │ ├── RelatedResourcesResult.cs │ │ ├── RestoreParams.cs │ │ ├── RestoreResult.cs │ │ ├── UpdateParams.cs │ │ ├── UpdateResourceAccessModeParams.cs │ │ ├── UpdateResourceAccessModeResult.cs │ │ ├── UsageResult.cs │ │ ├── VisualSearchParams.cs │ │ └── VisualSearchResult.cs │ ├── AssetsUpload │ │ ├── ArchiveParams.cs │ │ ├── ArchiveResult.cs │ │ ├── AutoUploadParams.cs │ │ ├── BasicRawUploadParams.cs │ │ ├── ContextParams.cs │ │ ├── ContextResult.cs │ │ ├── CreateSlideshowParams.cs │ │ ├── CreateSlideshowResult.cs │ │ ├── DeletionParams.cs │ │ ├── DeletionResult.cs │ │ ├── ExplicitParams.cs │ │ ├── ExplicitResult.cs │ │ ├── ExplodeParams.cs │ │ ├── ExplodeResult.cs │ │ ├── ImageUploadParams.cs │ │ ├── ImageUploadResult.cs │ │ ├── MultiAssetsParams.cs │ │ ├── MultiParams.cs │ │ ├── MultiResult.cs │ │ ├── NestedTypes │ │ │ ├── AccessControlRule.cs │ │ │ ├── ArchiveCallMode.cs │ │ │ ├── ArchiveFormat.cs │ │ │ ├── Audio.cs │ │ │ ├── Breakpoint.cs │ │ │ ├── Eager.cs │ │ │ ├── FaceCoordinates.cs │ │ │ ├── ImageInfo.cs │ │ │ ├── ProfilingData.cs │ │ │ ├── ProfilingDataAction.cs │ │ │ ├── ResponsiveBreakpointList.cs │ │ │ ├── Slide.cs │ │ │ ├── Slideshow.cs │ │ │ ├── SlideshowManifest.cs │ │ │ └── Video.cs │ │ ├── PublishResourceParams.cs │ │ ├── PublishResourceResult.cs │ │ ├── RawPartUploadResult.cs │ │ ├── RawUploadParams.cs │ │ ├── RawUploadResult.cs │ │ ├── RenameParams.cs │ │ ├── RenameResult.cs │ │ ├── SpriteParams.cs │ │ ├── SpriteResult.cs │ │ ├── TagParams.cs │ │ ├── TagResult.cs │ │ ├── TextParams.cs │ │ ├── TextResult.cs │ │ ├── UploadResult.cs │ │ ├── VideoUploadParams.cs │ │ └── VideoUploadResult.cs │ ├── BaseParams.cs │ ├── BaseResult.cs │ ├── Error.cs │ ├── Folders │ │ ├── CreateFolderResult.cs │ │ ├── DeleteFolderResult.cs │ │ ├── Folder.cs │ │ ├── GetFoldersParams.cs │ │ ├── GetFoldersResult.cs │ │ ├── RenameFolderParams.cs │ │ └── RenameFolderResult.cs │ ├── JsonConverter │ │ ├── ModerationResponseConverter.cs │ │ ├── RepresentationsConverter.cs │ │ ├── SafeArrayConverter.cs │ │ └── SafeBooleanConverter.cs │ ├── MappingsUpload │ │ ├── UploadMappingParams.cs │ │ └── UploadMappingResults.cs │ ├── MetadataFields │ │ ├── AndValidationParams.cs │ │ ├── ComparisonValidationParams.cs │ │ ├── DataSourceEntriesParams.cs │ │ ├── DateGreaterThanValidationParams.cs │ │ ├── DateLessThanValidationParams.cs │ │ ├── DateMetadataFieldCreateParams.cs │ │ ├── DateMetadataFieldUpdateParams.cs │ │ ├── DelMetadataFieldResult.cs │ │ ├── EntryParams.cs │ │ ├── EntryResult.cs │ │ ├── EnumMetadataFieldCreateParams.cs │ │ ├── EnumMetadataFieldUpdateParams.cs │ │ ├── IntGreaterThanValidationParams.cs │ │ ├── IntLessThanValidationParams.cs │ │ ├── IntMetadataFieldCreateParams.cs │ │ ├── IntMetadataFieldUpdateParams.cs │ │ ├── MetadataDataSourceParams.cs │ │ ├── MetadataDataSourceResult.cs │ │ ├── MetadataFieldBaseParams.cs │ │ ├── MetadataFieldCreateParams.cs │ │ ├── MetadataFieldListResult.cs │ │ ├── MetadataFieldResult.cs │ │ ├── MetadataFieldUpdateParams.cs │ │ ├── MetadataReorderParams.cs │ │ ├── MetadataUpdateParams.cs │ │ ├── MetadataUpdateResult.cs │ │ ├── MetadataValidationParams.cs │ │ ├── MetadataValidationResult.cs │ │ ├── ReorderMetadataFieldDataSourceParams.cs │ │ ├── SetMetadataFieldCreateParams.cs │ │ ├── SetMetadataFieldUpdateParams.cs │ │ ├── StringLengthValidationParams.cs │ │ ├── StringMetadataFieldCreateParams.cs │ │ └── StringMetadataFieldUpdateParams.cs │ ├── Moderation.cs │ ├── ModerationLabel.cs │ ├── ModerationResponse.cs │ ├── PingResult.cs │ ├── PresetsUpload │ │ ├── DeleteUploadPresetResult.cs │ │ ├── GetUploadPresetResult.cs │ │ ├── ListUploadPresetsParams.cs │ │ ├── ListUploadPresetsResult.cs │ │ ├── UploadPresetParams.cs │ │ ├── UploadPresetResult.cs │ │ └── UploadSettings.cs │ ├── Search │ │ ├── IdentityInfo.cs │ │ ├── ImageAnalysis.cs │ │ ├── SearchFolder.cs │ │ ├── SearchFoldersResult.cs │ │ ├── SearchResource.cs │ │ ├── SearchResult.cs │ │ └── SearchResultBase.cs │ ├── StreamingProfiles │ │ ├── Representation.cs │ │ ├── StreamingProfileBaseData.cs │ │ ├── StreamingProfileBaseParams.cs │ │ ├── StreamingProfileCreateParams.cs │ │ ├── StreamingProfileData.cs │ │ ├── StreamingProfileListResult.cs │ │ ├── StreamingProfileResult.cs │ │ └── StreamingProfileUpdateParams.cs │ └── Transformations │ │ ├── CreateTransformParams.cs │ │ ├── DeleteTransformParams.cs │ │ ├── GetTransformParams.cs │ │ ├── GetTransformResult.cs │ │ ├── ListTransformsParams.cs │ │ ├── ListTransformsResult.cs │ │ ├── TransformDerived.cs │ │ ├── TransformDesc.cs │ │ ├── TransformResult.cs │ │ ├── UpdateTransformParams.cs │ │ └── UpdateTransformResult.cs ├── Api.cs ├── ApiShared.Internal.cs ├── ApiShared.Proxy.cs ├── ApiShared.cs ├── AuthToken.cs ├── CSource.cs ├── Cloudinary.AdminApi.Analysis.cs ├── Cloudinary.AdminApi.MetadataFields.cs ├── Cloudinary.AdminApi.StreamingProfiles.cs ├── Cloudinary.AdminApi.cs ├── Cloudinary.UploadApi.cs ├── Cloudinary.cs ├── Cloudinary.ruleset ├── CloudinaryConfiguration.cs ├── CloudinaryDotNet.csproj ├── CloudinaryIcon.png ├── CloudinaryVersion.cs ├── Constants.cs ├── Core │ ├── ChunkData.cs │ ├── ICloneable.cs │ ├── LimitedStream.cs │ ├── Rectangle.cs │ └── SystemExtension.cs ├── Crc32.cs ├── FileDescription.cs ├── ICloudinary.cs ├── ICloudinaryAdminApi.cs ├── ICloudinarySearchApi.cs ├── ICloudinaryUploadApi.cs ├── ISignProvider.cs ├── Properties │ └── AssemblyInfo.cs ├── Provisioning │ ├── AccountProvisioning.cs │ ├── Actions │ │ ├── AccessKeyResult.cs │ │ ├── ApiAccessKey.cs │ │ ├── BaseSubAccountParams.cs │ │ ├── BaseUserGroupParams.cs │ │ ├── BaseUserParams.cs │ │ ├── CreateSubAccountParams.cs │ │ ├── CreateUserGroupParams.cs │ │ ├── CreateUserParams.cs │ │ ├── DelAccessKeyParams.cs │ │ ├── DelAccessKeyResult.cs │ │ ├── DelSubAccountResult.cs │ │ ├── DelUserGroupResult.cs │ │ ├── DelUserResult.cs │ │ ├── GenerateAccessKeyParams.cs │ │ ├── ListAccessKeysParams.cs │ │ ├── ListAccessKeysResult.cs │ │ ├── ListSubAccountsParams.cs │ │ ├── ListSubAccountsResult.cs │ │ ├── ListUserGroupsResult.cs │ │ ├── ListUsersParams.cs │ │ ├── ListUsersResult.cs │ │ ├── Role.cs │ │ ├── SubAccountResult.cs │ │ ├── UpdateAccessKeyParams.cs │ │ ├── UpdateSubAccountParams.cs │ │ ├── UpdateUserGroupParams.cs │ │ ├── UpdateUserParams.cs │ │ ├── UserGroupResult.cs │ │ └── UserResult.cs │ ├── IAccountProvisioning.cs │ ├── ProvisioningApi.cs │ └── ProvisioningApiAccount.cs ├── Search │ ├── Search.cs │ ├── SearchBaseFluent.cs │ ├── SearchFluent.cs │ ├── SearchFolders.cs │ └── SearchFoldersFluent.cs ├── Shared.projitems ├── SignatureAlgorithm.cs ├── StringDictionary.cs ├── Transforms │ ├── AudioFrequency.cs │ ├── BaseExpression.cs │ ├── BaseLayer.cs │ ├── Condition.cs │ ├── CustomFunction.cs │ ├── EagerTransformation.cs │ ├── Expression.cs │ ├── FetchLayer.cs │ ├── Gravity.cs │ ├── ImageTransform.cs │ ├── Layer.cs │ ├── Radius.cs │ ├── ResponsiveBreakpoint.cs │ ├── SubtitlesLayer.cs │ ├── TextLayer.cs │ ├── Transformation.cs │ ├── VideoCodec.cs │ ├── VideoLayer.cs │ └── VideoTransform.cs ├── Url.cs ├── UrlBuilder.cs ├── Utils.cs └── VideoSource.cs ├── CloudinaryDotnet.sln ├── LICENSE ├── README.md ├── appveyor.yml ├── before_build.ps1 ├── build.ps1 ├── get_cloudinary_js.ps1 ├── samples ├── CloudinaryDotNetSamples.sln ├── PhotoAlbum │ ├── Data │ │ ├── Photo.cs │ │ ├── PhotosDbContext.cs │ │ └── UploadResult.cs │ ├── Infrastructure │ │ └── DirectUploadType.cs │ ├── Pages │ │ ├── Index.cshtml │ │ ├── Index.cshtml.cs │ │ ├── MyPhotos.cshtml │ │ ├── MyPhotos.cshtml.cs │ │ ├── PhotoDetail.cshtml │ │ ├── PhotoDetail.cshtml.cs │ │ ├── Shared │ │ │ ├── _Layout.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── Upload.cshtml │ │ ├── Upload.cshtml.cs │ │ ├── UploadDirectly.cshtml │ │ ├── UploadDirectly.cshtml.cs │ │ ├── UploadSucceeded.cshtml │ │ ├── UploadSucceeded.cshtml.cs │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── PhotoAlbum.csproj │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── appsettings.Development.json │ ├── package-lock.json │ ├── package.json │ └── wwwroot │ │ ├── bootstrap │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ │ ├── css │ │ ├── app.css │ │ └── site.css │ │ ├── favicon.ico │ │ └── js │ │ ├── jquery.cloudinary.js │ │ ├── jquery.fileupload.js │ │ ├── jquery.iframe-transport.js │ │ ├── jquery.ui.widget.js │ │ └── site.js └── README.md └── set_version.ps1 /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Bug report for Cloudinary .NET SDK 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Bug report for Cloudinary .NET SDK 11 | Before proceeding, please update to latest version and test if the issue persists 12 | 13 | ## Describe the bug in a sentence or two. 14 | … 15 | 16 | ## Issue Type (Can be multiple) 17 | - [ ] Build - Cannot install or import the SDK 18 | - [ ] Performance - Performance issues 19 | - [ ] Behaviour - Functions are not working as expected (such as generate URL) 20 | - [ ] Documentation - Inconsistency between the docs and behaviour 21 | - [ ] Other (Specify) 22 | 23 | ## Steps to reproduce 24 | … if applicable 25 | 26 | ## Error screenshots or Stack Trace (if applicable) 27 | … 28 | 29 | ## OS and Version 30 | - [ ] Linux 31 | - [ ] Windows 32 | - [ ] macOS 33 | - [ ] MultiPlatform 34 | 35 | ## Versions and Libraries (fill in the version numbers) 36 | - Cloudinary .NET SDK version - 0.0.0 37 | - .NET Core - 0.0.0 38 | - .NET Framework - 0.0.0 39 | 40 | ## Repository 41 | 42 | If possible, please provide a link to a reproducible repository that showcases the problem 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Feature request for Cloudinary .NET SDK 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Feature request for Cloudinary .NET SDK 11 | …(If your feature is for other SDKs, please request them there) 12 | 13 | 14 | ## Explain your use case 15 | … (A high level explanation of why you need this feature) 16 | 17 | ## Describe the problem you’re trying to solve 18 | … (A more technical view of what you’d like to accomplish, and how this feature will help you achieve it) 19 | 20 | ## Do you have a proposed solution? 21 | … (yes, no? Please elaborate if needed) 22 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Brief Summary of Changes 2 | 5 | 6 | #### What does this PR address? 7 | - [ ] GitHub issue (Add reference - #XX) 8 | - [ ] Refactoring 9 | - [ ] New feature 10 | - [ ] Bug fix 11 | - [ ] Adds more tests 12 | 13 | #### Are tests included? 14 | - [ ] Yes 15 | - [ ] No 16 | 17 | #### Reviewer, please note: 18 | 25 | 26 | #### Checklist: 27 | 28 | 29 | - [ ] My code follows the code style of this project. 30 | - [ ] My change requires a change to the documentation. 31 | - [ ] I ran the full test suite before pushing the changes and all the tests pass. 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Cloudinary SDK 2 | app.config 3 | appsettings.json 4 | 5 | # User-specific files 6 | *.suo 7 | *.user 8 | *.userosscache 9 | *.sln.docstates 10 | 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | build/ 23 | bld/ 24 | [Bb]in/ 25 | [Oo]bj/ 26 | [Ll]og/ 27 | [Ll]ib/ 28 | [Bb]uildResult/ 29 | 30 | # Visual Studo 2015 cache/options directory 31 | .vs/ 32 | 33 | # MSTest test Results 34 | [Tt]est[Rr]esult*/ 35 | [Bb]uild[Ll]og.* 36 | 37 | 38 | # NUNIT 39 | *.VisualState.xml 40 | TestResult.xml 41 | 42 | # Visual Studio profiler 43 | *.psess 44 | *.vsp 45 | *.vspx 46 | 47 | # ReSharper is a .NET coding add-in 48 | _ReSharper*/ 49 | *.[Rr]e[Ss]harper 50 | *.DotSettings.user 51 | 52 | # NuGet Packages 53 | *.nupkg 54 | 55 | 56 | # The packages folder can be ignored because of Package Restore 57 | **/packages/* 58 | 59 | 60 | # Visual Studio cache files 61 | *.[Cc]ache 62 | # but keep track of directories ending in .cache 63 | !*.[Cc]ache/ 64 | 65 | # Others 66 | node_modules/ 67 | bower_components/ 68 | 69 | # Backup & report files from converting an old project file 70 | _UpgradeReport_Files/ 71 | Backup*/ 72 | UpgradeLog*.XML 73 | UpgradeLog*.htm 74 | 75 | *snk 76 | 77 | .idea/ 78 | -------------------------------------------------------------------------------- /CloudinaryDotNet.IntegrationTests/AdminApi/OAuthTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | 4 | namespace CloudinaryDotNet.IntegrationTests.AdminApi 5 | { 6 | public class OAuthTest: IntegrationTestBase 7 | { 8 | private const string FAKE_OAUTH_TOKEN = "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI4"; 9 | private static string m_uniqueImagePublicId; 10 | 11 | public override void Initialize() 12 | { 13 | base.Initialize(); 14 | 15 | m_uniqueImagePublicId = $"asset_image_{m_uniqueTestId}"; 16 | } 17 | 18 | [Test] 19 | public void TestOAuthToken() 20 | { 21 | var result = m_cloudinary.GetResource(m_uniqueImagePublicId); 22 | Assert.IsNotNull(result.Error); 23 | Assert.IsTrue(result.Error.Message.Contains("Invalid token")); 24 | } 25 | 26 | protected override Account GetAccountInstance() 27 | { 28 | Account account = new Account(m_cloudName, FAKE_OAUTH_TOKEN); 29 | 30 | Assert.IsNotEmpty(account.Cloud, $"Cloud name must be specified in {CONFIG_PLACE}"); 31 | Assert.IsNotEmpty(account.OAuthToken); 32 | 33 | return account; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CloudinaryDotNet.IntegrationTests/CloudinaryDotNet.IntegrationTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net452;net8.0 5 | 6 | false 7 | 8 | 9 | 10 | true 11 | ..\CloudinaryDotNet.snk 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /CloudinaryDotNet.IntegrationTests/Resources/TestImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudinary/CloudinaryDotNet/de968a29875b3a5a5a74a633bd6489984a4866ca/CloudinaryDotNet.IntegrationTests/Resources/TestImage.jpg -------------------------------------------------------------------------------- /CloudinaryDotNet.IntegrationTests/Resources/TestLargeImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudinary/CloudinaryDotNet/de968a29875b3a5a5a74a633bd6489984a4866ca/CloudinaryDotNet.IntegrationTests/Resources/TestLargeImage.jpg -------------------------------------------------------------------------------- /CloudinaryDotNet.IntegrationTests/Resources/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudinary/CloudinaryDotNet/de968a29875b3a5a5a74a633bd6489984a4866ca/CloudinaryDotNet.IntegrationTests/Resources/favicon.ico -------------------------------------------------------------------------------- /CloudinaryDotNet.IntegrationTests/Resources/movie.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudinary/CloudinaryDotNet/de968a29875b3a5a5a74a633bd6489984a4866ca/CloudinaryDotNet.IntegrationTests/Resources/movie.mp4 -------------------------------------------------------------------------------- /CloudinaryDotNet.IntegrationTests/Resources/multipage.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudinary/CloudinaryDotNet/de968a29875b3a5a5a74a633bd6489984a4866ca/CloudinaryDotNet.IntegrationTests/Resources/multipage.pdf -------------------------------------------------------------------------------- /CloudinaryDotNet.IntegrationTests/Settings.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Newtonsoft.Json.Linq; 3 | 4 | namespace CloudinaryDotNet.IntegrationTests 5 | { 6 | public class Settings 7 | { 8 | private readonly JToken Config; 9 | 10 | public Settings(string basePath) 11 | { 12 | string configPath = Path.Combine(basePath, "appsettings.json"); 13 | Config = JObject.Parse(File.ReadAllText(configPath))["AccountSettings"]; 14 | } 15 | 16 | public string CloudName => Config["CloudName"].Value(); 17 | public string ApiKey => Config["ApiKey"].Value(); 18 | public string ApiSecret => Config["ApiSecret"].Value(); 19 | public string ApiBaseAddress => Config["ApiBaseAddress"].Value(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CloudinaryDotNet.IntegrationTests/UploadApi/DestroyMethodsTest.cs: -------------------------------------------------------------------------------- 1 | using CloudinaryDotNet.Actions; 2 | using NUnit.Framework; 3 | using System.Threading.Tasks; 4 | 5 | namespace CloudinaryDotNet.IntegrationTests.UploadApi 6 | { 7 | public class DestroyMethodsTest : IntegrationTestBase 8 | { 9 | [Test, RetryWithDelay] 10 | public void TestDestroyRaw() 11 | { 12 | var uploadResult = UploadTestRawResource(type: ApiShared.GetCloudinaryParam(ResourceType.Raw)); 13 | 14 | var deletionParams = GetDeletionParams(uploadResult.PublicId); 15 | var destroyResult = m_cloudinary.Destroy(deletionParams); 16 | 17 | AssertDestroyed(destroyResult); 18 | } 19 | 20 | [Test, RetryWithDelay] 21 | public async Task TestDestroyRawAsync() 22 | { 23 | var uploadResult = await UploadTestRawResourceAsync(type: ApiShared.GetCloudinaryParam(ResourceType.Raw)); 24 | 25 | var deletionParams = GetDeletionParams(uploadResult.PublicId); 26 | var destroyResult = await m_cloudinary.DestroyAsync(deletionParams); 27 | 28 | AssertDestroyed(destroyResult); 29 | } 30 | 31 | private DeletionParams GetDeletionParams(string publicId) 32 | { 33 | return new DeletionParams(publicId) 34 | { 35 | ResourceType = ResourceType.Raw 36 | }; 37 | } 38 | 39 | private void AssertDestroyed(DeletionResult result) 40 | { 41 | Assert.AreEqual("ok", result.Result, result.Error?.Message); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /CloudinaryDotNet.IntegrationTests/appsettings.json.sample: -------------------------------------------------------------------------------- 1 | { 2 | "AccountSettings": { 3 | "CloudName": "", 4 | "ApiKey": "", 5 | "ApiSecret": "", 6 | "ApiBaseAddress": "", 7 | "ProvisioningApiKey": "", 8 | "ProvisioningApiSecret": "", 9 | "ProvisioningAccountId": "" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /CloudinaryDotNet.Tests/ApiShared.ProxyTest.cs: -------------------------------------------------------------------------------- 1 | #if NETSTANDARD2_0 2 | using NUnit.Framework; 3 | 4 | namespace CloudinaryDotNet.Tests 5 | { 6 | public class ApiSharedProxyTest 7 | { 8 | private ApiShared _apiShared; 9 | 10 | [SetUp] 11 | public void SetUp() 12 | { 13 | _apiShared = new ApiShared(); 14 | } 15 | 16 | [Test] 17 | public void TestDoesNotRecreateClientOnEmptyProxy([Values(null, "")] string proxy) 18 | { 19 | var originalClient = _apiShared.Client; 20 | _apiShared.ApiProxy = proxy; 21 | 22 | Assert.AreEqual(originalClient, _apiShared.Client); 23 | } 24 | 25 | [Test] 26 | public void TestDoesNotRecreateClientOnTheSameProxy() 27 | { 28 | var proxy = "http://proxy.com"; 29 | 30 | _apiShared.ApiProxy = proxy; 31 | var originalClient = _apiShared.Client; 32 | 33 | _apiShared.ApiProxy = proxy; 34 | 35 | Assert.AreEqual(originalClient, _apiShared.Client); 36 | } 37 | 38 | [Test] 39 | public void TestRecreatesClientWhenNewProxyIsSet() 40 | { 41 | var proxy = "http://proxy.com"; 42 | var originalClient = _apiShared.Client; 43 | 44 | _apiShared.ApiProxy = proxy; 45 | 46 | Assert.AreNotEqual(originalClient, _apiShared.Client); 47 | } 48 | } 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net452;net8.0 5 | 6 | false 7 | 8 | 9 | 10 | true 11 | ..\CloudinaryDotNet.snk 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /CloudinaryDotNet.Tests/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Tests 2 | { 3 | public abstract class TestConstants 4 | { 5 | public const string CloudName = "testcloud"; 6 | public const string DefaultApiKey = "1234"; 7 | public const string DefaultApiSecret = "abcd"; 8 | public const string DefaultRootPath = "http://res.cloudinary.com/testcloud/"; 9 | public const string DefaultVideoUpPath = DefaultRootPath + "video/upload/"; 10 | public const string DefaultImageUpPath = DefaultRootPath + "image/upload/"; 11 | public const string DefaultImageFetchPath = DefaultRootPath + "image/fetch/"; 12 | public const string TestPublicId = "test_id"; 13 | public const string TestPublicId2 = "test_id2"; 14 | public const string TestPublicId3 = "test_id3"; 15 | public const string TestAssetId = "4af5a0d1d4047808528b5425d166c101"; 16 | public const string TestAssetId2 = "4af5a0d1d4047808528b5425d166c102"; 17 | public const string TestAssetId3 = "4af5a0d1d4047808528b5425d166c103"; 18 | public const string TestTag = "test_tag"; 19 | public const string TestRemoteImg = "http://cloudinary.com/images/old_logo.png"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CloudinaryDotNet.Tests/Parameters/MetadataUpdateParamsTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using CloudinaryDotNet.Actions; 4 | using NUnit.Framework; 5 | 6 | namespace CloudinaryDotNet.Tests.Parameters 7 | { 8 | public class MetadataFieldUpdateParamsTest 9 | { 10 | [Test] 11 | public void TestMetadataUpdateParamsCheck() 12 | { 13 | var parameters = new MetadataUpdateParams(); 14 | 15 | Assert.Throws(parameters.Check, "List of public ids should not be empty"); 16 | } 17 | 18 | [Test] 19 | public void TestMetadataUpdateParamsDictionary() 20 | { 21 | var parameters = new MetadataUpdateParams 22 | { 23 | PublicIds = new List { "test_id_1", "test_id_2" } 24 | }; 25 | parameters.Metadata.Add("metadata_color", "red"); 26 | parameters.Metadata.Add("metadata_shape", ""); 27 | parameters.ClearInvalid = true; 28 | 29 | Assert.DoesNotThrow(parameters.Check); 30 | var dictionary = parameters.ToParamsDictionary(); 31 | 32 | Assert.AreEqual(parameters.Type, dictionary["type"]); 33 | Assert.AreEqual(parameters.PublicIds, dictionary["public_ids"]); 34 | Assert.AreEqual("metadata_color=red|metadata_shape", dictionary["metadata"]); 35 | Assert.AreEqual("true", dictionary["clear_invalid"]); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /CloudinaryDotNet.Tests/SearchApi/SearchFoldersTest.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using SystemHttp = System.Net.Http; 3 | 4 | namespace CloudinaryDotNet.Tests.SearchApi 5 | { 6 | public class SearchFoldersTest 7 | { 8 | private MockedCloudinary _cloudinary = new MockedCloudinary(); 9 | 10 | [SetUp] 11 | public void SetUp() 12 | { 13 | _cloudinary = new MockedCloudinary(); 14 | } 15 | 16 | [Test] 17 | public void TestShouldSearchFolders() 18 | { 19 | _cloudinary 20 | .SearchFolders() 21 | .Expression("path:*") 22 | .MaxResults(1) 23 | .Execute(); 24 | 25 | _cloudinary.AssertHttpCall(SystemHttp.HttpMethod.Post, "folders/search"); 26 | 27 | var requestJson = _cloudinary.RequestJson(); 28 | 29 | Assert.IsNotNull(requestJson["expression"]); 30 | Assert.AreEqual("path:*", requestJson["expression"].ToString()); 31 | Assert.IsNotNull(requestJson["max_results"]); 32 | Assert.AreEqual("1", requestJson["max_results"].ToString()); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CloudinaryDotNet.Tests/Transformations/Video/VideoCodecTest.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace CloudinaryDotNet.Tests.Transformations.Video 4 | { 5 | [TestFixture] 6 | public class VideoCodecTest 7 | { 8 | [TestCase(VideoCodec.Auto, "vc_auto")] 9 | [TestCase(VideoCodec.Vp8, "vc_vp8")] 10 | [TestCase(VideoCodec.Vp9, "vc_vp9")] 11 | [TestCase(VideoCodec.Prores, "vc_prores")] 12 | [TestCase(VideoCodec.H264, "vc_h264")] 13 | [TestCase(VideoCodec.H265, "vc_h265")] 14 | [TestCase(VideoCodec.Theora, "vc_theora")] 15 | public void TestVideoCodecsConstantValues(string actual, string expected) 16 | { 17 | Assert.AreEqual(expected, new Transformation().VideoCodec(actual).ToString()); 18 | } 19 | 20 | [Test] 21 | public void TestVideoCodec() 22 | { 23 | // should support a string value 24 | 25 | var actual = new Transformation().VideoCodec("auto").ToString(); 26 | Assert.AreEqual("vc_auto", actual); 27 | 28 | // should support a hash value 29 | 30 | actual = new Transformation().VideoCodec("codec", "h264", "profile", "basic", "level", "3.1").ToString(); 31 | Assert.AreEqual("vc_h264:basic:3.1", actual); 32 | } 33 | 34 | [TestCase("false", "vc_h265:auto:auto:bframes_no")] 35 | [TestCase("true", "vc_h265:auto:auto")] 36 | public void TestVideoCodecBFrames(string bFrame, string expected) 37 | { 38 | var actual = new Transformation() 39 | .VideoCodec("codec", "h265", "profile", "auto", "level", "auto", "b_frames", bFrame).ToString(); 40 | Assert.AreEqual(expected, actual); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CloudinaryDotNet.Tests/Util/StringDictionaryTest.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace CloudinaryDotNet.Tests.Util 6 | { 7 | [TestFixture] 8 | public class StringDictionaryTest 9 | { 10 | [Test] 11 | public void TestStringDictionaryAddListValue() 12 | { 13 | var sd = new StringDictionary(); 14 | 15 | sd.Add("k1", new List{"v11", "v12"}); 16 | sd.Add("k2", new List{"v21", "v22"}); 17 | 18 | Assert.AreEqual("k1=[\"v11\",\"v12\"]|k2=[\"v21\",\"v22\"]", Utils.SafeJoin("|", sd.SafePairs)); 19 | } 20 | 21 | [Test] 22 | public void TestStringDictionaryAddListValueSpecialCharacters() 23 | { 24 | var sd = new StringDictionary(); 25 | 26 | sd.Add("k1", new List{"v11|=\"'!@#$%^*({}[]"}); 27 | 28 | Assert.AreEqual(@"k1=[""v11\|\=\""'!@#$%^*({}[]""]", Utils.SafeJoin("|", sd.SafePairs)); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Analysis/AnalysisPayload.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | using Newtonsoft.Json.Linq; 5 | 6 | /// 7 | /// Payload structure for analysis results. 8 | /// 9 | [DataContract] 10 | public class AnalysisPayload 11 | { 12 | /// 13 | /// Gets or sets the entity analyzed. 14 | /// 15 | [DataMember(Name = "entity")] 16 | public string Entity { get; set; } 17 | 18 | /// 19 | /// Gets or sets the analysis data as a dictionary of key-value pairs. 20 | /// 21 | [DataMember(Name = "analysis")] 22 | public JToken Analysis { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Analysis/AnalyzeResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed result of the Analyze operation. 7 | /// 8 | [DataContract] 9 | public class AnalyzeResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets the data payload of the analysis result. 13 | /// 14 | [DataMember(Name = "data")] 15 | public AnalysisPayload Data { get; set; } 16 | 17 | /// 18 | /// Gets or sets the request ID associated with the analysis operation. 19 | /// 20 | [DataMember(Name = "request_id")] 21 | public string RequestId { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Analysis/AnalyzeUriRequestParameters.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Analyze Uri Request Parameters. 7 | /// 8 | public class AnalyzeUriRequestParameters : BaseParams 9 | { 10 | /// 11 | /// Gets or sets custom parameters. 12 | /// 13 | public CustomParameters Custom { get; set; } 14 | 15 | /// 16 | /// Validate object model. 17 | /// 18 | public override void Check() 19 | { 20 | } 21 | 22 | /// 23 | public override SortedDictionary ToParamsDictionary() 24 | { 25 | var dict = new SortedDictionary(); 26 | 27 | AddParam(dict, "custom", Custom); 28 | 29 | return dict; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Analysis/CustomParameters.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Custom Parameters. 8 | /// 9 | public class CustomParameters : BaseParams 10 | { 11 | /// 12 | /// Gets or sets the model name. 13 | /// 14 | public string ModelName { get; set; } 15 | 16 | /// 17 | /// Gets or sets the model version. 18 | /// 19 | public int ModelVersion { get; set; } 20 | 21 | /// 22 | public override void Check() 23 | { 24 | } 25 | 26 | /// 27 | public override SortedDictionary ToParamsDictionary() 28 | { 29 | var dict = new SortedDictionary(); 30 | 31 | AddParam(dict, "model_name", ModelName); 32 | AddParam(dict, "model_version", ModelVersion); 33 | 34 | return dict; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/AddRelatedResourcesByAssetIdsParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Parameters of AddRelatedResourcesByAssetIds request. 8 | /// 9 | public class AddRelatedResourcesByAssetIdsParams : RelatedResourcesByAssetIdsParams 10 | { 11 | /// 12 | /// Gets or sets the list of up to 10 asset IDs. 13 | /// 14 | public List AssetsToRelate { get; set; } 15 | 16 | /// 17 | /// Validate object model. 18 | /// 19 | public override void Check() 20 | { 21 | base.Check(); 22 | 23 | if (AssetsToRelate == null || AssetsToRelate.Count == 0) 24 | { 25 | throw new ArgumentException("AssetsToRelate must be specified!"); 26 | } 27 | } 28 | 29 | /// 30 | /// Maps object model to dictionary of parameters in cloudinary notation. 31 | /// 32 | /// Sorted dictionary of parameters. 33 | public override SortedDictionary ToParamsDictionary() 34 | { 35 | var dict = base.ToParamsDictionary(); 36 | 37 | AddParam(dict, "assets_to_relate", AssetsToRelate); 38 | 39 | return dict; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/AddRelatedResourcesParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Parameters of AddRelatedResources request. 8 | /// 9 | public class AddRelatedResourcesParams : RelatedResourcesParams 10 | { 11 | /// 12 | /// Gets or sets the list of up to 10 fully_qualified_public_ids given as resource_type/type/public_id. 13 | /// 14 | public List AssetsToRelate { get; set; } 15 | 16 | /// 17 | /// Validate object model. 18 | /// 19 | public override void Check() 20 | { 21 | base.Check(); 22 | 23 | if (AssetsToRelate == null || AssetsToRelate.Count == 0) 24 | { 25 | throw new ArgumentException("AssetsToRelate must be specified!"); 26 | } 27 | } 28 | 29 | /// 30 | /// Maps object model to dictionary of parameters in cloudinary notation. 31 | /// 32 | /// Sorted dictionary of parameters. 33 | public override SortedDictionary ToParamsDictionary() 34 | { 35 | var dict = base.ToParamsDictionary(); 36 | 37 | AddParam(dict, "assets_to_relate", AssetsToRelate); 38 | 39 | return dict; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/AddRelatedResourcesResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Parsed result of AddRelatedResources. 8 | /// 9 | [DataContract] 10 | public class AddRelatedResourcesResult : RelatedResourcesResult 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/ConfigParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Parameters for getting the Cloudinary account configuration. 7 | /// 8 | public class ConfigParams : BaseParams 9 | { 10 | /// 11 | /// Gets or sets a value indicating whether to include settings in the response. 12 | /// 13 | public bool Settings { get; set; } 14 | 15 | /// 16 | /// Validates the object model. 17 | /// 18 | /// Throw an exception if parameters are invalid. 19 | public override void Check() 20 | { 21 | // Currently, no validation required 22 | } 23 | 24 | /// 25 | /// Maps object model to a dictionary of parameters in Cloudinary notation. 26 | /// 27 | /// Sorted dictionary of parameters. 28 | public override SortedDictionary ToParamsDictionary() 29 | { 30 | var dict = new SortedDictionary(); 31 | 32 | if (Settings) 33 | { 34 | dict.Add("settings", "true"); 35 | } 36 | 37 | return dict; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/ConfigResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Represents the configuration details of your Cloudinary account. 8 | /// 9 | [DataContract] 10 | public class ConfigResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets the cloud name associated with your account. 14 | /// 15 | [DataMember(Name = "cloud_name")] 16 | public string CloudName { get; set; } 17 | 18 | /// 19 | /// Gets or sets the creation date of the account. 20 | /// 21 | [DataMember(Name = "created_at")] 22 | public DateTime CreatedAt { get; set; } 23 | 24 | /// 25 | /// Gets or sets the settings associated with your account. 26 | /// 27 | [DataMember(Name = "settings")] 28 | public AccountSettings Settings { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/DelDerivedResResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Parsed result of deletion derived resources. 8 | /// 9 | [DataContract] 10 | public class DelDerivedResResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets the list of media assets requested for deletion, with the status of each asset 14 | /// (deleted unless there was an issue). 15 | /// 16 | [DataMember(Name = "deleted")] 17 | public Dictionary Deleted { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/DeleteRelatedResourcesByAssetIdsParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Parameters of DeleteRelatedResourcesByAssetIds request. 8 | /// 9 | public class DeleteRelatedResourcesByAssetIdsParams : RelatedResourcesByAssetIdsParams 10 | { 11 | /// 12 | /// Gets or sets the list of up to 10 asset IDs. 13 | /// 14 | public List AssetsToUnrelate { get; set; } 15 | 16 | /// 17 | /// Validate object model. 18 | /// 19 | public override void Check() 20 | { 21 | base.Check(); 22 | 23 | if (AssetsToUnrelate == null || AssetsToUnrelate.Count == 0) 24 | { 25 | throw new ArgumentException("AssetsToUnrelate must be specified!"); 26 | } 27 | } 28 | 29 | /// 30 | /// Maps object model to dictionary of parameters in cloudinary notation. 31 | /// 32 | /// Sorted dictionary of parameters. 33 | public override SortedDictionary ToParamsDictionary() 34 | { 35 | var dict = base.ToParamsDictionary(); 36 | 37 | AddParam(dict, "assets_to_unrelate", AssetsToUnrelate); 38 | 39 | return dict; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/DeleteRelatedResourcesParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Parameters of DeleteRelatedResourcesParams request. 8 | /// 9 | public class DeleteRelatedResourcesParams : RelatedResourcesParams 10 | { 11 | /// 12 | /// Gets or sets the list of up to 10 fully_qualified_public_ids given as resource_type/type/public_id. 13 | /// 14 | public List AssetsToUnrelate { get; set; } 15 | 16 | /// 17 | /// Validate object model. 18 | /// 19 | public override void Check() 20 | { 21 | base.Check(); 22 | 23 | if (AssetsToUnrelate == null || AssetsToUnrelate.Count == 0) 24 | { 25 | throw new ArgumentException("AssetsToUnrelate must be specified!"); 26 | } 27 | } 28 | 29 | /// 30 | /// Maps object model to dictionary of parameters in cloudinary notation. 31 | /// 32 | /// Sorted dictionary of parameters. 33 | public override SortedDictionary ToParamsDictionary() 34 | { 35 | var dict = base.ToParamsDictionary(); 36 | 37 | AddParam(dict, "assets_to_unrelate", AssetsToUnrelate); 38 | 39 | return dict; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/DeleteRelatedResourcesResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Parsed result of DeleteRelatedResources. 8 | /// 9 | [DataContract] 10 | public class DeleteRelatedResourcesResult : RelatedResourcesResult 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/GetResourceParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | 5 | /// 6 | /// Parameters of the request of resource as well as its derived resources. 7 | /// 8 | public class GetResourceParams : GetResourceParamsBase 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The public ID of the resource. 14 | public GetResourceParams(string publicId) 15 | : base() 16 | { 17 | PublicId = publicId; 18 | } 19 | 20 | /// 21 | /// Gets or sets public id assigned to the requested resource. 22 | /// 23 | public string PublicId { get; set; } 24 | 25 | /// 26 | /// Validate object model. 27 | /// 28 | public override void Check() 29 | { 30 | if (string.IsNullOrEmpty(PublicId)) 31 | { 32 | throw new ArgumentException("PublicId must be set!"); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/GetResourceParamsAssetId.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | 5 | /// 6 | /// Parameters of the request of resource as well as its derived resources. 7 | /// 8 | public class GetResourceParamsAssetId : GetResourceParamsBase 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The asset ID of the resource. 14 | public GetResourceParamsAssetId(string assetId) 15 | : base() 16 | { 17 | AssetId = assetId; 18 | } 19 | 20 | /// 21 | /// Gets or sets asset id assigned to the requested resource. 22 | /// 23 | public string AssetId { get; set; } 24 | 25 | /// 26 | /// Validate object model. 27 | /// 28 | public override void Check() 29 | { 30 | if (string.IsNullOrEmpty(AssetId)) 31 | { 32 | throw new ArgumentException("AssetId must be set!"); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/ListResourceTypesResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | using Newtonsoft.Json.Linq; 6 | 7 | /// 8 | /// Parsed list of resource types. 9 | /// 10 | [DataContract] 11 | public class ListResourceTypesResult : BaseResult 12 | { 13 | /// 14 | /// An array of the resource types. 15 | /// 16 | [DataMember(Name = "resource_types")] 17 | protected string[] m_resourceTypes; 18 | 19 | /// 20 | /// Gets or sets an array of the resource types. 21 | /// 22 | public ResourceType[] ResourceTypes { get; set; } 23 | 24 | /// 25 | /// Overrides corresponding method of class. 26 | /// Populates additional token fields. 27 | /// 28 | /// JSON token received from the server. 29 | internal override void SetValues(JToken source) 30 | { 31 | base.SetValues(source); 32 | List types = new List(); 33 | foreach (var type in m_resourceTypes) 34 | { 35 | types.Add(Api.ParseCloudinaryParam(type)); 36 | } 37 | 38 | ResourceTypes = types.ToArray(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/ListResourcesByAssetFolderParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Allows to filter resources by asset folder. 8 | /// 9 | public class ListResourcesByAssetFolderParams : ListResourcesParams 10 | { 11 | /// 12 | /// Gets or sets the asset folder to filter resources. 13 | /// 14 | public string AssetFolder { get; set; } 15 | 16 | /// 17 | /// Validate object model. 18 | /// 19 | /// Tag must be set to list resource by tag. 20 | public override void Check() 21 | { 22 | base.Check(); 23 | 24 | if (string.IsNullOrEmpty(AssetFolder)) 25 | { 26 | throw new ArgumentException("AssetFolder must be set to filter resources by AssetFolder!"); 27 | } 28 | } 29 | 30 | /// 31 | /// Maps object model to dictionary of parameters in cloudinary notation. 32 | /// 33 | /// Sorted dictionary of parameters. 34 | public override SortedDictionary ToParamsDictionary() 35 | { 36 | SortedDictionary dict = base.ToParamsDictionary(); 37 | 38 | if (dict.ContainsKey("type")) 39 | { 40 | dict.Remove("type"); 41 | } 42 | 43 | AddParam(dict, "asset_folder", AssetFolder); 44 | 45 | return dict; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/ListResourcesByContextParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Allows to list resources by context metadata keys and values. 8 | /// 9 | public class ListResourcesByContextParams : ListResourcesParams 10 | { 11 | /// 12 | /// Gets or sets if only resources with the given key should be returned. Required. 13 | /// 14 | public string Key { get; set; } 15 | 16 | /// 17 | /// Gets or sets whether should only return resources with this given value for the context key. 18 | /// When not provided, return all resources for which the context key exists. Optional. 19 | /// 20 | public string Value { get; set; } 21 | 22 | /// 23 | /// Validate object model. 24 | /// 25 | public override void Check() 26 | { 27 | if (string.IsNullOrEmpty(Key)) 28 | { 29 | throw new InvalidOperationException("Key must be set to list resources by context."); 30 | } 31 | } 32 | 33 | /// 34 | /// Maps object model to dictionary of parameters in cloudinary notation. 35 | /// 36 | /// Sorted dictionary of parameters. 37 | public override SortedDictionary ToParamsDictionary() 38 | { 39 | var dict = base.ToParamsDictionary(); 40 | 41 | AddParam(dict, "key", Key); 42 | AddParam(dict, "value", Value); 43 | 44 | return dict; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/ListResourcesByModerationParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Allows to filter resources by moderation kind/status. 8 | /// 9 | public class ListResourcesByModerationParams : ListResourcesParams 10 | { 11 | /// 12 | /// Gets or sets the kind of the moderation (manual, etc.). 13 | /// 14 | public string ModerationKind { get; set; } 15 | 16 | /// 17 | /// Gets or sets the moderation status. 18 | /// 19 | public ModerationStatus ModerationStatus { get; set; } 20 | 21 | /// 22 | /// Validate object model. 23 | /// 24 | public override void Check() 25 | { 26 | base.Check(); 27 | 28 | if (string.IsNullOrEmpty(ModerationKind)) 29 | { 30 | throw new ArgumentException("ModerationKind must be set to filter resources by moderation kind/status!"); 31 | } 32 | } 33 | 34 | /// 35 | /// Maps object model to dictionary of parameters in cloudinary notation. 36 | /// 37 | /// Sorted dictionary of parameters. 38 | public override SortedDictionary ToParamsDictionary() 39 | { 40 | SortedDictionary dict = base.ToParamsDictionary(); 41 | 42 | if (dict.ContainsKey("type")) 43 | { 44 | dict.Remove("type"); 45 | } 46 | 47 | return dict; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/ListResourcesByPrefixParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Allow to filter resources by prefix. 7 | /// 8 | public class ListResourcesByPrefixParams : ListResourcesParams 9 | { 10 | /// 11 | /// Gets or sets find all resources that their public ID starts with the given prefix. 12 | /// 13 | public string Prefix { get; set; } 14 | 15 | /// 16 | /// Maps object model to dictionary of parameters in cloudinary notation. 17 | /// 18 | /// Sorted dictionary of parameters. 19 | public override SortedDictionary ToParamsDictionary() 20 | { 21 | SortedDictionary dict = base.ToParamsDictionary(); 22 | 23 | AddParam(dict, "prefix", Prefix); 24 | 25 | return dict; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/ListResourcesByTagParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Allows to filter resources by tag. 8 | /// 9 | public class ListResourcesByTagParams : ListResourcesParams 10 | { 11 | /// 12 | /// Gets or sets the tag to filter resources. 13 | /// 14 | public string Tag { get; set; } 15 | 16 | /// 17 | /// Validate object model. 18 | /// 19 | /// Tag must be set to list resource by tag. 20 | public override void Check() 21 | { 22 | base.Check(); 23 | 24 | if (string.IsNullOrEmpty(Tag)) 25 | { 26 | throw new ArgumentException("Tag must be set to filter resources by tag!"); 27 | } 28 | } 29 | 30 | /// 31 | /// Maps object model to dictionary of parameters in cloudinary notation. 32 | /// 33 | /// Sorted dictionary of parameters. 34 | public override SortedDictionary ToParamsDictionary() 35 | { 36 | SortedDictionary dict = base.ToParamsDictionary(); 37 | 38 | if (dict.ContainsKey("type")) 39 | { 40 | dict.Remove("type"); 41 | } 42 | 43 | return dict; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/ListResourcesResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed result of the resources listing request. 7 | /// 8 | [DataContract] 9 | public class ListResourcesResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets list of the assets matching the request conditions. 13 | /// 14 | [DataMember(Name = "resources")] 15 | public Resource[] Resources { get; set; } 16 | 17 | /// 18 | /// Gets or sets when a listing request has more results to return than , 19 | /// the value is returned as part of the response. You can then specify this value as 20 | /// the parameter of the following listing request. 21 | /// 22 | [DataMember(Name = "next_cursor")] 23 | public string NextCursor { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/ListSpecificResourcesParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Allows to filter resources by specific public identifiers. 7 | /// 8 | public class ListSpecificResourcesParams : ListResourcesParams 9 | { 10 | /// 11 | /// Gets or sets the public identifiers to list. 12 | /// When set it overrides usage of . 13 | /// 14 | public List PublicIds { get; set; } = new List(); 15 | 16 | /// 17 | /// Gets or sets the asset identifiers to list. 18 | /// 19 | public List AssetIds { get; set; } = new List(); 20 | 21 | /// 22 | /// Maps object model to dictionary of parameters in cloudinary notation. 23 | /// 24 | /// Sorted dictionary of parameters. 25 | public override SortedDictionary ToParamsDictionary() 26 | { 27 | var dict = base.ToParamsDictionary(); 28 | 29 | if (PublicIds?.Count > 0) 30 | { 31 | AddParam(dict, "public_ids", PublicIds); 32 | 33 | if (dict.ContainsKey("direction")) 34 | { 35 | dict.Remove("direction"); 36 | } 37 | } 38 | 39 | if (AssetIds?.Count > 0) 40 | { 41 | AddParam(dict, "asset_ids", AssetIds); 42 | } 43 | 44 | return dict; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/ListTagsResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed list of tags. 7 | /// 8 | [DataContract] 9 | public class ListTagsResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets the list of tags currently assigned to the media asset. 13 | /// 14 | [DataMember(Name = "tags")] 15 | public string[] Tags { get; set; } 16 | 17 | /// 18 | /// Gets or sets a value for a situation when a listing request has more results to return than , the 19 | /// value is returned as part of the response. You can then specify this value as the 20 | /// parameter of the following listing request. 21 | /// 22 | [DataMember(Name = "next_cursor")] 23 | public string NextCursor { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/AccessibilityAnalysis.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Details of the accessibility analysis. 7 | /// 8 | [DataContract] 9 | public class AccessibilityAnalysis 10 | { 11 | /// 12 | /// Gets or sets details of colorblind accessibility analysis. 13 | /// 14 | [DataMember(Name = "colorblind_accessibility_analysis")] 15 | public ColorblindAccessibilityAnalysis ColorblindAccessibilityAnalysis { get; set; } 16 | 17 | /// 18 | /// Gets or sets value between 0-1. 19 | /// 20 | [DataMember(Name = "colorblind_accessibility_score")] 21 | public double ColorblindAccessibilityScore { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/AccountSettings.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Represents the settings of your Cloudinary account. 7 | /// 8 | [DataContract] 9 | public class AccountSettings 10 | { 11 | /// 12 | /// Gets or sets the folder mode. 13 | /// 14 | [DataMember(Name = "folder_mode")] 15 | public string FolderMode { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/AdvOcr.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Details of executing an ADV_OCR engine. 8 | /// 9 | [DataContract] 10 | public class AdvOcr 11 | { 12 | /// 13 | /// Gets or sets the status of the OCR operation. 14 | /// 15 | [DataMember(Name = "status")] 16 | public string Status { get; set; } 17 | 18 | /// 19 | /// Gets or sets data returned by OCR plugin. 20 | /// 21 | [DataMember(Name = "data")] 22 | public List Data { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/AdvOcrData.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Data returned by OCR plugin. 8 | /// 9 | [DataContract] 10 | public class AdvOcrData 11 | { 12 | /// 13 | /// Gets or sets annotations of the recognized text. 14 | /// 15 | [DataMember(Name = "textAnnotations")] 16 | public List TextAnnotations { get; set; } 17 | 18 | /// 19 | /// Gets or sets this annotation provides the structural hierarchy for the OCR detected text. 20 | /// If present, text (OCR) detection or document (OCR) text detection has completed successfully. 21 | /// 22 | [DataMember(Name = "fullTextAnnotation")] 23 | public FullTextAnnotation FullTextAnnotation { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/AssetVersion.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Details of asset version. 8 | /// 9 | [DataContract] 10 | public class AssetVersion 11 | { 12 | /// 13 | /// Gets or sets asset version identifier. 14 | /// 15 | [DataMember(Name = "version_id")] 16 | public string VersionId { get; set; } 17 | 18 | /// 19 | /// Gets or sets asset version number. 20 | /// 21 | [DataMember(Name = "version")] 22 | public string Version { get; set; } 23 | 24 | /// 25 | /// Gets or sets asset size in bytes. 26 | /// 27 | [DataMember(Name = "size")] 28 | public string Size { get; set; } 29 | 30 | /// 31 | /// Gets or sets time when version created. 32 | /// 33 | [DataMember(Name = "time")] 34 | public DateTime Time { get; set; } 35 | 36 | /// 37 | /// Gets or sets a value indicating whether asset version can be restored. 38 | /// 39 | [DataMember(Name = "restorable")] 40 | public bool Restorable { get; set; } 41 | 42 | /// 43 | /// Gets or sets asset version url. 44 | /// 45 | [DataMember(Name = "url")] 46 | public string Url { get; set; } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Block.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Logical element on the page. 7 | /// 8 | [DataContract] 9 | public abstract class Block 10 | { 11 | /// 12 | /// Gets or sets additional information detected on the page. 13 | /// 14 | [DataMember(Name = "property")] 15 | public PageProperty Property { get; set; } 16 | 17 | /// 18 | /// Gets or sets the bounding box for the block. 19 | /// The vertices are in the order of top-left, top-right, bottom-right, bottom-left. 20 | /// 21 | [DataMember(Name = "boundingBox")] 22 | public BoundingBlock BoundingBox { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/BoundingBlock.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// The outer bounding polygon for the detected image annotation. 8 | /// 9 | [DataContract] 10 | public class BoundingBlock 11 | { 12 | /// 13 | /// Gets or sets the bounding polygon vertices. 14 | /// 15 | [DataMember(Name = "vertices")] 16 | public List Vertices { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/BoundingBox.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Identifies the bounding box around the face. 7 | /// 8 | [DataContract] 9 | public class BoundingBox 10 | { 11 | /// 12 | /// Gets or sets top left point of the bounding box. 13 | /// 14 | [DataMember(Name = "tl")] 15 | public Point TopLeft { get; set; } 16 | 17 | /// 18 | /// Gets or sets size of the bounding box. 19 | /// 20 | [DataMember(Name = "size")] 21 | public Size Size { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/CinemagraphAnalysis.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Details of the cinemagraph analysis. 7 | /// 8 | [DataContract] 9 | public class CinemagraphAnalysis 10 | { 11 | /// 12 | /// Gets or sets value between 0-1, where 0 means definitely not a cinemagraph 13 | /// and 1 means definitely a cinemagraph). 14 | /// 15 | [DataMember(Name = "cinemagraph_score")] 16 | public double CinemagraphScore { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/ColorblindAccessibilityAnalysis.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Details of colorblind accessibility analysis. 7 | /// 8 | [DataContract] 9 | public class ColorblindAccessibilityAnalysis 10 | { 11 | /// 12 | /// Gets or sets distinct edges value between 0-1. 13 | /// 14 | [DataMember(Name = "distinct_edges")] 15 | public double DistinctEdges { get; set; } 16 | 17 | /// 18 | /// Gets or sets distinct colors value between 0-1. 19 | /// 20 | [DataMember(Name = "distinct_colors")] 21 | public double DistinctColors { get; set; } 22 | 23 | /// 24 | /// Gets or sets most indistinct pair of colors. 25 | /// 26 | [DataMember(Name = "most_indistinct_pair")] 27 | public string[] MostIndistinctPair { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Coordinates.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// The coordinates of a single region contained in an image that is subsequently used for cropping the image using 7 | /// the custom gravity mode. 8 | /// 9 | [DataContract] 10 | public class Coordinates 11 | { 12 | /// 13 | /// Gets or sets a list of custom coordinates. 14 | /// 15 | [DataMember(Name = "custom")] 16 | public int[][] Custom { get; set; } 17 | 18 | /// 19 | /// Gets or sets a list of coordinates of detected faces. 20 | /// 21 | [DataMember(Name = "faces")] 22 | public int[][] Faces { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/DeletedDataStatistics.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed result of statistics of deleted resource. 7 | /// 8 | [DataContract] 9 | public class DeletedDataStatistics 10 | { 11 | /// 12 | /// Gets or sets count of original resources deleted. 13 | /// 14 | [DataMember(Name = "original")] 15 | public int Original { get; set; } 16 | 17 | /// 18 | /// Gets or sets count of derived resources deleted. 19 | /// 20 | [DataMember(Name = "derived")] 21 | public int Derived { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/DetectedLanguage.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Detected language for a structural component. 7 | /// 8 | [DataContract] 9 | public class DetectedLanguage 10 | { 11 | /// 12 | /// Gets or sets the BCP-47 language code, such as "en-US" or "sr-Latn". 13 | /// For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. 14 | /// 15 | [DataMember(Name = "languageCode")] 16 | public string LanguageCode { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Detection.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Requested information from executing a Rekognition face add-on. 7 | /// 8 | [DataContract] 9 | public class Detection 10 | { 11 | /// 12 | /// Gets or sets details of the result of recognition. 13 | /// 14 | [DataMember(Name = "rekognition_face")] 15 | public RekognitionFace RekognitionFace { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/FullTextAnnotation.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// For multi-page files (e.g. PDFs), a node indicating the containing page. 8 | /// 9 | [DataContract] 10 | public class FullTextAnnotation 11 | { 12 | /// 13 | /// Gets or sets a list of detected pages. 14 | /// 15 | [DataMember(Name = "pages")] 16 | public List Pages { get; set; } 17 | 18 | /// 19 | /// Gets or sets recognized text. 20 | /// 21 | [DataMember(Name = "text")] 22 | public string Text { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Info.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Any requested information from executing one of the Cloudinary Add-ons on the media asset. 7 | /// 8 | [DataContract] 9 | public class Info 10 | { 11 | /// 12 | /// Gets or sets requested information from executing a Rekognition face add-ons. 13 | /// 14 | [DataMember(Name = "detection")] 15 | public Detection Detection { get; set; } 16 | 17 | /// 18 | /// Gets or sets requested information from executing an OCR add-ons. 19 | /// 20 | [DataMember(Name = "ocr")] 21 | public Ocr Ocr { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Ocr.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Details of executing an OCR add-on. 7 | /// 8 | [DataContract] 9 | public class Ocr 10 | { 11 | /// 12 | /// Gets or sets details of executing an ADV_OCR engine. 13 | /// 14 | [DataMember(Name = "adv_ocr")] 15 | public AdvOcr AdvOcr { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Page.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Detected page from OCR. 8 | /// 9 | [DataContract] 10 | public class Page 11 | { 12 | /// 13 | /// Gets or sets additional information detected on the page. 14 | /// 15 | [DataMember(Name = "property")] 16 | public PageProperty Property { get; set; } 17 | 18 | /// 19 | /// Gets or sets page width. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. 20 | /// 21 | [DataMember(Name = "width")] 22 | public int? Width { get; set; } 23 | 24 | /// 25 | /// Gets or sets page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. 26 | /// 27 | [DataMember(Name = "height")] 28 | public int? Height { get; set; } 29 | 30 | /// 31 | /// Gets or sets list of text blocks on this page. 32 | /// 33 | [DataMember(Name = "blocks")] 34 | public List Blocks { get; set; } 35 | } 36 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/PageProperty.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Additional information detected on the page. 8 | /// 9 | [DataContract] 10 | public class PageProperty 11 | { 12 | /// 13 | /// Gets or sets a list of detected languages together with confidence. 14 | /// 15 | [DataMember(Name = "detectedLanguages")] 16 | public List DetectedLanguages { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Paragraph.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Structural unit of text representing a number of words in certain order. 8 | /// 9 | [DataContract] 10 | public class Paragraph : Block 11 | { 12 | /// 13 | /// Gets or sets list of words in this paragraph. 14 | /// 15 | [DataMember(Name = "words")] 16 | public List Words { get; set; } 17 | 18 | /// 19 | /// Gets or sets the actual text representation of this paragraph. 20 | /// 21 | [DataMember(Name = "text")] 22 | public string Text { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Point.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Point, represented by X and Y coordinates. 7 | /// 8 | [DataContract] 9 | public class Point 10 | { 11 | /// 12 | /// Gets or sets x - coordinate. 13 | /// 14 | [DataMember(Name = "x")] 15 | public double X { get; set; } 16 | 17 | /// 18 | /// Gets or sets y - coordinate. 19 | /// 20 | public double Y { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Predominant.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// The predominant colors in the image according to both a Google palette and a Cloudinary palette. 7 | /// 8 | [DataContract] 9 | public class Predominant 10 | { 11 | /// 12 | /// Gets or sets google palette details. 13 | /// 14 | [DataMember(Name = "google")] 15 | public object[][] Google { get; set; } 16 | 17 | /// 18 | /// Gets or sets cloudinary palette details. 19 | /// 20 | [DataMember(Name = "cloudinary")] 21 | public object[][] Cloudinary { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/RekognitionFace.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Details of each face found in the image. 8 | /// 9 | [DataContract] 10 | public class RekognitionFace 11 | { 12 | /// 13 | /// Gets or sets status of the recognition process. 14 | /// 15 | [DataMember(Name = "status")] 16 | public string Status { get; set; } 17 | 18 | /// 19 | /// Gets or sets properties of each detected face. 20 | /// 21 | [DataMember(Name = "data")] 22 | public List Faces { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/RelatedResource.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Details of a related resource. 8 | /// 9 | [DataContract] 10 | public class RelatedResource 11 | { 12 | /// 13 | /// Gets or sets an API message. 14 | /// 15 | [DataMember(Name = "message")] 16 | public string Message { get; set; } 17 | 18 | /// 19 | /// Gets or sets the API code. 20 | /// 21 | [DataMember(Name = "code")] 22 | public string Code { get; set; } 23 | 24 | /// 25 | /// Gets or sets the asset ID. 26 | /// 27 | [DataMember(Name = "asset")] 28 | public string Asset { get; set; } 29 | 30 | /// 31 | /// Gets or sets an API status. 32 | /// 33 | [DataMember(Name = "status")] 34 | public int Status { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Size.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// A size of the block, represented by width and height. 7 | /// 8 | [DataContract] 9 | public class Size 10 | { 11 | /// 12 | /// Gets or sets width of the block. 13 | /// 14 | [DataMember(Name = "width")] 15 | public double Width { get; set; } 16 | 17 | /// 18 | /// Gets or sets width of the block. 19 | /// 20 | [DataMember(Name = "height")] 21 | public double Height { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Symbol.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// A single symbol representation. 7 | /// 8 | [DataContract] 9 | public class Symbol : Block 10 | { 11 | /// 12 | /// Gets or sets the actual UTF-8 representation of the symbol. 13 | /// 14 | [DataMember(Name = "text")] 15 | public string Text { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/TextAnnotation.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// TextAnnotation contains a structured representation of OCR extracted text. 7 | /// 8 | [DataContract] 9 | public class TextAnnotation 10 | { 11 | /// 12 | /// Gets or sets the detected locale of the text. 13 | /// 14 | [DataMember(Name = "locale")] 15 | public string Locale { get; set; } 16 | 17 | /// 18 | /// Gets or sets a description listing the entirety of the detected text content, with a newline character (\n) separating 19 | /// groups of text. 20 | /// 21 | [DataMember(Name = "description")] 22 | public string Description { get; set; } 23 | 24 | /// 25 | /// Gets or sets the outer bounding polygon for the detected image annotation. 26 | /// 27 | [DataMember(Name="boundingPoly")] 28 | public BoundingBlock BoundingPoly { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/TextBlock.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// A text element on the page. 8 | /// 9 | [DataContract] 10 | public class TextBlock : Block 11 | { 12 | /// 13 | /// Gets or sets list of paragraphs in this block. 14 | /// 15 | [DataMember(Name = "paragraphs")] 16 | public List Paragraphs { get; set; } 17 | 18 | /// 19 | /// Gets or sets detected block type (text, image etc) for this block. 20 | /// 21 | [DataMember(Name = "blockType")] 22 | public string BlockType { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Usage.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Usage information about the objects in account. 7 | /// 8 | [DataContract] 9 | public class Usage 10 | { 11 | /// 12 | /// Gets or sets a number of objects in your account. 13 | /// 14 | [DataMember(Name = "usage")] 15 | public long Used { get; set; } 16 | 17 | /// 18 | /// Gets or sets current limit of objects for account. 19 | /// 20 | [DataMember(Name = "limit")] 21 | public long Limit { get; set; } 22 | 23 | /// 24 | /// Gets or sets current usage percentage. 25 | /// 26 | [DataMember(Name = "used_percent")] 27 | public float UsedPercent { get; set; } 28 | 29 | /// 30 | /// Gets or sets current usage of credits. 31 | /// 32 | [DataMember(Name = "credits_usage")] 33 | public float CreditsUsage { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/NestedTypes/Word.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// A word representation. 8 | /// 9 | [DataContract] 10 | public class Word : Block 11 | { 12 | /// 13 | /// Gets or sets list of symbols in the word. The order of the symbols follows the natural reading order. 14 | /// 15 | [DataMember(Name = "symbols")] 16 | public List Symbols { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/RelatedResourcesByAssetIdsParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Parameters of RelatedResourcesByAssetIds requests. 8 | /// 9 | public abstract class RelatedResourcesByAssetIdsParams : BaseParams 10 | { 11 | /// 12 | /// Gets or sets the Asset ID of the resource to update. 13 | /// 14 | public string AssetId { get; set; } 15 | 16 | /// 17 | /// Validate object model. 18 | /// 19 | public override void Check() 20 | { 21 | if (string.IsNullOrEmpty(AssetId)) 22 | { 23 | throw new ArgumentException("AssetId must be set!"); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/RelatedResourcesParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | 5 | /// 6 | /// Base Parameters of RelatedResources requests. 7 | /// 8 | public abstract class RelatedResourcesParams : BaseParams 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public RelatedResourcesParams() 14 | { 15 | ResourceType = ResourceType.Image; 16 | Type = "upload"; 17 | } 18 | 19 | /// 20 | /// Gets or sets the type of file for which to add related resources. Possible values: image, raw, video. 21 | /// Default: image. Optional. 22 | /// 23 | public ResourceType ResourceType { get; set; } 24 | 25 | /// 26 | /// Gets or sets the storage type: upload, private, authenticated, facebook, twitter, gplus, instagram_name, 27 | /// gravatar, youtube, hulu, vimeo, animoto, worldstarhiphop or dailymotion. Default: upload. Optional. 28 | /// 29 | public string Type { get; set; } 30 | 31 | /// 32 | /// Gets or sets the public ID of the resource to update. 33 | /// s 34 | public string PublicId { get; set; } 35 | 36 | /// 37 | /// Validate object model. 38 | /// 39 | public override void Check() 40 | { 41 | if (string.IsNullOrEmpty(PublicId)) 42 | { 43 | throw new ArgumentException("PublicId must be set!"); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/RelatedResourcesResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Parsed result of RelatedResources. 8 | /// 9 | [DataContract] 10 | public abstract class RelatedResourcesResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets the list of successful assets. 14 | /// 15 | [DataMember(Name = "success")] 16 | public List Success { get; set; } 17 | 18 | /// 19 | /// Gets or sets the list of failed assets. 20 | /// 21 | [DataMember(Name = "failed")] 22 | public List Failed { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/UpdateResourceAccessModeResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Results of the resource access mode update. 8 | /// 9 | [DataContract] 10 | public class UpdateResourceAccessModeResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets list of successfully updated results. 14 | /// 15 | [DataMember(Name = "updated")] 16 | public List Updated { get; set; } 17 | 18 | /// 19 | /// Gets or sets list of failed results. 20 | /// 21 | [DataMember(Name = "failed")] 22 | public List Failed { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsManagement/VisualSearchResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Parsed result of the visual search request. 8 | /// 9 | [DataContract] 10 | public class VisualSearchResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets list of the assets matching the request conditions. 14 | /// 15 | [DataMember(Name = "resources")] 16 | public List Resources { get; set; } 17 | 18 | /// 19 | /// Gets or sets the total count of assets matching the search criteria. 20 | /// 21 | [DataMember(Name = "total_count")] 22 | public int TotalCount { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/AutoUploadParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | /// 4 | /// Parameters of auto file uploading. 5 | /// 6 | public class AutoUploadParams : ImageUploadParams 7 | { 8 | /// 9 | /// Gets get the type of auto asset for upload. 10 | /// 11 | public override ResourceType ResourceType => ResourceType.Auto; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/ContextResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Results of context management. 7 | /// 8 | [DataContract] 9 | public class ContextResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets public IDs of affected assets. 13 | /// 14 | [DataMember(Name = "public_ids")] 15 | public string[] PublicIds { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/CreateSlideshowResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Result of the create slideshow operation. 7 | /// 8 | [DataContract] 9 | public class CreateSlideshowResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets the status of the create slideshow operation. 13 | /// 14 | [DataMember(Name = "status")] 15 | public string Status { get; set; } 16 | 17 | /// 18 | /// Gets or sets the public ID assigned to the asset. 19 | /// 20 | [DataMember(Name = "public_id")] 21 | public string PublicId { get; set; } 22 | 23 | /// 24 | /// Gets or sets the ID of the batch. 25 | /// 26 | [DataMember(Name = "batch_id")] 27 | public string BatchId { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/DeletionResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed result of asset deletion. 7 | /// 8 | [DataContract] 9 | public class DeletionResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets result description. 13 | /// 14 | [DataMember(Name = "result")] 15 | public string Result { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/ExplodeResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed response after a call of Explode method. 7 | /// 8 | [DataContract] 9 | public class ExplodeResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets status that is returned when passing 'Async' argument set to 'true' to the server. 13 | /// 14 | [DataMember(Name = "status")] 15 | public string Status { get; set; } 16 | 17 | /// 18 | /// Gets or sets id of the batch. 19 | /// 20 | [DataMember(Name = "batch_id")] 21 | public string BatchId { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/MultiParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Parameters of request to create a single animated GIF file from a group of images. 7 | /// 8 | public class MultiParams : MultiAssetsParams 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The animated GIF is created from all images with this tag. 14 | public MultiParams(string tag) 15 | : base(tag) 16 | { 17 | } 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | /// The animated GIF is created from all images with the urls specified. 23 | public MultiParams(List urls) 24 | : base(urls) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/ArchiveCallMode.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Either return a URL to the generated archive file ('download') or store it as a raw asset 7 | /// in your Cloudinary account('create'). 8 | /// 9 | public enum ArchiveCallMode 10 | { 11 | /// 12 | /// Generates a signed URL that expires after 1 hour (by default). The URL can be accessed to dynamically 13 | /// create and then download an archive file based on the given parameter values. The resulting archive file 14 | /// is not cached or stored in your Cloudinary account. 15 | /// 16 | [EnumMember(Value = "download")] 17 | Download, 18 | 19 | /// 20 | /// Generates an archive file based on the given parameter values (default target_format = zip), uploads the 21 | /// file to your Cloudinary account, returns a JSON response with the URLs for accessing the archive file, 22 | /// and can then be delivered like any other raw file uploaded to Cloudinary. 23 | /// 24 | [EnumMember(Value = "create")] 25 | Create, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/ArchiveFormat.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// The format for the generated archive. 7 | /// 8 | public enum ArchiveFormat 9 | { 10 | /// 11 | /// Specifies ZIP format for an archive 12 | /// 13 | [EnumMember(Value = "zip")] 14 | Zip, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/Audio.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Additional metadata for audio. 7 | /// 8 | [DataContract] 9 | public class Audio 10 | { 11 | /// 12 | /// Gets or sets the audiocodec applied. 13 | /// 14 | [DataMember(Name = "codec")] 15 | public string Codec { get; set; } 16 | 17 | /// 18 | /// Gets or sets bitrate of the audio. This parameter controls the number of bits used to represent the audio data. 19 | /// 20 | [DataMember(Name = "bit_rate")] 21 | public int? BitRate { get; set; } 22 | 23 | /// 24 | /// Gets or sets audio sampling frequency. Represents an integer value in Hz. 25 | /// 26 | [DataMember(Name = "frequency")] 27 | public int? Frequency { get; set; } 28 | 29 | /// 30 | /// Gets or sets audio channel. 31 | /// 32 | [DataMember(Name = "channels")] 33 | public int? Channels { get; set; } 34 | 35 | /// 36 | /// Gets or sets audio channel layout. 37 | /// 38 | [DataMember(Name = "channel_layout")] 39 | public string ChannelLayout { get; set; } 40 | } 41 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/Breakpoint.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Settings of the responsive breakpoints(images) found. 7 | /// 8 | [JsonObject] 9 | public class Breakpoint 10 | { 11 | /// 12 | /// Gets or sets width of the image. 13 | /// 14 | [JsonProperty("width")] 15 | public int Width { get; set; } 16 | 17 | /// 18 | /// Gets or sets width of the image. 19 | /// 20 | [JsonProperty("height")] 21 | public int Height { get; set; } 22 | 23 | /// 24 | /// Gets or sets size of the image. 25 | /// 26 | [JsonProperty("bytes")] 27 | public long Bytes { get; set; } 28 | 29 | /// 30 | /// Gets or sets the URL for accessing the media asset. 31 | /// 32 | [JsonProperty("url")] 33 | public string Url { get; set; } 34 | 35 | /// 36 | /// Gets or sets the HTTPS URL for securely accessing the media asset. 37 | /// 38 | [JsonProperty("secure_url")] 39 | public string SecureUrl { get; set; } 40 | } 41 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/FaceCoordinates.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Globalization; 6 | using System.Linq; 7 | using CloudinaryDotNet.Core; 8 | 9 | /// 10 | /// The coordinates of faces contained in an uploaded image. 11 | /// 12 | [Obsolete("One could use List")] 13 | public class FaceCoordinates : List 14 | { 15 | /// 16 | /// Represents the face coordinates as string "x,y,w,h|x,y,w,h" separated with a pipe (❘). 17 | /// For example: "10,20,150,130❘213,345,82,61". 18 | /// 19 | /// The string representation of face coordinates. 20 | public override string ToString() 21 | { 22 | return string.Join( 23 | "|", 24 | this.Select(r => 25 | string.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3}", r.X, r.Y, r.Width, r.Height)).ToArray()); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/ImageInfo.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Details of an image in the sprite. 7 | /// 8 | [DataContract] 9 | public class ImageInfo 10 | { 11 | /// 12 | /// Gets or sets width of the image. 13 | /// 14 | [DataMember(Name = "width")] 15 | public int Width { get; set; } 16 | 17 | /// 18 | /// Gets or sets width of the image. 19 | /// 20 | [DataMember(Name = "height")] 21 | public int Height { get; set; } 22 | 23 | /// 24 | /// Gets or sets x-coordinate of the image in sprite. 25 | /// 26 | [DataMember(Name = "x")] 27 | public int X { get; set; } 28 | 29 | /// 30 | /// Gets or sets y-coordinate of the image in sprite. 31 | /// 32 | [DataMember(Name = "y")] 33 | public int Y { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/ProfilingData.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Represents processing statistics data. 7 | /// 8 | [DataContract] 9 | public class ProfilingData 10 | { 11 | /// 12 | /// Gets or sets cpu usage metrics. 13 | /// 14 | [DataMember(Name = "cpu")] 15 | public long Cpu { get; set; } 16 | 17 | /// 18 | /// Gets or sets real metrics. 19 | /// 20 | [DataMember(Name = "real")] 21 | public long Real { get; set; } 22 | 23 | /// 24 | /// Gets or sets processing statistics data about actions on resource. 25 | /// 26 | [DataMember(Name = "action")] 27 | public ProfilingDataAction Action { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/ProfilingDataAction.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Represents processing statistics data about actions on resource. 7 | /// 8 | [DataContract] 9 | public class ProfilingDataAction 10 | { 11 | /// 12 | /// Gets or sets action name applied to resource asset. 13 | /// 14 | [DataMember(Name = "action")] 15 | public string Action { get; set; } 16 | 17 | /// 18 | /// Gets or sets action parameter applied to resource asset. 19 | /// 20 | [DataMember(Name = "parameter")] 21 | public string Parameter { get; set; } 22 | 23 | /// 24 | /// Gets or sets size before applied action. 25 | /// 26 | [DataMember(Name = "presize")] 27 | public long[] Presize { get; set; } 28 | 29 | /// 30 | /// Gets or sets size after applied action. 31 | /// 32 | [DataMember(Name = "postsize")] 33 | public long[] Postsize { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/ResponsiveBreakpointList.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// Parsed results of uploading image with Responsive breakpoints. 8 | /// 9 | public class ResponsiveBreakpointList 10 | { 11 | /// 12 | /// Gets or sets array of responsive breakpoints found. 13 | /// 14 | [JsonProperty("breakpoints")] 15 | public List Breakpoints { get; set; } 16 | 17 | /// 18 | /// Gets or sets the transformation applied to the image before finding the best breakpoints. 19 | /// 20 | [JsonProperty("transformation")] 21 | public string Transformation { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/Slideshow.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// Represents settings of the slideshow. 8 | /// Is a part of SlideshowManifest. 9 | /// 10 | public class Slideshow 11 | { 12 | /// 13 | /// Gets or sets the transition to use for all slides. Server Default: CrossZoom. 14 | /// 15 | [JsonProperty(PropertyName = "transition_s")] 16 | public string Transition { get; set; } 17 | 18 | /// 19 | /// Gets or sets a single transformation to apply to all slides. Server Default: null. 20 | /// 21 | [JsonProperty(PropertyName = "transformation_s")] 22 | public string Transformation { get; set; } 23 | 24 | /// 25 | /// Gets or sets the duration for all slides in milliseconds. Server Default: 3000. 26 | /// 27 | [JsonProperty(PropertyName = "sdur")] 28 | public int SlideDuration { get; set; } 29 | 30 | /// 31 | /// Gets or sets the duration for all transitions in milliseconds. Server Default: 1000. 32 | /// 33 | [JsonProperty(PropertyName = "tdur")] 34 | public int TransitionDuration { get; set; } 35 | 36 | /// 37 | /// Gets or sets the duration for all transitions in milliseconds. Server Default: 1000. 38 | /// 39 | [JsonProperty(PropertyName = "slides")] 40 | public List Slides { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/SlideshowManifest.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using Newtonsoft.Json; 4 | 5 | /// 6 | /// Represents a manifest for slideshow creation. 7 | /// 8 | public class SlideshowManifest 9 | { 10 | /// 11 | /// Gets or sets the width of the slideshow in pixels. 12 | /// 13 | [JsonProperty(PropertyName = "w")] 14 | public int Width { get; set; } 15 | 16 | /// 17 | /// Gets or sets the height of the slideshow in pixels. 18 | /// 19 | [JsonProperty(PropertyName = "h")] 20 | public int Height { get; set; } 21 | 22 | /// 23 | /// Gets or sets the duration of the slideshow in seconds. Server Default: 10. 24 | /// 25 | [JsonProperty(PropertyName = "du", NullValueHandling=NullValueHandling.Ignore)] 26 | public int Duration { get; set; } 27 | 28 | /// 29 | /// Gets or sets the frames per second of the slideshow. Server Default: 20. 30 | /// 31 | [JsonProperty(PropertyName = "fps", NullValueHandling=NullValueHandling.Ignore)] 32 | public int Fps { get; set; } 33 | 34 | /// 35 | /// Gets or sets the slideshow settings. 36 | /// 37 | [JsonProperty(PropertyName = "vars")] 38 | public Slideshow Variables { get; set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/NestedTypes/Video.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Additional metadata for video. 7 | /// 8 | [DataContract] 9 | public class Video 10 | { 11 | /// 12 | /// Gets or sets type of video format. 13 | /// 14 | [DataMember(Name = "pix_format")] 15 | public string Format { get; set; } 16 | 17 | /// 18 | /// Gets or sets the video codec applied. 19 | /// 20 | [DataMember(Name = "codec")] 21 | public string Codec { get; set; } 22 | 23 | /// 24 | /// Gets or sets video level. 25 | /// 26 | [DataMember(Name = "level")] 27 | public int? Level { get; set; } 28 | 29 | /// 30 | /// Gets or sets bitrate of the video. This parameter controls the number of bits used to represent the video data. 31 | /// 32 | [DataMember(Name = "bit_rate")] 33 | public int? BitRate { get; set; } 34 | 35 | /// 36 | /// Gets or sets applied profile name. 37 | /// 38 | [DataMember(Name = "profile")] 39 | public string Profile { get; set; } 40 | } 41 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/PublishResourceResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Result of resource publishing. 8 | /// 9 | [DataContract] 10 | public class PublishResourceResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets list of details of published resources. 14 | /// 15 | [DataMember(Name = "published")] 16 | public List Published { get; set; } 17 | 18 | /// 19 | /// Gets or sets list of details of the resources with failed publish. 20 | /// 21 | [DataMember(Name = "failed")] 22 | public List Failed { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/RawPartUploadResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Results of a file's chunk uploading. 7 | /// 8 | [DataContract] 9 | public class RawPartUploadResult : RawUploadResult 10 | { 11 | /// 12 | /// Gets or sets id of the uploaded chunk of the asset. 13 | /// 14 | [DataMember(Name = "upload_id")] 15 | public string UploadId { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/RenameResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | /// 4 | /// Results of resource renaming. 5 | /// 6 | public class RenameResult : GetResourceResult 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/SpriteParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Parameters of create sprite request. 7 | /// 8 | public class SpriteParams : MultiAssetsParams 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The tag name assigned to images that we should merge into the sprite. 14 | public SpriteParams(string tag) 15 | : base(tag) 16 | { 17 | } 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | /// The sprite is created from all images with the urls specified. 23 | public SpriteParams(List urls) 24 | : base(urls) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/TagResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Results of tags management. 7 | /// 8 | [DataContract] 9 | public class TagResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets a list of public IDs (up to 1000) of affected assets. 13 | /// 14 | [DataMember(Name = "public_ids")] 15 | public string[] PublicIds { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/AssetsUpload/VideoUploadParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | /// 4 | /// Parameters of video file uploading. 5 | /// 6 | public class VideoUploadParams : ImageUploadParams 7 | { 8 | /// 9 | /// Gets get the type of video asset for upload. 10 | /// 11 | public override ResourceType ResourceType => ResourceType.Video; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Error.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Represents a server-side error. 7 | /// 8 | [DataContract] 9 | public class Error 10 | { 11 | /// 12 | /// Gets or sets error description. 13 | /// 14 | [DataMember(Name = "message")] 15 | public string Message { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Folders/CreateFolderResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Result of folder creation. 7 | /// 8 | [DataContract] 9 | public class CreateFolderResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets a value indicating whether folder creation was successful. 13 | /// 14 | [DataMember(Name = "success")] 15 | public bool Success { get; set; } 16 | 17 | /// 18 | /// Gets or sets path to the folder. 19 | /// 20 | [DataMember(Name = "path")] 21 | public string Path { get; set; } 22 | 23 | /// 24 | /// Gets or sets name of the folder. 25 | /// 26 | [DataMember(Name = "name")] 27 | public string Name { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Folders/DeleteFolderResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Parsed result of folder deletion. 8 | /// 9 | [DataContract] 10 | public class DeleteFolderResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets the list of media assets requested for deletion, with the status of each asset (deleted unless there was an issue). 14 | /// 15 | [DataMember(Name = "deleted")] 16 | public List Deleted { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Folders/Folder.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Folder details. 7 | /// 8 | [DataContract] 9 | public class Folder 10 | { 11 | /// 12 | /// Gets or sets name of the folder. 13 | /// 14 | [DataMember(Name = "name")] 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// Gets or sets path to the folder. 19 | /// 20 | [DataMember(Name = "path")] 21 | public string Path { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Folders/GetFoldersParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | 6 | /// 7 | /// Parameters for managing folders list. 8 | /// 9 | public class GetFoldersParams : BaseParams 10 | { 11 | /// 12 | /// Gets or sets maximum number of results to return (up to 500). Default: 10. 13 | /// 14 | public int MaxResults { get; set; } 15 | 16 | /// 17 | /// Gets or sets when a request has more results to return than , this value is returned as part of the response. 18 | /// 19 | public string NextCursor { get; set; } 20 | 21 | /// 22 | /// Validate object model. 23 | /// 24 | public override void Check() 25 | { 26 | // ok 27 | } 28 | 29 | /// 30 | /// Maps object model to dictionary of parameters in cloudinary notation. 31 | /// 32 | /// Sorted dictionary of parameters. 33 | public override SortedDictionary ToParamsDictionary() 34 | { 35 | var dict = base.ToParamsDictionary(); 36 | 37 | if (MaxResults > 0) 38 | { 39 | AddParam(dict, "max_results", MaxResults.ToString(CultureInfo.InvariantCulture)); 40 | } 41 | 42 | AddParam(dict, "next_cursor", NextCursor); 43 | 44 | return dict; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Folders/GetFoldersResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Parsed result of folders listing. 8 | /// 9 | [DataContract] 10 | public class GetFoldersResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets list of folders. 14 | /// 15 | [DataMember(Name = "folders")] 16 | public List Folders { get; set; } 17 | 18 | /// 19 | /// Gets or sets the next cursor. 20 | /// 21 | /// When a listing request has more results to return than , 22 | /// the value is returned as part of the response. You can then specify this value as 23 | /// the parameter of the following listing request. 24 | /// 25 | [DataMember(Name = "next_cursor")] 26 | public string NextCursor { get; set; } 27 | 28 | /// 29 | /// Gets or sets the total count of folders. 30 | /// 31 | [DataMember(Name = "total_count")] 32 | public int TotalCount { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Folders/RenameFolderParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Parameters for managing folders list. 8 | /// 9 | public class RenameFolderParams : BaseParams 10 | { 11 | /// 12 | /// Gets or sets the full path of the existing folder. 13 | /// 14 | public string FromPath { get; set; } 15 | 16 | /// 17 | /// Gets or sets the full path of the new folder. 18 | /// 19 | public string ToPath { get; set; } 20 | 21 | /// 22 | /// Validate object model. 23 | /// 24 | public override void Check() 25 | { 26 | if (string.IsNullOrEmpty(FromPath)) 27 | { 28 | throw new ArgumentException("FromPath must be specified!"); 29 | } 30 | 31 | if (string.IsNullOrEmpty(ToPath)) 32 | { 33 | throw new ArgumentException("ToPath must be specified!"); 34 | } 35 | } 36 | 37 | /// 38 | /// Maps object model to dictionary of parameters in cloudinary notation. 39 | /// 40 | /// Sorted dictionary of parameters. 41 | public override SortedDictionary ToParamsDictionary() 42 | { 43 | var dict = base.ToParamsDictionary(); 44 | 45 | AddParam(dict, "to_folder", ToPath); 46 | 47 | return dict; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Folders/RenameFolderResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed result of folders listing. 7 | /// 8 | [DataContract] 9 | public class RenameFolderResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets original folder. 13 | /// 14 | [DataMember(Name = "from")] 15 | public Folder From { get; set; } 16 | 17 | /// 18 | /// Gets or sets new folder. 19 | /// 20 | [DataMember(Name = "to")] 21 | public Folder To { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/AndValidationParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | /// 7 | /// And validation, relevant for all field types. 8 | /// Allows to include more than one validation rule to be evaluated. 9 | /// 10 | public class AndValidationParams : MetadataValidationParams 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// List of combined rules. 16 | public AndValidationParams(List rules) 17 | { 18 | Type = MetadataValidationType.And; 19 | Rules = rules; 20 | } 21 | 22 | /// 23 | /// Gets or sets rules combined with an 'AND' logic relation between them. 24 | /// 25 | public List Rules { get; set; } 26 | 27 | /// 28 | /// Validate object model. 29 | /// 30 | public override void Check() 31 | { 32 | Utils.ShouldNotBeEmpty(() => Rules); 33 | } 34 | 35 | /// 36 | /// Add parameters to the object model dictionary. 37 | /// 38 | /// Dictionary to be updated with parameters. 39 | protected override void AddParamsToDictionary(SortedDictionary dict) 40 | { 41 | base.AddParamsToDictionary(dict); 42 | var rulesList = Rules.Select(entry => entry.ToParamsDictionary()).ToList(); 43 | dict.Add("rules", rulesList); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/DataSourceEntriesParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Represents delete datasource entries operation. 7 | /// 8 | public class DataSourceEntriesParams : BaseParams 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// IDs of datasource entries to delete. 14 | public DataSourceEntriesParams(List externalIds) 15 | { 16 | ExternalIds = externalIds; 17 | } 18 | 19 | /// 20 | /// Gets or sets an array of IDs of datasource entries to delete. 21 | /// 22 | public List ExternalIds { get; set; } 23 | 24 | /// 25 | /// Validates object model. 26 | /// 27 | public override void Check() 28 | { 29 | Utils.ShouldNotBeEmpty(() => ExternalIds); 30 | } 31 | 32 | /// 33 | /// Add parameters to the object model dictionary. 34 | /// 35 | /// Dictionary to be updated with parameters. 36 | protected override void AddParamsToDictionary(SortedDictionary dict) 37 | { 38 | base.AddParamsToDictionary(dict); 39 | AddParam(dict, "external_ids", ExternalIds); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/DateGreaterThanValidationParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Globalization; 6 | 7 | /// 8 | /// Greater-than rule for dates. 9 | /// 10 | public class DateGreaterThanValidationParams : ComparisonValidationParams 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// Value that will be used to compare with. 16 | public DateGreaterThanValidationParams(DateTime value) 17 | : base(value) 18 | { 19 | Type = MetadataValidationType.GreaterThan; 20 | } 21 | 22 | /// 23 | /// Add parameters to the object model dictionary. 24 | /// 25 | /// Dictionary to be updated with parameters. 26 | protected override void AddParamsToDictionary(SortedDictionary dict) 27 | { 28 | base.AddParamsToDictionary(dict); 29 | dict.Add("value", Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/DateLessThanValidationParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Globalization; 6 | 7 | /// 8 | /// Less-than rule for dates. 9 | /// 10 | public class DateLessThanValidationParams : ComparisonValidationParams 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// Value that will be used to compare with. 16 | public DateLessThanValidationParams(DateTime value) 17 | : base(value) 18 | { 19 | Type = MetadataValidationType.LessThan; 20 | } 21 | 22 | /// 23 | /// Add parameters to the object model dictionary. 24 | /// 25 | /// Dictionary to be updated with parameters. 26 | protected override void AddParamsToDictionary(SortedDictionary dict) 27 | { 28 | base.AddParamsToDictionary(dict); 29 | dict.Add("value", Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/DelMetadataFieldResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Result of removing the metadata field. 7 | /// 8 | [DataContract] 9 | public class DelMetadataFieldResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets an API message. 13 | /// 14 | [DataMember(Name = "message")] 15 | public string Message { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/EntryResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Defines a single possible value for the field. 7 | /// 8 | [DataContract] 9 | public class EntryResult 10 | { 11 | /// 12 | /// Gets or sets a unique immutable identification string for the datasource entry. 13 | /// 14 | [DataMember(Name = "external_id")] 15 | public string ExternalId { get; set; } 16 | 17 | /// 18 | /// Gets or sets the value for this datasource. 19 | /// 20 | [DataMember(Name = "value")] 21 | public string Value { get; set; } 22 | 23 | /// 24 | /// Gets or sets the state. 25 | /// 26 | /// Only given as part of a response - ignored on requests. 27 | /// It is immutable unless changed via DELETE of a datasource entry. 28 | /// Possible values: 'active' and 'inactive'. 29 | /// 30 | [DataMember(Name = "state")] 31 | public string State { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/EnumMetadataFieldCreateParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Represents parameters, required for 'enum' metadata field creation. 7 | /// 8 | public class EnumMetadataFieldCreateParams : MetadataFieldCreateParams 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The label of the metadata field. 14 | public EnumMetadataFieldCreateParams(string label) 15 | : base(label) 16 | { 17 | Type = MetadataFieldType.Enum; 18 | } 19 | 20 | /// 21 | /// Validates object model. 22 | /// 23 | public override void Check() 24 | { 25 | base.Check(); 26 | Utils.ShouldBeSpecified(() => DataSource); 27 | Utils.ShouldNotBeSpecified(() => Validation); 28 | DataSource.Check(); 29 | } 30 | 31 | /// 32 | /// Add parameters to the object model dictionary. 33 | /// 34 | /// Dictionary to be updated with parameters. 35 | protected override void AddParamsToDictionary(SortedDictionary dict) 36 | { 37 | base.AddParamsToDictionary(dict); 38 | if (DefaultValue != null) 39 | { 40 | AddParam(dict, "default_value", DefaultValue); 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/EnumMetadataFieldUpdateParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Represents parameters, required for 'enum' metadata field update. 7 | /// 8 | public class EnumMetadataFieldUpdateParams : MetadataFieldUpdateParams 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public EnumMetadataFieldUpdateParams() 14 | { 15 | Type = MetadataFieldType.Enum; 16 | } 17 | 18 | /// 19 | /// Validate object model. 20 | /// 21 | public override void Check() 22 | { 23 | base.Check(); 24 | DataSource?.Check(); 25 | Utils.ShouldNotBeSpecified(() => Validation); 26 | } 27 | 28 | /// 29 | /// Add parameters to the object model dictionary. 30 | /// 31 | /// Dictionary to be updated with parameters. 32 | protected override void AddParamsToDictionary(SortedDictionary dict) 33 | { 34 | base.AddParamsToDictionary(dict); 35 | if (DefaultValue != null) 36 | { 37 | AddParam(dict, "default_value", DefaultValue); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/IntGreaterThanValidationParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Greater-than rule for integers. 7 | /// 8 | public class IntGreaterThanValidationParams : ComparisonValidationParams 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// Value that will be used to compare with. 14 | public IntGreaterThanValidationParams(int value) 15 | : base(value) 16 | { 17 | Type = MetadataValidationType.GreaterThan; 18 | } 19 | 20 | /// 21 | /// Add parameters to the object model dictionary. 22 | /// 23 | /// Dictionary to be updated with parameters. 24 | protected override void AddParamsToDictionary(SortedDictionary dict) 25 | { 26 | base.AddParamsToDictionary(dict); 27 | dict.Add("value", Value); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/IntLessThanValidationParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Less-than rule for integers. 7 | /// 8 | public class IntLessThanValidationParams : ComparisonValidationParams 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// Value that will be used to compare with. 14 | public IntLessThanValidationParams(int value) 15 | : base(value) 16 | { 17 | Type = MetadataValidationType.LessThan; 18 | } 19 | 20 | /// 21 | /// Add parameters to the object model dictionary. 22 | /// 23 | /// Dictionary to be updated with parameters. 24 | protected override void AddParamsToDictionary(SortedDictionary dict) 25 | { 26 | base.AddParamsToDictionary(dict); 27 | dict.Add("value", Value); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/IntMetadataFieldUpdateParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Represents parameters, required for 'integer' metadata field update. 8 | /// 9 | public class IntMetadataFieldUpdateParams : MetadataFieldUpdateParams 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | public IntMetadataFieldUpdateParams() 15 | { 16 | Type = MetadataFieldType.Integer; 17 | } 18 | 19 | /// 20 | /// Validates object model. 21 | /// 22 | public override void Check() 23 | { 24 | base.Check(); 25 | var allowedValidationTypes = new List 26 | { 27 | typeof(IntLessThanValidationParams), 28 | typeof(IntGreaterThanValidationParams), 29 | typeof(AndValidationParams), 30 | }; 31 | CheckScalarDataModel(allowedValidationTypes); 32 | } 33 | 34 | /// 35 | /// Add parameters to the object model dictionary. 36 | /// 37 | /// Dictionary to be updated with parameters. 38 | protected override void AddParamsToDictionary(SortedDictionary dict) 39 | { 40 | base.AddParamsToDictionary(dict); 41 | if (DefaultValue != null) 42 | { 43 | dict.Add("default_value", DefaultValue.Value); 44 | } 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/MetadataDataSourceResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Represents a data source for a given field. 8 | /// 9 | [DataContract] 10 | public class MetadataDataSourceResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets a list of datasource values. 14 | /// 15 | [DataMember(Name = "values")] 16 | public List Values { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/MetadataFieldCreateParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Represents parameters, required for metadata field creation. 7 | /// 8 | /// Type that can describe the field type. 9 | public abstract class MetadataFieldCreateParams : MetadataFieldBaseParams 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | /// The label of the metadata field. 15 | protected MetadataFieldCreateParams(string label) 16 | { 17 | Label = label; 18 | } 19 | 20 | /// 21 | /// Validates object model. 22 | /// 23 | public override void Check() 24 | { 25 | Utils.ShouldBeSpecified(() => Label); 26 | 27 | if (Mandatory) 28 | { 29 | Utils.ShouldBeSpecified(() => DefaultValue); 30 | } 31 | } 32 | 33 | /// 34 | /// Add parameters to the object model dictionary. 35 | /// 36 | /// Dictionary to be updated with parameters. 37 | protected override void AddParamsToDictionary(SortedDictionary dict) 38 | { 39 | base.AddParamsToDictionary(dict); 40 | AddParam(dict, "label", Label); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/MetadataFieldListResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Result of metadata fields listing. 8 | /// 9 | [DataContract] 10 | public class MetadataFieldListResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets a list of basic details of listed metadata fields. 14 | /// 15 | [DataMember(Name = "metadata_fields")] 16 | public IEnumerable MetadataFields { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/MetadataFieldUpdateParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Represents parameters, required for metadata field update. 7 | /// 8 | /// Type that can describe the field type. 9 | public abstract class MetadataFieldUpdateParams : MetadataFieldBaseParams 10 | { 11 | /// 12 | /// Validates object model. 13 | /// 14 | public override void Check() 15 | { 16 | } 17 | 18 | /// 19 | /// Add parameters to the object model dictionary. 20 | /// 21 | /// Dictionary to be updated with parameters. 22 | protected override void AddParamsToDictionary(SortedDictionary dict) 23 | { 24 | base.AddParamsToDictionary(dict); 25 | if (!string.IsNullOrEmpty(Label)) 26 | { 27 | AddParam(dict, "label", Label); 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/MetadataUpdateResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Results of context management. 7 | /// 8 | [DataContract] 9 | public class MetadataUpdateResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets public IDs of affected assets. 13 | /// 14 | [DataMember(Name = "public_ids")] 15 | public string[] PublicIds { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/MetadataValidationParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Represents the base class for metadata fields validation mechanisms. 7 | /// 8 | public abstract class MetadataValidationParams : BaseParams 9 | { 10 | /// 11 | /// Gets or sets the type of value that can be assigned to the metadata field. 12 | /// 13 | public MetadataValidationType Type { get; set; } 14 | 15 | /// 16 | /// Add parameters to the object model dictionary. 17 | /// 18 | /// Dictionary to be updated with parameters. 19 | protected override void AddParamsToDictionary(SortedDictionary dict) 20 | { 21 | AddParam(dict, "type", Api.GetCloudinaryParam(Type)); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/MetadataValidationResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Details on metadata field validation. 8 | /// 9 | [DataContract] 10 | public class MetadataValidationResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets validation type. 14 | /// 15 | [DataMember(Name = "type")] 16 | public string Type { get; set; } 17 | 18 | /// 19 | /// Gets or sets the value for validation. 20 | /// 21 | [DataMember(Name = "value")] 22 | public object Value { get; set; } 23 | 24 | /// 25 | /// Gets or sets a value to indicate whether to check for equality. 26 | /// 27 | [DataMember(Name = "equals")] 28 | public bool? IsEqual { get; set; } 29 | 30 | /// 31 | /// Gets or sets the minimum string length. 32 | /// 33 | [DataMember(Name = "min")] 34 | public int? Min { get; set; } 35 | 36 | /// 37 | /// Gets or sets the maximum string length. 38 | /// 39 | [DataMember(Name = "max")] 40 | public int? Max { get; set; } 41 | 42 | /// 43 | /// Gets or sets rules combined with an 'AND' logic relation between them. 44 | /// 45 | [DataMember(Name = "rules")] 46 | public List Rules { get; set; } 47 | } 48 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/ReorderMetadataFieldDataSourceParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Represents the values to be applied to reorder metadata data source. 7 | /// 8 | public class ReorderMetadataFieldDataSourceParams : BaseParams 9 | { 10 | /// 11 | /// Gets or sets criteria for the order. Currently supports only value. 12 | /// 13 | public string OrderBy { get; set; } 14 | 15 | /// 16 | /// Gets or sets direction of order (either asc (default) or desc). 17 | /// 18 | public string Direction { get; set; } 19 | 20 | /// 21 | /// Validates object model. 22 | /// 23 | public override void Check() 24 | { 25 | Utils.ShouldNotBeEmpty(() => OrderBy); 26 | } 27 | 28 | /// 29 | /// Add parameters to the object model dictionary. 30 | /// 31 | /// Dictionary to be updated with parameters. 32 | protected override void AddParamsToDictionary(SortedDictionary dict) 33 | { 34 | AddParam(dict, "order_by", OrderBy); 35 | if (!string.IsNullOrEmpty(Direction)) 36 | { 37 | AddParam(dict, "direction", Direction); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/SetMetadataFieldUpdateParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Represents parameters, required for 'set' metadata field update. 7 | /// 8 | public class SetMetadataFieldUpdateParams : MetadataFieldUpdateParams> 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public SetMetadataFieldUpdateParams() 14 | { 15 | Type = MetadataFieldType.Set; 16 | } 17 | 18 | /// 19 | /// Validates object model. 20 | /// 21 | public override void Check() 22 | { 23 | base.Check(); 24 | DataSource?.Check(); 25 | Utils.ShouldNotBeSpecified(() => Validation); 26 | } 27 | 28 | /// 29 | /// Add parameters to the object model dictionary. 30 | /// 31 | /// Dictionary to be updated with parameters. 32 | protected override void AddParamsToDictionary(SortedDictionary dict) 33 | { 34 | base.AddParamsToDictionary(dict); 35 | if (DefaultValue != null) 36 | { 37 | AddParam(dict, "default_value", DefaultValue); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/MetadataFields/StringMetadataFieldUpdateParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Represents parameters, required for 'string' metadata field update. 8 | /// 9 | public class StringMetadataFieldUpdateParams : MetadataFieldUpdateParams 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | public StringMetadataFieldUpdateParams() 15 | { 16 | Type = MetadataFieldType.String; 17 | } 18 | 19 | /// 20 | /// Validates object model. 21 | /// 22 | public override void Check() 23 | { 24 | base.Check(); 25 | var allowedValidationTypes = new List 26 | { 27 | typeof(StringLengthValidationParams), 28 | typeof(AndValidationParams), 29 | }; 30 | CheckScalarDataModel(allowedValidationTypes); 31 | } 32 | 33 | /// 34 | /// Add parameters to the object model dictionary. 35 | /// 36 | /// Dictionary to be updated with parameters. 37 | protected override void AddParamsToDictionary(SortedDictionary dict) 38 | { 39 | base.AddParamsToDictionary(dict); 40 | if (DefaultValue != null) 41 | { 42 | dict.Add("default_value", DefaultValue); 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Moderation.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Runtime.Serialization; 5 | using Newtonsoft.Json; 6 | 7 | /// 8 | /// The data received from image moderation service. 9 | /// 10 | [DataContract] 11 | public class Moderation 12 | { 13 | /// 14 | /// Moderation status of assets. 15 | /// 16 | [DataMember(Name = "status")] 17 | public ModerationStatus Status; 18 | 19 | /// 20 | /// Type of image moderation service: "manual", "webpurify", "aws_rek", or "metascan". 21 | /// 22 | [DataMember(Name = "kind")] 23 | public string Kind; 24 | 25 | /// 26 | /// Result of the request for moderation. 27 | /// 28 | [DataMember(Name = "response")] 29 | [JsonConverter(typeof(ModerationResponseConverter))] 30 | public ModerationResponse Response; 31 | 32 | /// 33 | /// Date of the moderation status update. 34 | /// 35 | [DataMember(Name = "updated_at")] 36 | public DateTime UpdatedAt; 37 | } 38 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/ModerationLabel.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Description of the offensive content category. 7 | /// 8 | [DataContract] 9 | public class ModerationLabel 10 | { 11 | /// 12 | /// Amazon Rekognition assigns a moderation confidence score (0 - 100) indicating the chances that an image 13 | /// belongs to an offensive content category. 14 | /// 15 | [DataMember(Name = "confidence")] 16 | public float Confidence; 17 | 18 | /// 19 | /// Public ID of the duplicate asset. 20 | /// 21 | [DataMember(Name = "public_id")] 22 | public string PublicId; 23 | 24 | /// 25 | /// Name of the offensive content category. 26 | /// 27 | [DataMember(Name = "name")] 28 | public string Name; 29 | 30 | /// 31 | /// Name of the parent offensive content category. 32 | /// 33 | [DataMember(Name = "parent_name")] 34 | public string ParentName; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/ModerationResponse.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Result of the request for moderation. 7 | /// 8 | [DataContract] 9 | public class ModerationResponse 10 | { 11 | /// 12 | /// Detected offensive content categories. 13 | /// 14 | [DataMember(Name = "moderation_labels")] 15 | public ModerationLabel[] ModerationLabels; 16 | } 17 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/PingResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed details of a single ping request. 7 | /// 8 | [DataContract] 9 | public class PingResult : BaseResult 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/PresetsUpload/DeleteUploadPresetResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Results of DeleteUploadPreset operation. 7 | /// 8 | [DataContract] 9 | public class DeleteUploadPresetResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets API message. 13 | /// 14 | [DataMember(Name = "message")] 15 | public string Message { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/PresetsUpload/GetUploadPresetResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Upload preset details. 7 | /// 8 | [DataContract] 9 | public class GetUploadPresetResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets name of upload preset. 13 | /// 14 | [DataMember(Name = "name")] 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// Gets or sets a value indicating whether true enables unsigned uploading to Cloudinary with this upload preset. 19 | /// 20 | [DataMember(Name = "unsigned")] 21 | public bool Unsigned { get; set; } 22 | 23 | /// 24 | /// Gets or sets other preset settings. 25 | /// 26 | [DataMember(Name = "settings")] 27 | public UploadSettings Settings { get; set; } 28 | 29 | /// 30 | /// Gets or sets JavaScript code expression to be evaluated. 31 | /// 32 | [DataMember(Name = "eval")] 33 | public string Eval { get; set; } 34 | 35 | /// 36 | /// Gets or sets JavaScript code expression to be evaluated on upload success. 37 | /// 38 | [DataMember(Name = "on_success")] 39 | public string OnSuccess { get; set; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/PresetsUpload/ListUploadPresetsParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | 6 | /// 7 | /// Parameters of list upload presets request. 8 | /// 9 | public class ListUploadPresetsParams : BaseParams 10 | { 11 | /// 12 | /// Gets or sets max number of resources to return. Default=10. Maximum=500. Optional. 13 | /// 14 | public int MaxResults { get; set; } 15 | 16 | /// 17 | /// Gets or sets next cursor value. 18 | /// 19 | public string NextCursor { get; set; } 20 | 21 | /// 22 | /// Validate object model. 23 | /// 24 | public override void Check() 25 | { 26 | // ok 27 | } 28 | 29 | /// 30 | /// Maps object model to dictionary of parameters in cloudinary notation. 31 | /// 32 | /// Sorted dictionary of parameters. 33 | public override SortedDictionary ToParamsDictionary() 34 | { 35 | SortedDictionary dict = base.ToParamsDictionary(); 36 | 37 | if (MaxResults > 0) 38 | { 39 | AddParam(dict, "max_results", MaxResults.ToString(CultureInfo.InvariantCulture)); 40 | } 41 | 42 | AddParam(dict, "next_cursor", NextCursor); 43 | 44 | return dict; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/PresetsUpload/ListUploadPresetsResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Parsed result of upload presets listing. 8 | /// 9 | [DataContract] 10 | public class ListUploadPresetsResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets presets. 14 | /// 15 | [DataMember(Name = "presets")] 16 | public List Presets { get; set; } 17 | 18 | /// 19 | /// Gets or sets the cursor value if there are more presets than . 20 | /// 21 | [DataMember(Name = "next_cursor")] 22 | public string NextCursor { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/PresetsUpload/UploadPresetResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed response after manipulation of upload presets. 7 | /// 8 | [DataContract] 9 | public class UploadPresetResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets response message. 13 | /// 14 | [DataMember(Name = "message")] 15 | public string Message { get; set; } 16 | 17 | /// 18 | /// Gets or sets name assigned to the upload preset. 19 | /// 20 | [DataMember(Name = "name")] 21 | public string Name { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Search/IdentityInfo.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Represents indetity data. 7 | /// 8 | [DataContract] 9 | public class IdentityInfo 10 | { 11 | /// 12 | /// Gets or sets identity access key. 13 | /// 14 | [DataMember(Name = "access_key")] 15 | public string AccessKey { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Search/SearchFolder.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// The details of the folder found. 7 | /// 8 | [DataContract] 9 | public class SearchFolder 10 | { 11 | /// 12 | /// Gets or sets the name of the folder. 13 | /// 14 | [DataMember(Name = "name")] 15 | public string Name; 16 | 17 | /// 18 | /// Gets or sets the path of the folder. 19 | /// 20 | [DataMember(Name = "path")] 21 | public string Path { get; set; } 22 | 23 | /// 24 | /// Gets or sets date when the folder was created. 25 | /// 26 | [DataMember(Name = "created_at")] 27 | public string CreatedAt { get; set; } 28 | 29 | /// 30 | /// Gets or sets the eternal id of the folder. 31 | /// 32 | [DataMember(Name = "external_id")] 33 | public string ExternalId { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Search/SearchFoldersResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Search response with information about the folders matching the search criteria. 8 | /// 9 | [DataContract] 10 | public class SearchFoldersResult : SearchResultBase 11 | { 12 | /// 13 | /// Gets or sets the details of each of the folders found. 14 | /// 15 | [DataMember(Name = "folders")] 16 | public List Folders { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Search/SearchResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Search response with information about the assets matching the search criteria. 8 | /// 9 | [DataContract] 10 | public class SearchResult : SearchResultBase 11 | { 12 | /// 13 | /// Gets or sets the details of each of the assets (resources) found. 14 | /// 15 | [DataMember(Name = "resources")] 16 | public List Resources { get; set; } 17 | 18 | /// 19 | /// Gets or sets counts of assets, grouped by specified parameters. 20 | /// 21 | [DataMember(Name = "aggregations")] 22 | public Dictionary> Aggregations { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Search/SearchResultBase.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Search response with information matching the search criteria. 7 | /// 8 | public class SearchResultBase : BaseResult 9 | { 10 | /// 11 | /// Gets or sets the total count of assets matching the search criteria. 12 | /// 13 | [DataMember(Name = "total_count")] 14 | public int TotalCount { get; set; } 15 | 16 | /// 17 | /// Gets or sets the time taken to process the request. 18 | /// 19 | [DataMember(Name = "time")] 20 | public long Time { get; set; } 21 | 22 | /// 23 | /// Gets or sets when a search request has more results to return than max_results, the next_cursor value is returned as 24 | /// part of the response. 25 | /// 26 | [DataMember(Name = "next_cursor")] 27 | public string NextCursor { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/StreamingProfiles/Representation.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// Details of the transformation parameters for the representation. 8 | /// 9 | [DataContract] 10 | public class Representation 11 | { 12 | /// 13 | /// Specifies the transformation parameters for the representation. 14 | /// All video transformation parameters except video_sampling are supported. 15 | /// Common transformation parameters for representations include: width, height 16 | /// (or aspect_ratio), bit_rate, video_codec, audio_codec, sample_rate (or fps), etc. 17 | /// 18 | [DataMember(Name = "transformation")] 19 | [JsonConverter(typeof(RepresentationsConverter))] 20 | public Transformation Transformation; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/StreamingProfiles/StreamingProfileBaseData.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Basic details of the streaming profile. 7 | /// 8 | [DataContract] 9 | public class StreamingProfileBaseData 10 | { 11 | /// 12 | /// Gets or sets the identification name of the new streaming profile. 13 | /// 14 | [DataMember(Name = "name")] 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// Gets or sets a descriptive name for the profile. 19 | /// 20 | [DataMember(Name = "display_name")] 21 | public string DisplayName { get; set; } 22 | 23 | /// 24 | /// Gets or sets a value indicating whether streaming profile is defined. 25 | /// 26 | [DataMember(Name = "predefined")] 27 | public bool Predefined { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/StreamingProfiles/StreamingProfileCreateParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Parameters of create streaming profile request. 8 | /// 9 | public class StreamingProfileCreateParams : StreamingProfileBaseParams 10 | { 11 | /// 12 | /// Gets or sets the identification name to assign to the new streaming profile. The name is 13 | /// case-insensitive and can contain alphanumeric characters, underscores (_) and hyphens (-). 14 | /// 15 | public string Name { get; set; } 16 | 17 | /// 18 | /// Validate object model. 19 | /// 20 | public override void Check() 21 | { 22 | if (string.IsNullOrEmpty(Name)) 23 | { 24 | throw new ArgumentException($"{nameof(Name)} field must be specified"); 25 | } 26 | 27 | base.Check(); 28 | } 29 | 30 | /// 31 | /// Maps object model to dictionary of parameters in cloudinary notation. 32 | /// 33 | /// Sorted dictionary of parameters. 34 | public override SortedDictionary ToParamsDictionary() 35 | { 36 | SortedDictionary dict = base.ToParamsDictionary(); 37 | dict.Add("name", Name); 38 | return dict; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/StreamingProfiles/StreamingProfileData.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Details of the streaming profile. 8 | /// 9 | [DataContract] 10 | public class StreamingProfileData : StreamingProfileBaseData 11 | { 12 | /// 13 | /// Gets or sets a collection of Representations that defines a custom streaming profile. 14 | /// 15 | [DataMember(Name = "representations")] 16 | public List Representations { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/StreamingProfiles/StreamingProfileListResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// Result of listing of streaming profiles. 8 | /// 9 | [DataContract] 10 | public class StreamingProfileListResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets list of basic details of the streaming profiles. 14 | /// 15 | [DataMember(Name = "data")] 16 | public IEnumerable Data { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/StreamingProfiles/StreamingProfileResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Detailed information about streaming profile. 7 | /// 8 | [DataContract] 9 | public class StreamingProfileResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets an API message. 13 | /// 14 | [DataMember(Name = "message")] 15 | public string Message { get; set; } 16 | 17 | /// 18 | /// Gets or sets details of the streaming profile. 19 | /// 20 | [DataMember(Name = "data")] 21 | public StreamingProfileData Data { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/StreamingProfiles/StreamingProfileUpdateParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | /// 4 | /// Parameters of update streaming profile request. 5 | /// 6 | public class StreamingProfileUpdateParams : StreamingProfileBaseParams 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Transformations/DeleteTransformParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Definition of the properties for deleting a transformation. 8 | /// 9 | public class DeleteTransformParams : BaseParams 10 | { 11 | /// 12 | /// Gets or sets name of the transformation. 13 | /// 14 | public string Transformation { get; set; } 15 | 16 | /// 17 | /// Validate object model. 18 | /// 19 | public override void Check() 20 | { 21 | if (string.IsNullOrEmpty(Transformation)) 22 | { 23 | throw new ArgumentException("Transformation must be set!"); 24 | } 25 | } 26 | 27 | /// 28 | /// Map object model to dictionary of parameters in cloudinary notation. 29 | /// 30 | /// Sorted dictionary of parameters. 31 | public override SortedDictionary ToParamsDictionary() 32 | { 33 | var dict = base.ToParamsDictionary(); 34 | AddParam(dict, "transformation", Transformation); 35 | 36 | return dict; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Transformations/ListTransformsResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed list of transformations details. 7 | /// 8 | [DataContract] 9 | public class ListTransformsResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets a listing of transformations specified in your account. 13 | /// 14 | [DataMember(Name = "transformations")] 15 | public TransformDesc[] Transformations { get; set; } 16 | 17 | /// 18 | /// Gets or sets a value for a situation when a listing request has more results to return than , 19 | /// the value is returned as part of the response. You can then specify this value as 20 | /// the parameter of the following listing request. 21 | /// 22 | [DataMember(Name = "next_cursor")] 23 | public string NextCursor { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Actions/Transformations/TransformResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed response after transformation manipulation. 7 | /// 8 | [DataContract] 9 | public class TransformResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets result message. 13 | /// 14 | [DataMember(Name = "message")] 15 | public string Message { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Cloudinary.AdminApi.Analysis.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using CloudinaryDotNet.Actions; 6 | 7 | /// 8 | /// Part of Cloudinary .NET API main class, responsible for media analysis. 9 | /// 10 | public partial class Cloudinary 11 | { 12 | /// 13 | /// Analyzes an asset with the requested analysis type asynchronously. 14 | /// 15 | /// Parameters of analysis. 16 | /// (Optional) Cancellation token. 17 | /// Detailed analysis information. 18 | public Task AnalyzeAsync(AnalyzeParams parameters, CancellationToken? cancellationToken = null) 19 | { 20 | var url = m_api.ApiUrlV2.Add(Constants.ANALYSIS).Add(Constants.ANALYZE).Add(Constants.URI).BuildUrl(); 21 | 22 | return CallAdminApiJsonAsync(HttpMethod.POST, url, parameters, cancellationToken); 23 | } 24 | 25 | /// 26 | /// Analyzes an asset with the requested analysis type. 27 | /// 28 | /// Parameters of analysis. 29 | /// Detailed analysis information . 30 | public AnalyzeResult Analyze(AnalyzeParams parameters) => AnalyzeAsync(parameters).GetAwaiter().GetResult(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CloudinaryDotNet/CloudinaryConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | /// 4 | /// Struct with Cloudinary configuration parameters. 5 | /// 6 | public static class CloudinaryConfiguration 7 | { 8 | /// 9 | /// The name of your cloud. 10 | /// 11 | public static string CloudName = string.Empty; 12 | 13 | /// 14 | /// API key. 15 | /// 16 | public static string ApiKey = string.Empty; 17 | 18 | /// 19 | /// API secret. 20 | /// 21 | public static string ApiSecret = string.Empty; 22 | 23 | /// 24 | /// Authentication token for the token-based authentication. 25 | /// 26 | public static AuthToken AuthToken; 27 | 28 | /// 29 | /// Defines whether to generate 32 characters length signature for URIs. 30 | /// 31 | public static bool LongUrlSignature; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CloudinaryDotNet/CloudinaryIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudinary/CloudinaryDotNet/de968a29875b3a5a5a74a633bd6489984a4866ca/CloudinaryDotNet/CloudinaryIcon.png -------------------------------------------------------------------------------- /CloudinaryDotNet/CloudinaryVersion.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | /// 4 | /// Contains information about release version. 5 | /// 6 | internal static class CloudinaryVersion 7 | { 8 | /// 9 | /// Gets full version number of Cloudinary .NET SDK. 10 | /// 11 | public static string Full => "1.27.5"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Core/ICloneable.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Core 2 | { 3 | /// 4 | /// Supports cloning, which creates a new instance of a class with the same value as an existing instance. 5 | /// 6 | public interface ICloneable 7 | { 8 | /// 9 | /// Creates a new object that is a copy of the current instance. 10 | /// 11 | /// A new object that is a copy of this instance. 12 | object Clone(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Core/SystemExtension.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Core 2 | { 3 | using System.Reflection; 4 | using Newtonsoft.Json; 5 | 6 | /// 7 | /// SystemExtension. 8 | /// 9 | public static class SystemExtension 10 | { 11 | /// 12 | /// Clones the object. 13 | /// 14 | /// The source to clone. 15 | /// Object type. 16 | /// New instance of the cloned object. 17 | public static T Clone(this T source) 18 | { 19 | var serialized = JsonConvert.SerializeObject(source); 20 | return JsonConvert.DeserializeObject(serialized); 21 | } 22 | 23 | /// 24 | /// Copies the writable properties from the source object to the destination object. 25 | /// 26 | /// The source object whose properties will be copied. 27 | /// The destination object where the properties will be copied. 28 | public static void CopyPropertiesTo(this object source, object destination) 29 | { 30 | var properties = typeof(FileDescription).GetRuntimeProperties(); 31 | 32 | foreach (var property in properties) 33 | { 34 | if (!property.CanWrite) 35 | { 36 | continue; 37 | } 38 | 39 | var value = property.GetValue(source); 40 | 41 | property.SetValue(destination, value); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /CloudinaryDotNet/ICloudinary.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | /// 4 | /// Cloudinary Interface. 5 | /// 6 | public interface ICloudinary : ICloudinaryAdminApi, ICloudinarySearchApi, ICloudinaryUploadApi 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /CloudinaryDotNet/ICloudinarySearchApi.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | /// 4 | /// Cloudinary Search API Interface. 5 | /// 6 | public interface ICloudinarySearchApi 7 | { 8 | /// 9 | /// Gets the advanced search provider used by the Cloudinary instance. 10 | /// 11 | /// Instance of the class. 12 | Search Search(); 13 | 14 | /// 15 | /// Gets the advanced search folders provider used by the Cloudinary instance. 16 | /// 17 | /// Instance of the class. 18 | SearchFolders SearchFolders(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CloudinaryDotNet/ISignProvider.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Digital signature provider. 7 | /// 8 | public interface ISignProvider 9 | { 10 | /// 11 | /// Generate digital signature for parameters. 12 | /// 13 | /// The parameters to sign. 14 | /// Generated signature. 15 | string SignParameters(IDictionary parameters); 16 | 17 | /// 18 | /// Generate digital signature for part of an URI. 19 | /// 20 | /// The part of an URI to sign. 21 | /// Indicates whether to generate long signature. 22 | /// Generated signature. 23 | string SignUriPart(string uriPart, bool isLong); 24 | 25 | /// 26 | /// Generate digital signature for a string. 27 | /// 28 | /// String to sign. 29 | /// Signature algorithm. 30 | /// Generated signature. 31 | string SignString(string toSign, SignatureAlgorithm signatureAlgorithm); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | // Makes internals visible to unit test project 4 | #if SIGN_ASSEMBLY 5 | [assembly: InternalsVisibleTo("CloudinaryDotNet.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001004dd0cacc2cbf7a5933bd5cddf82e397d4a05db7c46af9cdd0d5e40485e6db5472b1677c8445928438b2a283f6de438993a0ec7ab757de45e48bc7817b3b894eeb7e3b767fe98832a59d3cbdf2d224dfadf66be5d3b5e196395a238faa31923e52816da13d31464ce7bcdc9987e06bf8187786229fafdc2e4ae9b74319f8004b0")] 6 | [assembly: InternalsVisibleTo("CloudinaryDotNet.IntegrationTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001004dd0cacc2cbf7a5933bd5cddf82e397d4a05db7c46af9cdd0d5e40485e6db5472b1677c8445928438b2a283f6de438993a0ec7ab757de45e48bc7817b3b894eeb7e3b767fe98832a59d3cbdf2d224dfadf66be5d3b5e196395a238faa31923e52816da13d31464ce7bcdc9987e06bf8187786229fafdc2e4ae9b74319f8004b0")] 7 | #else 8 | [assembly: InternalsVisibleTo("CloudinaryDotNet.Tests")] 9 | [assembly: InternalsVisibleTo("CloudinaryDotNet.IntegrationTests")] 10 | #endif 11 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/AccessKeyResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System; 4 | using System.Runtime.Serialization; 5 | 6 | /// 7 | /// A single access key. 8 | /// 9 | [DataContract] 10 | public class AccessKeyResult : BaseResult 11 | { 12 | /// 13 | /// Gets or sets name of the access key. 14 | /// 15 | [DataMember(Name = "name")] 16 | public string Name { get; set; } 17 | 18 | /// 19 | /// Gets or sets API key. 20 | /// 21 | [DataMember(Name = "api_key")] 22 | public string ApiKey { get; set; } 23 | 24 | /// 25 | /// Gets or sets the API secret. 26 | /// 27 | [DataMember(Name = "api_secret")] 28 | public string ApiSecret { get; set; } 29 | 30 | /// 31 | /// Gets or sets date when the key was created. 32 | /// 33 | [DataMember(Name = "created_at")] 34 | public DateTime CreatedAt { get; set; } 35 | 36 | /// 37 | /// Gets or sets date when the key was updated. 38 | /// 39 | [DataMember(Name = "updated_at")] 40 | public DateTime UpdatedAt { get; set; } 41 | 42 | /// 43 | /// Gets or sets a value indicating whether access key is enabled or not. 44 | /// 45 | [DataMember(Name = "enabled")] 46 | public bool Enabled { get; set; } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/ApiAccessKey.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Access key, enabled for the account. 7 | /// 8 | [DataContract] 9 | public class ApiAccessKey 10 | { 11 | /// 12 | /// Gets or sets account API key. 13 | /// 14 | [DataMember(Name = "key")] 15 | public string Key { get; set; } 16 | 17 | /// 18 | /// Gets or sets the account API secret. 19 | /// 20 | [DataMember(Name = "secret")] 21 | public string Secret { get; set; } 22 | 23 | /// 24 | /// Gets or sets a value indicating whether account is enabled or not. 25 | /// 26 | [DataMember(Name = "enabled")] 27 | public bool Enabled { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/BaseUserGroupParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Base parameters for user groups modification requests. 7 | /// 8 | public abstract class BaseUserGroupParams : BaseParams 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The name of the user group. 14 | protected BaseUserGroupParams(string name) 15 | { 16 | Name = name; 17 | } 18 | 19 | /// 20 | /// Gets or sets the name of the user group. 21 | /// 22 | public string Name { get; set; } 23 | 24 | /// 25 | /// Validate object model. 26 | /// 27 | public override void Check() 28 | { 29 | Utils.ShouldNotBeEmpty(() => Name); 30 | } 31 | 32 | /// 33 | /// Add parameters to the object model dictionary. 34 | /// 35 | /// Dictionary to be updated with parameters. 36 | protected override void AddParamsToDictionary(SortedDictionary dict) 37 | { 38 | AddParam(dict, "name", Name); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/CreateSubAccountParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Parameters of create sub-account request. 7 | /// 8 | public class CreateSubAccountParams : BaseSubAccountParams 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The name of the sub-account. 14 | public CreateSubAccountParams(string subAccountName) 15 | { 16 | Name = subAccountName; 17 | Enabled = true; 18 | } 19 | 20 | /// 21 | /// Gets or sets he ID of another sub-account, from which to copy all of 22 | /// the following settings:Size limits, Timed limits, and Flags. 23 | /// 24 | public string BaseSubAccountId { get; set; } 25 | 26 | /// 27 | /// Validate object model. 28 | /// 29 | public override void Check() 30 | { 31 | Utils.ShouldNotBeEmpty(() => Name); 32 | } 33 | 34 | /// 35 | /// Add parameters to the object model dictionary. 36 | /// 37 | /// Dictionary to be updated with parameters. 38 | protected override void AddParamsToDictionary(SortedDictionary dict) 39 | { 40 | base.AddParamsToDictionary(dict); 41 | if (!string.IsNullOrEmpty(BaseSubAccountId)) 42 | { 43 | AddParam(dict, "base_sub_account_id", BaseSubAccountId); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/CreateUserGroupParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | /// 4 | /// Parameters of create user group request. 5 | /// 6 | public class CreateUserGroupParams : BaseUserGroupParams 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// The name of the user group. 12 | public CreateUserGroupParams(string name) 13 | : base(name) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/CreateUserParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | /// 4 | /// Parameters of create user request. 5 | /// 6 | public class CreateUserParams : BaseUserParams 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// Name of the user. 12 | /// Email of the user. 13 | /// The role to assign to the user. 14 | public CreateUserParams(string name, string email, Role role) 15 | { 16 | Name = name; 17 | Email = email; 18 | Role = role; 19 | } 20 | 21 | /// 22 | /// Validate object model. 23 | /// 24 | public override void Check() 25 | { 26 | Utils.ShouldNotBeEmpty(() => Name); 27 | Utils.ShouldNotBeEmpty(() => Email); 28 | Utils.ShouldBeSpecified(() => Role); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/DelAccessKeyResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Result of deleting a key. 7 | /// 8 | [DataContract] 9 | public class DelAccessKeyResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets an API message. 13 | /// 14 | [DataMember(Name = "message")] 15 | public string Message { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/DelSubAccountResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Result of removing a sub-account. 7 | /// 8 | [DataContract] 9 | public class DelSubAccountResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets an API message. 13 | /// 14 | [DataMember(Name = "message")] 15 | public string Message { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/DelUserGroupResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Result of removing a user group. 7 | /// 8 | [DataContract] 9 | public class DelUserGroupResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets a value indicating whether an API message. 13 | /// 14 | [DataMember(Name = "ok")] 15 | public bool Ok { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/DelUserResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Result of removing a user. 7 | /// 8 | [DataContract] 9 | public class DelUserResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets an API message. 13 | /// 14 | [DataMember(Name = "message")] 15 | public string Message { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/ListAccessKeysResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed result of the access keys listing request. 7 | /// 8 | [DataContract] 9 | public class ListAccessKeysResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets a list of the access keys matching the request conditions. 13 | /// 14 | [DataMember(Name = "access_keys")] 15 | public AccessKeyResult[] AccessKeys { get; set; } 16 | 17 | /// 18 | /// Gets or sets a number of total access keys. 19 | /// 20 | [DataMember(Name = "total")] 21 | public int Total { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/ListSubAccountsResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed result of the sub-accounts listing request. 7 | /// 8 | [DataContract] 9 | public class ListSubAccountsResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets list of the sub-accounts matching the request conditions. 13 | /// 14 | [DataMember(Name = "sub_accounts")] 15 | public SubAccountResult[] SubAccounts { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/ListUserGroupsResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed result of the user groups listing request. 7 | /// 8 | [DataContract] 9 | public class ListUserGroupsResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets list of the user groups. 13 | /// 14 | [DataMember(Name = "user_groups")] 15 | public UserGroupResult[] UserGroups { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/ListUsersResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Parsed result of the users listing request. 7 | /// 8 | [DataContract] 9 | public class ListUsersResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets a list of the users matching the request conditions. 13 | /// 14 | [DataMember(Name = "users")] 15 | public UserResult[] Users { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/UpdateSubAccountParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | /// 4 | /// Parameters of update sub-account request. 5 | /// 6 | public class UpdateSubAccountParams : BaseSubAccountParams 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// The ID of the sub-account. 12 | public UpdateSubAccountParams(string subAccountId) 13 | { 14 | SubAccountId = subAccountId; 15 | } 16 | 17 | /// 18 | /// Gets or sets the ID of the sub-account. 19 | /// 20 | public string SubAccountId { get; set; } 21 | 22 | /// 23 | /// Validate object model. 24 | /// 25 | public override void Check() 26 | { 27 | Utils.ShouldNotBeEmpty(() => SubAccountId); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/UpdateUserGroupParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | /// 4 | /// Parameters of update user group request. 5 | /// 6 | public class UpdateUserGroupParams : BaseUserGroupParams 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// The ID of the user group to update. 12 | /// The name of the user group to update. 13 | public UpdateUserGroupParams(string userGroupId, string name) 14 | : base(name) 15 | { 16 | UserGroupId = userGroupId; 17 | } 18 | 19 | /// 20 | /// Gets or sets the ID of the user. 21 | /// 22 | public string UserGroupId { get; set; } 23 | 24 | /// 25 | /// Validate object model. 26 | /// 27 | public override void Check() 28 | { 29 | base.Check(); 30 | Utils.ShouldNotBeEmpty(() => UserGroupId); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/UpdateUserParams.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | /// 4 | /// Parameters of update user request. 5 | /// 6 | public class UpdateUserParams : BaseUserParams 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// The ID of the user to update. 12 | public UpdateUserParams(string userId) 13 | { 14 | UserId = userId; 15 | } 16 | 17 | /// 18 | /// Gets or sets the ID of the user. 19 | /// 20 | public string UserId { get; set; } 21 | 22 | /// 23 | /// Validate object model. 24 | /// 25 | public override void Check() 26 | { 27 | Utils.ShouldNotBeEmpty(() => UserId); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Provisioning/Actions/UserGroupResult.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet.Actions 2 | { 3 | using System.Runtime.Serialization; 4 | 5 | /// 6 | /// Detailed information about user group. 7 | /// 8 | [DataContract] 9 | public class UserGroupResult : BaseResult 10 | { 11 | /// 12 | /// Gets or sets the ID of the user group. 13 | /// 14 | [DataMember(Name = "id")] 15 | public string GroupId { get; set; } 16 | 17 | /// 18 | /// Gets or sets the name of the user group. 19 | /// 20 | [DataMember(Name = "name")] 21 | public string Name { get; set; } 22 | 23 | /// 24 | /// Gets or sets users of the group. 25 | /// 26 | [DataMember(Name = "users")] 27 | public string[] Users { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Search/Search.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | /// 4 | /// Advanced search provider. Allows you to retrieve information on all the assets in your account with the help of 5 | /// query expressions in a Lucene-like query language. 6 | /// 7 | public class Search : SearchFluent 8 | { 9 | /// 10 | /// Initializes a new instance of the class. 11 | /// 12 | /// Provider of the API calls. 13 | public Search(ApiShared api) 14 | : base(api) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Search/SearchFolders.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | /// 4 | /// Advanced search provider. Allows you to retrieve information on all the folders in your account with the help of 5 | /// query expressions in a Lucene-like query language. 6 | /// 7 | public class SearchFolders : SearchFoldersFluent 8 | { 9 | /// 10 | /// Initializes a new instance of the class. 11 | /// 12 | /// Provider of the API calls. 13 | public SearchFolders(ApiShared api) 14 | : base(api) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CloudinaryDotNet/SignatureAlgorithm.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | /// 4 | /// Defines supported algorithms for generating/verifying hashed message authentication codes (HMAC). 5 | /// 6 | public enum SignatureAlgorithm 7 | { 8 | /// 9 | /// SHA1 algorithm 10 | /// 11 | SHA1, 12 | 13 | /// 14 | /// SHA256 algorithm 15 | /// 16 | SHA256, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Transforms/Layer.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | /// 4 | /// Common not abstract class for Layers. 5 | /// 6 | public class Layer : BaseLayer 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Transforms/SubtitlesLayer.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | /// 4 | /// Represents property of the overlay parameter ( l_subtitles: in URLs), 5 | /// followed by the SRT file name (including the .srt extension). 6 | /// 7 | public class SubtitlesLayer : TextLayer 8 | { 9 | /// 10 | /// Initializes a new instance of the class. 11 | /// 12 | public SubtitlesLayer() 13 | { 14 | m_resourceType = "subtitles"; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CloudinaryDotNet/Transforms/VideoCodec.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | /// 4 | /// Video codecs. 5 | /// 6 | public static class VideoCodec 7 | { 8 | /// 9 | /// Auto normalize and optimize the video for web viewing. 10 | /// 11 | public const string Auto = "auto"; 12 | 13 | /// 14 | /// Video codec 'vp8'. 15 | /// 16 | public const string Vp8 = "vp8"; 17 | 18 | /// 19 | /// Video codec 'vp9'. 20 | /// 21 | public const string Vp9 = "vp9"; 22 | 23 | /// 24 | /// Video codec 'prores'. 25 | /// 26 | public const string Prores = "prores"; 27 | 28 | /// 29 | /// Video codec 'h264'. 30 | /// 31 | public const string H264 = "h264"; 32 | 33 | /// 34 | /// Video codec 'h265'. 35 | /// 36 | public const string H265 = "h265"; 37 | 38 | /// 39 | /// Video codec 'theora'. 40 | /// 41 | public const string Theora = "theora"; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CloudinaryDotNet/VideoSource.cs: -------------------------------------------------------------------------------- 1 | namespace CloudinaryDotNet 2 | { 3 | /// 4 | /// Source for video tag. 5 | /// 6 | public class VideoSource 7 | { 8 | /// 9 | /// Gets or sets one of the HTML5 video tag MIME types: video/mp4, video/webm, video/ogg. 10 | /// 11 | public string Type { get; set; } 12 | 13 | /// 14 | /// Gets or sets a single value, or a comma-separated list of values identifying the codec(s) that should be used to 15 | /// generate the video. The codec definition can include additional properties,separated with a dot. 16 | /// For example, codecs="avc1.42E01E,mp4a.40.2". 17 | /// 18 | public string[] Codecs { get; set; } 19 | 20 | /// 21 | /// Gets or sets transformation, applied to the in video tag. 22 | /// 23 | public Transformation Transformation { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 https://cloudinary.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 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. 22 | -------------------------------------------------------------------------------- /before_build.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Setting up appsettings.json for tests" 2 | 3 | $strConfigSource = "$env:APPVEYOR_BUILD_FOLDER\CloudinaryDotNet.IntegrationTests\appsettings.json.sample" 4 | $strConfigDest = "$env:APPVEYOR_BUILD_FOLDER\CloudinaryDotNet.IntegrationTests\appsettings.json" 5 | $apiEndpoint = "https://sub-account-testing.cloudinary.com/create_sub_account" 6 | 7 | $postParams = @{ 8 | "prefix"="DotNet" 9 | } | ConvertTo-Json 10 | 11 | $res = Invoke-WebRequest -Uri $apiEndpoint -ContentType "application/json" -Method POST -Body $postParams | ConvertFrom-Json 12 | 13 | $cloud = $res.payload 14 | 15 | Copy-Item $strConfigSource -Destination $strConfigDest 16 | 17 | (Get-Content $strConfigDest).replace('"ApiBaseAddress": ""', '"ApiBaseAddress": "' + $env:ApiBaseAddress + '"') | Set-Content $strConfigDest 18 | (Get-Content $strConfigDest).replace('"CloudName": ""', '"CloudName": "' + $cloud.cloudName + '"') | Set-Content $strConfigDest 19 | (Get-Content $strConfigDest).replace('"ApiKey": ""', '"ApiKey": "'+ $cloud.cloudApiKey + '"') | Set-Content $strConfigDest 20 | (Get-Content $strConfigDest).replace('"ApiSecret": ""', '"ApiSecret": "' + $cloud.cloudApiSecret + '"') | Set-Content $strConfigDest 21 | 22 | Write-Host "CloudName: $($cloud.cloudName)" 23 | 24 | Write-Host "Done" 25 | -------------------------------------------------------------------------------- /build.ps1: -------------------------------------------------------------------------------- 1 | param([switch]$sign) 2 | 3 | Write-Host "Starting dotnet pack..." 4 | 5 | dotnet pack -c:Release -o:lib -p:Sign=$sign 6 | 7 | Write-Host "Done" 8 | -------------------------------------------------------------------------------- /samples/CloudinaryDotNetSamples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.11.35312.102 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PhotoAlbum", "PhotoAlbum\PhotoAlbum.csproj", "{3AD00431-929F-4124-8890-FC3C021BAAD8}" 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 | {3AD00431-929F-4124-8890-FC3C021BAAD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {3AD00431-929F-4124-8890-FC3C021BAAD8}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {3AD00431-929F-4124-8890-FC3C021BAAD8}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {3AD00431-929F-4124-8890-FC3C021BAAD8}.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 = {AC23D31C-4C87-47CC-9D14-27DFF59AB869} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Data/Photo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace PhotoAlbum.Data 5 | { 6 | public class Photo 7 | { 8 | [Key] 9 | public int Id { get; set; } 10 | public DateTime CreatedAt { get; set; } 11 | public string PublicId { get; set; } 12 | public int Version { get; set; } 13 | public string Signature { get; set; } 14 | public int Width { get; set; } 15 | public int Height { get; set; } 16 | public string Format { get; set; } 17 | public string ResourceType { get; set; } 18 | public int Bytes { get; set; } 19 | public string Type { get; set; } 20 | public string Url { get; set; } 21 | public string SecureUrl { get; set; } 22 | public string Path { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Data/PhotosDbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | 3 | namespace PhotoAlbum.Data 4 | { 5 | public class PhotosDbContext : DbContext 6 | { 7 | public PhotosDbContext(DbContextOptions options) : base (options) 8 | { 9 | 10 | } 11 | 12 | public DbSet Photos { get; set; } 13 | public DbSet UploadResults { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Data/UploadResult.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace PhotoAlbum.Data 4 | { 5 | public class UploadResult 6 | { 7 | [Key] 8 | public int Id { get; set; } 9 | public string UploadResultAsJson { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Infrastructure/DirectUploadType.cs: -------------------------------------------------------------------------------- 1 | namespace PhotoAlbum.Infrastructure 2 | { 3 | public enum DirectUploadType 4 | { 5 | Signed, 6 | Unsigned 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | using Microsoft.EntityFrameworkCore; 5 | using PhotoAlbum.Data; 6 | 7 | namespace PhotoAlbum.Pages 8 | { 9 | public class IndexModel : PageModel 10 | { 11 | private readonly PhotosDbContext _dbContext; 12 | 13 | public List Photos { get; set; } 14 | 15 | public IndexModel(PhotosDbContext dbContext) 16 | { 17 | _dbContext = dbContext; 18 | } 19 | 20 | public async Task OnGetAsync() 21 | { 22 | Photos = await _dbContext.Photos.ToListAsync().ConfigureAwait(false); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Pages/MyPhotos.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | using Microsoft.EntityFrameworkCore; 4 | using PhotoAlbum.Data; 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | 8 | namespace PhotoAlbum.Pages 9 | { 10 | public class MyPhotosModel : PageModel 11 | { 12 | private readonly PhotosDbContext _dbContext; 13 | 14 | public List Photos { get; set; } 15 | 16 | public MyPhotosModel(PhotosDbContext dbContext) 17 | { 18 | _dbContext = dbContext; 19 | } 20 | 21 | public async Task OnGetAsync() 22 | { 23 | Photos = await _dbContext.Photos.ToListAsync().ConfigureAwait(false); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Pages/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Pages/Upload.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model PhotoAlbum.Pages.UploadModel 3 | 4 | @{ 5 | ViewData["Title"] = "PhotoAlbum - Upload page"; 6 | } 7 | 8 |
9 |
10 |
11 |

Upload through your server

12 | 13 |
14 |
15 |
16 |
17 | 18 | 19 |
20 | 21 |
22 | 23 |
24 |
25 |
26 |
27 | 28 |
29 | Back to list... 30 |
31 |
32 |
33 |
34 |
35 | @Html.Raw(Model.RenderedMarkdown) 36 |
37 |
38 | 39 | 40 |
41 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Pages/UploadSucceeded.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using Microsoft.AspNetCore.Mvc.RazorPages; 5 | using Microsoft.EntityFrameworkCore; 6 | using Newtonsoft.Json; 7 | using PhotoAlbum.Data; 8 | 9 | namespace PhotoAlbum.Pages 10 | { 11 | public class UploadSucceededModel : PageModel 12 | { 13 | private readonly PhotosDbContext _dbContext; 14 | 15 | public List> Items { get; set; } = new(); 16 | 17 | public UploadSucceededModel(PhotosDbContext dbContext) 18 | { 19 | _dbContext = dbContext; 20 | } 21 | 22 | public async Task OnGetAsync() 23 | { 24 | var lastUploadResult = await _dbContext.UploadResults 25 | .OrderByDescending(_ => _.Id) 26 | .FirstOrDefaultAsync().ConfigureAwait(false); 27 | 28 | if (!string.IsNullOrWhiteSpace(lastUploadResult?.UploadResultAsJson)) 29 | { 30 | Items = JsonConvert.DeserializeObject>>(lastUploadResult.UploadResultAsJson); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Pages/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using CloudinaryDotNet 2 | @using PhotoAlbum.Infrastructure 3 | @using PhotoAlbum.Data 4 | 5 | @namespace PhotoAlbum.Pages 6 | 7 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 8 | 9 | @inject Cloudinary Cloudinary 10 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Pages/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/PhotoAlbum.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | PhotoAlbum 5 | false 6 | 3c750543-7d40-4020-b812-85dae9ab6962 7 | 4 8 | 9 | ..\..\Shared\Cloudinary.ruleset 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | all 25 | runtime; build; native; contentfiles; analyzers; buildtransitive 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:54165", 7 | "sslPort": 44328 8 | } 9 | }, 10 | "profiles": { 11 | "PhotoAlbum": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": "true", 14 | "launchBrowser": true, 15 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development", 18 | "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" 19 | } 20 | }, 21 | "IIS Express": { 22 | "commandName": "IISExpress", 23 | "launchBrowser": true, 24 | "environmentVariables": { 25 | "ASPNETCORE_ENVIRONMENT": "Development", 26 | "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AccountSettings": { 10 | "CloudName": "your_cloud_name", 11 | "ApiKey": "your_api_key", 12 | "ApiSecret": "your_api_secret", 13 | "ApiBaseAddress": "https://api.cloudinary.com" 14 | } 15 | } -------------------------------------------------------------------------------- /samples/PhotoAlbum/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "npm-proj-1714038956170-0.3523377885068282Xer3ri", 3 | "lockfileVersion": 1, 4 | "requires": true, 5 | "dependencies": { 6 | "cloudinary-jquery-file-upload": { 7 | "version": "2.13.1", 8 | "resolved": "https://registry.npmjs.org/cloudinary-jquery-file-upload/-/cloudinary-jquery-file-upload-2.13.1.tgz", 9 | "integrity": "sha512-tbrdfI9BV9zml+FnSJ2mAD/+iD9JpopR22YKUNP2MuHnoGORjbDXKP9nxj2cLx2MLeWuUi5Ui4t86BFdhRFdyQ==" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "cloudinary-jquery-file-upload": "^2.13.1" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /samples/PhotoAlbum/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudinary/CloudinaryDotNet/de968a29875b3a5a5a74a633bd6489984a4866ca/samples/PhotoAlbum/wwwroot/favicon.ico -------------------------------------------------------------------------------- /samples/PhotoAlbum/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | // for details on configuring this project to bundle and minify static web assets. 3 | 4 | // Write your Javascript code. 5 | -------------------------------------------------------------------------------- /set_version.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [Parameter(Mandatory=$true)][string]$VersionStr 3 | ) 4 | 5 | # Some basic validation 6 | $Version = [System.Version]::Parse($VersionStr) 7 | 8 | $CodeVersionPath = "$PSScriptRoot/CloudinaryDotNet/CloudinaryVersion.cs" 9 | 10 | $CsProjPath = "$PSScriptRoot/CloudinaryDotNet/CloudinaryDotNet.csproj" 11 | 12 | function Set-Version-In-Code($CodeVersionPath, $Version) { 13 | $Text = [IO.File]::ReadAllText($CodeVersionPath) -replace "Full => `"\d+\.\d+\.?\d*`"", "Full => `"$Version`"" 14 | [IO.File]::WriteAllText($CodeVersionPath, $Text) 15 | } 16 | 17 | function Set-CsProj-Version($CsProjPath, $Version) { 18 | $Text = [IO.File]::ReadAllText($CsProjPath) 19 | $r = [regex]'\d+\.\d+\.?\d*' 20 | $Text = $r.Replace($Text, "$Version", 1) # Replaces only the first occurrence 21 | [IO.File]::WriteAllText($CsProjPath, $Text) 22 | } 23 | 24 | Set-Version-In-Code $CodeVersionPath $Version 25 | Set-CsProj-Version $CsProjPath $Version 26 | 27 | --------------------------------------------------------------------------------